diff --git a/Salmon Engine/Salmon Engine.vcxproj b/Salmon Engine/Salmon Engine.vcxproj index 33c8103..fd9a1a7 100644 --- a/Salmon Engine/Salmon Engine.vcxproj +++ b/Salmon Engine/Salmon Engine.vcxproj @@ -148,7 +148,7 @@ Level3 Disabled - TARGET_SALMON;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG + TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG $(SalmonEnginePath);$(LibsPath)\boost_1_52_0;$(LibsPath)\openal\OpenAL11_windows_sdk;$(LibsPath)\libogg-1.3.0\include;$(LibsPath)\libvorbis-1.3.2\include;$(LibsPath)\sqplus\sqplus;$(LibsPath)\sqplus\include;$(LibsPath)\DirectXsdk\Include;$(LibsPath)\lpng1510 4503 @@ -160,7 +160,7 @@ Level3 Disabled - TARGET_SALMON;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG;NOSOUND + TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG;NOSOUND $(SalmonEnginePath);$(LibsPath)\boost_1_52_0;$(LibsPath)\openal\OpenAL11_windows_sdk;$(LibsPath)\libogg-1.3.0\include;$(LibsPath)\libvorbis-1.3.2\include;$(LibsPath)\sqplus\sqplus;$(LibsPath)\sqplus\include;C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include;$(LibsPath)\lpng1510 /wd 4503 @@ -175,7 +175,7 @@ true true MultiThreadedDLL - TARGET_SALMON;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;NDEBUG + TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;NDEBUG $(SalmonEnginePath);$(LibsPath)\boost_1_52_0;$(LibsPath)\openal\OpenAL11_windows_sdk;$(LibsPath)\libogg-1.3.0\include;$(LibsPath)\libvorbis-1.3.2\include;$(LibsPath)\sqplus\sqplus;$(LibsPath)\sqplus\include;$(LibsPath)\DirectXsdk\Include;$(LibsPath)\lpng1510 4503 diff --git a/include/Engine.h b/include/Engine.h index e452dba..f447442 100644 --- a/include/Engine.h +++ b/include/Engine.h @@ -1,30 +1,15 @@ #ifndef ENGINE_H_INCLUDED #define ENGINE_H_INCLUDED - -#ifdef TARGET_SALMON - #ifdef TARGET_WIN32 - #define SALMON_WIN32 - #endif - - #ifdef TARGET_ANDROID - #define SALMON_ANDROID - #endif - #ifdef TARGET_IOS - #define SALMON_IOS - #endif -#endif - - -#ifdef SALMON_WIN32 +#ifdef TARGET_WIN32 #include "SalmonEngineWindows.h" #endif -#ifdef SALMON_ANDROID +#ifdef TARGET_ANDROID #include "SalmonEngineAndroid.h" #endif -#ifdef SALMON_IOS +#ifdef TARGET_IOS #include "include/SalmonEngineIos.h" #endif diff --git a/include/Render/SalmonRender/SalmonRenderInterface.h b/include/Render/SalmonRender/SalmonRenderInterface.h index 7aabbd5..3d0240e 100644 --- a/include/Render/SalmonRender/SalmonRenderInterface.h +++ b/include/Render/SalmonRender/SalmonRenderInterface.h @@ -27,30 +27,24 @@ protected: float GlobalShadowAreaHalfSize; + vec3 CamPos; //Do not change - call CalcCamPos instead + virtual void DrawQuad(const T2DQuad& quad) = 0; public: - TCamera CameraMover; - - //vec3 CamShift; - vec3 CamPos; //Do not change - call CalcCamPosVec instead - //vec3 CamVec; //Do not change - call CalcCamPosVec instead - - vec3 GetCamShift() - { - return boost::apply_visitor(TGetCamShiftVisitor(), CameraMover); - } - - vec3 GetCamVec() - { - return boost::apply_visitor(TGetCamVecVisitor(), CameraMover); - } + TCamera Camera; TSalmonRendererInterface(); virtual void InitOpenGL(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight); - void CalcCamPosVec(); + vec3 GetCamShift(); + + vec3 GetCamVec(); + + vec3 GetCamPos(); + + void CalcCamPos(); virtual void SetUniforms(); @@ -75,8 +69,6 @@ public: void SetGlNegZView(); - vec3 GetCamPos(); - virtual void SwitchToScreen(); virtual void SwitchToFrameBuffer(const std::string& frameName); void SwitchToCubemapBuffer(const std::string& frameName,cardinal cubeSide); diff --git a/src/Render/SalmonRender/Cameras.cpp b/src/Render/SalmonRender/Cameras.cpp index 76e3718..a8f7a34 100644 --- a/src/Render/SalmonRender/Cameras.cpp +++ b/src/Render/SalmonRender/Cameras.cpp @@ -36,7 +36,7 @@ void TPanoramicCamera::MoveAlpha(float dAlpha) } //Possibly refactor??? - Renderer->CalcCamPosVec(); + Renderer->CalcCamPos(); } @@ -59,7 +59,7 @@ void TPanoramicCamera::MovePhi(float dPhi) } //Possibly refactor??? - Renderer->CalcCamPosVec(); + Renderer->CalcCamPos(); } @@ -74,7 +74,7 @@ void TPanoramicCamera::MoveDist(float dDist) //Possibly refactor??? - Renderer->CalcCamPosVec(); + Renderer->CalcCamPos(); } @@ -96,7 +96,7 @@ void TPanoramicCamera::SetAlpha(float alpha) } //Possibly refactor??? - Renderer->CalcCamPosVec(); + Renderer->CalcCamPos(); } void TPanoramicCamera::MoveForward() @@ -113,7 +113,7 @@ void TPanoramicCamera::MoveForward() CamShift = CamShift + mov; //Possibly refactor??? - Renderer->CalcCamPosVec(); + Renderer->CalcCamPos(); } void TPanoramicCamera::MoveBackward() @@ -129,7 +129,7 @@ void TPanoramicCamera::MoveBackward() CamShift = CamShift + mov; //Possibly refactor??? - Renderer->CalcCamPosVec(); + Renderer->CalcCamPos(); } @@ -147,7 +147,7 @@ void TPanoramicCamera::MoveLeft() CamShift = CamShift + mov; //Possibly refactor??? - Renderer->CalcCamPosVec(); + Renderer->CalcCamPos(); } @@ -165,7 +165,7 @@ void TPanoramicCamera::MoveRight() CamShift = CamShift + mov; //Possibly refactor??? - Renderer->CalcCamPosVec(); + Renderer->CalcCamPos(); } diff --git a/src/Render/SalmonRender/SalmonRenderInterface.cpp b/src/Render/SalmonRender/SalmonRenderInterface.cpp index d97b42c..67344a8 100644 --- a/src/Render/SalmonRender/SalmonRenderInterface.cpp +++ b/src/Render/SalmonRender/SalmonRenderInterface.cpp @@ -97,13 +97,27 @@ void TSalmonRendererInterface::InitOpenGL(int screenWidth, int screenHeight, flo } +vec3 TSalmonRendererInterface::GetCamShift() +{ + return boost::apply_visitor(TGetCamShiftVisitor(), Camera); +} -void TSalmonRendererInterface::CalcCamPosVec() +vec3 TSalmonRendererInterface::GetCamVec() +{ + return boost::apply_visitor(TGetCamVecVisitor(), Camera); +} + +vec3 TSalmonRendererInterface::GetCamPos() +{ + return CamPos; +} + +void TSalmonRendererInterface::CalcCamPos() { TCalcCamVecVisitor v; - boost::apply_visitor(v, CameraMover); + boost::apply_visitor(v, Camera); CamPos = GetCamShift() - GetCamVec(); @@ -181,7 +195,7 @@ void TSalmonRendererInterface::PushPerspectiveProjectionMatrix(float angle, floa void TSalmonRendererInterface::SetGLCamView() { TSetCameraViewVisitor v; - boost::apply_visitor(v, CameraMover); + boost::apply_visitor(v, Camera); CamModelViewMatrix = ModelviewMatrixStack.top(); CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix); @@ -294,12 +308,6 @@ void TSalmonRendererInterface::SetGlNegZView() } -vec3 TSalmonRendererInterface::GetCamPos() -{ - return CamPos; -} - - void TSalmonRendererInterface::SwitchToScreen() { diff --git a/src/SalmonEngineWindows.cpp b/src/SalmonEngineWindows.cpp index c8e4343..be3e545 100644 --- a/src/SalmonEngineWindows.cpp +++ b/src/SalmonEngineWindows.cpp @@ -173,7 +173,7 @@ LONG WINAPI WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) BeginPaint(hWnd, &ps); EndPaint(hWnd, &ps); - ProcessTickCount(); + //ProcessTickCount(); break; case WM_SIZE: