void MobileExampleApp::Draw (float dt) { Eegeo::EegeoWorld& eegeoWorld = World(); Eegeo::Modules::Map::Layers::InteriorsPresentationModule& interiorsModule = eegeoWorld.GetMapModule().GetInteriorsPresentationModule(); Eegeo::Resources::Interiors::Camera::InteriorsCameraController& interiorsCameraController = interiorsModule.GetCameraController(); Eegeo::Camera::CameraState cameraState(interiorsCameraController.IsEnabled() ? interiorsCameraController.GetCameraState() : m_pGlobeCameraController->GetCameraState()); Eegeo::Camera::RenderCamera renderCamera(interiorsCameraController.IsEnabled() ? interiorsCameraController.GetRenderCamera() : m_pGlobeCameraController->GetRenderCamera()); Eegeo::dv3 ecefInterestPoint(cameraState.InterestPointEcef()); if(!eegeoWorld.Initialising()) { WorldPinsModule().GetWorldPinsInFocusController().Update(dt, ecefInterestPoint, renderCamera); } Eegeo::EegeoDrawParameters drawParameters(cameraState.LocationEcef(), cameraState.InterestPointEcef(), cameraState.ViewMatrix(), cameraState.ProjectionMatrix(), m_screenProperties); eegeoWorld.Draw(drawParameters); if (m_pLoadingScreen != NULL) { m_pLoadingScreen->Draw(); } }
int GlutApp::render() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // glLoadIdentity(); // gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); glColor3f(1.0, 0.0, 1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); Imath::V3f* eye = new Imath::V3f(); renderCamera(*eye); glutSolidTeapot(1.0); // glBegin(GL_QUADS); // // glColor3f(0.5, 0.0, 1.0); // glVertex3f(-2, -2, 0); // glVertex3f(2, -2, 0); // glColor3f(1.0, 0.5, 0.0); // glVertex3f(2, 2, 0); // glVertex3f(-2, 2, 0); // // glEnd(); // swap drawing buffers glutSwapBuffers(); return 0; }
void DynamicText3DExample::EnqueueRenderables(const Eegeo::Rendering::RenderContext& renderContext, Eegeo::Rendering::RenderQueue& renderQueue) { Eegeo::Camera::RenderCamera renderCamera(GetGlobeCameraController().GetRenderCamera()); const dv3& ecefCameraPosition = renderCamera.GetEcefLocation(); v3 camSurfaceNormal = ecefCameraPosition.Norm().ToSingle(); float environmentScale = m_environmentFlatteningService.GetCurrentScale(); for(std::vector<PlaceNameView*>::const_iterator it = m_views.begin(); it != m_views.end(); ++it) { PlaceNameView& view = **it; view.UpdateTransformsAndVisibility(renderCamera, camSurfaceNormal, 4.0, environmentScale); if(view.IsInFrustum() && !view.IsCompletelyTransparent()) { typedef std::vector<PlaceNameRenderable*> TRenderables; const TRenderables& renderables = view.GetRenderables(); for(TRenderables::const_iterator it = renderables.begin(); it != renderables.end(); ++it) { const Rendering::RenderableBase* pRenderable = *it;; renderQueue.EnqueueRenderable(pRenderable); } } } }
void PositionJavaPinButtonExample::Project (const Eegeo::Space::LatLongAltitude& location, Eegeo::v3& screenPosition) { //project a 3D Ecef location to the screen Eegeo::m44 finalMatrix; Eegeo::Camera::RenderCamera renderCamera(GetGlobeCameraController().GetRenderCamera()); Eegeo::m44::Mul (finalMatrix, renderCamera.GetProjectionMatrix(), renderCamera.GetViewMatrix()); Eegeo::v3 local = (location.ToECEF() - renderCamera.GetEcefLocation()).ToSingle(); Eegeo::v4 inVector(local, 1.0f); // get clip space coords Eegeo::v4 outVector = Eegeo::v4::Mul(inVector, finalMatrix); // divide through by w to get normalized device space coords -- range [-1, 1] screenPosition.SetX((outVector.GetX()/outVector.GetW())); screenPosition.SetY((outVector.GetY()/outVector.GetW())); screenPosition.SetZ((outVector.GetZ()/outVector.GetW())); // transform from [-1, 1] to [0, 1] screenPosition.SetX((screenPosition.GetX() + 1.0f) * 0.5f); screenPosition.SetY(1.0f - ((screenPosition.GetY() + 1.0f) * 0.5f)); float viewport[] = {0, 0, renderCamera.GetViewportWidth(), renderCamera.GetViewportHeight()}; // transform from [0, 1] to screen coords. screenPosition.SetX((screenPosition.GetX()*(viewport[2]-viewport[0])) + viewport[0]); screenPosition.SetY((screenPosition.GetY()*(viewport[3]-viewport[1])) + viewport[1]); }
void PinOverModelExample::Update(float dt) { // Update the PinsModule to query terrain heights and update screen space coordinats for the Pins. Eegeo::Camera::RenderCamera renderCamera(GetGlobeCameraController().GetRenderCamera()); m_pPinsModule->Update(dt, renderCamera); m_pModel->UpdateAnimator(1.0f/30.0f); m_pMyModelRenderable->UpdateObserverLocation(renderCamera.GetEcefLocation()); }
Eegeo::Camera::CameraState CameraSplineExample::GetCurrentCameraState() const { Eegeo::dv3 interestPoint(m_pSplineCameraController->GetRenderCamera().GetEcefLocation().Norm() * Eegeo::Space::EarthConstants::Radius); Eegeo::Camera::RenderCamera renderCamera(m_pSplineCameraController->GetRenderCamera()); return Eegeo::Camera::CameraState(renderCamera.GetEcefLocation(), interestPoint, renderCamera.GetViewMatrix(), renderCamera.GetProjectionMatrix()); }
void GLRenderer::renderCamera(Scene* scene, Camera* camera, int viewportX, int viewportY, int viewportWidth, int viewportHeight, ShaderManager* shader_manager, PostEffectShaderManager* post_effect_shader_manager, RenderTexture* post_effect_render_texture_a, RenderTexture* post_effect_render_texture_b) { renderCamera(scene, camera, 0, viewportX, viewportY, viewportWidth, viewportHeight, shader_manager, post_effect_shader_manager, post_effect_render_texture_a, post_effect_render_texture_b); }
void ofxVirtualCamera::update() { kinect.update(); if(kinect.isFrameNew()) { newFrame = true; updateSurface(); updateMesh(); renderCamera(); updatePixels(); } }
void GLRenderer::renderCamera(Scene* scene, Camera* camera, RenderTexture* render_texture, ShaderManager* shader_manager, PostEffectShaderManager* post_effect_shader_manager, RenderTexture* post_effect_render_texture_a, RenderTexture* post_effect_render_texture_b) { renderCamera(scene, camera, render_texture->getFrameBufferId(), 0, 0, render_texture->width(), render_texture->height(), shader_manager, post_effect_shader_manager, post_effect_render_texture_a, post_effect_render_texture_b); }
void PinsExample::Update(float dt) { m_addRemoveTimer += dt; if(m_addRemoveTimer > 3.0f) { AddRemovePin0(); m_addRemoveTimer = 0.0f; } // Update the PinsModule to query terrain heights and update screen space coordinats for the Pins. Eegeo::Camera::RenderCamera renderCamera(GetGlobeCameraController().GetRenderCamera()); m_pPinsModule->Update(dt, renderCamera); }
void GLRenderer::renderCamera(Scene* scene, Camera* camera, ShaderManager* shader_manager, PostEffectShaderManager* post_effect_shader_manager, RenderTexture* post_effect_render_texture_a, RenderTexture* post_effect_render_texture_b) { GLint curFBO; GLint viewport[4]; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &curFBO); glGetIntegerv(GL_VIEWPORT, viewport); renderCamera(scene, camera, curFBO, viewport[0], viewport[1], viewport[2], viewport[3], shader_manager, post_effect_shader_manager, post_effect_render_texture_a, post_effect_render_texture_b); }
void RouteSimulationExample::Update(float dt) { //Defer initialisation until the loading state is over. if(!m_initialised) { return; } Eegeo::Camera::RenderCamera renderCamera(m_usingFollowCamera ? m_pRouteSessionFollowCameraController->GetRenderCamera() : GetGlobeCameraController().GetRenderCamera()); m_pViewBindingForCycleSession->Update(); m_pViewBindingForOscillatingSession->Update(); m_pViewBindingForCameraSession->Update(); //The route session for which we want to project a position to (in this case, the ecef interest //point) should be updated giving it the latest position. Eegeo::Camera::CameraState cameraState(GetCurrentCameraState()); const Eegeo::dv3& ecefPositionToProjectToRoute = cameraState.InterestPointEcef(); m_pSessionCamera->SetCurrentPositionSnappedToRoute(ecefPositionToProjectToRoute); //For the session which should just cycle the route forever, when it has completed simply end //the session and restart playback from the beginning. if(m_pSessionCycle->IsRouteCompleted()) { m_pSessionCycle->EndPlayback(); m_pSessionCycle->StartPlaybackFromBeginning(); } //For the session which should oscillate, when the route is finished we change the playback direction //and unpause the session (such that it restarts from where it left off), and also demonstrate that //we can change playback speed by selecting a random speed multiplier. This multiplier applies to the //link speed (such that it is like a 'fast-forward' function). If we wanted to, we could also override //the playback speed such that the link speed is ignored by calling the UseCustomSpeedValue method. if(m_pSessionAlternatingSpeedChanger->IsRouteCompleted()) { m_pSessionAlternatingSpeedChanger->TogglePlaybackDirection(); m_pSessionAlternatingSpeedChanger->Unpause(); m_linkSpeedMultiplier = 0.5f + ((rand() % 200)/100.f); m_pSessionAlternatingSpeedChanger->UseLinkSpeedValueWithMultiplier(m_linkSpeedMultiplier); } EXAMPLE_LOG("%f metres from start of route. %f percent.\n", m_pSessionAlternatingSpeedChanger->GetDistanceFromStartInMetres(),(m_pSessionAlternatingSpeedChanger->GetDistanceFromStartInMetres() / m_pRoute->GetLength())*100.0f) ; }
void Vizzer::render(ApplicationData &app) { timer.frame(); for (const auto &f : iterate(state.bundler.frames)) { vec3f cameraColor(0.5f, 0.5f, 0.9f); vec3f meshColor(1.0f, 1.0f, 1.0f); if (f.index == state.selectedCamera) { meshColor = vec3f(0.9f, 0.5f, 0.5f); cameraColor = vec3f(0.9f, 0.5f, 0.5f); assets.renderMesh(state.frameCloudsBig[f.index], camera.getCameraPerspective(), meshColor); } renderCamera(app, f.value.debugCamera, cameraColor); assets.renderMesh(state.frameCloudsSmall[f.index], camera.getCameraPerspective(), meshColor); } /*const float borderRadius = 0.01f; assets.renderCylinder(camera.getCameraPerspective(), vec3f(1.0f, 0.0f, 0.0f), vec3f(1.0f, 1.0f, 0.0f), borderRadius, vec3f(1.0f, 0.0f, 0.0f)); assets.renderCylinder(camera.getCameraPerspective(), vec3f(1.0f, 1.0f, 0.0f), vec3f(0.0f, 1.0f, 0.0f), borderRadius, vec3f(1.0f, 0.0f, 0.0f)); assets.renderCylinder(camera.getCameraPerspective(), vec3f(0.0f, 1.0f, 0.0f), vec3f(0.0f, 0.0f, 0.0f), borderRadius, vec3f(1.0f, 0.0f, 0.0f)); assets.renderCylinder(camera.getCameraPerspective(), vec3f(0.0f, 0.0f, 0.0f), vec3f(1.0f, 0.0f, 0.0f), borderRadius, vec3f(1.0f, 0.0f, 0.0f));*/ vector<string> text; text.push_back(string("FPS: ") + convert::toString(timer.framesPerSecond())); //if (rand() % 100 == 0) // cout << camera.toString() << endl; const bool useText = true; if (useText) drawText(app, text); }
bool CameraViewUpdate() { if (viewFightInitRequired()) initFightView(); bool ghostAvailable = getGameState()->getGhost() != NULL; // Clear the screen IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); if (ghostAvailable && (!gameIsHalt() || getGameState()->getGhost()->isDead())) { updateGhost(); } renderCamera(); setupPlayer(); if (ghostAvailable) renderGhost(); playerAttackView->Render(); playerHit->Render(); manaBar->Render(); cameraDefend->Update(); cameraDefend->Render(); tutorialView->Render(); IwGxFlush(); IwGxSwapBuffers(); IwGxTickUpdate(); return true; }
void MobileExampleApp::Update(float dt) { Eegeo::EegeoWorld& eegeoWorld(World()); Eegeo::Modules::Map::Layers::InteriorsPresentationModule& interiorsModule = eegeoWorld.GetMapModule().GetInteriorsPresentationModule(); Eegeo::Resources::Interiors::Camera::InteriorsCameraController& interiorsCameraController = interiorsModule.GetCameraController(); m_pCurrentTouchController = interiorsModule.GetCameraController().IsEnabled() ? &interiorsModule.GetTouchController() : m_pCameraTouchController; eegeoWorld.EarlyUpdate(dt); m_pGlobeCameraController->Update(dt); m_pCameraTransitionController->Update(dt); if(interiorsCameraController.IsEnabled()) { interiorsCameraController.Update(dt); } Eegeo::Camera::CameraState cameraState(interiorsCameraController.IsEnabled() ? interiorsCameraController.GetCameraState() : m_pGlobeCameraController->GetCameraState()); Eegeo::Camera::RenderCamera renderCamera(interiorsCameraController.IsEnabled() ? interiorsCameraController.GetRenderCamera() : m_pGlobeCameraController->GetRenderCamera()); Eegeo::dv3 ecefInterestPoint(cameraState.InterestPointEcef()); m_pPoiRingModule->GetPoiRingController().Update(dt, renderCamera, ecefInterestPoint); Eegeo::EegeoUpdateParameters updateParameters(dt, cameraState.LocationEcef(), cameraState.InterestPointEcef(), cameraState.ViewMatrix(), cameraState.ProjectionMatrix(), GetUpdatedStreamingVolume(cameraState, renderCamera), m_screenProperties); eegeoWorld.Update(updateParameters); m_pSearchModule->GetSearchRefreshService().TryRefreshSearch(dt, ecefInterestPoint); m_pPinsModule->GetController().Update(dt, renderCamera); if(!eegeoWorld.Initialising()) { WorldPinsModule().GetWorldPinsScaleController().Update(dt, renderCamera); CompassModule().GetCompassUpdateController().Update(dt); CompassModule().GetCompassUpdateController().Update(dt); m_pGpsMarkerModule->GetGpsMarkerController().Update(dt, renderCamera); if (m_interiorsEnabled) { Eegeo_ASSERT(m_pInteriorsEntitiesPinsModule != NULL); m_pInteriorsEntitiesPinsModule->GetPinsModule().Update(dt, renderCamera); m_pInteriorsEntitiesPinsModule->GetInteriorsEntitiesPinsController().Update(dt); } InitialExperience::SdkModel::IInitialExperienceModel& initialExperienceModel = m_initialExperienceModule.GetInitialExperienceModel(); if(!initialExperienceModel.HasCompletedInitialExperience() && IsLoadingScreenComplete()) { InitialExperience::SdkModel::IInitialExperienceController& initialExperienceController = m_initialExperienceModule.GetInitialExperienceController(); initialExperienceController.Update(dt); } if (!m_setMetricsLocation) { Eegeo::dv3 gpsLocation; if(m_pNavigationService->TryGetGpsLocationOnTerrain(gpsLocation)) { Eegeo::Space::LatLong ll = Eegeo::Space::LatLong::FromECEF(gpsLocation); m_metricsService.SetPosition(ll.GetLatitudeInDegrees(), ll.GetLongitudeInDegrees(), 0.f, 0.f); m_setMetricsLocation = true; } } } m_pNavigationService->Update(dt); UpdateLoadingScreen(dt); }
void CascadedShadowMappingRenderer::render(float deltaTime) { renderLight(); renderCamera(); }