minor fixing

This commit is contained in:
Vladislav Khorev 2013-01-28 10:40:28 +00:00
parent 8ec1ba5e74
commit de3a23b98d
6 changed files with 42 additions and 57 deletions

View File

@ -148,7 +148,7 @@
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>TARGET_SALMON;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG</PreprocessorDefinitions> <PreprocessorDefinitions>TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(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</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(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</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4503</DisableSpecificWarnings> <DisableSpecificWarnings>4503</DisableSpecificWarnings>
</ClCompile> </ClCompile>
@ -160,7 +160,7 @@
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>TARGET_SALMON;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG;NOSOUND</PreprocessorDefinitions> <PreprocessorDefinitions>TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG;NOSOUND</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(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</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(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</AdditionalIncludeDirectories>
<DisableSpecificWarnings>/wd 4503</DisableSpecificWarnings> <DisableSpecificWarnings>/wd 4503</DisableSpecificWarnings>
</ClCompile> </ClCompile>
@ -175,7 +175,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PreprocessorDefinitions>TARGET_SALMON;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;NDEBUG</PreprocessorDefinitions> <PreprocessorDefinitions>TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;NDEBUG</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(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</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(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</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4503</DisableSpecificWarnings> <DisableSpecificWarnings>4503</DisableSpecificWarnings>
</ClCompile> </ClCompile>

View File

@ -1,30 +1,15 @@
#ifndef ENGINE_H_INCLUDED #ifndef ENGINE_H_INCLUDED
#define ENGINE_H_INCLUDED #define ENGINE_H_INCLUDED
#ifdef TARGET_WIN32
#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
#include "SalmonEngineWindows.h" #include "SalmonEngineWindows.h"
#endif #endif
#ifdef SALMON_ANDROID #ifdef TARGET_ANDROID
#include "SalmonEngineAndroid.h" #include "SalmonEngineAndroid.h"
#endif #endif
#ifdef SALMON_IOS #ifdef TARGET_IOS
#include "include/SalmonEngineIos.h" #include "include/SalmonEngineIos.h"
#endif #endif

View File

@ -27,30 +27,24 @@ protected:
float GlobalShadowAreaHalfSize; float GlobalShadowAreaHalfSize;
vec3 CamPos; //Do not change - call CalcCamPos instead
virtual void DrawQuad(const T2DQuad& quad) = 0; virtual void DrawQuad(const T2DQuad& quad) = 0;
public: public:
TCamera CameraMover; TCamera Camera;
//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);
}
TSalmonRendererInterface(); TSalmonRendererInterface();
virtual void InitOpenGL(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight); virtual void InitOpenGL(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight);
void CalcCamPosVec(); vec3 GetCamShift();
vec3 GetCamVec();
vec3 GetCamPos();
void CalcCamPos();
virtual void SetUniforms(); virtual void SetUniforms();
@ -75,8 +69,6 @@ public:
void SetGlNegZView(); void SetGlNegZView();
vec3 GetCamPos();
virtual void SwitchToScreen(); virtual void SwitchToScreen();
virtual void SwitchToFrameBuffer(const std::string& frameName); virtual void SwitchToFrameBuffer(const std::string& frameName);
void SwitchToCubemapBuffer(const std::string& frameName,cardinal cubeSide); void SwitchToCubemapBuffer(const std::string& frameName,cardinal cubeSide);

View File

@ -36,7 +36,7 @@ void TPanoramicCamera::MoveAlpha(float dAlpha)
} }
//Possibly refactor??? //Possibly refactor???
Renderer->CalcCamPosVec(); Renderer->CalcCamPos();
} }
@ -59,7 +59,7 @@ void TPanoramicCamera::MovePhi(float dPhi)
} }
//Possibly refactor??? //Possibly refactor???
Renderer->CalcCamPosVec(); Renderer->CalcCamPos();
} }
@ -74,7 +74,7 @@ void TPanoramicCamera::MoveDist(float dDist)
//Possibly refactor??? //Possibly refactor???
Renderer->CalcCamPosVec(); Renderer->CalcCamPos();
} }
@ -96,7 +96,7 @@ void TPanoramicCamera::SetAlpha(float alpha)
} }
//Possibly refactor??? //Possibly refactor???
Renderer->CalcCamPosVec(); Renderer->CalcCamPos();
} }
void TPanoramicCamera::MoveForward() void TPanoramicCamera::MoveForward()
@ -113,7 +113,7 @@ void TPanoramicCamera::MoveForward()
CamShift = CamShift + mov; CamShift = CamShift + mov;
//Possibly refactor??? //Possibly refactor???
Renderer->CalcCamPosVec(); Renderer->CalcCamPos();
} }
void TPanoramicCamera::MoveBackward() void TPanoramicCamera::MoveBackward()
@ -129,7 +129,7 @@ void TPanoramicCamera::MoveBackward()
CamShift = CamShift + mov; CamShift = CamShift + mov;
//Possibly refactor??? //Possibly refactor???
Renderer->CalcCamPosVec(); Renderer->CalcCamPos();
} }
@ -147,7 +147,7 @@ void TPanoramicCamera::MoveLeft()
CamShift = CamShift + mov; CamShift = CamShift + mov;
//Possibly refactor??? //Possibly refactor???
Renderer->CalcCamPosVec(); Renderer->CalcCamPos();
} }
@ -165,7 +165,7 @@ void TPanoramicCamera::MoveRight()
CamShift = CamShift + mov; CamShift = CamShift + mov;
//Possibly refactor??? //Possibly refactor???
Renderer->CalcCamPosVec(); Renderer->CalcCamPos();
} }

View File

@ -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; TCalcCamVecVisitor v;
boost::apply_visitor(v, CameraMover); boost::apply_visitor(v, Camera);
CamPos = GetCamShift() - GetCamVec(); CamPos = GetCamShift() - GetCamVec();
@ -181,7 +195,7 @@ void TSalmonRendererInterface::PushPerspectiveProjectionMatrix(float angle, floa
void TSalmonRendererInterface::SetGLCamView() void TSalmonRendererInterface::SetGLCamView()
{ {
TSetCameraViewVisitor v; TSetCameraViewVisitor v;
boost::apply_visitor(v, CameraMover); boost::apply_visitor(v, Camera);
CamModelViewMatrix = ModelviewMatrixStack.top(); CamModelViewMatrix = ModelviewMatrixStack.top();
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix); CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);
@ -294,12 +308,6 @@ void TSalmonRendererInterface::SetGlNegZView()
} }
vec3 TSalmonRendererInterface::GetCamPos()
{
return CamPos;
}
void TSalmonRendererInterface::SwitchToScreen() void TSalmonRendererInterface::SwitchToScreen()
{ {

View File

@ -173,7 +173,7 @@ LONG WINAPI WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
BeginPaint(hWnd, &ps); BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
ProcessTickCount(); //ProcessTickCount();
break; break;
case WM_SIZE: case WM_SIZE: