void ModelComponent::addToScene() { if (model) { if (type == "STAT") { getMainCamera()->getScene()->addStaticModel(model); } else { getMainCamera()->getScene()->addModel(model); } } if (physobj) { physobj->getBody()->setUserPointer(this); PhysicsWorld::get()->addObject(physobj); } }
void gk3DEngine::_SwapRenderSequence() { if (m_pSceneMng) { m_pSceneMng->_sceneStart( (gkCamera*)getMainCamera() ); //gEnv->pRenderer->RC_SetTodKey(getTimeOfDay()->getCurrentTODKey()); } }
ICamera* gk3DEngine::getRenderingCamera() { if (m_camStack.empty()) { return getMainCamera(); } else { return m_camStack.top(); } }
void processEvent(SDL_Event *e) override { Sample::processEvent(e); if (e->type == SDL_KEYDOWN) { if (e->key.keysym.sym == SDLK_KP_PLUS) { mGammaFactor += 0.02; if (mGammaFactor > 2.2) mGammaFactor = 2.2; lite3dpp::Material::setFloatGlobalParameter("GammaFactor", mGammaFactor); } else if (e->key.keysym.sym == SDLK_KP_MINUS) { mGammaFactor -= 0.02; if (mGammaFactor < 1.0) mGammaFactor = 1.0; lite3dpp::Material::setFloatGlobalParameter("GammaFactor", mGammaFactor); } else if (e->key.keysym.sym == SDLK_o) { static bool fxaaEnabled = false; fxaaEnabled = !fxaaEnabled; lite3dpp::Material::setIntGlobalParameter("FXAA", fxaaEnabled ? 1 : 0); } else if (e->key.keysym.sym == SDLK_l) { static bool flashLightEnabled = false; flashLightEnabled = !flashLightEnabled; mFlashLight->getLight()->enabled(flashLightEnabled); } } else if (e->type == SDL_MOUSEMOTION) { mFlashLight->setRotation(getMainCamera().getRotation()); } }
void timerTick(lite3d_timer *timerid) override { Sample::timerTick(timerid); lite3dpp::Material::setFloatv3GlobalParameter("eye", getMainCamera().getPosition()); mFlashLight->setPosition(getMainCamera().getPosition()); }