| @@ -10,7 +10,7 @@ liblol_a_SOURCES = \ | |||||
| world.cpp world.h sample.cpp sample.h sampler.cpp sampler.h \ | world.cpp world.h sample.cpp sample.h sampler.cpp sampler.h \ | ||||
| text.cpp text.h emitter.cpp emitter.h numeric.h hash.cpp hash.h \ | text.cpp text.h emitter.cpp emitter.h numeric.h hash.cpp hash.h \ | ||||
| worldentity.cpp worldentity.h gradient.cpp gradient.h \ | worldentity.cpp worldentity.h gradient.cpp gradient.h \ | ||||
| platform.cpp platform.h sprite.cpp sprite.h \ | |||||
| platform.cpp platform.h sprite.cpp sprite.h camera.cpp camera.h \ | |||||
| \ | \ | ||||
| lol/unit.h lol/debug.h \ | lol/unit.h lol/debug.h \ | ||||
| lol/math/vector.h lol/math/half.h lol/math/real.h lol/math/remez.h \ | lol/math/vector.h lol/math/half.h lol/math/real.h lol/math/remez.h \ | ||||
| @@ -0,0 +1,70 @@ | |||||
| // | |||||
| // Lol Engine | |||||
| // | |||||
| // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | |||||
| // modify it under the terms of the Do What The Fuck You Want To | |||||
| // Public License, Version 2, as published by Sam Hocevar. See | |||||
| // http://sam.zoy.org/projects/COPYING.WTFPL for more details. | |||||
| // | |||||
| #if defined HAVE_CONFIG_H | |||||
| # include "config.h" | |||||
| #endif | |||||
| #include <cstring> | |||||
| #include <cstdlib> | |||||
| #include "core.h" | |||||
| #if defined _WIN32 || defined _XBOX | |||||
| # define strcasecmp _stricmp | |||||
| #endif | |||||
| namespace lol | |||||
| { | |||||
| Camera::Camera(vec3 const &position, vec3 const &target, vec3 const &up) | |||||
| : m_target(target), | |||||
| m_up(up) | |||||
| { | |||||
| m_gamegroup = GAMEGROUP_BEFORE; | |||||
| SetPosition(position); | |||||
| } | |||||
| Camera::~Camera() | |||||
| { | |||||
| } | |||||
| void Camera::SetPosition(vec3 const &pos) | |||||
| { | |||||
| m_position = pos; | |||||
| } | |||||
| mat4 const &Camera::GetViewMatrix() | |||||
| { | |||||
| return m_view_matrix; | |||||
| } | |||||
| mat4 const &Camera::GetProjMatrix() | |||||
| { | |||||
| return m_proj_matrix; | |||||
| } | |||||
| void Camera::TickGame(float deltams) | |||||
| { | |||||
| WorldEntity::TickGame(deltams); | |||||
| m_view_matrix = mat4::lookat(m_position, m_target, m_up); | |||||
| m_proj_matrix = mat4::perspective(45.0f, 640.0f, 480.0f, 1.f, 1000.0f); | |||||
| //m_proj_matrix = mat4::ortho(-160, 160, -120, 120, .1f, 2000.0f); | |||||
| } | |||||
| void Camera::TickDraw(float deltams) | |||||
| { | |||||
| WorldEntity::TickDraw(deltams); | |||||
| } | |||||
| } /* namespace lol */ | |||||
| @@ -0,0 +1,49 @@ | |||||
| // | |||||
| // Lol Engine | |||||
| // | |||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | |||||
| // modify it under the terms of the Do What The Fuck You Want To | |||||
| // Public License, Version 2, as published by Sam Hocevar. See | |||||
| // http://sam.zoy.org/projects/COPYING.WTFPL for more details. | |||||
| // | |||||
| // | |||||
| // The Camera class | |||||
| // ---------------- | |||||
| // | |||||
| #if !defined __CAMERA_H__ | |||||
| #define __CAMERA_H__ | |||||
| #include "worldentity.h" | |||||
| namespace lol | |||||
| { | |||||
| class Camera : public WorldEntity | |||||
| { | |||||
| public: | |||||
| Camera(vec3 const &position, vec3 const &target, vec3 const &up); | |||||
| ~Camera(); | |||||
| char const *GetName() { return "<camera>"; } | |||||
| void SetPosition(vec3 const &pos); | |||||
| mat4 const &GetViewMatrix(); | |||||
| mat4 const &GetProjMatrix(); | |||||
| protected: | |||||
| virtual void TickGame(float deltams); | |||||
| virtual void TickDraw(float deltams); | |||||
| private: | |||||
| mat4 m_view_matrix, m_proj_matrix; | |||||
| vec3 m_target, m_up; | |||||
| }; | |||||
| } /* namespace lol */ | |||||
| #endif /* __CAMERA_H__ */ | |||||
| @@ -85,6 +85,7 @@ static inline int isnan(float f) | |||||
| #include "entity.h" | #include "entity.h" | ||||
| #include "worldentity.h" | #include "worldentity.h" | ||||
| #include "camera.h" | |||||
| #include "emitter.h" | #include "emitter.h" | ||||
| #include "font.h" | #include "font.h" | ||||
| #include "gradient.h" | #include "gradient.h" | ||||
| @@ -74,6 +74,7 @@ | |||||
| <ItemGroup> | <ItemGroup> | ||||
| <ClCompile Include="..\src\application\application.cpp" /> | <ClCompile Include="..\src\application\application.cpp" /> | ||||
| <ClCompile Include="..\src\audio.cpp" /> | <ClCompile Include="..\src\audio.cpp" /> | ||||
| <ClCompile Include="..\src\camera.cpp" /> | |||||
| <ClCompile Include="..\src\debug\fps.cpp" /> | <ClCompile Include="..\src\debug\fps.cpp" /> | ||||
| <ClCompile Include="..\src\debug\quad.cpp" /> | <ClCompile Include="..\src\debug\quad.cpp" /> | ||||
| <ClCompile Include="..\src\debug\record.cpp" /> | <ClCompile Include="..\src\debug\record.cpp" /> | ||||
| @@ -128,6 +129,7 @@ | |||||
| <ClInclude Include="..\src\array.h" /> | <ClInclude Include="..\src\array.h" /> | ||||
| <ClInclude Include="..\src\audio.h" /> | <ClInclude Include="..\src\audio.h" /> | ||||
| <ClInclude Include="..\src\bitfield.h" /> | <ClInclude Include="..\src\bitfield.h" /> | ||||
| <ClInclude Include="..\src\camera.h" /> | |||||
| <ClInclude Include="..\src\core.h" /> | <ClInclude Include="..\src\core.h" /> | ||||
| <ClInclude Include="..\src\debug\fps.h" /> | <ClInclude Include="..\src\debug\fps.h" /> | ||||
| <ClInclude Include="..\src\debug\quad.h" /> | <ClInclude Include="..\src\debug\quad.h" /> | ||||
| @@ -185,4 +187,4 @@ | |||||
| <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||||
| <ImportGroup Label="ExtensionTargets"> | <ImportGroup Label="ExtensionTargets"> | ||||
| </ImportGroup> | </ImportGroup> | ||||
| </Project> | |||||
| </Project> | |||||
| @@ -70,6 +70,9 @@ | |||||
| <ClCompile Include="..\src\audio.cpp"> | <ClCompile Include="..\src\audio.cpp"> | ||||
| <Filter>src</Filter> | <Filter>src</Filter> | ||||
| </ClCompile> | </ClCompile> | ||||
| <ClCompile Include="..\src\camera.cpp"> | |||||
| <Filter>src</Filter> | |||||
| </ClCompile> | |||||
| <ClCompile Include="..\src\dict.cpp"> | <ClCompile Include="..\src\dict.cpp"> | ||||
| <Filter>src</Filter> | <Filter>src</Filter> | ||||
| </ClCompile> | </ClCompile> | ||||
| @@ -225,6 +228,9 @@ | |||||
| <ClInclude Include="..\src\bitfield.h"> | <ClInclude Include="..\src\bitfield.h"> | ||||
| <Filter>src</Filter> | <Filter>src</Filter> | ||||
| </ClInclude> | </ClInclude> | ||||
| <ClInclude Include="..\src\camera.h"> | |||||
| <Filter>src</Filter> | |||||
| </ClInclude> | |||||
| <ClInclude Include="..\src\core.h"> | <ClInclude Include="..\src\core.h"> | ||||
| <Filter>src</Filter> | <Filter>src</Filter> | ||||
| </ClInclude> | </ClInclude> | ||||
| @@ -365,4 +371,4 @@ | |||||
| <Filter>src</Filter> | <Filter>src</Filter> | ||||
| </ClInclude> | </ClInclude> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| </Project> | |||||
| </Project> | |||||
| @@ -27,7 +27,6 @@ | |||||
| </ProjectConfiguration> | </ProjectConfiguration> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| <ClInclude Include="..\orbital\camera.h" /> | |||||
| <ClInclude Include="..\orbital\mesh.h" /> | <ClInclude Include="..\orbital\mesh.h" /> | ||||
| <ClInclude Include="..\orbital\orbital.h" /> | <ClInclude Include="..\orbital\orbital.h" /> | ||||
| <ClInclude Include="..\orbital\particlesystem.h" /> | <ClInclude Include="..\orbital\particlesystem.h" /> | ||||
| @@ -58,4 +57,4 @@ | |||||
| <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||||
| <ImportGroup Label="ExtensionTargets"> | <ImportGroup Label="ExtensionTargets"> | ||||
| </ImportGroup> | </ImportGroup> | ||||
| </Project> | |||||
| </Project> | |||||
| @@ -2,7 +2,6 @@ | |||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| <ClInclude Include="..\orbital\mesh.h" /> | <ClInclude Include="..\orbital\mesh.h" /> | ||||
| <ClInclude Include="..\orbital\camera.h" /> | |||||
| </ItemGroup> | </ItemGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| <ClInclude Include="..\orbital\orbital.h" /> | <ClInclude Include="..\orbital\orbital.h" /> | ||||
| @@ -13,4 +12,4 @@ | |||||
| <ItemGroup> | <ItemGroup> | ||||
| <ClCompile Include="..\orbital\orbital.cpp" /> | <ClCompile Include="..\orbital\orbital.cpp" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| </Project> | |||||
| </Project> | |||||