diff options
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_Camera.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Dome.cpp | 21 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 58 |
3 files changed, 40 insertions, 43 deletions
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 6988d563808..361cd65d50a 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -320,7 +320,7 @@ void KX_Camera::ExtractFrustumSphere() if (m_projection_matrix[3][3] == MT_Scalar(0.0f)) { - // frustrum projection + // frustum projection // detect which of the corner of the far clipping plane is the farthest to the origin MT_Vector4 nfar; // far point in device normalized coordinate MT_Point3 farpoint; // most extreme far point in camera coordinate @@ -359,7 +359,7 @@ void KX_Camera::ExtractFrustumSphere() nfar.setValue(-nfar[0], -nfar[1], -1.0f, 1.0f); nfar = clip_camcs_matrix*nfar; nearpoint.setValue(nfar[0]/nfar[3], nfar[1]/nfar[3], nfar[2]/nfar[3]); - // this is a frustrum projection + // this is a frustum projection N = nearpoint.dot(nearpoint); e = farpoint[2]; s = nearpoint[2]; diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index 818a46531c9..6585b9dc831 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -1450,22 +1450,21 @@ void KX_Dome::CalculateFrustum(KX_Camera *cam) gluPerspective(90.0f,1.0f,cam->GetCameraNear(),cam->GetCameraFar()); #endif - RAS_FrameFrustum m_frustrum; //90 deg. Frustum + RAS_FrameFrustum m_frustum; //90 deg. Frustum - m_frustrum.camnear = cam->GetCameraNear(); - m_frustrum.camfar = cam->GetCameraFar(); + m_frustum.camnear = cam->GetCameraNear(); + m_frustum.camfar = cam->GetCameraFar(); -// float top = tan(90.0f*MT_PI/360.0f) * m_frustrum.camnear; - float top = m_frustrum.camnear; // for deg = 90deg, tan = 1 +// float top = tan(90.0f*MT_PI/360.0f) * m_frustum.camnear; + float top = m_frustum.camnear; // for deg = 90deg, tan = 1 - m_frustrum.x1 = -top; - m_frustrum.x2 = top; - m_frustrum.y1 = -top; - m_frustrum.y2 = top; + m_frustum.x1 = -top; + m_frustum.x2 = top; + m_frustum.y1 = -top; + m_frustum.y2 = top; m_projmat = m_rasterizer->GetFrustumMatrix( - m_frustrum.x1, m_frustrum.x2, m_frustrum.y1, m_frustrum.y2, m_frustrum.camnear, m_frustrum.camfar); - + m_frustum.x1, m_frustum.x2, m_frustum.y1, m_frustum.y2, m_frustum.camnear, m_frustum.camfar); } void KX_Dome::CalculateCameraOrientation() diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index cb44758c46d..c8bfab0453e 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -107,7 +107,7 @@ double KX_KetsjiEngine::m_suspendedtime = 0.0; double KX_KetsjiEngine::m_suspendeddelta = 0.0; double KX_KetsjiEngine::m_average_framerate = 0.0; bool KX_KetsjiEngine::m_restrict_anim_fps = false; -short KX_KetsjiEngine::m_exitkey = 130; //ESC Key +short KX_KetsjiEngine::m_exitkey = 130; // ESC Key /** @@ -310,7 +310,7 @@ void KX_KetsjiEngine::RenderDome() KX_SceneList::iterator sceneit; KX_Scene* scene = NULL; - int n_renders=m_dome->GetNumberRenders();// usually 4 or 6 + int n_renders=m_dome->GetNumberRenders(); // usually 4 or 6 for (int i=0;i<n_renders;i++) { m_canvas->ClearBuffer(RAS_ICanvas::COLOR_BUFFER|RAS_ICanvas::DEPTH_BUFFER); for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); sceneit++) @@ -327,7 +327,7 @@ void KX_KetsjiEngine::RenderDome() if (i == 0) { RenderShadowBuffers(scene); } - // Avoid drawing the scene with the active camera twice when it's viewport is enabled + // Avoid drawing the scene with the active camera twice when its viewport is enabled if (cam && !cam->GetViewport()) { if (scene->IsClearingZBuffer()) @@ -337,7 +337,7 @@ void KX_KetsjiEngine::RenderDome() // do the rendering m_dome->RenderDomeFrame(scene,cam, i); - //render all the font objects for this scene + // render all the font objects for this scene scene->RenderFonts(); } @@ -355,7 +355,7 @@ void KX_KetsjiEngine::RenderDome() // do the rendering m_dome->RenderDomeFrame(scene, (*it),i); - //render all the font objects for this scene + // render all the font objects for this scene scene->RenderFonts(); } @@ -438,7 +438,6 @@ void KX_KetsjiEngine::StartEngine(bool clearIpo) m_sceneconverter->ResetPhysicsObjectsAnimationIpo(clearIpo); m_sceneconverter->WritePhysicsObjectToAnimationIpo(m_currentFrame); } - } void KX_KetsjiEngine::ClearFrame() @@ -539,7 +538,7 @@ void KX_KetsjiEngine::EndFrame() m_average_framerate = 1.0/tottime; - // Go to next profiling measurement, time spend after this call is shown in the next frame. + // Go to next profiling measurement, time spent after this call is shown in the next frame. m_logger->NextMeasurement(m_kxsystem->GetTimeInSeconds()); m_logger->StartLog(tc_rasterizer, m_kxsystem->GetTimeInSeconds(), true); @@ -609,7 +608,7 @@ bool KX_KetsjiEngine::NextFrame() double deltatime = m_clockTime - m_frameTime; if (deltatime<0.0) { - // We got here too quickly, which means there is nothing todo, just return and don't render. + // We got here too quickly, which means there is nothing to do, just return and don't render. // Not sure if this is the best fix, but it seems to stop the jumping framerate issue (#33088) return false; } @@ -660,13 +659,13 @@ bool KX_KetsjiEngine::NextFrame() * update. */ m_logger->StartLog(tc_logic, m_kxsystem->GetTimeInSeconds(), true); - m_sceneconverter->resetNoneDynamicObjectToIpo();//this is for none dynamic objects with ipo + m_sceneconverter->resetNoneDynamicObjectToIpo(); // this is for none dynamic objects with ipo scene->UpdateObjectActivity(); if (!scene->IsSuspended()) { - // if the scene was suspended recalcutlate the delta tu "curtime" + // if the scene was suspended recalculate the delta tu "curtime" m_suspendedtime = scene->getSuspendedTime(); if (scene->getSuspendedTime()!=0.0) scene->setSuspendedDelta(scene->getSuspendedDelta()+m_clockTime-scene->getSuspendedTime()); @@ -769,7 +768,7 @@ bool KX_KetsjiEngine::NextFrame() frames--; } - // Start logging time spend outside main loop + // Start logging time spent outside main loop m_logger->StartLog(tc_outside, m_kxsystem->GetTimeInSeconds(), true); return doRender; @@ -838,13 +837,13 @@ void KX_KetsjiEngine::Render() // pass the scene's worldsettings to the rasterizer scene->GetWorldInfo()->UpdateWorldSettings(); - // this is now done incrementatlly in KX_Scene::CalculateVisibleMeshes + // this is now done incrementally in KX_Scene::CalculateVisibleMeshes //scene->UpdateMeshTransformations(); // shadow buffers RenderShadowBuffers(scene); - // Avoid drawing the scene with the active camera twice when it's viewport is enabled + // Avoid drawing the scene with the active camera twice when its viewport is enabled if (cam && !cam->GetViewport()) { if (scene->IsClearingZBuffer()) @@ -898,7 +897,7 @@ void KX_KetsjiEngine::Render() if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); - //pass the scene, for picking and raycasting (shadows) + // pass the scene, for picking and raycasting (shadows) m_rasterizer->SetAuxilaryClientInfo(scene); // do the rendering @@ -948,10 +947,10 @@ void KX_KetsjiEngine::SetNameNextGame(const STR_String& nextgame) int KX_KetsjiEngine::GetExitCode() { - // if a gameactuator has set an exitcode or if there are no scenes left + // if a game actuator has set an exit code or if there are no scenes left if (!m_exitcode) { - if (m_scenes.begin()==m_scenes.end()) + if (m_scenes.begin() == m_scenes.end()) m_exitcode = KX_EXIT_REQUEST_NO_SCENES_LEFT; } @@ -1017,9 +1016,8 @@ void KX_KetsjiEngine::SetCameraOverrideZoom(float camzoom) void KX_KetsjiEngine::GetSceneViewport(KX_Scene *scene, KX_Camera* cam, RAS_Rect& area, RAS_Rect& viewport) { - // In this function we make sure the rasterizer settings are upto - // date. We compute the viewport so that logic - // using this information is upto date. + // In this function we make sure the rasterizer settings are up-to-date. + // We compute the viewport so that logic using this information is up-to-date. // Note we postpone computation of the projection matrix // so that we are using the latest camera position. @@ -1171,7 +1169,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) if (override_camera && m_overrideCamUseOrtho) { m_rasterizer->SetProjectionMatrix(m_overrideCamProjMat); if (!cam->hasValidProjectionMatrix()) { - // needed to get frustrum planes for culling + // needed to get frustum planes for culling MT_Matrix4x4 projmat; projmat.setValue(m_overrideCamProjMat.getPointer()); cam->SetProjectionMatrix(projmat); @@ -1280,7 +1278,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) scene->RenderBuckets(camtrans, m_rasterizer); - //render all the font objects for this scene + // render all the font objects for this scene scene->RenderFonts(); if (scene->GetPhysicsEnvironment()) @@ -1335,7 +1333,7 @@ void KX_KetsjiEngine::StopEngine() } // Scene Management is able to switch between scenes -// and have several scene's running in parallel +// and have several scenes running in parallel void KX_KetsjiEngine::AddScene(KX_Scene* scene) { m_scenes.push_back(scene); @@ -1351,7 +1349,7 @@ void KX_KetsjiEngine::PostProcessScene(KX_Scene* scene) SG_SetActiveStage(SG_STAGE_SCENE); // if there is no activecamera, or the camera is being - // overridden we need to construct a temporarily camera + // overridden we need to construct a temporary camera if (!scene->GetActiveCamera() || override_camera) { KX_Camera* activecam = NULL; @@ -1368,7 +1366,7 @@ void KX_KetsjiEngine::PostProcessScene(KX_Scene* scene) activecam = new KX_Camera(scene,KX_Scene::m_callbacks,camdata); activecam->SetName("__default__cam__"); - // set transformation + // set transformation if (override_camera) { const MT_CmMatrix4x4& cammatdata = m_overrideCamViewMat; MT_Transform trans = MT_Transform(cammatdata.getPointer()); @@ -1388,7 +1386,7 @@ void KX_KetsjiEngine::PostProcessScene(KX_Scene* scene) scene->SetActiveCamera(activecam); scene->GetObjectList()->Add(activecam->AddRef()); scene->GetRootParentList()->Add(activecam->AddRef()); - //done with activecam + // done with activecam activecam->Release(); } @@ -1482,7 +1480,7 @@ void KX_KetsjiEngine::RenderDebugProperties() // Add the ymargin for titles below the other section of debug info ycoord += title_y_top_margin; - /* Property display*/ + /* Property display */ if (m_show_debug_properties) { /* Title for debugging("Debug properties") */ @@ -1712,7 +1710,7 @@ void KX_KetsjiEngine::AddScheduledScenes() bool KX_KetsjiEngine::ReplaceScene(const STR_String& oldscene,const STR_String& newscene) { - // Don't allow replacement if the new scene doesn't exists. + // Don't allow replacement if the new scene doesn't exist. // Allows smarter game design (used to have no check here). // Note that it creates a small backward compatbility issue // for a game that did a replace followed by a lib load with the @@ -1799,7 +1797,7 @@ void KX_KetsjiEngine::SetAnimRecordMode(bool animation_record, int startFrame) m_animation_record = animation_record; if (animation_record) { - //when recording physics keyframes, run at a variable (capped) frame rate (fixed time == full speed) + // when recording physics keyframes, run at a variable (capped) frame rate (fixed time == full speed) m_bFixedTime = false; } m_currentFrame = startFrame; @@ -2043,12 +2041,12 @@ void KX_KetsjiEngine::Resize() { KX_SceneList::iterator sceneit; - /* extended mode needs to recalculate camera frustrums when */ + /* extended mode needs to recalculate camera frusta when */ KX_Scene* firstscene = *m_scenes.begin(); const RAS_FrameSettings &framesettings = firstscene->GetFramingType(); if (framesettings.FrameType() == RAS_FrameSettings::e_frame_extend) { - for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); sceneit++) { + for (sceneit = m_scenes.begin(); sceneit != m_scenes.end(); sceneit++) { KX_Camera* cam = ((KX_Scene *)*sceneit)->GetActiveCamera(); cam->InvalidateProjectionMatrix(); } |