Almost removed Halibut Engine
This commit is contained in:
parent
2e6989afe7
commit
feef4c1453
@ -324,6 +324,7 @@ LOCAL_SRC_FILES += src/SmartValueManager/SmartValueManager.cpp
|
|||||||
LOCAL_SRC_FILES += src/ModelManager/ModelManager.cpp
|
LOCAL_SRC_FILES += src/ModelManager/ModelManager.cpp
|
||||||
LOCAL_SRC_FILES += src/ModelManager/NewModelManager.cpp
|
LOCAL_SRC_FILES += src/ModelManager/NewModelManager.cpp
|
||||||
LOCAL_SRC_FILES += src/SimpleLand/SimpleLand.cpp
|
LOCAL_SRC_FILES += src/SimpleLand/SimpleLand.cpp
|
||||||
|
LOCAL_SRC_FILES += src/PhysicsManager/PhysicsManager.cpp
|
||||||
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES += src/Render/RenderMisc.cpp
|
LOCAL_SRC_FILES += src/Render/RenderMisc.cpp
|
||||||
|
@ -66,6 +66,7 @@
|
|||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>TARGET_HALIBUT;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG</PreprocessorDefinitions>
|
<PreprocessorDefinitions>TARGET_HALIBUT;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>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
@ -77,6 +78,7 @@
|
|||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>TARGET_HALIBUT;TARGET_WIN32;NOSOUND;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG</PreprocessorDefinitions>
|
<PreprocessorDefinitions>TARGET_HALIBUT;TARGET_WIN32;NOSOUND;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)\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)\lpng1510</AdditionalIncludeDirectories>
|
||||||
|
<DisableSpecificWarnings>4503</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
@ -90,6 +92,7 @@
|
|||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>TARGET_HALIBUT;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;NDEBUG</PreprocessorDefinitions>
|
<PreprocessorDefinitions>TARGET_HALIBUT;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>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -20,14 +20,21 @@
|
|||||||
<ClInclude Include="..\include\Engine.h" />
|
<ClInclude Include="..\include\Engine.h" />
|
||||||
<ClInclude Include="..\include\FrameManager\FrameManager.h" />
|
<ClInclude Include="..\include\FrameManager\FrameManager.h" />
|
||||||
<ClInclude Include="..\include\GlobalConst.h" />
|
<ClInclude Include="..\include\GlobalConst.h" />
|
||||||
|
<ClInclude Include="..\include\GUIManager\ButtonWidget.h" />
|
||||||
|
<ClInclude Include="..\include\GUIManager\GUIManager.h" />
|
||||||
|
<ClInclude Include="..\include\GUIManager\WidgetTemplatesImpl.h" />
|
||||||
|
<ClInclude Include="..\include\GUIManager\WidgetXmlParsers.h" />
|
||||||
|
<ClInclude Include="..\include\HalibutAnimation\HalibutAnimation.h" />
|
||||||
<ClInclude Include="..\include\LightManager\LightManager.h" />
|
<ClInclude Include="..\include\LightManager\LightManager.h" />
|
||||||
<ClInclude Include="..\include\ModelManager\ModelManager.h" />
|
<ClInclude Include="..\include\ModelManager\ModelManager.h" />
|
||||||
<ClInclude Include="..\include\ModelManager\NewModelManager.h" />
|
<ClInclude Include="..\include\ModelManager\NewModelManager.h" />
|
||||||
<ClInclude Include="..\include\OpenGLExt\OpenGlExt.h" />
|
<ClInclude Include="..\include\OpenGLExt\OpenGlExt.h" />
|
||||||
|
<ClInclude Include="..\include\PhysicsManager\PhysicsManager.h" />
|
||||||
<ClInclude Include="..\include\Render\RenderInterface.h" />
|
<ClInclude Include="..\include\Render\RenderInterface.h" />
|
||||||
<ClInclude Include="..\include\Render\RenderMisc.h" />
|
<ClInclude Include="..\include\Render\RenderMisc.h" />
|
||||||
<ClInclude Include="..\include\Render\RenderParams.h" />
|
<ClInclude Include="..\include\Render\RenderParams.h" />
|
||||||
<ClInclude Include="..\include\Render\SalmonRender\BackgroundCubemap.h" />
|
<ClInclude Include="..\include\Render\SalmonRender\BackgroundCubemap.h" />
|
||||||
|
<ClInclude Include="..\include\Render\SalmonRender\Cameras.h" />
|
||||||
<ClInclude Include="..\include\Render\SalmonRender\SalmonRenderWindows.h" />
|
<ClInclude Include="..\include\Render\SalmonRender\SalmonRenderWindows.h" />
|
||||||
<ClInclude Include="..\include\Render\SalmonRender\SalmonRenderInterface.h" />
|
<ClInclude Include="..\include\Render\SalmonRender\SalmonRenderInterface.h" />
|
||||||
<ClInclude Include="..\include\SalmonEngineInterface.h" />
|
<ClInclude Include="..\include\SalmonEngineInterface.h" />
|
||||||
@ -57,14 +64,20 @@
|
|||||||
<ClCompile Include="..\src\FontManager\FontManager.cpp" />
|
<ClCompile Include="..\src\FontManager\FontManager.cpp" />
|
||||||
<ClCompile Include="..\src\FrameManager\FrameManager.cpp" />
|
<ClCompile Include="..\src\FrameManager\FrameManager.cpp" />
|
||||||
<ClCompile Include="..\src\GlobalConst.cpp" />
|
<ClCompile Include="..\src\GlobalConst.cpp" />
|
||||||
|
<ClCompile Include="..\src\GUIManager\ButtonWidget.cpp" />
|
||||||
|
<ClCompile Include="..\src\GUIManager\GUIManager.cpp" />
|
||||||
|
<ClCompile Include="..\src\GUIManager\WidgetXmlParsers.cpp" />
|
||||||
|
<ClCompile Include="..\src\HalibutAnimation\HalibutAnimation.cpp" />
|
||||||
<ClCompile Include="..\src\LightManager\LightManager.cpp" />
|
<ClCompile Include="..\src\LightManager\LightManager.cpp" />
|
||||||
<ClCompile Include="..\src\ModelManager\ModelManager.cpp" />
|
<ClCompile Include="..\src\ModelManager\ModelManager.cpp" />
|
||||||
<ClCompile Include="..\src\ModelManager\NewModelManager.cpp" />
|
<ClCompile Include="..\src\ModelManager\NewModelManager.cpp" />
|
||||||
<ClCompile Include="..\src\OpenGLExt\OpenGlExt.cpp" />
|
<ClCompile Include="..\src\OpenGLExt\OpenGlExt.cpp" />
|
||||||
|
<ClCompile Include="..\src\PhysicsManager\PhysicsManager.cpp" />
|
||||||
<ClCompile Include="..\src\Render\RenderInterface.cpp" />
|
<ClCompile Include="..\src\Render\RenderInterface.cpp" />
|
||||||
<ClCompile Include="..\src\Render\RenderMisc.cpp" />
|
<ClCompile Include="..\src\Render\RenderMisc.cpp" />
|
||||||
<ClCompile Include="..\src\Render\RenderParams.cpp" />
|
<ClCompile Include="..\src\Render\RenderParams.cpp" />
|
||||||
<ClCompile Include="..\src\Render\SalmonRender\BackgroundCubemap.cpp" />
|
<ClCompile Include="..\src\Render\SalmonRender\BackgroundCubemap.cpp" />
|
||||||
|
<ClCompile Include="..\src\Render\SalmonRender\Cameras.cpp" />
|
||||||
<ClCompile Include="..\src\Render\SalmonRender\SalmonRenderWindows.cpp" />
|
<ClCompile Include="..\src\Render\SalmonRender\SalmonRenderWindows.cpp" />
|
||||||
<ClCompile Include="..\src\Render\SalmonRender\SalmonRenderInterface.cpp" />
|
<ClCompile Include="..\src\Render\SalmonRender\SalmonRenderInterface.cpp" />
|
||||||
<ClCompile Include="..\src\SalmonEngineInterface.cpp" />
|
<ClCompile Include="..\src\SalmonEngineInterface.cpp" />
|
||||||
@ -161,10 +174,10 @@
|
|||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<PreprocessorDefinitions>TARGET_SALMON;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;NDEBUG</PreprocessorDefinitions>
|
<PreprocessorDefinitions>TARGET_SALMON;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>/wd 4503</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4503</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
50
include/PhysicsManager/PhysicsManager.h
Normal file
50
include/PhysicsManager/PhysicsManager.h
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#ifndef PHYSICS_MANAGER_H_INCLUDED
|
||||||
|
#define PHYSICS_MANAGER_H_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
#include "include/Utils/Utils.h"
|
||||||
|
#include "include/ModelManager/NewModelManager.h"
|
||||||
|
|
||||||
|
namespace SE
|
||||||
|
{
|
||||||
|
|
||||||
|
class TVolumeBody
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
std::stack<std::vector<TSmpTriangle>> SmpTriangleArrStack;
|
||||||
|
|
||||||
|
std::vector<TSmpTriangle> SmpTriangleArr;
|
||||||
|
|
||||||
|
vec3 DimensionalMinPos;
|
||||||
|
vec3 DimensionalMaxPos;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void PushData();
|
||||||
|
void PopData();
|
||||||
|
|
||||||
|
void Move(const vec3& v);
|
||||||
|
void Rotate(const mat3& r);
|
||||||
|
void Scale(float s);
|
||||||
|
void Scale(const vec3& s);
|
||||||
|
|
||||||
|
void AssignFromFlexModel(TFlexModel& flexModel);
|
||||||
|
|
||||||
|
bool CheckCollision(const vec3& a, const vec3& b);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class TPhysicsManager
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
public:
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} //namespace SE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
123
include/Render/SalmonRender/Cameras.h
Normal file
123
include/Render/SalmonRender/Cameras.h
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
#ifndef CAMERAS_H_INCLUDED
|
||||||
|
#define CAMERAS_H_INCLUDED
|
||||||
|
|
||||||
|
#include "include/Utils/Utils.h"
|
||||||
|
|
||||||
|
namespace SE
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
struct TCameraInterface
|
||||||
|
{
|
||||||
|
vec3 CamVec;
|
||||||
|
|
||||||
|
vec3 CamShift;
|
||||||
|
|
||||||
|
TCameraInterface();
|
||||||
|
|
||||||
|
virtual ~TCameraInterface()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TPanoramicCamera : public TCameraInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
float CamAlpha;
|
||||||
|
float CamPhi;
|
||||||
|
float CamDist;
|
||||||
|
|
||||||
|
TPanoramicCamera();
|
||||||
|
|
||||||
|
void MoveAlpha(float dAlpha);
|
||||||
|
void MovePhi(float dPhi);
|
||||||
|
void MoveDist(float dDist);
|
||||||
|
void SetAlpha(float alpha);
|
||||||
|
|
||||||
|
void MoveForward();
|
||||||
|
void MoveBackward();
|
||||||
|
void MoveLeft();
|
||||||
|
void MoveRight();
|
||||||
|
|
||||||
|
void CalcCamVec();
|
||||||
|
|
||||||
|
void SetCamView();
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TPitCamera : public TCameraInterface
|
||||||
|
{
|
||||||
|
vec4 CameraQuat;
|
||||||
|
|
||||||
|
void SetCamView();
|
||||||
|
|
||||||
|
void CalcCamVec();
|
||||||
|
|
||||||
|
void RotateByQuat(vec4 quat);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef boost::variant<TPanoramicCamera, TPitCamera> TCamera;
|
||||||
|
|
||||||
|
|
||||||
|
struct TSetCameraViewVisitor : public boost::static_visitor<void>
|
||||||
|
{
|
||||||
|
void operator()(TPanoramicCamera& panoramicCamera)
|
||||||
|
{
|
||||||
|
panoramicCamera.SetCamView();
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator()(TPitCamera& pitCamera)
|
||||||
|
{
|
||||||
|
pitCamera.SetCamView();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct TCalcCamVecVisitor : public boost::static_visitor<void>
|
||||||
|
{
|
||||||
|
void operator()(TPanoramicCamera& panoramicCamera)
|
||||||
|
{
|
||||||
|
panoramicCamera.CalcCamVec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator()(TPitCamera& pitCamera)
|
||||||
|
{
|
||||||
|
pitCamera.CalcCamVec();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct TGetCamVecVisitor : public boost::static_visitor<vec3&>
|
||||||
|
{
|
||||||
|
vec3& operator()(TPanoramicCamera& panoramicCamera) const
|
||||||
|
{
|
||||||
|
return panoramicCamera.CamVec;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3& operator()(TPitCamera& pitCamera) const
|
||||||
|
{
|
||||||
|
return pitCamera.CamVec;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TGetCamShiftVisitor : public boost::static_visitor<vec3&>
|
||||||
|
{
|
||||||
|
vec3& operator()(TPanoramicCamera& panoramicCamera) const
|
||||||
|
{
|
||||||
|
return panoramicCamera.CamShift;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3& operator()(TPitCamera& pitCamera) const
|
||||||
|
{
|
||||||
|
return pitCamera.CamShift;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} //namespace SE
|
||||||
|
|
||||||
|
#endif
|
@ -11,127 +11,17 @@
|
|||||||
|
|
||||||
#include "include/Render/RenderInterface.h"
|
#include "include/Render/RenderInterface.h"
|
||||||
|
|
||||||
|
#include "include/Render/SalmonRender/Cameras.h"
|
||||||
|
|
||||||
namespace SE
|
namespace SE
|
||||||
{
|
{
|
||||||
|
|
||||||
struct TCameraInterface
|
|
||||||
{
|
|
||||||
vec3 CamVec;
|
|
||||||
|
|
||||||
vec3 CamShift;
|
|
||||||
|
|
||||||
TCameraInterface();
|
|
||||||
|
|
||||||
virtual ~TCameraInterface()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TPanoramicCamera : public TCameraInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
float CamAlpha;
|
|
||||||
float CamPhi;
|
|
||||||
float CamDist;
|
|
||||||
|
|
||||||
TPanoramicCamera();
|
|
||||||
|
|
||||||
void MoveAlpha(float dAlpha);
|
|
||||||
void MovePhi(float dPhi);
|
|
||||||
void MoveDist(float dDist);
|
|
||||||
void SetAlpha(float alpha);
|
|
||||||
|
|
||||||
void MoveForward();
|
|
||||||
void MoveBackward();
|
|
||||||
void MoveLeft();
|
|
||||||
void MoveRight();
|
|
||||||
|
|
||||||
void CalcCamVec();
|
|
||||||
|
|
||||||
void SetCamView();
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TPitCamera : public TCameraInterface
|
|
||||||
{
|
|
||||||
vec4 CameraQuat;
|
|
||||||
|
|
||||||
void SetCamView();
|
|
||||||
|
|
||||||
void CalcCamVec();
|
|
||||||
|
|
||||||
void RotateByQuat(vec4 quat);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef boost::variant<TPanoramicCamera, TPitCamera> TCamera;
|
|
||||||
|
|
||||||
|
|
||||||
struct TSetCameraViewVisitor : public boost::static_visitor<void>
|
|
||||||
{
|
|
||||||
void operator()(TPanoramicCamera& panoramicCamera)
|
|
||||||
{
|
|
||||||
panoramicCamera.SetCamView();
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator()(TPitCamera& pitCamera)
|
|
||||||
{
|
|
||||||
pitCamera.SetCamView();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct TCalcCamVecVisitor : public boost::static_visitor<void>
|
|
||||||
{
|
|
||||||
void operator()(TPanoramicCamera& panoramicCamera)
|
|
||||||
{
|
|
||||||
panoramicCamera.CalcCamVec();
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator()(TPitCamera& pitCamera)
|
|
||||||
{
|
|
||||||
pitCamera.CalcCamVec();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct TGetCamVecVisitor : public boost::static_visitor<vec3&>
|
|
||||||
{
|
|
||||||
vec3& operator()(TPanoramicCamera& panoramicCamera) const
|
|
||||||
{
|
|
||||||
return panoramicCamera.CamVec;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3& operator()(TPitCamera& pitCamera) const
|
|
||||||
{
|
|
||||||
return pitCamera.CamVec;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TGetCamShiftVisitor : public boost::static_visitor<vec3&>
|
|
||||||
{
|
|
||||||
vec3& operator()(TPanoramicCamera& panoramicCamera) const
|
|
||||||
{
|
|
||||||
return panoramicCamera.CamShift;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3& operator()(TPitCamera& pitCamera) const
|
|
||||||
{
|
|
||||||
return pitCamera.CamShift;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class TSalmonRendererInterface : public TRendererInterface
|
class TSalmonRendererInterface : public TRendererInterface
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/*
|
|
||||||
float CamAlpha;
|
|
||||||
float CamPhi;
|
|
||||||
float CamDist;
|
|
||||||
vec3 CamShift;*/
|
|
||||||
|
|
||||||
mat4 CamModelViewMatrix;
|
mat4 CamModelViewMatrix;
|
||||||
mat4 CamInversedModelViewMatrix;
|
mat4 CamInversedModelViewMatrix;
|
||||||
|
|
||||||
@ -167,6 +57,9 @@ public:
|
|||||||
void SetPerspectiveFullScreenViewport();
|
void SetPerspectiveFullScreenViewport();
|
||||||
void SetOrthoFullScreenViewport();
|
void SetOrthoFullScreenViewport();
|
||||||
|
|
||||||
|
void SetPerspectiveProjection(float angle = pi/6.f, float zNear = 1.f, float zFar = 100.f);
|
||||||
|
void SetOrthoProjection();
|
||||||
|
|
||||||
mat4 GetModelviewMatrix();
|
mat4 GetModelviewMatrix();
|
||||||
|
|
||||||
void SetPerspectiveProjectionMatrix(float angle, float aspect, float zNear, float zFar);
|
void SetPerspectiveProjectionMatrix(float angle, float aspect, float zNear, float zFar);
|
||||||
|
@ -43,7 +43,9 @@ This code combines all headers for Salmon engine into one header file
|
|||||||
#include "include/SmartValueManager/SmartValueManager.h"
|
#include "include/SmartValueManager/SmartValueManager.h"
|
||||||
|
|
||||||
#include "include/ModelManager/NewModelManager.h"
|
#include "include/ModelManager/NewModelManager.h"
|
||||||
|
#include "include/PhysicsManager/PhysicsManager.h"
|
||||||
|
#include "include/GUIManager/GUIManager.h"
|
||||||
|
#include "include/HalibutAnimation/HalibutAnimation.h"
|
||||||
|
|
||||||
namespace SE
|
namespace SE
|
||||||
{
|
{
|
||||||
@ -64,6 +66,8 @@ public:
|
|||||||
TScriptManager ScriptManager;
|
TScriptManager ScriptManager;
|
||||||
TFontManager FontManager;
|
TFontManager FontManager;
|
||||||
TSmartValueManager SmartValueManager;
|
TSmartValueManager SmartValueManager;
|
||||||
|
TGUIManager GUIManager;
|
||||||
|
THalibutAnimationManager HalibutAnimationManager;
|
||||||
|
|
||||||
#ifdef TARGET_ANDROID
|
#ifdef TARGET_ANDROID
|
||||||
TSoundManagerAndroid SoundManager;
|
TSoundManagerAndroid SoundManager;
|
||||||
@ -115,12 +119,16 @@ public:
|
|||||||
|
|
||||||
virtual void OuterOnTapUp(vec2 p);
|
virtual void OuterOnTapUp(vec2 p);
|
||||||
|
|
||||||
|
virtual void OuterOnTapUpAfterShift(vec2 p);
|
||||||
|
|
||||||
virtual void OuterOnMove(vec2 shift);
|
virtual void OuterOnMove(vec2 shift);
|
||||||
|
|
||||||
virtual void InnerOnTapDown(vec2 p) { }
|
virtual void InnerOnTapDown(vec2 p) { }
|
||||||
|
|
||||||
virtual void InnerOnTapUp(vec2 p) { }
|
virtual void InnerOnTapUp(vec2 p) { }
|
||||||
|
|
||||||
|
virtual void InnerOnTapUpAfterShift(vec2 p) { }
|
||||||
|
|
||||||
virtual void InnerOnMove(vec2 shift) { }
|
virtual void InnerOnMove(vec2 shift) { }
|
||||||
|
|
||||||
virtual void OnMouseMove(TMouseState& mouseState) { } //Windows only
|
virtual void OnMouseMove(TMouseState& mouseState) { } //Windows only
|
||||||
|
@ -61,3 +61,8 @@ public:
|
|||||||
int MainLoop(TApplication& application);
|
int MainLoop(TApplication& application);
|
||||||
|
|
||||||
} //namespace SE
|
} //namespace SE
|
||||||
|
|
||||||
|
//This file includes templates that call any of three singletones: Console, ResourceManager or Renderer
|
||||||
|
|
||||||
|
#include "include/GUIManager/WidgetTemplatesImpl.h"
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ mat4 MultMatrixMatrix(const mat4& m1, const mat4& m2);
|
|||||||
|
|
||||||
bool IsFloatEqual(float a, float b);
|
bool IsFloatEqual(float a, float b);
|
||||||
|
|
||||||
bool LineCouldCrossTriangle(const vec3& a, const vec3& b, const TSmpTriangle& tr); //overall test
|
bool LineCouldCrossTriangle(const vec3& a, const vec3& b, const TSmpTriangle& tr); //overall (dimensional) test
|
||||||
|
|
||||||
int LineCrossTriangle(const vec3& a, const vec3& b, const TSmpTriangle& tr);
|
int LineCrossTriangle(const vec3& a, const vec3& b, const TSmpTriangle& tr);
|
||||||
|
|
||||||
|
@ -12,13 +12,10 @@ TApplicationInterface::TApplicationInterface()
|
|||||||
void TApplicationInterface::OuterInit(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight)
|
void TApplicationInterface::OuterInit(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight)
|
||||||
{
|
{
|
||||||
ResourceManager->ScriptManager.BindBasicFunctions();
|
ResourceManager->ScriptManager.BindBasicFunctions();
|
||||||
|
|
||||||
|
Renderer->InitOpenGL(screenWidth, screenHeight, matrixWidth, matrixHeight);
|
||||||
|
|
||||||
InnerInit();
|
InnerInit();
|
||||||
#ifdef TARGET_HALIBUT
|
|
||||||
Renderer->InitOpenGL(screenWidth, screenHeight, matrixWidth, matrixHeight);
|
|
||||||
#endif
|
|
||||||
#ifdef TARGET_SALMON
|
|
||||||
Renderer->InitOpenGL(screenWidth, screenHeight, matrixWidth, matrixHeight);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CheckGlError();
|
CheckGlError();
|
||||||
|
|
||||||
|
@ -88,6 +88,8 @@ cardinal TFrameManager::AddFrameRenderBuffer(const std::string& frameName,cardin
|
|||||||
FrameMap[frameName].Height = height;
|
FrameMap[frameName].Height = height;
|
||||||
FrameMap[frameName].TexName = texName;
|
FrameMap[frameName].TexName = texName;
|
||||||
|
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
return FrameMap[frameName].FrameBuffer;
|
return FrameMap[frameName].FrameBuffer;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -180,7 +182,8 @@ cardinal TFrameManager::AddCubemapBuffer(const std::string& frameName,cardinal w
|
|||||||
FrameMap[frameName].Height = height;
|
FrameMap[frameName].Height = height;
|
||||||
FrameMap[frameName].TexName = texName;
|
FrameMap[frameName].TexName = texName;
|
||||||
|
|
||||||
//return FrameMap[frameName].TexID; //That is easier
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
return FrameMap[frameName].FrameBuffer;
|
return FrameMap[frameName].FrameBuffer;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -262,6 +265,8 @@ cardinal TFrameManager::AddDepthBuffer(const std::string& frameName, cardinal wi
|
|||||||
FrameMap[frameName].Height = height;
|
FrameMap[frameName].Height = height;
|
||||||
FrameMap[frameName].TexName = texName;
|
FrameMap[frameName].TexName = texName;
|
||||||
|
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
return FrameMap[frameName].FrameBuffer;
|
return FrameMap[frameName].FrameBuffer;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
138
src/PhysicsManager/PhysicsManager.cpp
Normal file
138
src/PhysicsManager/PhysicsManager.cpp
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
#include "include/PhysicsManager/PhysicsManager.h"
|
||||||
|
#include "include/ModelManager/NewModelManager.h"
|
||||||
|
#include "include/ShaderManager/ShaderManager.h"
|
||||||
|
|
||||||
|
namespace SE
|
||||||
|
{
|
||||||
|
|
||||||
|
const int CONST_MAX_VOLUME_STACK = 64;
|
||||||
|
|
||||||
|
void TVolumeBody::AssignFromFlexModel(TFlexModel& flexModel)
|
||||||
|
{
|
||||||
|
SmpTriangleArr.clear();
|
||||||
|
|
||||||
|
TDataTriangleList& dataTriangleList = flexModel.GetDataTriangleList();
|
||||||
|
|
||||||
|
if (dataTriangleList.Vec3CoordArr.count(CONST_STRING_POSITION_ATTRIB) == 0)
|
||||||
|
{
|
||||||
|
throw ErrorToLog("Error in AssignFromFlexModel - empty flexModel!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataTriangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].size() == 0)
|
||||||
|
{
|
||||||
|
throw ErrorToLog("Error in AssignFromFlexModel - empty flexModel! size == 0!");
|
||||||
|
}
|
||||||
|
|
||||||
|
DimensionalMinPos = dataTriangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][0];
|
||||||
|
DimensionalMaxPos = dataTriangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][0];
|
||||||
|
|
||||||
|
|
||||||
|
for (size_t j = 0; j < dataTriangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].size(); j+=3)
|
||||||
|
{
|
||||||
|
TSmpTriangle smpTriangle;
|
||||||
|
|
||||||
|
smpTriangle.p[0] = dataTriangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][j];
|
||||||
|
smpTriangle.p[1] = dataTriangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][j + 1];
|
||||||
|
smpTriangle.p[2] = dataTriangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][j + 2];
|
||||||
|
|
||||||
|
smpTriangle.v = smpTriangle.p[1] - smpTriangle.p[0];
|
||||||
|
smpTriangle.w = smpTriangle.p[2] - smpTriangle.p[1];
|
||||||
|
|
||||||
|
smpTriangle.n = CrossProduct(smpTriangle.v, smpTriangle.w);
|
||||||
|
|
||||||
|
SmpTriangleArr.push_back(smpTriangle);
|
||||||
|
|
||||||
|
DimensionalMinPos.v[0] = min(min(min(DimensionalMinPos.v[0], smpTriangle.p[0].v[0]), smpTriangle.p[1].v[0]), smpTriangle.p[2].v[0]);
|
||||||
|
DimensionalMinPos.v[1] = min(min(min(DimensionalMinPos.v[1], smpTriangle.p[0].v[1]), smpTriangle.p[1].v[1]), smpTriangle.p[2].v[1]);
|
||||||
|
DimensionalMinPos.v[2] = min(min(min(DimensionalMinPos.v[2], smpTriangle.p[0].v[2]), smpTriangle.p[1].v[2]), smpTriangle.p[2].v[2]);
|
||||||
|
|
||||||
|
DimensionalMaxPos.v[0] = max(max(max(DimensionalMaxPos.v[0], smpTriangle.p[0].v[0]), smpTriangle.p[1].v[0]), smpTriangle.p[2].v[0]);
|
||||||
|
DimensionalMaxPos.v[1] = max(max(max(DimensionalMaxPos.v[1], smpTriangle.p[0].v[1]), smpTriangle.p[1].v[1]), smpTriangle.p[2].v[1]);
|
||||||
|
DimensionalMaxPos.v[2] = max(max(max(DimensionalMaxPos.v[2], smpTriangle.p[0].v[2]), smpTriangle.p[1].v[2]), smpTriangle.p[2].v[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TVolumeBody::PushData()
|
||||||
|
{
|
||||||
|
if (SmpTriangleArrStack.size() >= CONST_MAX_VOLUME_STACK)
|
||||||
|
{
|
||||||
|
throw ErrorToLog("TVolumeBody::PushData - stack overflow");
|
||||||
|
}
|
||||||
|
|
||||||
|
SmpTriangleArrStack.push(SmpTriangleArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TVolumeBody::PopData()
|
||||||
|
{
|
||||||
|
if (SmpTriangleArrStack.size() <= 0)
|
||||||
|
{
|
||||||
|
throw ErrorToLog("TVolumeBody::PushData - stack underflow");
|
||||||
|
}
|
||||||
|
|
||||||
|
SmpTriangleArr = SmpTriangleArrStack.top();
|
||||||
|
|
||||||
|
SmpTriangleArrStack.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TVolumeBody::Move(const vec3& v)
|
||||||
|
{
|
||||||
|
BOOST_FOREACH(TSmpTriangle& smpTriangle, SmpTriangleArr)
|
||||||
|
{
|
||||||
|
smpTriangle.p[0] -= v;
|
||||||
|
smpTriangle.p[1] -= v;
|
||||||
|
smpTriangle.p[2] -= v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TVolumeBody::Rotate(const mat3& r)
|
||||||
|
{
|
||||||
|
throw ErrorToLog("TVolumeBody::Rotate not implemented yet!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void TVolumeBody::Scale(float s)
|
||||||
|
{
|
||||||
|
throw ErrorToLog("TVolumeBody::Scale not implemented yet!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void TVolumeBody::Scale(const vec3& s)
|
||||||
|
{
|
||||||
|
throw ErrorToLog("TVolumeBody::Scale not implemented yet!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool TVolumeBody::CheckCollision(const vec3& a, const vec3& b)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (int i=0; i<3; i++)
|
||||||
|
{
|
||||||
|
if (max(a.v[i], b.v[i]) < DimensionalMinPos.v[i])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (min(a.v[i], b.v[i]) > DimensionalMaxPos.v[i])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_FOREACH(TSmpTriangle& smpTriangle, SmpTriangleArr)
|
||||||
|
{
|
||||||
|
if (LineCouldCrossTriangle(a, b, smpTriangle))
|
||||||
|
{
|
||||||
|
if (LineCrossTriangle(a, b, smpTriangle) == 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} //namespace SE
|
222
src/Render/SalmonRender/Cameras.cpp
Normal file
222
src/Render/SalmonRender/Cameras.cpp
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
#include "include/Render/SalmonRender/Cameras.h"
|
||||||
|
#include "include/Engine.h"
|
||||||
|
|
||||||
|
namespace SE
|
||||||
|
{
|
||||||
|
|
||||||
|
TCameraInterface::TCameraInterface()
|
||||||
|
: CamShift(ZeroVec3)
|
||||||
|
{
|
||||||
|
CamVec = vec3(0,0,-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TPanoramicCamera::TPanoramicCamera()
|
||||||
|
: CamAlpha(0.0f)
|
||||||
|
, CamPhi(0.0f)
|
||||||
|
, CamDist(0.0f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TPanoramicCamera::MoveAlpha(float dAlpha)
|
||||||
|
{
|
||||||
|
if (dAlpha == 0.0f)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CamAlpha += dAlpha;
|
||||||
|
|
||||||
|
while (CamAlpha >= 2*pi)
|
||||||
|
{
|
||||||
|
CamAlpha -= 2*pi;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (CamAlpha<0.0f)
|
||||||
|
{
|
||||||
|
CamAlpha += 2*pi;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Possibly refactor???
|
||||||
|
Renderer->CalcCamPosVec();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPanoramicCamera::MovePhi(float dPhi)
|
||||||
|
{
|
||||||
|
if (dPhi == 0.0f)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//float oldCamPhi = CamPhi;
|
||||||
|
CamPhi += dPhi;
|
||||||
|
|
||||||
|
if (CamPhi > CONST_MAX_CAM_PHI)
|
||||||
|
{
|
||||||
|
CamPhi = CONST_MAX_CAM_PHI;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CamPhi < CONST_MIN_CAM_PHI)
|
||||||
|
{
|
||||||
|
CamPhi = CONST_MIN_CAM_PHI;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Possibly refactor???
|
||||||
|
Renderer->CalcCamPosVec();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPanoramicCamera::MoveDist(float dDist)
|
||||||
|
{
|
||||||
|
CamDist += dDist;
|
||||||
|
|
||||||
|
if (CamDist<CONST_MIN_CAM_DIST)
|
||||||
|
{
|
||||||
|
CamDist = CONST_MIN_CAM_DIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Possibly refactor???
|
||||||
|
Renderer->CalcCamPosVec();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPanoramicCamera::SetAlpha(float alpha)
|
||||||
|
{
|
||||||
|
if (alpha == CamAlpha)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CamAlpha = alpha;
|
||||||
|
|
||||||
|
while (CamAlpha >= 2*pi)
|
||||||
|
{
|
||||||
|
CamAlpha -= 2*pi;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (CamAlpha<0.0f)
|
||||||
|
{
|
||||||
|
CamAlpha += 2*pi;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Possibly refactor???
|
||||||
|
Renderer->CalcCamPosVec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPanoramicCamera::MoveForward()
|
||||||
|
{
|
||||||
|
vec3 mov;
|
||||||
|
|
||||||
|
float sina = sinf(CamAlpha);
|
||||||
|
float cosa = cosf(CamAlpha);
|
||||||
|
|
||||||
|
mov.v[0] = sina;
|
||||||
|
mov.v[1] = 0;
|
||||||
|
mov.v[2] = - cosa;
|
||||||
|
|
||||||
|
CamShift = CamShift + mov;
|
||||||
|
|
||||||
|
//Possibly refactor???
|
||||||
|
Renderer->CalcCamPosVec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPanoramicCamera::MoveBackward()
|
||||||
|
{
|
||||||
|
vec3 mov;
|
||||||
|
|
||||||
|
float sina = sinf(CamAlpha);
|
||||||
|
float cosa = cosf(CamAlpha);
|
||||||
|
|
||||||
|
mov.v[0] = - sina;
|
||||||
|
mov.v[1] = 0;
|
||||||
|
mov.v[2] = cosa;
|
||||||
|
|
||||||
|
CamShift = CamShift + mov;
|
||||||
|
//Possibly refactor???
|
||||||
|
Renderer->CalcCamPosVec();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPanoramicCamera::MoveLeft()
|
||||||
|
{
|
||||||
|
vec3 mov;
|
||||||
|
|
||||||
|
float sina = sinf(CamAlpha);
|
||||||
|
float cosa = cosf(CamAlpha);
|
||||||
|
|
||||||
|
mov.v[0] = - cosa;
|
||||||
|
mov.v[1] = 0;
|
||||||
|
mov.v[2] = - sina;
|
||||||
|
|
||||||
|
CamShift = CamShift + mov;
|
||||||
|
|
||||||
|
//Possibly refactor???
|
||||||
|
Renderer->CalcCamPosVec();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPanoramicCamera::MoveRight()
|
||||||
|
{
|
||||||
|
vec3 mov;
|
||||||
|
|
||||||
|
float sina = sinf(CamAlpha);
|
||||||
|
float cosa = cosf(CamAlpha);
|
||||||
|
|
||||||
|
mov.v[0] = cosa;
|
||||||
|
mov.v[1] = 0;
|
||||||
|
mov.v[2] = sina;
|
||||||
|
|
||||||
|
CamShift = CamShift + mov;
|
||||||
|
|
||||||
|
//Possibly refactor???
|
||||||
|
Renderer->CalcCamPosVec();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TPanoramicCamera::CalcCamVec()
|
||||||
|
{
|
||||||
|
vec3 camPos;
|
||||||
|
vec3 camVec;
|
||||||
|
|
||||||
|
float sina = sinf(CamAlpha);
|
||||||
|
float cosa = cosf(CamAlpha);
|
||||||
|
float sinp = sinf(CamPhi);
|
||||||
|
float cosp = cosf(CamPhi);
|
||||||
|
|
||||||
|
CamVec.v[0] = CamDist * cosp * sina;
|
||||||
|
CamVec.v[1] = - CamDist * sinp;
|
||||||
|
CamVec.v[2] = - CamDist * cosp * cosa;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPanoramicCamera::SetCamView()
|
||||||
|
{
|
||||||
|
|
||||||
|
Renderer->LoadIdentity();
|
||||||
|
Renderer->TranslateMatrix(vec3(0.0f, 0.0f, -CamDist));
|
||||||
|
Renderer->RotateMatrix(vec4(1.f * sin(CamPhi/2.f), 0.f, 0.f, 1.f * cos(CamPhi/2.f)));
|
||||||
|
Renderer->RotateMatrix(vec4(0.f, 1.f * sin(CamAlpha/2.f), 0.f, 1.f * cos(CamAlpha/2.f)));
|
||||||
|
Renderer->TranslateMatrix(-CamShift);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TPitCamera::SetCamView()
|
||||||
|
{
|
||||||
|
Renderer->LoadIdentity();
|
||||||
|
Renderer->RotateMatrix(InverseQuat(CameraQuat));
|
||||||
|
|
||||||
|
Renderer->TranslateMatrix(-CamShift);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPitCamera::CalcCamVec()
|
||||||
|
{
|
||||||
|
vec3 r = vec3(0,0,-1);
|
||||||
|
|
||||||
|
CamVec = Normalize(CameraQuat * vec4(r) * InverseQuat(CameraQuat));
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPitCamera::RotateByQuat(vec4 quat)
|
||||||
|
{
|
||||||
|
CameraQuat = quat * CameraQuat;
|
||||||
|
//float len = Length(CameraQuat);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} //namespace SE
|
@ -6,220 +6,6 @@
|
|||||||
namespace SE
|
namespace SE
|
||||||
{
|
{
|
||||||
|
|
||||||
TCameraInterface::TCameraInterface()
|
|
||||||
: CamShift(ZeroVec3)
|
|
||||||
, CamVec(ZeroVec3)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
TPanoramicCamera::TPanoramicCamera()
|
|
||||||
: CamAlpha(0.0f)
|
|
||||||
, CamPhi(0.0f)
|
|
||||||
, CamDist(0.0f)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void TPanoramicCamera::MoveAlpha(float dAlpha)
|
|
||||||
{
|
|
||||||
if (dAlpha == 0.0f)
|
|
||||||
return;
|
|
||||||
|
|
||||||
CamAlpha += dAlpha;
|
|
||||||
|
|
||||||
while (CamAlpha >= 2*pi)
|
|
||||||
{
|
|
||||||
CamAlpha -= 2*pi;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (CamAlpha<0.0f)
|
|
||||||
{
|
|
||||||
CamAlpha += 2*pi;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Possibly refactor???
|
|
||||||
Renderer->CalcCamPosVec();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void TPanoramicCamera::MovePhi(float dPhi)
|
|
||||||
{
|
|
||||||
if (dPhi == 0.0f)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//float oldCamPhi = CamPhi;
|
|
||||||
CamPhi += dPhi;
|
|
||||||
|
|
||||||
if (CamPhi > CONST_MAX_CAM_PHI)
|
|
||||||
{
|
|
||||||
CamPhi = CONST_MAX_CAM_PHI;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CamPhi < CONST_MIN_CAM_PHI)
|
|
||||||
{
|
|
||||||
CamPhi = CONST_MIN_CAM_PHI;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Possibly refactor???
|
|
||||||
Renderer->CalcCamPosVec();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void TPanoramicCamera::MoveDist(float dDist)
|
|
||||||
{
|
|
||||||
CamDist += dDist;
|
|
||||||
|
|
||||||
if (CamDist<CONST_MIN_CAM_DIST)
|
|
||||||
{
|
|
||||||
CamDist = CONST_MIN_CAM_DIST;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Possibly refactor???
|
|
||||||
Renderer->CalcCamPosVec();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void TPanoramicCamera::SetAlpha(float alpha)
|
|
||||||
{
|
|
||||||
if (alpha == CamAlpha)
|
|
||||||
return;
|
|
||||||
|
|
||||||
CamAlpha = alpha;
|
|
||||||
|
|
||||||
while (CamAlpha >= 2*pi)
|
|
||||||
{
|
|
||||||
CamAlpha -= 2*pi;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (CamAlpha<0.0f)
|
|
||||||
{
|
|
||||||
CamAlpha += 2*pi;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Possibly refactor???
|
|
||||||
Renderer->CalcCamPosVec();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TPanoramicCamera::MoveForward()
|
|
||||||
{
|
|
||||||
vec3 mov;
|
|
||||||
|
|
||||||
float sina = sinf(CamAlpha);
|
|
||||||
float cosa = cosf(CamAlpha);
|
|
||||||
|
|
||||||
mov.v[0] = sina;
|
|
||||||
mov.v[1] = 0;
|
|
||||||
mov.v[2] = - cosa;
|
|
||||||
|
|
||||||
CamShift = CamShift + mov;
|
|
||||||
|
|
||||||
//Possibly refactor???
|
|
||||||
Renderer->CalcCamPosVec();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TPanoramicCamera::MoveBackward()
|
|
||||||
{
|
|
||||||
vec3 mov;
|
|
||||||
|
|
||||||
float sina = sinf(CamAlpha);
|
|
||||||
float cosa = cosf(CamAlpha);
|
|
||||||
|
|
||||||
mov.v[0] = - sina;
|
|
||||||
mov.v[1] = 0;
|
|
||||||
mov.v[2] = cosa;
|
|
||||||
|
|
||||||
CamShift = CamShift + mov;
|
|
||||||
//Possibly refactor???
|
|
||||||
Renderer->CalcCamPosVec();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void TPanoramicCamera::MoveLeft()
|
|
||||||
{
|
|
||||||
vec3 mov;
|
|
||||||
|
|
||||||
float sina = sinf(CamAlpha);
|
|
||||||
float cosa = cosf(CamAlpha);
|
|
||||||
|
|
||||||
mov.v[0] = - cosa;
|
|
||||||
mov.v[1] = 0;
|
|
||||||
mov.v[2] = - sina;
|
|
||||||
|
|
||||||
CamShift = CamShift + mov;
|
|
||||||
|
|
||||||
//Possibly refactor???
|
|
||||||
Renderer->CalcCamPosVec();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void TPanoramicCamera::MoveRight()
|
|
||||||
{
|
|
||||||
vec3 mov;
|
|
||||||
|
|
||||||
float sina = sinf(CamAlpha);
|
|
||||||
float cosa = cosf(CamAlpha);
|
|
||||||
|
|
||||||
mov.v[0] = cosa;
|
|
||||||
mov.v[1] = 0;
|
|
||||||
mov.v[2] = sina;
|
|
||||||
|
|
||||||
CamShift = CamShift + mov;
|
|
||||||
|
|
||||||
//Possibly refactor???
|
|
||||||
Renderer->CalcCamPosVec();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void TPanoramicCamera::CalcCamVec()
|
|
||||||
{
|
|
||||||
vec3 camPos;
|
|
||||||
vec3 camVec;
|
|
||||||
|
|
||||||
float sina = sinf(CamAlpha);
|
|
||||||
float cosa = cosf(CamAlpha);
|
|
||||||
float sinp = sinf(CamPhi);
|
|
||||||
float cosp = cosf(CamPhi);
|
|
||||||
|
|
||||||
CamVec.v[0] = CamDist * cosp * sina;
|
|
||||||
CamVec.v[1] = - CamDist * sinp;
|
|
||||||
CamVec.v[2] = - CamDist * cosp * cosa;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void TPanoramicCamera::SetCamView()
|
|
||||||
{
|
|
||||||
|
|
||||||
Renderer->LoadIdentity();
|
|
||||||
Renderer->TranslateMatrix(vec3(0.0f, 0.0f, -CamDist));
|
|
||||||
Renderer->RotateMatrix(vec4(1.f * sin(CamPhi/2.f), 0.f, 0.f, 1.f * cos(CamPhi/2.f)));
|
|
||||||
Renderer->RotateMatrix(vec4(0.f, 1.f * sin(CamAlpha/2.f), 0.f, 1.f * cos(CamAlpha/2.f)));
|
|
||||||
Renderer->TranslateMatrix(-CamShift);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void TPitCamera::SetCamView()
|
|
||||||
{
|
|
||||||
Renderer->LoadIdentity();
|
|
||||||
Renderer->RotateMatrix(InverseQuat(CameraQuat));
|
|
||||||
|
|
||||||
Renderer->TranslateMatrix(-CamShift);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TPitCamera::CalcCamVec()
|
|
||||||
{
|
|
||||||
vec3 r = vec3(0,0,-1);
|
|
||||||
|
|
||||||
CamVec = Normalize(CameraQuat * vec4(r) * InverseQuat(CameraQuat));
|
|
||||||
}
|
|
||||||
|
|
||||||
void TPitCamera::RotateByQuat(vec4 quat)
|
|
||||||
{
|
|
||||||
CameraQuat = quat * CameraQuat;
|
|
||||||
//float len = Length(CameraQuat);
|
|
||||||
}
|
|
||||||
|
|
||||||
//============================================
|
//============================================
|
||||||
//============================================
|
//============================================
|
||||||
//============================================
|
//============================================
|
||||||
@ -273,6 +59,11 @@ void TSalmonRendererInterface::SetUniforms()
|
|||||||
|
|
||||||
RenderUniform3fv(CONST_STRING_CAMPOS_UNIFORM, GetCamPos().v);
|
RenderUniform3fv(CONST_STRING_CAMPOS_UNIFORM, GetCamPos().v);
|
||||||
|
|
||||||
|
RenderUniform1f(CONST_STRING_TRANSPARENCY_UNIFORM, 1.f);
|
||||||
|
|
||||||
|
RenderUniform4fv(CONST_STRING_MATERIAL_COLOR_UNIFORM, WhiteColor);
|
||||||
|
|
||||||
|
|
||||||
ResourceManager->LightManager.SetLightUniforms();
|
ResourceManager->LightManager.SetLightUniforms();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,10 +80,6 @@ void TSalmonRendererInterface::InitOpenGL(int screenWidth, int screenHeight, flo
|
|||||||
MatrixWidth = matrixWidth;
|
MatrixWidth = matrixWidth;
|
||||||
MatrixHeight = matrixHeight;
|
MatrixHeight = matrixHeight;
|
||||||
|
|
||||||
SetPerspectiveProjectionMatrix(pi / 6.f, 1.0, 1.0f, 100.0f); //Baad =(
|
|
||||||
|
|
||||||
SetPerspectiveFullScreenViewport();
|
|
||||||
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
#ifdef TARGET_WIN32
|
#ifdef TARGET_WIN32
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
@ -331,14 +118,24 @@ void TSalmonRendererInterface::SetPerspectiveFullScreenViewport()
|
|||||||
SetPerspectiveProjectionMatrix(pi / 6.f, float(MatrixWidth) / float(MatrixHeight), 1.0f, 100.0f);
|
SetPerspectiveProjectionMatrix(pi / 6.f, float(MatrixWidth) / float(MatrixHeight), 1.0f, 100.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TSalmonRendererInterface::SetPerspectiveProjection(float angle, float zNear, float zFar)
|
||||||
|
{
|
||||||
|
SetPerspectiveProjectionMatrix(angle, float(MatrixWidth) / float(MatrixHeight), zNear, zFar);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TSalmonRendererInterface::SetOrthoFullScreenViewport()
|
void TSalmonRendererInterface::SetOrthoFullScreenViewport()
|
||||||
{
|
{
|
||||||
|
|
||||||
glViewport(0, 0, ScreenWidth, ScreenHeight);
|
glViewport(0, 0, ScreenWidth, ScreenHeight);
|
||||||
|
|
||||||
SetProjectionMatrix(static_cast<float>(MatrixWidth), static_cast<float>(MatrixHeight));
|
SetProjectionMatrix(static_cast<float>(MatrixWidth), static_cast<float>(MatrixHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TSalmonRendererInterface::SetOrthoProjection()
|
||||||
|
{
|
||||||
|
SetProjectionMatrix(static_cast<float>(MatrixWidth), static_cast<float>(MatrixHeight));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mat4 TSalmonRendererInterface::GetModelviewMatrix()
|
mat4 TSalmonRendererInterface::GetModelviewMatrix()
|
||||||
{
|
{
|
||||||
@ -394,14 +191,6 @@ void TSalmonRendererInterface::SetGLCamView()
|
|||||||
|
|
||||||
void TSalmonRendererInterface::SetGlIdentityView()
|
void TSalmonRendererInterface::SetGlIdentityView()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
glLoadIdentity();
|
|
||||||
|
|
||||||
glGetFloatv(GL_MODELVIEW_MATRIX,CamModelViewMatrix.m);
|
|
||||||
|
|
||||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);
|
|
||||||
|
|
||||||
RenderUniform3fv(CONST_STRING_CAMPOS_UNIFORM, (float*)ZeroVec3.v);*/
|
|
||||||
|
|
||||||
LoadIdentity();
|
LoadIdentity();
|
||||||
|
|
||||||
@ -413,16 +202,6 @@ void TSalmonRendererInterface::SetGlIdentityView()
|
|||||||
|
|
||||||
void TSalmonRendererInterface::SetGlPosXView()
|
void TSalmonRendererInterface::SetGlPosXView()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
glLoadIdentity();
|
|
||||||
glRotatef ( 90.0, 0.0, 1.0, 0.0 );
|
|
||||||
glRotatef ( 180.0, 1.0, 0.0, 0.0 );
|
|
||||||
glTranslatef(-CamPos.v[0], -CamPos.v[1], -CamPos.v[2]);
|
|
||||||
|
|
||||||
glGetFloatv(GL_MODELVIEW_MATRIX,CamModelViewMatrix.m);
|
|
||||||
|
|
||||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);*/
|
|
||||||
|
|
||||||
LoadIdentity();
|
LoadIdentity();
|
||||||
|
|
||||||
RotateMatrix(vec4(0.f, 1.f * sin(pi / 4.f), 0.f, 1.f * cos(pi / 4.f)));
|
RotateMatrix(vec4(0.f, 1.f * sin(pi / 4.f), 0.f, 1.f * cos(pi / 4.f)));
|
||||||
@ -439,15 +218,6 @@ void TSalmonRendererInterface::SetGlPosXView()
|
|||||||
|
|
||||||
void TSalmonRendererInterface::SetGlNegXView()
|
void TSalmonRendererInterface::SetGlNegXView()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
glLoadIdentity();
|
|
||||||
glRotatef ( -90.0, 0.0, 1.0, 0.0 );
|
|
||||||
glRotatef ( 180.0, 1.0, 0.0, 0.0 );
|
|
||||||
glTranslatef(-CamPos.v[0], -CamPos.v[1], -CamPos.v[2]);
|
|
||||||
|
|
||||||
glGetFloatv(GL_MODELVIEW_MATRIX,CamModelViewMatrix.m);
|
|
||||||
|
|
||||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);*/
|
|
||||||
|
|
||||||
LoadIdentity();
|
LoadIdentity();
|
||||||
|
|
||||||
@ -464,14 +234,6 @@ void TSalmonRendererInterface::SetGlNegXView()
|
|||||||
|
|
||||||
void TSalmonRendererInterface::SetGlPosYView()
|
void TSalmonRendererInterface::SetGlPosYView()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
glLoadIdentity();
|
|
||||||
glRotatef ( -90.0, 1.0, 0.0, 0.0 );
|
|
||||||
glTranslatef(-CamPos.v[0], -CamPos.v[1], -CamPos.v[2]);
|
|
||||||
|
|
||||||
glGetFloatv(GL_MODELVIEW_MATRIX,CamModelViewMatrix.m);
|
|
||||||
|
|
||||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);*/
|
|
||||||
|
|
||||||
LoadIdentity();
|
LoadIdentity();
|
||||||
RotateMatrix(vec4(-1.f * sin(pi / 4.f), 0.f, 0.f, 1.f * cos(pi / 4.f)));
|
RotateMatrix(vec4(-1.f * sin(pi / 4.f), 0.f, 0.f, 1.f * cos(pi / 4.f)));
|
||||||
@ -487,14 +249,6 @@ void TSalmonRendererInterface::SetGlPosYView()
|
|||||||
|
|
||||||
void TSalmonRendererInterface::SetGlNegYView()
|
void TSalmonRendererInterface::SetGlNegYView()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
glLoadIdentity();
|
|
||||||
glRotatef ( 90.0, 1.0, 0.0, 0.0 );
|
|
||||||
glTranslatef(-CamPos.v[0], -CamPos.v[1], -CamPos.v[2]);
|
|
||||||
|
|
||||||
glGetFloatv(GL_MODELVIEW_MATRIX,CamModelViewMatrix.m);
|
|
||||||
|
|
||||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);*/
|
|
||||||
|
|
||||||
LoadIdentity();
|
LoadIdentity();
|
||||||
RotateMatrix(vec4(1.f * sin(pi / 4.f), 0.f, 0.f, 1.f * cos(pi / 4.f)));
|
RotateMatrix(vec4(1.f * sin(pi / 4.f), 0.f, 0.f, 1.f * cos(pi / 4.f)));
|
||||||
@ -509,16 +263,6 @@ void TSalmonRendererInterface::SetGlNegYView()
|
|||||||
|
|
||||||
void TSalmonRendererInterface::SetGlPosZView()
|
void TSalmonRendererInterface::SetGlPosZView()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
glLoadIdentity();
|
|
||||||
glRotatef ( 180.0, 0.0, 1.0, 0.0 );
|
|
||||||
glRotatef ( 180.0, 0.0, 0.0, 1.0 );
|
|
||||||
glTranslatef(-CamPos.v[0], -CamPos.v[1], -CamPos.v[2]);
|
|
||||||
|
|
||||||
glGetFloatv(GL_MODELVIEW_MATRIX,CamModelViewMatrix.m);
|
|
||||||
|
|
||||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);
|
|
||||||
*/
|
|
||||||
|
|
||||||
LoadIdentity();
|
LoadIdentity();
|
||||||
|
|
||||||
@ -535,14 +279,6 @@ void TSalmonRendererInterface::SetGlPosZView()
|
|||||||
|
|
||||||
void TSalmonRendererInterface::SetGlNegZView()
|
void TSalmonRendererInterface::SetGlNegZView()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
glLoadIdentity();
|
|
||||||
glRotatef ( 180.0, 0.0, 0.0, 1.0 );
|
|
||||||
glTranslatef(-CamPos.v[0], -CamPos.v[1], -CamPos.v[2]);
|
|
||||||
|
|
||||||
glGetFloatv(GL_MODELVIEW_MATRIX,CamModelViewMatrix.m);
|
|
||||||
|
|
||||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);*/
|
|
||||||
|
|
||||||
LoadIdentity();
|
LoadIdentity();
|
||||||
|
|
||||||
@ -567,8 +303,6 @@ vec3 TSalmonRendererInterface::GetCamPos()
|
|||||||
void TSalmonRendererInterface::SwitchToScreen()
|
void TSalmonRendererInterface::SwitchToScreen()
|
||||||
{
|
{
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
SetPerspectiveFullScreenViewport();
|
|
||||||
SetGLCamView();
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,7 +317,6 @@ void TSalmonRendererInterface::SwitchToFrameBuffer(const std::string& frameName)
|
|||||||
|
|
||||||
SetFrameViewport(frameName);
|
SetFrameViewport(frameName);
|
||||||
|
|
||||||
SetGLCamView();
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -598,14 +331,6 @@ void TSalmonRendererInterface::SwitchToCubemapBuffer(const std::string& frameNam
|
|||||||
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, Frame.FrameBuffer);
|
glBindFramebuffer(GL_FRAMEBUFFER, Frame.FrameBuffer);
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + cubeSide, Frame.TexID, 0);
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + cubeSide, Frame.TexID, 0);
|
||||||
/*
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glLoadIdentity();
|
|
||||||
gluPerspective(90, 1, 1, 100);
|
|
||||||
glViewport(0, 0, Frame.Width, Frame.Height);
|
|
||||||
glMatrixMode(GL_MODELVIEW);*/
|
|
||||||
|
|
||||||
SetPerspectiveProjectionMatrix(90, 1, 1, 100);
|
|
||||||
|
|
||||||
SetFrameViewport(frameName);
|
SetFrameViewport(frameName);
|
||||||
|
|
||||||
|
@ -44,6 +44,12 @@ void TApplicationAncestor::OuterDraw()
|
|||||||
InnerDraw();
|
InnerDraw();
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
Renderer->SetOrthoProjection();
|
||||||
|
Renderer->LoadIdentity();
|
||||||
|
|
||||||
|
ResourceManager->GUIManager.Draw();
|
||||||
|
|
||||||
Renderer->PushShader("DefaultShader");
|
Renderer->PushShader("DefaultShader");
|
||||||
|
|
||||||
if (IsConsoleOut)
|
if (IsConsoleOut)
|
||||||
@ -59,6 +65,8 @@ void TApplicationAncestor::OuterUpdate(cardinal timer)
|
|||||||
{
|
{
|
||||||
ResourceManager->SoundManager.Update(timer);
|
ResourceManager->SoundManager.Update(timer);
|
||||||
|
|
||||||
|
ResourceManager->GUIManager.Update(timer);
|
||||||
|
|
||||||
InnerUpdate(timer);
|
InnerUpdate(timer);
|
||||||
|
|
||||||
CheckGlError();
|
CheckGlError();
|
||||||
@ -67,19 +75,24 @@ void TApplicationAncestor::OuterUpdate(cardinal timer)
|
|||||||
|
|
||||||
void TApplicationAncestor::OuterOnTapDown(vec2 p)
|
void TApplicationAncestor::OuterOnTapDown(vec2 p)
|
||||||
{
|
{
|
||||||
//ResourceManager->GUIManager.OnMouseDown(p);
|
ResourceManager->GUIManager.OnMouseDown(p);
|
||||||
InnerOnTapDown(p);
|
InnerOnTapDown(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TApplicationAncestor::OuterOnTapUp(vec2 p)
|
void TApplicationAncestor::OuterOnTapUp(vec2 p)
|
||||||
{
|
{
|
||||||
//ResourceManager->GUIManager.OnMouseUp(p);
|
ResourceManager->GUIManager.OnMouseUp(p);
|
||||||
InnerOnTapUp(p);
|
InnerOnTapUp(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TApplicationAncestor::OuterOnTapUpAfterShift(vec2 p)
|
||||||
|
{
|
||||||
|
InnerOnTapUpAfterShift(p);
|
||||||
|
}
|
||||||
|
|
||||||
void TApplicationAncestor::OuterOnMove(vec2 shift)
|
void TApplicationAncestor::OuterOnMove(vec2 shift)
|
||||||
{
|
{
|
||||||
//ResourceManager->GUIManager.OnMove(shift);
|
ResourceManager->GUIManager.OnMove(shift);
|
||||||
InnerOnMove(shift);
|
InnerOnMove(shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,13 +132,23 @@ void DrawScene()
|
|||||||
|
|
||||||
void ProcessTickCount()
|
void ProcessTickCount()
|
||||||
{
|
{
|
||||||
|
//Can't choose witch one is better
|
||||||
|
|
||||||
|
/*
|
||||||
App->UpdateQuick();
|
App->UpdateQuick();
|
||||||
NewTickCount = GetTickCount();
|
NewTickCount = GetTickCount();
|
||||||
if (NewTickCount - LastTickCount > CONST_TIMER_INTERVAL)
|
if (NewTickCount - LastTickCount > CONST_TIMER_INTERVAL)
|
||||||
{
|
{
|
||||||
LastTickCount = NewTickCount;
|
LastTickCount = NewTickCount;
|
||||||
App->OuterUpdate(CONST_TIMER_INTERVAL);
|
App->OuterUpdate(CONST_TIMER_INTERVAL);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
NewTickCount = GetTickCount();
|
||||||
|
if (NewTickCount - LastTickCount > CONST_TIMER_INTERVAL)
|
||||||
|
{
|
||||||
|
App->OuterUpdate(NewTickCount - LastTickCount);
|
||||||
|
LastTickCount = NewTickCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -247,7 +257,11 @@ case WM_MOUSEMOVE:
|
|||||||
mouseState.MiddleButtonPressed = (wParam & MK_MBUTTON);
|
mouseState.MiddleButtonPressed = (wParam & MK_MBUTTON);
|
||||||
mouseState.MiddleButtonPressed = (wParam & MK_RBUTTON);
|
mouseState.MiddleButtonPressed = (wParam & MK_RBUTTON);
|
||||||
|
|
||||||
if (!MouseMoved)
|
if (MouseMoved)
|
||||||
|
{
|
||||||
|
App->OuterOnTapUpAfterShift(vec2(static_cast<float>(mouseState.X), static_cast<float>(App->Height - mouseState.Y)));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
App->OuterOnTapUp(vec2(static_cast<float>(mouseState.X), static_cast<float>(App->Height - mouseState.Y)));
|
App->OuterOnTapUp(vec2(static_cast<float>(mouseState.X), static_cast<float>(App->Height - mouseState.Y)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user