├── doc ├── Add new shader.txt └── How To.txt ├── include ├── glm │ ├── gtx │ │ ├── ocl_type.inl │ │ ├── vec1.inl │ │ ├── simd_vec4.hpp │ │ ├── std_based_type.inl │ │ ├── number_precision.inl │ │ ├── unsigned_int.inl │ │ ├── raw_data.inl │ │ ├── perpendicular.inl │ │ ├── projection.inl │ │ ├── int_10_10_10_2.inl │ │ ├── normal.inl │ │ ├── mixed_product.inl │ │ ├── log_base.inl │ │ ├── noise.inl │ │ ├── handed_coordinate_space.inl │ │ ├── orthonormalize.inl │ │ ├── matrix_cross_product.inl │ │ ├── vector_access.inl │ │ ├── closest_point.inl │ │ ├── polar_coordinates.inl │ │ ├── unsigned_int.hpp │ │ ├── extend.inl │ │ ├── gradient_paint.inl │ │ ├── optimum_pow.inl │ │ ├── vector_angle.inl │ │ └── component_wise.inl │ ├── core │ │ ├── type_half.inl │ │ ├── func_common.hpp │ │ ├── func_common.inl │ │ ├── func_integer.hpp │ │ ├── type_mat.inl │ │ ├── type_vec.inl │ │ ├── intrinsic_exponential.inl │ │ ├── intrinsic_trigonometric.inl │ │ ├── type_vec.hpp │ │ ├── hint.hpp │ │ ├── dummy.cpp │ │ ├── type_size.hpp │ │ ├── _fixes.hpp │ │ ├── intrinsic_trigonometric.hpp │ │ └── intrinsic_vector_relational.hpp │ ├── gtc │ │ └── type_precision.inl │ └── CMakeLists.txt ├── tinyxml │ ├── changes.txt │ ├── tinystr.cpp │ ├── premake4.lua │ └── tinyxmlerror.cpp ├── bullet │ ├── BulletSoftBody │ │ └── btSoftBody.cpp │ ├── BulletCollision │ │ ├── Gimpact │ │ │ ├── btGImpactShape.h │ │ │ ├── btGImpactCollisionAlgorithm.cpp │ │ │ └── gim_geometry.h │ │ ├── BroadphaseCollision │ │ │ ├── btBroadphaseProxy.cpp │ │ │ ├── btDispatcher.cpp │ │ │ ├── btCollisionAlgorithm.cpp │ │ │ ├── btOverlappingPairCallback.h │ │ │ └── btAxisSweep3.cpp │ │ ├── NarrowPhaseCollision │ │ │ ├── btConvexCast.cpp │ │ │ ├── btConvexPenetrationDepthSolver.h │ │ │ ├── btMinkowskiPenetrationDepthSolver.h │ │ │ ├── btGjkEpaPenetrationDepthSolver.h │ │ │ └── btGjkConvexCast.h │ │ ├── CollisionShapes │ │ │ ├── btConcaveShape.cpp │ │ │ ├── btTriangleCallback.cpp │ │ │ ├── btTriangleBuffer.cpp │ │ │ ├── btCollisionMargin.h │ │ │ ├── btMaterial.h │ │ │ ├── btEmptyShape.cpp │ │ │ ├── btBox2dShape.cpp │ │ │ ├── btTriangleCallback.h │ │ │ └── btConvexPolyhedron.h │ │ └── CollisionDispatch │ │ │ ├── btEmptyCollisionAlgorithm.cpp │ │ │ ├── btActivatingCollisionAlgorithm.h │ │ │ ├── btCollisionCreateFunc.h │ │ │ ├── btCollisionConfiguration.h │ │ │ ├── btActivatingCollisionAlgorithm.cpp │ │ │ ├── btInternalEdgeUtility.h │ │ │ └── btBoxBoxDetector.h │ ├── vectormath │ │ └── vmInclude.h │ ├── BulletDynamics │ │ ├── Vehicle │ │ │ ├── btVehicleRaycaster.h │ │ │ └── btWheelInfo.cpp │ │ ├── Dynamics │ │ │ └── btActionInterface.h │ │ └── Character │ │ │ └── btCharacterControllerInterface.h │ └── LinearMath │ │ ├── btDefaultMotionState.h │ │ ├── btRandom.h │ │ ├── btMotionState.h │ │ ├── btMinMax.h │ │ └── btGeometryUtil.h ├── srutil │ └── delegate │ │ ├── delegate.hpp │ │ └── detail │ │ └── make_delegates.pl └── SFML │ ├── Graphics │ ├── BlendMode.hpp │ └── Export.hpp │ ├── Audio │ └── Export.hpp │ ├── System │ ├── Export.hpp │ └── Sleep.hpp │ ├── Window │ └── Export.hpp │ ├── Network │ ├── Export.hpp │ └── SocketHandle.hpp │ ├── Audio.hpp │ ├── Network.hpp │ └── Window.hpp ├── tools ├── build_automator.bat ├── premake4.exe └── README.txt ├── .gitignore ├── data ├── meshes │ ├── quad.obj │ └── cube.obj ├── shaders │ ├── PassthroughFrag.frag │ ├── MotionBlurVert.vert │ ├── ReflectionVert.vert │ ├── ShadowMapVert.vert │ ├── PassthroughVert.vert │ ├── DeferredLightingPassVert.vert │ ├── RefractionVert.vert │ ├── DeferredGeometryPassVert.vert │ └── DeferredGeometryPassFrag.frag └── materials │ ├── cow.xml │ ├── red.xml │ ├── scatter.xml │ ├── reflective.xml │ └── refractive.xml ├── libs ├── SFML_2.0 │ ├── Debug │ │ ├── sfml-main-d.lib │ │ ├── sfml-audio-s-d.lib │ │ ├── sfml-system-s-d.lib │ │ ├── sfml-window-s-d.lib │ │ ├── sfml-graphics-s-d.lib │ │ └── sfml-network-s-d.lib │ └── Release │ │ ├── sfml-main.lib │ │ ├── sfml-audio-s.lib │ │ ├── sfml-system-s.lib │ │ ├── sfml-window-s.lib │ │ ├── sfml-graphics-s.lib │ │ └── sfml-network-s.lib └── bullet_2.79 │ ├── Release │ ├── LinearMath.lib │ ├── BulletCollision.lib │ ├── BulletDynamics.lib │ └── BulletSoftBody.lib │ └── Debug │ ├── LinearMath_Debug.lib │ ├── BulletCollision_Debug.lib │ ├── BulletDynamics_Debug.lib │ └── BulletSoftBody_Debug.lib ├── src ├── OpenGL │ ├── GLTexture.h │ ├── GLUniformBlock.h │ ├── GLView.h │ ├── GLState.h │ ├── Programs │ │ ├── GLProgram_Passthrough.h │ │ ├── GLProgram.cpp │ │ ├── GLProgram.h │ │ ├── GLProgramDatabase.h │ │ ├── GLProgram_Reflection.h │ │ ├── GLProgram_MotionBlur.h │ │ └── GLProgram_ShadowMap.h │ ├── GLMeshData.h │ ├── GLUniformBlockHelper.h │ ├── GLMesh.h │ ├── GLUniformBlock.cpp │ └── FrameBuffers │ │ └── GLFramebuffer_DepthBuffer.h ├── Utils │ ├── BoundingBox.h │ ├── Singleton.h │ ├── Factory.h │ ├── Ray.h │ ├── Database.h │ └── IntersectionAlgorithms.h ├── Physics │ ├── PhysicsUtils.h │ ├── PhysicsWorld.h │ ├── PhysicsUtils.cpp │ └── PhysicsWorld.cpp ├── GlobalPaths.h ├── Objects │ ├── ExampleObject.h │ ├── Lights │ │ ├── ShadowLight.h │ │ ├── ShadowLight.cpp │ │ └── Light.h │ ├── ExampleObject.cpp │ ├── Cameras │ │ ├── Camera1stPerson.h │ │ ├── Camera3rdPerson.h │ │ └── Camera.cpp │ └── RenderObject.h ├── WorldDatabase.h ├── MeshDatabase.h ├── MaterialDatabase.h ├── Material.h ├── GlobalPaths.cpp ├── SFMLCore.h ├── main.cpp ├── MeshDatabase.cpp ├── World.h ├── WorldDatabase.cpp ├── MaterialDatabase.cpp └── SFMLCore.cpp └── README.txt /doc/Add new shader.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /include/glm/gtx/ocl_type.inl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /include/glm/gtx/vec1.inl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tools/build_automator.bat: -------------------------------------------------------------------------------- 1 | "premake4.exe" --platform=x32 --os=windows vs2010 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #OS junk files 2 | [Tt]humbs.db 3 | *.DS_Store 4 | 5 | [Bb]uild/ 6 | *~* 7 | -------------------------------------------------------------------------------- /data/meshes/quad.obj: -------------------------------------------------------------------------------- 1 | v -1 1 0 2 | v 1 1 0 3 | v -1 -1 0 4 | v 1 -1 0 5 | f 4 1 3 6 | f 2 1 4 7 | -------------------------------------------------------------------------------- /tools/premake4.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/tools/premake4.exe -------------------------------------------------------------------------------- /include/glm/gtx/simd_vec4.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/include/glm/gtx/simd_vec4.hpp -------------------------------------------------------------------------------- /include/tinyxml/changes.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/include/tinyxml/changes.txt -------------------------------------------------------------------------------- /include/tinyxml/tinystr.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/include/tinyxml/tinystr.cpp -------------------------------------------------------------------------------- /include/glm/core/type_half.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/include/glm/core/type_half.inl -------------------------------------------------------------------------------- /include/glm/core/func_common.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/include/glm/core/func_common.hpp -------------------------------------------------------------------------------- /include/glm/core/func_common.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/include/glm/core/func_common.inl -------------------------------------------------------------------------------- /include/glm/core/func_integer.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/include/glm/core/func_integer.hpp -------------------------------------------------------------------------------- /libs/SFML_2.0/Debug/sfml-main-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/SFML_2.0/Debug/sfml-main-d.lib -------------------------------------------------------------------------------- /libs/SFML_2.0/Release/sfml-main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/SFML_2.0/Release/sfml-main.lib -------------------------------------------------------------------------------- /libs/SFML_2.0/Debug/sfml-audio-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/SFML_2.0/Debug/sfml-audio-s-d.lib -------------------------------------------------------------------------------- /libs/SFML_2.0/Debug/sfml-system-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/SFML_2.0/Debug/sfml-system-s-d.lib -------------------------------------------------------------------------------- /libs/SFML_2.0/Debug/sfml-window-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/SFML_2.0/Debug/sfml-window-s-d.lib -------------------------------------------------------------------------------- /libs/SFML_2.0/Release/sfml-audio-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/SFML_2.0/Release/sfml-audio-s.lib -------------------------------------------------------------------------------- /libs/SFML_2.0/Release/sfml-system-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/SFML_2.0/Release/sfml-system-s.lib -------------------------------------------------------------------------------- /libs/SFML_2.0/Release/sfml-window-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/SFML_2.0/Release/sfml-window-s.lib -------------------------------------------------------------------------------- /libs/bullet_2.79/Release/LinearMath.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/bullet_2.79/Release/LinearMath.lib -------------------------------------------------------------------------------- /libs/SFML_2.0/Debug/sfml-graphics-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/SFML_2.0/Debug/sfml-graphics-s-d.lib -------------------------------------------------------------------------------- /libs/SFML_2.0/Debug/sfml-network-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/SFML_2.0/Debug/sfml-network-s-d.lib -------------------------------------------------------------------------------- /libs/SFML_2.0/Release/sfml-graphics-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/SFML_2.0/Release/sfml-graphics-s.lib -------------------------------------------------------------------------------- /libs/SFML_2.0/Release/sfml-network-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/SFML_2.0/Release/sfml-network-s.lib -------------------------------------------------------------------------------- /include/bullet/BulletSoftBody/btSoftBody.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/include/bullet/BulletSoftBody/btSoftBody.cpp -------------------------------------------------------------------------------- /libs/bullet_2.79/Debug/LinearMath_Debug.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/bullet_2.79/Debug/LinearMath_Debug.lib -------------------------------------------------------------------------------- /libs/bullet_2.79/Release/BulletCollision.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/bullet_2.79/Release/BulletCollision.lib -------------------------------------------------------------------------------- /libs/bullet_2.79/Release/BulletDynamics.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/bullet_2.79/Release/BulletDynamics.lib -------------------------------------------------------------------------------- /libs/bullet_2.79/Release/BulletSoftBody.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/bullet_2.79/Release/BulletSoftBody.lib -------------------------------------------------------------------------------- /libs/bullet_2.79/Debug/BulletCollision_Debug.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/bullet_2.79/Debug/BulletCollision_Debug.lib -------------------------------------------------------------------------------- /libs/bullet_2.79/Debug/BulletDynamics_Debug.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/bullet_2.79/Debug/BulletDynamics_Debug.lib -------------------------------------------------------------------------------- /libs/bullet_2.79/Debug/BulletSoftBody_Debug.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/libs/bullet_2.79/Debug/BulletSoftBody_Debug.lib -------------------------------------------------------------------------------- /include/bullet/BulletCollision/Gimpact/btGImpactShape.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/include/bullet/BulletCollision/Gimpact/btGImpactShape.h -------------------------------------------------------------------------------- /data/shaders/PassthroughFrag.frag: -------------------------------------------------------------------------------- 1 | #version 330 2 | layout(std140) uniform; 3 | 4 | //Output 5 | out vec4 outputColor; 6 | 7 | //Main 8 | void main() 9 | { 10 | outputColor = vec4(0,0,0,1); 11 | } 12 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IanLilleyT/Real-Time-Reflections-OpenGL/HEAD/include/bullet/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp -------------------------------------------------------------------------------- /data/shaders/MotionBlurVert.vert: -------------------------------------------------------------------------------- 1 | #version 330 2 | layout(std140) uniform; 3 | 4 | //Input 5 | layout(location = 0) in vec3 position; 6 | 7 | //Main 8 | void main() 9 | { 10 | gl_Position = vec4(position,1.0); 11 | } 12 | -------------------------------------------------------------------------------- /data/shaders/ReflectionVert.vert: -------------------------------------------------------------------------------- 1 | #version 330 2 | layout(std140) uniform; 3 | 4 | //Input 5 | layout(location = 0) in vec3 position; 6 | 7 | //Main 8 | void main() 9 | { 10 | gl_Position = vec4(position,1.0); 11 | } 12 | -------------------------------------------------------------------------------- /data/shaders/ShadowMapVert.vert: -------------------------------------------------------------------------------- 1 | #version 330 2 | layout(std140) uniform; 3 | 4 | //Input 5 | layout(location = 0) in vec3 position; 6 | 7 | //Main 8 | void main() 9 | { 10 | gl_Position = vec4(position,1.0); 11 | } 12 | -------------------------------------------------------------------------------- /data/materials/cow.xml: -------------------------------------------------------------------------------- 1 | 2 | blue 3 | 0 0 1 1 4 | 1 1 1 1 5 | .1 6 | 1 7 | -------------------------------------------------------------------------------- /data/materials/red.xml: -------------------------------------------------------------------------------- 1 | 2 | red 3 | 1 0 0 1 4 | 1 1 1 1 5 | .3 6 | 0 7 | -------------------------------------------------------------------------------- /src/OpenGL/GLTexture.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | #include //For GL commands 4 | 5 | class GLTexture 6 | { 7 | public: 8 | GLTexture(); 9 | ~GLTexture(); 10 | private: 11 | GLuint textureObject; 12 | GLenum textureUnit; 13 | 14 | }*/ -------------------------------------------------------------------------------- /doc/How To.txt: -------------------------------------------------------------------------------- 1 | How to create a new shader: 2 | 3 | 1) Create NameFrag.frag and NameVert.vert 4 | 2) Add GLProgram_Name.h to "Programs" folder 5 | 3) Add code (base off another shader file) 6 | 4) Register in ClassRegister 7 | 8 | How to create a new Object class: 9 | -------------------------------------------------------------------------------- /data/materials/scatter.xml: -------------------------------------------------------------------------------- 1 | 2 | blue 3 | 0 0 1 1 4 | 1 1 1 1 5 | .05 6 | .5 7 | 1 8 | -------------------------------------------------------------------------------- /data/materials/reflective.xml: -------------------------------------------------------------------------------- 1 | 2 | blue 3 | 0 0 1 1 4 | 1 1 1 1 5 | .3 6 | .5 7 | 1 8 | -------------------------------------------------------------------------------- /data/materials/refractive.xml: -------------------------------------------------------------------------------- 1 | 2 | blue 3 | 1 0 0 1 4 | 1 1 1 1 5 | .1 6 | 0 7 | 0 8 | 1 9 | 1.2 10 | -------------------------------------------------------------------------------- /src/Utils/BoundingBox.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include //For math 6 | 7 | class BoundingBox 8 | { 9 | public: 10 | BoundingBox(glm::vec3 min, glm::vec3 max) 11 | { 12 | this->min = min; 13 | this->max = max; 14 | } 15 | BoundingBox(){} 16 | ~BoundingBox(){} 17 | 18 | glm::vec3 min; 19 | glm::vec3 max; 20 | }; -------------------------------------------------------------------------------- /src/Physics/PhysicsUtils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | class PhysicsUtils 8 | { 9 | public: 10 | static glm::mat4 convertBulletTransformToGLM(btTransform& transform); 11 | static btTransform convertGLMTransformToBullet(glm::mat4 transform); 12 | 13 | static btVector3 convertGLMVectorToBullet(glm::vec3 vector); 14 | static glm::vec3 convertBulletVectorToGLM(btVector3& vector); 15 | }; -------------------------------------------------------------------------------- /data/shaders/PassthroughVert.vert: -------------------------------------------------------------------------------- 1 | #version 330 2 | layout(std140) uniform; 3 | 4 | //Input 5 | layout(location = 0) in vec3 position; 6 | 7 | //Uniforms 8 | uniform mat4 modelToCameraMatrix; 9 | 10 | //Projection matrix 11 | uniform ProjectionBlock 12 | { 13 | mat4 cameraToClipMatrix; 14 | float zNear; 15 | float zFar; 16 | float screenWidth; 17 | float screenHeight; 18 | }; 19 | 20 | //Main 21 | void main() 22 | { 23 | gl_Position = cameraToClipMatrix * modelToCameraMatrix * vec4(position,1.0); 24 | } 25 | -------------------------------------------------------------------------------- /data/shaders/DeferredLightingPassVert.vert: -------------------------------------------------------------------------------- 1 | #version 330 2 | layout(std140) uniform; 3 | 4 | //Input 5 | layout(location = 0) in vec3 position; 6 | 7 | //Uniforms 8 | uniform mat4 modelToCameraMatrix; 9 | 10 | //Projection matrix 11 | uniform ProjectionBlock 12 | { 13 | mat4 cameraToClipMatrix; 14 | float zNear; 15 | float zFar; 16 | float screenWidth; 17 | float screenHeight; 18 | }; 19 | 20 | //Main 21 | void main() 22 | { 23 | gl_Position = /*cameraToClipMatrix * modelToCameraMatrix * */vec4(position,1.0); 24 | } 25 | -------------------------------------------------------------------------------- /src/GlobalPaths.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For storing paths 4 | 5 | class GlobalPaths 6 | { 7 | public: 8 | GlobalPaths(); 9 | ~GlobalPaths(); 10 | 11 | void setDataPath(std::string path); 12 | std::string getDataPath(); 13 | std::string getShaderPath(); 14 | std::string getMeshPath(); 15 | std::string getWorldPath(); 16 | std::string getMaterialPath(); 17 | 18 | private: 19 | std::string dataPath; 20 | std::string shaderPath; 21 | std::string meshPath; 22 | std::string worldPath; 23 | std::string materialPath; 24 | }; -------------------------------------------------------------------------------- /src/Objects/ExampleObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Object.h" //Superclass 4 | 5 | class ExampleObject: public Object 6 | { 7 | public: 8 | //Class 9 | static std::string className; 10 | 11 | //Construct/Destruct 12 | ExampleObject(); 13 | virtual ~ExampleObject(); 14 | 15 | //Initialize 16 | virtual void initialize(TiXmlElement* element); 17 | void initialize(std::string name, int value); 18 | 19 | //Type 20 | virtual std::string getClassname(); 21 | 22 | protected: 23 | void initialize(int value); 24 | 25 | int value; 26 | }; -------------------------------------------------------------------------------- /include/glm/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-06-08 5 | // Updated : 2008-06-08 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/std_based_type.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /include/glm/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-05-10 5 | // Updated : 2007-05-10 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/number_precision.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /include/glm/gtx/unsigned_int.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-24 5 | // Updated : 2008-10-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/unsigned_int.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | }//namespace glm 14 | -------------------------------------------------------------------------------- /src/Utils/Singleton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //Ensures that only one instance is present 4 | #include 5 | 6 | template 7 | class Singleton 8 | { 9 | public: 10 | static T* Instance() 11 | { 12 | if(!m_pInstance) m_pInstance = new T; 13 | assert(m_pInstance !=0); 14 | return m_pInstance; 15 | } 16 | protected: 17 | Singleton(); 18 | ~Singleton(); 19 | private: 20 | Singleton(Singleton const&); 21 | Singleton& operator=(Singleton const&); 22 | static T* m_pInstance; 23 | }; 24 | 25 | template T* Singleton::m_pInstance=0; 26 | -------------------------------------------------------------------------------- /src/WorldDatabase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For names 4 | #include //For storing worlds 5 | 6 | #include "World.h" //For storing worlds 7 | #include "GlobalPaths.h" //For getting worlds path 8 | #include "Utils/Singleton.h" //For using global classes 9 | 10 | class WorldDatabase 11 | { 12 | public: 13 | WorldDatabase(); 14 | ~WorldDatabase(); 15 | 16 | World* loadWorld(std::string worldFileName); 17 | 18 | static std::string NONE; 19 | 20 | private: 21 | World* findWorld(std::string worldFileName); 22 | World* openWorldFile(std::string worldFileName); 23 | std::map worldMap; 24 | }; -------------------------------------------------------------------------------- /include/tinyxml/premake4.lua: -------------------------------------------------------------------------------- 1 | 2 | solution "tinyxml_pm" 3 | configurations {"Debug", "Release"} 4 | defines {"_CRT_SECURE_NO_WARNINGS", "_SCL_SECURE_NO_WARNINGS", "WIN32", "TIXML_USE_STL"} 5 | 6 | project "tinyxml_pm" 7 | kind "StaticLib" 8 | language "c++" 9 | targetdir "lib" 10 | 11 | files 12 | { 13 | "tinyxml.cpp", 14 | "tinyxmlerror.cpp", 15 | "tinyxmlparser.cpp", 16 | "tinystr.cpp", 17 | } 18 | 19 | configuration "Debug" 20 | defines {"DEBUG", "_DEBUG"} 21 | flags "Symbols" 22 | targetname "tinyxml_pmD" 23 | 24 | configuration "Release" 25 | defines {"NDEBUG", "RELEASE"}; 26 | targetname "tinyxml_pm" 27 | -------------------------------------------------------------------------------- /src/MeshDatabase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For names 4 | #include //For storing meshes 5 | 6 | #include "OpenGL/GLMesh.h" //For storing meshes 7 | #include "GlobalPaths.h" //For getting mesh path 8 | #include "Utils/Singleton.h" //For using global classes 9 | 10 | class MeshDatabase 11 | { 12 | public: 13 | MeshDatabase(); 14 | virtual ~MeshDatabase(); 15 | 16 | GLMeshData* loadMesh(std::string meshName); 17 | 18 | static std::string NONE; 19 | 20 | private: 21 | GLMeshData* findMesh(std::string meshName); 22 | GLMeshData* openMeshFile(std::string meshName); 23 | std::map meshMap; 24 | }; -------------------------------------------------------------------------------- /src/Utils/Factory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | template void* constructor() { return (void*)new T(); } 7 | 8 | class Factory 9 | { 10 | public: 11 | Factory(){} 12 | ~Factory(){} 13 | 14 | typedef void*(*constructor_t)(); 15 | typedef std::map map_type; 16 | map_type m_classes; 17 | 18 | template 19 | void register_class(std::string const& n) 20 | { 21 | m_classes[n] = &constructor; 22 | } 23 | 24 | void* construct(std::string const& n) 25 | { 26 | map_type::iterator i = m_classes.find(n); 27 | if (i == m_classes.end()) return 0; 28 | return i->second(); 29 | } 30 | }; -------------------------------------------------------------------------------- /src/MaterialDatabase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For names 4 | #include //For storing materials 5 | 6 | #include "Material.h" //For storing materials 7 | #include "GlobalPaths.h" //For getting material path 8 | #include "Utils/Singleton.h" //For using global classes 9 | 10 | class MaterialDatabase 11 | { 12 | public: 13 | MaterialDatabase(); 14 | ~MaterialDatabase(); 15 | 16 | Material* loadMaterial(std::string materialFileName); 17 | 18 | static std::string NONE; 19 | 20 | private: 21 | Material* findMaterial(std::string materialFileName); 22 | Material* openMaterialFile(std::string materialFileName); 23 | std::map materialMap; 24 | }; -------------------------------------------------------------------------------- /include/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-11-19 5 | // Updated : 2008-11-19 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/raw_data.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | // Dependency: 10 | // - GLM core 11 | /////////////////////////////////////////////////////////////////////////////////////////////////// 12 | -------------------------------------------------------------------------------- /include/srutil/delegate/delegate.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | (c) Sergey Ryazanov (http://home.onego.ru/~ryazanov) 3 | 4 | Fast delegate compatible with C++ Standard. 5 | */ 6 | #ifndef SRUTIL_DELEGATE_INCLUDED 7 | #define SRUTIL_DELEGATE_INCLUDED 8 | 9 | namespace srutil 10 | { 11 | #ifdef SRUTIL_DELEGATE_PREFERRED_SYNTAX 12 | template class delegate; 13 | template class delegate_invoker; 14 | #endif 15 | } 16 | 17 | #ifdef _MSC_VER 18 | #define SRUTIL_DELEGATE_CALLTYPE __fastcall 19 | #else 20 | #define SRUTIL_DELEGATE_CALLTYPE 21 | #endif 22 | 23 | #include "detail/delegate_list.hpp" 24 | 25 | #undef SRUTIL_DELEGATE_CALLTYPE 26 | 27 | #endif//SRUTIL_DELEGATE_INCLUDED 28 | -------------------------------------------------------------------------------- /src/Physics/PhysicsWorld.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "PhysicsObject.h" 9 | #include "../Utils/Utils.h" 10 | 11 | class PhysicsWorld 12 | { 13 | public: 14 | PhysicsWorld(); 15 | ~PhysicsWorld(); 16 | 17 | void addObject(PhysicsObject* object); 18 | void update(); 19 | std::vector& getObjects(); 20 | 21 | btDefaultCollisionConfiguration* collisionConfiguration; 22 | btDynamicsWorld* dynamicsWorld; 23 | btBroadphaseInterface* broadphase; 24 | btCollisionDispatcher* dispatcher; 25 | btConstraintSolver* solver; 26 | 27 | private: 28 | std::vector objects; 29 | }; -------------------------------------------------------------------------------- /src/Material.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For math 4 | 5 | #include //For parsing material file 6 | 7 | #include "Utils/Utils.h" //For parsing glm types 8 | 9 | class Material 10 | { 11 | public: 12 | //Construct/Destruct 13 | Material(); 14 | ~Material(); 15 | 16 | //Initialize 17 | void initialize(TiXmlElement* element); 18 | 19 | //Name 20 | void setName(std::string name); 21 | std::string getName(); 22 | 23 | //Public variables 24 | glm::vec4 diffuseColor; 25 | glm::vec4 specularColor; 26 | float specularShininess; 27 | float roughness; 28 | float reflectivity; 29 | float refractivity; 30 | float refractiveIndex; 31 | float transparency; 32 | 33 | private: 34 | std::string name; 35 | }; 36 | -------------------------------------------------------------------------------- /src/OpenGL/GLUniformBlock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For names 4 | 5 | #include //For math 6 | #include //For OpenGL commands 7 | 8 | class GLUniformBlock 9 | { 10 | public: 11 | GLUniformBlock(); 12 | ~GLUniformBlock(); 13 | 14 | //Other 15 | void createUBO(); 16 | void bindToProgram(GLuint program); 17 | 18 | //Setters 19 | void setUBO(GLuint ubo); 20 | void setName(std::string name); 21 | void setBindingIndex(int index); 22 | void setData(void* data); 23 | void setSize(int size); 24 | 25 | //Getters 26 | GLuint getUBO(); 27 | std::string getName(); 28 | int getBindingIndex(); 29 | int getSize(); 30 | 31 | private: 32 | GLuint ubo; 33 | std::string name; 34 | int bindingIndex; 35 | int size; 36 | }; -------------------------------------------------------------------------------- /src/Physics/PhysicsUtils.cpp: -------------------------------------------------------------------------------- 1 | #include "PhysicsUtils.h" 2 | 3 | glm::mat4 PhysicsUtils::convertBulletTransformToGLM(btTransform& transform) 4 | { 5 | float data[16]; 6 | transform.getOpenGLMatrix(data); 7 | return glm::make_mat4(data); 8 | } 9 | btTransform PhysicsUtils::convertGLMTransformToBullet(glm::mat4 transform) 10 | { 11 | const float* data = glm::value_ptr(transform); 12 | btTransform bulletTransform; 13 | bulletTransform.setFromOpenGLMatrix(data); 14 | return bulletTransform; 15 | } 16 | btVector3 PhysicsUtils::convertGLMVectorToBullet(glm::vec3 vector) 17 | { 18 | return btVector3(vector.x,vector.y,vector.z); 19 | } 20 | glm::vec3 PhysicsUtils::convertBulletVectorToGLM(btVector3& vector) 21 | { 22 | return glm::vec3(vector.getX(),vector.getY(),vector.getZ()); 23 | } -------------------------------------------------------------------------------- /src/OpenGL/GLView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For math 4 | #include //For OpenGL commans 5 | 6 | #include "GLState.h" //For setting matrices 7 | #include "../Utils/Ray.h" //For picking 8 | #include "../Utils/Singleton.h" //For accessing GLState 9 | 10 | class GLView 11 | { 12 | public: 13 | GLView(); 14 | ~GLView(); 15 | 16 | void calcCameraToClipMatrix(float viewAngle, float frustumNear, float frustumFar); 17 | 18 | Ray getPickingRay(int x, int y); 19 | void setWindowDimensions(int w, int h); 20 | glm::ivec2 getWindowDimensions(); 21 | 22 | float getViewAngle(); 23 | float getFrustumNear(); 24 | float getFrustumFar(); 25 | 26 | private: 27 | 28 | float viewAngle; 29 | float frustumScale; 30 | float frustumNear; 31 | float frustumFar; 32 | }; -------------------------------------------------------------------------------- /src/Objects/Lights/ShadowLight.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Light.h" //Superclass 4 | #include "../Cameras/Camera3rdPerson.h" 5 | #include "../../OpenGL/GLState.h" 6 | #include "../../OpenGL/GLView.h" 7 | 8 | class ShadowLight: public Light 9 | { 10 | public: 11 | //Class 12 | static std::string className; 13 | 14 | //Construct/Destruct 15 | ShadowLight(); 16 | virtual ~ShadowLight(); 17 | 18 | //Initialize 19 | virtual void initialize(TiXmlElement* element); 20 | void initialize(std::string name, glm::vec4 color, float intensity); 21 | 22 | //Type 23 | virtual std::string getClassname(); 24 | 25 | glm::mat4 getWorldToCameraMatrix(); 26 | 27 | Camera3rdPerson* lightCamera; 28 | 29 | private: 30 | void initialize(); 31 | 32 | virtual void updateTransformationMatrix(); 33 | }; -------------------------------------------------------------------------------- /include/glm/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-03-06 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/perpendicular.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER vecType perp 14 | ( 15 | vecType const & x, 16 | vecType const & Normal 17 | ) 18 | { 19 | return x - proj(x, Normal); 20 | } 21 | }//namespace glm 22 | -------------------------------------------------------------------------------- /data/shaders/RefractionVert.vert: -------------------------------------------------------------------------------- 1 | #version 330 2 | layout(std140) uniform; 3 | 4 | //Input 5 | layout(location = 0) in vec3 position; 6 | layout(location = 1) in vec3 normal; 7 | 8 | //Output 9 | out vec3 cameraSpaceNormal; 10 | out vec3 cameraSpacePosition; 11 | 12 | //Uniforms 13 | uniform mat4 modelToCameraMatrix; 14 | uniform mat3 normalModelToCameraMatrix; 15 | 16 | //Projection matrix 17 | uniform ProjectionBlock 18 | { 19 | mat4 cameraToClipMatrix; 20 | float zNear; 21 | float zFar; 22 | float screenWidth; 23 | float screenHeight; 24 | }; 25 | 26 | //Main 27 | void main() 28 | { 29 | cameraSpaceNormal = vec3(normalize(normalModelToCameraMatrix * normal)); 30 | cameraSpacePosition = vec3(modelToCameraMatrix * vec4(position, 1.0)); 31 | gl_Position = cameraToClipMatrix * vec4(cameraSpacePosition,1.0); 32 | } 33 | -------------------------------------------------------------------------------- /data/shaders/DeferredGeometryPassVert.vert: -------------------------------------------------------------------------------- 1 | #version 330 2 | layout(std140) uniform; 3 | 4 | //Input 5 | layout(location = 0) in vec3 position; 6 | layout(location = 1) in vec3 normal; 7 | 8 | //Output 9 | out vec3 cameraSpaceNormal; 10 | out vec3 cameraSpacePosition; 11 | 12 | //Uniforms 13 | uniform mat4 modelToCameraMatrix; 14 | uniform mat3 normalModelToCameraMatrix; 15 | 16 | //Projection matrix 17 | uniform ProjectionBlock 18 | { 19 | mat4 cameraToClipMatrix; 20 | float zNear; 21 | float zFar; 22 | float screenWidth; 23 | float screenHeight; 24 | }; 25 | 26 | //Main 27 | void main() 28 | { 29 | cameraSpaceNormal = vec3(normalize(normalModelToCameraMatrix * normal)); 30 | cameraSpacePosition = vec3(modelToCameraMatrix * vec4(position, 1.0)); 31 | gl_Position = cameraToClipMatrix * vec4(cameraSpacePosition,1.0); 32 | } 33 | -------------------------------------------------------------------------------- /src/GlobalPaths.cpp: -------------------------------------------------------------------------------- 1 | #include "GlobalPaths.h" 2 | 3 | GlobalPaths::GlobalPaths(){} 4 | GlobalPaths::~GlobalPaths(){} 5 | 6 | void GlobalPaths::setDataPath(std::string path) 7 | { 8 | this->dataPath = path; 9 | this->shaderPath = dataPath + "shaders/"; 10 | this->meshPath = dataPath + "meshes/"; 11 | this->worldPath = dataPath + "worlds/"; 12 | this->materialPath = dataPath + "materials/"; 13 | } 14 | std::string GlobalPaths::getDataPath() 15 | { 16 | return this->dataPath; 17 | } 18 | std::string GlobalPaths::getShaderPath() 19 | { 20 | return this->shaderPath; 21 | } 22 | std::string GlobalPaths::getMeshPath() 23 | { 24 | return this->meshPath; 25 | } 26 | std::string GlobalPaths::getWorldPath() 27 | { 28 | return this->worldPath; 29 | } 30 | std::string GlobalPaths::getMaterialPath() 31 | { 32 | return this->materialPath; 33 | } -------------------------------------------------------------------------------- /include/bullet/vectormath/vmInclude.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __VM_INCLUDE_H 3 | #define __VM_INCLUDE_H 4 | 5 | #include "LinearMath/btScalar.h" 6 | 7 | #if defined (USE_SYSTEM_VECTORMATH) || defined (__CELLOS_LV2__) 8 | #include 9 | #else //(USE_SYSTEM_VECTORMATH) 10 | #if defined (BT_USE_SSE) && defined (_WIN32) 11 | #include "sse/vectormath_aos.h" 12 | #else //all other platforms 13 | #include "scalar/vectormath_aos.h" 14 | #endif //(BT_USE_SSE) && defined (_WIN32) 15 | #endif //(USE_SYSTEM_VECTORMATH) 16 | 17 | 18 | 19 | typedef Vectormath::Aos::Vector3 vmVector3; 20 | typedef Vectormath::Aos::Quat vmQuat; 21 | typedef Vectormath::Aos::Matrix3 vmMatrix3; 22 | typedef Vectormath::Aos::Transform3 vmTransform3; 23 | typedef Vectormath::Aos::Point3 vmPoint3; 24 | 25 | #endif //__VM_INCLUDE_H 26 | 27 | 28 | -------------------------------------------------------------------------------- /include/glm/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-03-06 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/projection.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER vecType proj 14 | ( 15 | vecType const & x, 16 | vecType const & Normal 17 | ) 18 | { 19 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; 20 | } 21 | }//namespace glm 22 | -------------------------------------------------------------------------------- /include/glm/gtx/int_10_10_10_2.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2010-07-07 5 | // Updated : 2010-07-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/int_10_10_10_2.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | GLM_FUNC_QUALIFIER dword uint10_10_10_2_cast 13 | ( 14 | glm::vec4 const & v 15 | ) 16 | { 17 | return dword(uint(v.x * 2047.f) << 0 | uint(v.y * 2047.f) << 10 | uint(v.z * 2047.f) << 20 | uint(v.w * 3.f) << 30); 18 | } 19 | }//namespace glm 20 | -------------------------------------------------------------------------------- /include/glm/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2011-06-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/normal.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 triangleNormal 14 | ( 15 | detail::tvec3 const & p1, 16 | detail::tvec3 const & p2, 17 | detail::tvec3 const & p3 18 | ) 19 | { 20 | return normalize(cross(p1 - p2, p1 - p3)); 21 | } 22 | }//namespace glm 23 | -------------------------------------------------------------------------------- /include/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-04-03 5 | // Updated : 2008-09-17 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/mixed_product.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER valType mixedProduct 14 | ( 15 | detail::tvec3 const & v1, 16 | detail::tvec3 const & v2, 17 | detail::tvec3 const & v3 18 | ) 19 | { 20 | return dot(cross(v1, v2), v3); 21 | } 22 | }//namespace glm 23 | -------------------------------------------------------------------------------- /src/OpenGL/GLState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include //For loading in matrices 6 | 7 | #include "../Material.h" 8 | 9 | class GLState 10 | { 11 | public: 12 | GLState(){} 13 | ~GLState(){} 14 | glm::mat4 modelToWorldMatrix; 15 | glm::mat4 worldToCameraMatrix; 16 | glm::mat4 oldWorldToCameraMatrix; 17 | glm::mat4 cameraToClipMatrix; 18 | 19 | Material* material; 20 | std::string globalProgramName; 21 | 22 | int positionTextureUnit; 23 | int normalTextureUnit; 24 | int diffuseColorTextureUnit; 25 | int specularColorTextureUnit; 26 | int otherTextureUnit; 27 | int depthTextureUnit; 28 | int colorBufferTextureUnit; 29 | int shadowMapTextureUnit; 30 | 31 | glm::vec3 lightCameraSpacePosition; 32 | glm::vec3 lightColor; 33 | float lightIntensity; 34 | glm::mat4 lightWorldToCameraMatrix; 35 | 36 | float refractivity; 37 | float refractiveIndex; 38 | 39 | float fps; 40 | }; -------------------------------------------------------------------------------- /include/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-10-24 5 | // Updated : 2008-10-24 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/log_base.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | #include "../core/_vectorize.hpp" 11 | 12 | namespace glm 13 | { 14 | template 15 | GLM_FUNC_QUALIFIER genType log( 16 | genType const & x, 17 | genType const & base) 18 | { 19 | assert(x != genType(0)); 20 | 21 | return glm::log(x) / glm::log(base); 22 | } 23 | 24 | VECTORIZE_VEC_SCA(log) 25 | VECTORIZE_VEC_VEC(log) 26 | }//namespace glm 27 | -------------------------------------------------------------------------------- /src/OpenGL/Programs/GLProgram_Passthrough.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "GLProgram.h" 4 | 5 | class GLProgram_Passthrough: public GLProgram 6 | { 7 | public: 8 | GLProgram_Passthrough() : GLProgram(){} 9 | virtual ~GLProgram_Passthrough(){} 10 | 11 | protected: 12 | virtual void bindUniformBlocks() 13 | { 14 | this->bindUniformBlock(GLUniformBlockHelper::TYPE_PROJECTION); 15 | } 16 | virtual void fillUniforms() 17 | { 18 | GLState* glState = Singleton::Instance(); 19 | glm::mat4 modelToWorldMatrix = glState->modelToWorldMatrix; 20 | glm::mat4 worldToCameraMatrix = glState->worldToCameraMatrix; 21 | glm::mat4 modelToCameraMatrix = worldToCameraMatrix * modelToWorldMatrix; 22 | 23 | //Model to camera 24 | GLuint modelToCameraMatrixUniform = glGetUniformLocation(this->program, "modelToCameraMatrix"); 25 | glUniformMatrix4fv(modelToCameraMatrixUniform, 1, GL_FALSE, glm::value_ptr(modelToCameraMatrix)); 26 | } 27 | }; -------------------------------------------------------------------------------- /src/Objects/ExampleObject.cpp: -------------------------------------------------------------------------------- 1 | #include "ExampleObject.h" 2 | 3 | //Static vars 4 | std::string ExampleObject::className = "ExampleObject"; 5 | 6 | ExampleObject::ExampleObject() : Object() 7 | { 8 | this->value = 0; 9 | } 10 | ExampleObject::~ExampleObject(){} 11 | 12 | //Initialize 13 | void ExampleObject::initialize(TiXmlElement* element) 14 | { 15 | Object::initialize(element); 16 | 17 | int value; 18 | TiXmlElement* valueElement = element->FirstChildElement("value"); 19 | if(valueElement) value = Utils::convertStringToInt(valueElement->FirstChild()->Value()); 20 | 21 | this->initialize(value); 22 | } 23 | void ExampleObject::initialize(std::string name, int value) 24 | { 25 | Object::initialize(name); 26 | this->initialize(value); 27 | } 28 | void ExampleObject::initialize(int value) 29 | { 30 | this->value = value; 31 | } 32 | 33 | //Type 34 | std::string ExampleObject::getClassname() 35 | { 36 | return ExampleObject::className; 37 | } -------------------------------------------------------------------------------- /src/SFMLCore.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //for window title 4 | 5 | #include //For displaying the screen 6 | 7 | #include "Utils/Utils.h" //For conversions 8 | #include "Utils/Singleton.h" //For accessing global classes 9 | #include "Utils/EventHandler.h" //For sending events 10 | #include "OpenGL/GLDisplay.h" //For initializing GLDisplay 11 | #include "WorldDatabase.h" //For loading the initial world 12 | #include "World.h" //For loading the initial world 13 | 14 | /*--------------------------------------------- 15 | SFMLCore: Controls the RenderWindow, SFML event 16 | flow, and display 17 | ---------------------------------------------*/ 18 | 19 | class SFMLCore 20 | { 21 | public: 22 | SFMLCore(void); 23 | virtual ~SFMLCore(void); 24 | 25 | private: 26 | sf::Window* window; 27 | std::string title; 28 | 29 | void showFPS(); 30 | sf::Clock clock; 31 | int frameCount; 32 | float framerate; 33 | 34 | }; 35 | 36 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include //Must be included before SFML 4 | #include //For setting up random 5 | 6 | #include "ClassRegister.h" //For initializing factory classes 7 | #include "Utils/Singleton.h" //For accessing global classes 8 | #include "SFMLCore.h" //For initializing the program 9 | #include "GlobalPaths.h" //For setting data path 10 | 11 | int main(int argc, char **argv) 12 | { 13 | srand((unsigned int)time(NULL)); 14 | std::string executablePath = std::string(argv[0]); 15 | std::string dataPath = executablePath + "/../../data/"; 16 | Singleton::Instance()->setDataPath(dataPath); 17 | Singleton::Instance(); 18 | Singleton::Instance(); 19 | return 0; 20 | } 21 | 22 | /* 23 | TODO: 24 | -COLLADA mesh loading 25 | -Put all materials in one file 26 | -Archetypes 27 | -Better error handling (especially for XML loading) 28 | -Allow adding to database 29 | -Copying/ deep copying objects 30 | */ -------------------------------------------------------------------------------- /src/OpenGL/Programs/GLProgram.cpp: -------------------------------------------------------------------------------- 1 | #include "GLProgram.h" 2 | 3 | GLProgram::GLProgram(){} 4 | GLProgram::~GLProgram(){} 5 | 6 | void GLProgram::bindUniformBlock(std::string uniformBlockName) 7 | { 8 | GLUniformBlockHelper* glUniformBlockHelper = Singleton::Instance(); 9 | GLUniformBlock* uniformBlock = glUniformBlockHelper->findUniformBlock(uniformBlockName); 10 | uniformBlock->bindToProgram(this->program); 11 | } 12 | void GLProgram::bindUniformBlocks(){} 13 | void GLProgram::fillUniforms(){} 14 | 15 | //Setters 16 | void GLProgram::setProgram(GLuint program) //called from GLProgramDatabase 17 | { 18 | this->program = program; 19 | this->bindUniformBlocks(); 20 | } 21 | void GLProgram::setName(std::string name) //called from GLProgramDatabase 22 | { 23 | this->name = name; 24 | } 25 | 26 | //Getters 27 | GLuint GLProgram::getProgram() 28 | { 29 | return this->program; 30 | } 31 | std::string GLProgram::getName() 32 | { 33 | return this->name; 34 | } -------------------------------------------------------------------------------- /src/OpenGL/GLMeshData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include 20 | 21 | #include "../Utils/BoundingBox.h" 22 | 23 | class GLMeshData 24 | { 25 | public: 26 | GLMeshData(); 27 | ~GLMeshData(); 28 | 29 | bool initialize(std::string filename); 30 | bool initialize(std::vector vboData, std::vector iboData, 31 | GLuint numElements, GLenum drawType); 32 | 33 | GLenum drawType; 34 | std::vector vertexBufferData; 35 | std::vector indexBufferData; 36 | GLuint numElements; 37 | int numAttributes; 38 | std::string name; 39 | BoundingBox* boundingBox; 40 | 41 | private: 42 | bool initializeOBJ(std::string file); 43 | }; -------------------------------------------------------------------------------- /src/Utils/Ray.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "glm/glm.hpp" //For math 4 | 5 | class Ray 6 | { 7 | public: 8 | glm::vec3 origin; 9 | glm::vec3 direction; 10 | glm::vec3 inv_direction; 11 | glm::ivec3 sign; 12 | 13 | Ray(){} 14 | Ray(glm::vec3 o, glm::vec3 d) 15 | { 16 | origin = o; 17 | direction = d; 18 | inv_direction = glm::vec3(1/d.x, 1/d.y, 1/d.z); 19 | sign.x = (inv_direction.x < 0); 20 | sign.y = (inv_direction.y < 0); 21 | sign.z = (inv_direction.z < 0); 22 | } 23 | glm::vec3 getPointAlongRay(float t) 24 | { 25 | //Gets the point distance t away from the origin in the ray's direction 26 | return (this->origin + t*this->direction); 27 | } 28 | Ray transform(glm::mat4 transformation) 29 | { 30 | glm::vec3 originTransformed = glm::vec3(transformation*glm::vec4(this->origin,1.0f)); 31 | glm::vec3 directionTransformed = glm::normalize(glm::vec3(transformation*glm::vec4(this->direction,0.0))); 32 | Ray newRay = Ray(originTransformed,directionTransformed); 33 | return newRay; 34 | } 35 | }; 36 | 37 | -------------------------------------------------------------------------------- /src/Objects/Cameras/Camera1stPerson.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Camera.h" //Superclass 4 | 5 | class Camera1stPerson : public Camera 6 | { 7 | public: 8 | //Class 9 | static std::string className; 10 | 11 | Camera1stPerson(); 12 | virtual ~Camera1stPerson(); 13 | 14 | //Initialize 15 | virtual void initialize(TiXmlElement* element); 16 | void initialize(std::string name, glm::vec3 cameraPos); 17 | 18 | //Type 19 | virtual std::string getClassname(); 20 | 21 | //Modifiers 22 | virtual void setCameraPos(glm::vec3 newPos); 23 | 24 | virtual void rotateRad(float radX, float radY); 25 | virtual void rotateDeg(float degX, float degY); 26 | virtual void setRotationRad(float radX, float radY); 27 | virtual void setRotationDeg(float degX, float degY); 28 | 29 | virtual void zoom(float distance); 30 | virtual void setZoom(float distance); 31 | 32 | virtual void pan(float x, float y); 33 | virtual void setPan(float x, float y); 34 | 35 | protected: 36 | virtual void CalcMatrix(void); 37 | 38 | 39 | }; 40 | 41 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | For videos and the history of this project, go to: http://ianlilleycis565.blogspot.com/ 2 | 3 | Note: Only runs on Windows. The code itself should be supported by most OS's, but the lib file are all built for 32-bit Windows 4 | 5 | How to build and run: 6 | 1) Go into "tools" folder and double click "build_automator.bat" 7 | 2) Go into "build" folder and open the .sln file 8 | 3) Run in Release! 9 | 10 | Controls: 11 | Left mouse to rotate 12 | Middle mouse to pan 13 | Middle mouse roll to zoom 14 | Right mouse to zoom 15 | 16 | Alt+left mouse click to shoot sphere 17 | Alt+middle mouse click to shoot cow 18 | Alt+right mouse click to shoot cube 19 | 20 | Notes: 21 | -The cow physics look strange at times because they are represented with cubes 22 | -The default scene might be slow on some computers. The one I'm testing on is a NVIDIA GTX460 and it rarely goes below 50fps. 23 | -The physics assumes a timestep of 1/60, so if the fps is greater than 60, the physics will go really fast. I will fix this later. 24 | -I'm still working on the code, so not everything is going to be perfect. -------------------------------------------------------------------------------- /src/Objects/Lights/ShadowLight.cpp: -------------------------------------------------------------------------------- 1 | #include "ShadowLight.h" 2 | 3 | //Static vars 4 | std::string ShadowLight::className = "ShadowLight"; 5 | 6 | ShadowLight::ShadowLight() : Light() {} 7 | ShadowLight::~ShadowLight(){} 8 | 9 | //Initialize 10 | void ShadowLight::initialize(TiXmlElement* element) 11 | { 12 | this->initialize(); 13 | Light::initialize(element); 14 | } 15 | void ShadowLight::initialize(std::string name, glm::vec4 color, float intensity) 16 | { 17 | this->initialize(); 18 | Light::initialize(name,color,intensity); 19 | } 20 | void ShadowLight::initialize() 21 | { 22 | this->lightCamera = new Camera3rdPerson(); 23 | } 24 | 25 | //Type 26 | std::string ShadowLight::getClassname() 27 | { 28 | return ShadowLight::className; 29 | } 30 | 31 | //Transformations 32 | void ShadowLight::updateTransformationMatrix() 33 | { 34 | Light::updateTransformationMatrix(); 35 | this->lightCamera->setCameraPos(this->getTranslation()); 36 | } 37 | 38 | //World to camera matrix 39 | glm::mat4 ShadowLight::getWorldToCameraMatrix() 40 | { 41 | return this->lightCamera->getWorldToCameraMatrix(); 42 | } -------------------------------------------------------------------------------- /include/bullet/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btBroadphaseProxy.h" 17 | 18 | -------------------------------------------------------------------------------- /include/glm/gtx/noise.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise": 5 | // https://github.com/ashima/webgl-noise 6 | // Following Stefan Gustavson's paper "Simplex noise demystified": 7 | // http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | // Created : 2011-04-21 10 | // Updated : 2011-04-21 11 | // Licence : This source is under MIT License 12 | // File : glm/gtx/noise.inl 13 | /////////////////////////////////////////////////////////////////////////////////////////////////// 14 | // Dependency: 15 | // - GLM core 16 | /////////////////////////////////////////////////////////////////////////////////////////////////// 17 | 18 | namespace glm{ 19 | 20 | }//namespace glm 21 | -------------------------------------------------------------------------------- /src/Objects/Cameras/Camera3rdPerson.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Camera.h" //Superclass 4 | 5 | class Camera3rdPerson : public Camera 6 | { 7 | public: 8 | //Class 9 | static std::string className; 10 | 11 | Camera3rdPerson(void); 12 | virtual ~Camera3rdPerson(void); 13 | 14 | //Initialize 15 | virtual void initialize(TiXmlElement* element); 16 | void initialize(std::string name, glm::vec3 cameraPos); 17 | 18 | //Type 19 | virtual std::string getClassname(); 20 | 21 | //Modifiers 22 | virtual void setCameraPos(glm::vec3 newPos); 23 | 24 | virtual void rotateRad(float radX, float radY); 25 | virtual void rotateDeg(float degX, float degY); 26 | virtual void setRotationRad(float radX, float radY); 27 | virtual void setRotationDeg(float degX, float degY); 28 | 29 | virtual void zoom(float distance); 30 | virtual void setZoom(float distance); 31 | 32 | virtual void pan(float x, float y); 33 | virtual void setPan(float x, float y); 34 | 35 | glm::vec3 getLookAt(void); 36 | 37 | protected: 38 | 39 | virtual void CalcMatrix(void); 40 | 41 | float radius; 42 | glm::vec3 lookAt; 43 | }; 44 | 45 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/NarrowPhaseCollision/btConvexCast.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btConvexCast.h" 17 | 18 | btConvexCast::~btConvexCast() 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/BroadphaseCollision/btDispatcher.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btDispatcher.h" 17 | 18 | btDispatcher::~btDispatcher() 19 | { 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/MeshDatabase.cpp: -------------------------------------------------------------------------------- 1 | #include "MeshDatabase.h" 2 | 3 | std::string MeshDatabase::NONE = "NONE"; 4 | 5 | MeshDatabase::MeshDatabase(){} 6 | MeshDatabase::~MeshDatabase(){} 7 | 8 | GLMeshData* MeshDatabase::loadMesh(std::string meshName) 9 | { 10 | GLMeshData* meshData = 0; 11 | if(meshName != MeshDatabase::NONE) 12 | { 13 | meshData = this->findMesh(meshName); 14 | if(meshData == 0) 15 | { 16 | meshData = this->openMeshFile(meshName); 17 | if(meshData != 0) 18 | this->meshMap[meshData->name] = meshData; 19 | } 20 | } 21 | return meshData; 22 | } 23 | GLMeshData* MeshDatabase::findMesh(std::string meshName) 24 | { 25 | std::map::iterator it; 26 | it = this->meshMap.find(meshName); 27 | if(it != this->meshMap.end()) 28 | return it->second; 29 | else 30 | return 0; 31 | } 32 | GLMeshData* MeshDatabase::openMeshFile(std::string meshName) 33 | { 34 | std::string meshPath = Singleton::Instance()->getMeshPath(); 35 | std::string fullPath = meshPath + meshName + ".obj"; 36 | 37 | GLMeshData* meshData = new GLMeshData(); 38 | meshData->initialize(fullPath); 39 | meshData->name = meshName; 40 | 41 | return meshData; 42 | } -------------------------------------------------------------------------------- /include/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-02-19 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/handed_coordinate_space.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER bool rightHanded 14 | ( 15 | detail::tvec3 const & tangent, 16 | detail::tvec3 const & binormal, 17 | detail::tvec3 const & normal 18 | ) 19 | { 20 | return dot(cross(normal, tangent), binormal) > T(0); 21 | } 22 | 23 | template 24 | GLM_FUNC_QUALIFIER bool leftHanded 25 | ( 26 | detail::tvec3 const & tangent, 27 | detail::tvec3 const & binormal, 28 | detail::tvec3 const & normal 29 | ) 30 | { 31 | return dot(cross(normal, tangent), binormal) < T(0); 32 | } 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /include/bullet/BulletDynamics/Vehicle/btVehicleRaycaster.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005 Erwin Coumans http://bulletphysics.org 3 | * 4 | * Permission to use, copy, modify, distribute and sell this software 5 | * and its documentation for any purpose is hereby granted without fee, 6 | * provided that the above copyright notice appear in all copies. 7 | * Erwin Coumans makes no representations about the suitability 8 | * of this software for any purpose. 9 | * It is provided "as is" without express or implied warranty. 10 | */ 11 | #ifndef BT_VEHICLE_RAYCASTER_H 12 | #define BT_VEHICLE_RAYCASTER_H 13 | 14 | #include "LinearMath/btVector3.h" 15 | 16 | /// btVehicleRaycaster is provides interface for between vehicle simulation and raycasting 17 | struct btVehicleRaycaster 18 | { 19 | virtual ~btVehicleRaycaster() 20 | { 21 | } 22 | struct btVehicleRaycasterResult 23 | { 24 | btVehicleRaycasterResult() :m_distFraction(btScalar(-1.)){}; 25 | btVector3 m_hitPointInWorld; 26 | btVector3 m_hitNormalInWorld; 27 | btScalar m_distFraction; 28 | }; 29 | 30 | virtual void* castRay(const btVector3& from,const btVector3& to, btVehicleRaycasterResult& result) = 0; 31 | 32 | }; 33 | 34 | #endif //BT_VEHICLE_RAYCASTER_H 35 | 36 | -------------------------------------------------------------------------------- /src/Physics/PhysicsWorld.cpp: -------------------------------------------------------------------------------- 1 | #include "PhysicsWorld.h" 2 | 3 | PhysicsWorld::PhysicsWorld() 4 | { 5 | //Set up bullet objects 6 | this->collisionConfiguration = new btDefaultCollisionConfiguration(); 7 | this->dispatcher = new btCollisionDispatcher(this->collisionConfiguration); 8 | this->broadphase = new btDbvtBroadphase(); 9 | this->solver = new btSequentialImpulseConstraintSolver(); 10 | 11 | //Set up the world 12 | this->dynamicsWorld = new btDiscreteDynamicsWorld(this->dispatcher,this->broadphase,this->solver,this->collisionConfiguration); 13 | this->dynamicsWorld->getSolverInfo().m_splitImpulse = true; 14 | this->dynamicsWorld->getSolverInfo().m_numIterations = 20; 15 | this->dynamicsWorld->getDispatchInfo().m_useContinuous = true; 16 | this->dynamicsWorld->setGravity(btVector3(0,-10,0)); 17 | } 18 | PhysicsWorld::~PhysicsWorld(){} 19 | 20 | void PhysicsWorld::update() 21 | { 22 | this->dynamicsWorld->stepSimulation(1.0f/60.0f); 23 | } 24 | void PhysicsWorld::addObject(PhysicsObject* object) 25 | { 26 | this->dynamicsWorld->addRigidBody(object->getRigidBody()); 27 | this->objects.push_back(object); 28 | } 29 | std::vector& PhysicsWorld::getObjects() 30 | { 31 | return this->objects; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionShapes/btConcaveShape.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | 17 | #include "btConcaveShape.h" 18 | 19 | btConcaveShape::btConcaveShape() : m_collisionMargin(btScalar(0.)) 20 | { 21 | 22 | } 23 | 24 | btConcaveShape::~btConcaveShape() 25 | { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/OpenGL/GLUniformBlockHelper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For storing UniformBlocks 4 | #include //For storage 5 | #include //For names 6 | 7 | #include "GLUniformBlock.h" //For storing UniformBlocks 8 | #include "GLState.h" //For getting current world values 9 | #include "GLView.h" //For camera values 10 | #include "../Utils/Singleton.h" //For accessing GLState 11 | #include "../Objects/Lights/Light.h" 12 | 13 | class GLUniformBlockHelper 14 | { 15 | public: 16 | GLUniformBlockHelper(); 17 | ~GLUniformBlockHelper(); 18 | 19 | void initialize(); 20 | void updateAll(); 21 | void update(std::string name); 22 | 23 | GLUniformBlock* findUniformBlock(std::string name); 24 | 25 | static std::string TYPE_PROJECTION; 26 | static std::string TYPE_LIGHT; 27 | 28 | private: 29 | std::map uniformBlockMap; 30 | }; 31 | 32 | //---------------- 33 | // Structs /////// 34 | //---------------- 35 | struct ProjectionBlock 36 | { 37 | glm::mat4 cameraToClipMatrix; 38 | float zNear; 39 | float zFar; 40 | float screenWidth; 41 | float screenHeight; 42 | }; 43 | 44 | struct LightBlock 45 | { 46 | glm::vec4 ambientIntensity; 47 | float lightAttenuation; 48 | float maxIntensity; 49 | float gamma; 50 | }; -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionShapes/btTriangleCallback.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btTriangleCallback.h" 17 | 18 | btTriangleCallback::~btTriangleCallback() 19 | { 20 | 21 | } 22 | 23 | 24 | btInternalTriangleIndexCallback::~btInternalTriangleIndexCallback() 25 | { 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/OpenGL/Programs/GLProgram.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For storing uniform blocks 4 | #include //For program and attribute names 5 | 6 | #include //For OpenGL commands 7 | #include //For math 8 | #include //For getting value_ptr of glm types 9 | 10 | #include "../GLState.h" //Used by subclasses for getting uniform data 11 | #include "../GLUniformBlockHelper.h" //Used to find uniform blocks for binding 12 | #include "../GLUniformBlock.h" //Used for binding uniform blocks to program 13 | #include "../../Utils/Singleton.h" //Used with several global classes 14 | 15 | class GLProgram 16 | { 17 | public: 18 | GLProgram(); 19 | virtual ~GLProgram(); 20 | 21 | //Setters 22 | void setProgram(GLuint program); //set from GLProgramDatabase 23 | void setName(std::string name); //set from GLProgramDatabase 24 | 25 | //Getters 26 | GLuint getProgram(); 27 | std::string getName(); 28 | 29 | //Other 30 | virtual void fillUniforms(); 31 | 32 | protected: 33 | //Uniform Blocks 34 | virtual void bindUniformBlocks(); //set from subclasses 35 | virtual void bindUniformBlock(std::string uniformBlockName); 36 | 37 | GLuint program; 38 | std::string name; 39 | }; -------------------------------------------------------------------------------- /include/bullet/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btCollisionAlgorithm.h" 17 | #include "btDispatcher.h" 18 | 19 | btCollisionAlgorithm::btCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci) 20 | { 21 | m_dispatcher = ci.m_dispatcher1; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/World.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For finding object in array 4 | #include //For storing objects 5 | #include //For storing object 6 | #include //For object names 7 | 8 | #include //For parsing world xml file 9 | 10 | #include "Utils/Singleton.h" //For using global classes 11 | #include "Objects/Object.h" //Storage type 12 | #include "OpenGL/GLState.h" //Takes the world's lights 13 | #include "Objects/Lights/Light.h" //For sending lights to GLState 14 | #include "Utils/Factory.h" //For constructing new objects during initialization 15 | 16 | class World 17 | { 18 | public: 19 | World(); 20 | ~World(); 21 | 22 | void initialize(TiXmlElement* element); 23 | 24 | void update(); 25 | void render(); 26 | 27 | void addObject(Object* object); 28 | void removeObject(Object* object); 29 | void removeObject(std::string name); 30 | 31 | std::vector getObjectsByType(std::string type, bool exclusive = true); 32 | Object* getObjectByName(std::string name); 33 | Object* getObjectByNameAndType(std::string type, std::string name); 34 | 35 | //Name 36 | void setName(std::string name); 37 | std::string getName(); 38 | 39 | private: 40 | 41 | std::map> objectMap; 42 | std::string name; 43 | }; -------------------------------------------------------------------------------- /src/OpenGL/Programs/GLProgramDatabase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For shader compilation 4 | #include //For names 5 | #include //For storing programs 6 | #include //For OpenGL commands 7 | 8 | #include "GLProgram.h" //For storing programs 9 | #include "../../GlobalPaths.h" //For loading programs path 10 | #include "../../Utils/Factory.h" //For creating new program classes 11 | #include "../../Utils/Singleton.h" //For loading global classes 12 | 13 | class GLProgramDatabase 14 | { 15 | public: 16 | GLProgramDatabase(); 17 | ~GLProgramDatabase(); 18 | 19 | GLProgram* loadProgram(std::string ProgramName); 20 | 21 | static std::string NONE; 22 | 23 | private: 24 | GLProgram* findProgram(std::string ProgramName); 25 | GLProgram* makeProgramByName(std::string name); 26 | std::pair getShadersByType(std::string shaderType); 27 | std::map programMap; 28 | 29 | //Compiling shaders -- low level 30 | const char* GetShaderName(GLenum eShaderType); 31 | GLuint CreateShader(GLenum eShaderType,const std::string &strShaderFile, const std::string &strShaderName); 32 | GLuint LoadShader(GLenum eShaderType, const std::string &strShaderFilename); 33 | GLuint CreateProgram(const std::vector &shaderList); 34 | }; 35 | -------------------------------------------------------------------------------- /include/glm/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-21 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/orthonormalize.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat3x3 orthonormalize 14 | ( 15 | const detail::tmat3x3& m 16 | ) 17 | { 18 | detail::tmat3x3 r = m; 19 | 20 | r[0] = normalize(r[0]); 21 | 22 | float d0 = dot(r[0], r[1]); 23 | r[1] -= r[0] * d0; 24 | r[1] = normalize(r[1]); 25 | 26 | float d1 = dot(r[1], r[2]); 27 | d0 = dot(r[0], r[2]); 28 | r[2] -= r[0] * d0 + r[1] * d1; 29 | r[2] = normalize(r[2]); 30 | 31 | return r; 32 | } 33 | 34 | template 35 | GLM_FUNC_QUALIFIER detail::tvec3 orthonormalize 36 | ( 37 | const detail::tvec3& x, 38 | const detail::tvec3& y 39 | ) 40 | { 41 | return normalize(x - y * dot(y, x)); 42 | } 43 | }//namespace glm 44 | -------------------------------------------------------------------------------- /src/OpenGL/GLMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For setting VBO 4 | #include //For names 5 | 6 | #include //For GL commands 7 | 8 | #include "Programs/GLProgramDatabase.h" //For loading the program 9 | #include "Programs/GLProgram.h" //For storing the program 10 | #include "../Utils/Singleton.h" //For different global classes 11 | #include "GLMeshData.h" 12 | 13 | /*--------------------------------------------- 14 | GLMesh: Contains all the information needed 15 | to render objects. 16 | ---------------------------------------------*/ 17 | 18 | class GLMesh 19 | { 20 | public: 21 | GLMesh(); 22 | ~GLMesh(); 23 | 24 | //Initialize 25 | void initialize(std::vector vboData, std::vector iboData, GLuint numElements, GLenum drawType); 26 | void initialize(GLMeshData* meshData); 27 | GLMeshData* getGLMeshData(); 28 | 29 | //Program 30 | void setProgram(std::string programName); 31 | GLProgram* getProgram(); 32 | 33 | //Name 34 | void setName(std::string name); 35 | std::string getName(); 36 | 37 | //Render 38 | void Render(); 39 | 40 | private: 41 | void Generate(); 42 | 43 | //GLData 44 | GLMeshData* meshData; 45 | GLProgram* program; 46 | GLuint vertexBuffer; 47 | GLuint indexBuffer; 48 | GLuint vao; 49 | 50 | std::string name; 51 | }; 52 | -------------------------------------------------------------------------------- /src/Utils/Database.h: -------------------------------------------------------------------------------- 1 | //maybe save for later 2 | 3 | /* 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | template 10 | 11 | std::string Database::NONE = "NONE" 12 | 13 | class Database 14 | { 15 | public: 16 | T* get(std::string name) 17 | { 18 | T* object = 0; 19 | object = find(name); 20 | if(object == 0) 21 | { 22 | object = load(name); 23 | if(object != 0) 24 | this->map[name] = object; 25 | } 26 | return object; 27 | } 28 | 29 | static std::string NONE; 30 | 31 | private: 32 | T* find(std::string name) 33 | { 34 | std::map::iterator it; 35 | it = this->map.find(name); 36 | if(it != this->map.end()) 37 | return it->second; 38 | else 39 | return 0; 40 | } 41 | T* load(std::string name) 42 | { 43 | std::string fullPath = materialPath + materialFileName + ".xml"; 44 | 45 | Material* material = new Material(); 46 | 47 | //XML loading 48 | TiXmlDocument doc; 49 | doc.LoadFile(fullPath.c_str()); 50 | if(doc.Error()) throw std::runtime_error(doc.ErrorDesc()); 51 | TiXmlHandle docHandle(&doc); 52 | TiXmlElement* materialElement = docHandle.FirstChild("material").ToElement(); 53 | material->initialize(materialElement); 54 | 55 | return material; 56 | } 57 | 58 | std::string path; 59 | std::map map; 60 | }; 61 | */ -------------------------------------------------------------------------------- /src/WorldDatabase.cpp: -------------------------------------------------------------------------------- 1 | #include "WorldDatabase.h" 2 | 3 | std::string WorldDatabase::NONE = "NONE"; 4 | WorldDatabase::WorldDatabase(){} 5 | WorldDatabase::~WorldDatabase(){} 6 | 7 | World* WorldDatabase::loadWorld(std::string worldFileName) 8 | { 9 | World* newWorld = 0; 10 | newWorld = this->findWorld(worldFileName); 11 | if(newWorld == 0) 12 | { 13 | newWorld = this->openWorldFile(worldFileName); 14 | if(newWorld != 0) 15 | this->worldMap[worldFileName] = newWorld; 16 | } 17 | return newWorld; 18 | } 19 | World* WorldDatabase::findWorld(std::string worldFileName) 20 | { 21 | std::map::iterator it; 22 | it = this->worldMap.find(worldFileName); 23 | if(it != this->worldMap.end()) 24 | return it->second; 25 | else 26 | return 0; 27 | } 28 | World* WorldDatabase::openWorldFile(std::string worldFileName) 29 | { 30 | std::string worldPath = Singleton::Instance()->getWorldPath(); 31 | std::string fullPath = worldPath + worldFileName + ".xml"; 32 | 33 | World* world = new World(); 34 | 35 | //XML loading 36 | TiXmlDocument doc; 37 | doc.LoadFile(fullPath.c_str()); 38 | if(doc.Error()) throw std::runtime_error(doc.ErrorDesc()); 39 | TiXmlHandle docHandle(&doc); 40 | TiXmlElement* worldElement = docHandle.FirstChild("world").ToElement(); 41 | world->initialize(worldElement); 42 | 43 | return world; 44 | } -------------------------------------------------------------------------------- /src/Objects/Lights/Light.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For math 4 | 5 | #include "../Object.h" //Superclass 6 | 7 | class Light: public Object 8 | { 9 | public: 10 | //Class 11 | static std::string className; 12 | 13 | //Construct/Destruct 14 | Light(); 15 | virtual ~Light(); 16 | 17 | //Initialize 18 | virtual void initialize(TiXmlElement* element); 19 | void initialize(std::string name, glm::vec4 color, float intensity); 20 | 21 | //Type 22 | virtual std::string getClassname(); 23 | 24 | //Color 25 | void setColor(glm::vec4 color); 26 | glm::vec4 getColor(); 27 | 28 | //Intensity 29 | void setIntensity(float intensity); 30 | float getIntensity(); 31 | 32 | //Static 33 | static void setAmbientIntensity(glm::vec4 ambientIntensity); 34 | static void setLightAttenuation(float lightAttenuation); 35 | static void setMaxIntensity(float maxIntensity); 36 | static void setGamma(float gamma); 37 | 38 | static glm::vec4 getAmbientIntensity(); 39 | static float getLightAttenuation(); 40 | static float getMaxIntensity(); 41 | static float getGamma(); 42 | 43 | private: 44 | void initialize(glm::vec4 color, float intensity); 45 | 46 | glm::vec4 color; 47 | float intensity; 48 | 49 | //Static 50 | static glm::vec4 ambientIntensity; 51 | static float lightAttenuation; 52 | static float maxIntensity; 53 | static float gamma; 54 | }; -------------------------------------------------------------------------------- /include/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-21 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/matrix_cross_product.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat3x3 matrixCross3 14 | ( 15 | detail::tvec3 const & x 16 | ) 17 | { 18 | detail::tmat3x3 Result(T(0)); 19 | Result[0][1] = x.z; 20 | Result[1][0] = -x.z; 21 | Result[0][2] = -x.y; 22 | Result[2][0] = x.y; 23 | Result[1][2] = x.x; 24 | Result[2][1] = -x.x; 25 | return Result; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER detail::tmat4x4 matrixCross4 30 | ( 31 | detail::tvec3 const & x 32 | ) 33 | { 34 | detail::tmat4x4 Result(T(0)); 35 | Result[0][1] = x.z; 36 | Result[1][0] = -x.z; 37 | Result[0][2] = -x.y; 38 | Result[2][0] = x.y; 39 | Result[1][2] = x.x; 40 | Result[2][1] = -x.x; 41 | return Result; 42 | } 43 | 44 | }//namespace glm 45 | -------------------------------------------------------------------------------- /include/glm/gtx/vector_access.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-01-16 5 | // Updated : 2008-10-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/vector_access.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER void set 14 | ( 15 | detail::tvec2& v, 16 | valType const & x, 17 | valType const & y 18 | ) 19 | { 20 | v.x = x; 21 | v.y = y; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER void set 26 | ( 27 | detail::tvec3& v, 28 | valType const & x, 29 | valType const & y, 30 | valType const & z 31 | ) 32 | { 33 | v.x = x; 34 | v.y = y; 35 | v.z = z; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER void set 40 | ( 41 | detail::tvec4& v, 42 | valType const & x, 43 | valType const & y, 44 | valType const & z, 45 | valType const & w 46 | ) 47 | { 48 | v.x = x; 49 | v.y = y; 50 | v.z = z; 51 | v.w = w; 52 | } 53 | }//namespace glm 54 | -------------------------------------------------------------------------------- /include/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-30 5 | // Updated : 2008-10-05 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/closest_point.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | #ifndef glm_gtx_closest_point 11 | #define glm_gtx_closest_point 12 | 13 | namespace glm 14 | { 15 | template 16 | GLM_FUNC_QUALIFIER detail::tvec3 closestPointOnLine 17 | ( 18 | detail::tvec3 const & point, 19 | detail::tvec3 const & a, 20 | detail::tvec3 const & b 21 | ) 22 | { 23 | valType LineLength = distance(a, b); 24 | detail::tvec3 Vector = point - a; 25 | detail::tvec3 LineDirection = (b - a) / LineLength; 26 | 27 | // Project Vector to LineDirection to get the distance of point from a 28 | valType Distance = dot(Vector, LineDirection); 29 | 30 | if(Distance <= valType(0)) return a; 31 | if(Distance >= LineLength) return b; 32 | return a + LineDirection * Distance; 33 | } 34 | }//namespace glm 35 | 36 | #endif//glm_gtx_closest_point 37 | -------------------------------------------------------------------------------- /src/Utils/IntersectionAlgorithms.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For min/max 4 | 5 | #include //For math 6 | 7 | #include "Ray.h" //For intersection calculations 8 | #include "BoundingBox.h" 9 | 10 | struct IntersectionData 11 | { 12 | public: 13 | //All in world coordinates 14 | bool valid; 15 | glm::vec3 point; 16 | glm::vec3 normal; 17 | glm::vec3 reflection; 18 | float distanceAlongRay; 19 | }; 20 | 21 | class IntersectionAlgorithms 22 | { 23 | public: 24 | //Sees if a point is contained by the volume by shooting tha ray from opposite directions 25 | static IntersectionData PointInSphere(glm::vec3 point, glm::vec3 direction, glm::mat4 T); 26 | static IntersectionData PointInCylinder(glm::vec3 point, glm::vec3 direction, glm::mat4 T); 27 | 28 | static IntersectionData RaySphereIntersect(Ray& ray, glm::mat4 T); 29 | static IntersectionData RayCylinderIntersect(Ray& ray, glm::mat4 T); 30 | static IntersectionData RayBoxIntersect(Ray& ray, glm::mat4 T, BoundingBox* boundingBox); 31 | 32 | static bool IsValidIntersection(IntersectionData data); 33 | 34 | private: 35 | static float IntersectionAlgorithms::getMinT(bool expression1, bool expression2, float t1, float t2); 36 | static bool IntersectionAlgorithms::equal(float val1, float val2); 37 | static glm::vec3 IntersectionAlgorithms::getReflection(glm::vec3 initialDir, glm::vec3 normal); 38 | 39 | static float EPSILON; 40 | }; -------------------------------------------------------------------------------- /include/bullet/LinearMath/btDefaultMotionState.h: -------------------------------------------------------------------------------- 1 | #ifndef BT_DEFAULT_MOTION_STATE_H 2 | #define BT_DEFAULT_MOTION_STATE_H 3 | 4 | #include "btMotionState.h" 5 | 6 | ///The btDefaultMotionState provides a common implementation to synchronize world transforms with offsets. 7 | struct btDefaultMotionState : public btMotionState 8 | { 9 | btTransform m_graphicsWorldTrans; 10 | btTransform m_centerOfMassOffset; 11 | btTransform m_startWorldTrans; 12 | void* m_userPointer; 13 | 14 | btDefaultMotionState(const btTransform& startTrans = btTransform::getIdentity(),const btTransform& centerOfMassOffset = btTransform::getIdentity()) 15 | : m_graphicsWorldTrans(startTrans), 16 | m_centerOfMassOffset(centerOfMassOffset), 17 | m_startWorldTrans(startTrans), 18 | m_userPointer(0) 19 | 20 | { 21 | } 22 | 23 | ///synchronizes world transform from user to physics 24 | virtual void getWorldTransform(btTransform& centerOfMassWorldTrans ) const 25 | { 26 | centerOfMassWorldTrans = m_centerOfMassOffset.inverse() * m_graphicsWorldTrans ; 27 | } 28 | 29 | ///synchronizes world transform from physics to user 30 | ///Bullet only calls the update of worldtransform for active objects 31 | virtual void setWorldTransform(const btTransform& centerOfMassWorldTrans) 32 | { 33 | m_graphicsWorldTrans = centerOfMassWorldTrans * m_centerOfMassOffset ; 34 | } 35 | 36 | 37 | 38 | }; 39 | 40 | #endif //BT_DEFAULT_MOTION_STATE_H 41 | -------------------------------------------------------------------------------- /data/shaders/DeferredGeometryPassFrag.frag: -------------------------------------------------------------------------------- 1 | #version 330 2 | layout(std140) uniform; 3 | 4 | //Input 5 | in vec3 cameraSpaceNormal; 6 | in vec3 cameraSpacePosition; 7 | 8 | //Output 9 | layout(location = 0) out vec4 outputPosition; 10 | layout(location = 1) out vec4 outputNormal; 11 | layout(location = 2) out vec4 outputDiffuseColor; 12 | layout(location = 3) out vec4 outputSpecularColor; //includes specular shininess 13 | layout(location = 4) out vec4 outputOther; //roughness, reflectivity, refractivity, refractiveIndex 14 | 15 | //Uniforms 16 | uniform vec4 diffuseColor; 17 | uniform vec4 specularColor; 18 | uniform float specularShininess; 19 | uniform float roughness; 20 | uniform float reflectivity; 21 | uniform float refractivity; 22 | uniform float refractiveIndex; 23 | 24 | //Main 25 | void main() 26 | { 27 | //Camera space positions 28 | outputPosition.xyz = cameraSpacePosition; 29 | outputPosition.w = 1.0; 30 | 31 | //Camera space normals 32 | outputNormal.xyz = normalize(cameraSpaceNormal); 33 | outputNormal.w = 1.0; 34 | 35 | //Diffuse color 36 | outputDiffuseColor.xyz = diffuseColor.xyz; 37 | outputDiffuseColor.w = 1.0; 38 | 39 | //Specular color 40 | outputSpecularColor.xyz = specularColor.xyz; 41 | outputSpecularColor.w = specularShininess; 42 | 43 | //Other 44 | outputOther.x = roughness; 45 | outputOther.y = reflectivity; 46 | outputOther.z = refractivity; 47 | outputOther.w = refractiveIndex; 48 | } 49 | -------------------------------------------------------------------------------- /src/Objects/RenderObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include //For various properties 4 | 5 | #include "Object.h" //Superclass 6 | #include "../OpenGL/GLMesh.h" //For storing mesh 7 | #include "../Material.h" //For storing material 8 | #include "../OpenGL/GLState.h" //For updating model to camera matrix and material 9 | #include "../MaterialDatabase.h" //For loading material based on string name 10 | #include "../MeshDatabase.h" //For loading mesh based on string name 11 | #include "../Utils/Singleton.h" //For accessing global classes 12 | 13 | class RenderObject: public Object 14 | { 15 | public: 16 | //Class 17 | static std::string className; 18 | 19 | //Construct/Destruct 20 | RenderObject(); 21 | virtual ~RenderObject(); 22 | 23 | //Initialize 24 | virtual void initialize(TiXmlElement* element); 25 | void initialize(std::string name, std::string mesh, 26 | std::string material, std::string program); 27 | 28 | //Type 29 | virtual std::string getClassname(); 30 | 31 | //Update 32 | virtual void render(); 33 | 34 | //Mesh 35 | void setMesh(std::string name); 36 | GLMesh* getMesh(); 37 | 38 | //Material 39 | void setMaterial(std::string name); 40 | Material* getMaterial(); 41 | 42 | //Program 43 | void setProgram(std::string program); 44 | GLProgram* getProgram(); 45 | 46 | protected: 47 | void initialize(std::string mesh, std::string material, std::string program); 48 | 49 | GLMesh* mesh; 50 | Material* material; 51 | }; -------------------------------------------------------------------------------- /include/glm/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-03-06 5 | // Updated : 2009-05-01 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/polar_coordinates.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 polar 14 | ( 15 | detail::tvec3 const & euclidean 16 | ) 17 | { 18 | T length = length(euclidean); 19 | detail::tvec3 tmp = euclidean / length; 20 | T xz_dist = sqrt(tmp.x * tmp.x + tmp.z * tmp.z); 21 | 22 | return detail::tvec3( 23 | degrees(atan(xz_dist, tmp.y)), // latitude 24 | degrees(atan(tmp.x, tmp.z)), // longitude 25 | xz_dist); // xz distance 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER detail::tvec3 euclidean 30 | ( 31 | detail::tvec3 const & polar 32 | ) 33 | { 34 | T latitude = radians(polar.x); 35 | T longitude = radians(polar.y); 36 | return detail::tvec3( 37 | cos(latitude) * sin(longitude), 38 | sin(latitude), 39 | cos(latitude) * cos(longitude)); 40 | } 41 | 42 | }//namespace glm 43 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionShapes/btTriangleBuffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btTriangleBuffer.h" 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | void btTriangleBuffer::processTriangle(btVector3* triangle,int partId,int triangleIndex) 25 | { 26 | btTriangle tri; 27 | tri.m_vertex0 = triangle[0]; 28 | tri.m_vertex1 = triangle[1]; 29 | tri.m_vertex2 = triangle[2]; 30 | tri.m_partId = partId; 31 | tri.m_triangleIndex = triangleIndex; 32 | 33 | m_triangleBuffer.push_back(tri); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /tools/README.txt: -------------------------------------------------------------------------------- 1 | The "tools" folder is where we put all the build scripts. 2 | This document explains the process of building properly. 3 | 4 | When you should rebuild: 5 | -When someone has added files (or changed file names) to the git repo. 6 | -When there is no build folder 7 | -When there have been changes to the premake4.lua file 8 | Note: You do not have to delete the build folder (premake4.lua takes care of that) 9 | Note: Is is recommended that you rebuild after every pull (just for safety) 10 | 11 | ================= 12 | Premake: 13 | Premake is a build configuration tool that allows us to develop in Windows, MacOS, or Linux using several different IDE's 14 | Premake generates a folder which contains project settings for Visual Studio, Code::Blocks, make, etc. The solution files in the build folder reference the contents of our repository, meaning we can run our project without cluttering the repository with autogenerated files. 15 | Premake requires a configuration file called "premake4.lua". 16 | 17 | Building: 18 | -First cd into the directory containing the premake4.lua file 19 | 20 | -To build in windows : 21 | "./premake4.exe" --platform=x32 --os=windows vs2010 (or x64 if using a 64 bit machine) 22 | OR ---> double-click build_win.bat (default configuration of windows 32-bit and vs2010) 23 | 24 | -To build in linux: 25 | "./premake4" --platform=x32 --os=linux codeblocks (or x64 if using a 64 bit machine) 26 | 27 | -To build in macOS: 28 | Haven't done this yet 29 | ================= 30 | 31 | -------------------------------------------------------------------------------- /src/MaterialDatabase.cpp: -------------------------------------------------------------------------------- 1 | #include "MaterialDatabase.h" 2 | 3 | std::string MaterialDatabase::NONE = "NONE"; 4 | MaterialDatabase::MaterialDatabase(){} 5 | MaterialDatabase::~MaterialDatabase(){} 6 | 7 | Material* MaterialDatabase::loadMaterial(std::string materialFileName) 8 | { 9 | Material* newMaterial = 0; 10 | if(materialFileName != MaterialDatabase::NONE) 11 | { 12 | newMaterial = this->findMaterial(materialFileName); 13 | if(newMaterial == 0) 14 | { 15 | newMaterial = this->openMaterialFile(materialFileName); 16 | if(newMaterial != 0) 17 | this->materialMap[materialFileName] = newMaterial; 18 | } 19 | } 20 | return newMaterial; 21 | } 22 | Material* MaterialDatabase::findMaterial(std::string materialFileName) 23 | { 24 | std::map::iterator it; 25 | it = this->materialMap.find(materialFileName); 26 | if(it != this->materialMap.end()) 27 | return it->second; 28 | else 29 | return 0; 30 | } 31 | Material* MaterialDatabase::openMaterialFile(std::string materialFileName) 32 | { 33 | std::string materialPath = Singleton::Instance()->getMaterialPath(); 34 | std::string fullPath = materialPath + materialFileName + ".xml"; 35 | 36 | Material* material = new Material(); 37 | 38 | //XML loading 39 | TiXmlDocument doc; 40 | doc.LoadFile(fullPath.c_str()); 41 | if(doc.Error()) throw std::runtime_error(doc.ErrorDesc()); 42 | TiXmlHandle docHandle(&doc); 43 | TiXmlElement* materialElement = docHandle.FirstChild("material").ToElement(); 44 | material->initialize(materialElement); 45 | 46 | return material; 47 | } -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionShapes/btCollisionMargin.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_COLLISION_MARGIN_H 17 | #define BT_COLLISION_MARGIN_H 18 | 19 | ///The CONVEX_DISTANCE_MARGIN is a default collision margin for convex collision shapes derived from btConvexInternalShape. 20 | ///This collision margin is used by Gjk and some other algorithms 21 | ///Note that when creating small objects, you need to make sure to set a smaller collision margin, using the 'setMargin' API 22 | #define CONVEX_DISTANCE_MARGIN btScalar(0.04)// btScalar(0.1)//;//btScalar(0.01) 23 | 24 | 25 | 26 | #endif //BT_COLLISION_MARGIN_H 27 | 28 | -------------------------------------------------------------------------------- /include/glm/core/type_mat.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_mat.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /include/glm/core/type_vec.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_vec.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btEmptyCollisionAlgorithm.h" 17 | 18 | 19 | 20 | btEmptyAlgorithm::btEmptyAlgorithm(const btCollisionAlgorithmConstructionInfo& ci) 21 | : btCollisionAlgorithm(ci) 22 | { 23 | } 24 | 25 | void btEmptyAlgorithm::processCollision (btCollisionObject* ,btCollisionObject* ,const btDispatcherInfo& ,btManifoldResult* ) 26 | { 27 | } 28 | 29 | btScalar btEmptyAlgorithm::calculateTimeOfImpact(btCollisionObject* ,btCollisionObject* ,const btDispatcherInfo& ,btManifoldResult* ) 30 | { 31 | return btScalar(1.); 32 | } 33 | 34 | 35 | -------------------------------------------------------------------------------- /data/meshes/cube.obj: -------------------------------------------------------------------------------- 1 | # This file uses centimeters as units for non-parametric coordinates. 2 | 3 | mtllib cube.mtl 4 | g default 5 | v -0.500000 -0.500000 0.500000 6 | v 0.500000 -0.500000 0.500000 7 | v -0.500000 0.500000 0.500000 8 | v 0.500000 0.500000 0.500000 9 | v -0.500000 0.500000 -0.500000 10 | v 0.500000 0.500000 -0.500000 11 | v -0.500000 -0.500000 -0.500000 12 | v 0.500000 -0.500000 -0.500000 13 | vn 0.000000 0.000000 1.000000 14 | vn 0.000000 0.000000 1.000000 15 | vn 0.000000 0.000000 1.000000 16 | vn 0.000000 0.000000 1.000000 17 | vn 0.000000 1.000000 0.000000 18 | vn 0.000000 1.000000 0.000000 19 | vn 0.000000 1.000000 0.000000 20 | vn 0.000000 1.000000 0.000000 21 | vn 0.000000 0.000000 -1.000000 22 | vn 0.000000 0.000000 -1.000000 23 | vn 0.000000 0.000000 -1.000000 24 | vn 0.000000 0.000000 -1.000000 25 | vn 0.000000 -1.000000 0.000000 26 | vn 0.000000 -1.000000 0.000000 27 | vn 0.000000 -1.000000 0.000000 28 | vn 0.000000 -1.000000 0.000000 29 | vn 1.000000 0.000000 0.000000 30 | vn 1.000000 0.000000 0.000000 31 | vn 1.000000 0.000000 0.000000 32 | vn 1.000000 0.000000 0.000000 33 | vn -1.000000 0.000000 0.000000 34 | vn -1.000000 0.000000 0.000000 35 | vn -1.000000 0.000000 0.000000 36 | vn -1.000000 0.000000 0.000000 37 | s 1 38 | g pCube1 39 | usemtl initialShadingGroup 40 | f 1//1 2//2 3//3 41 | f 3//3 2//2 4//4 42 | s 2 43 | f 3//5 4//6 5//7 44 | f 5//7 4//6 6//8 45 | s 3 46 | f 5//9 6//10 7//11 47 | f 7//11 6//10 8//12 48 | s 4 49 | f 7//13 8//14 1//15 50 | f 1//15 8//14 2//16 51 | s 5 52 | f 2//17 8//18 4//19 53 | f 4//19 8//18 6//20 54 | s 6 55 | f 7//21 1//22 5//23 56 | f 5//23 1//22 3//24 57 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionShapes/btMaterial.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | /// This file was created by Alex Silverman 17 | 18 | #ifndef BT_MATERIAL_H 19 | #define BT_MATERIAL_H 20 | 21 | // Material class to be used by btMultimaterialTriangleMeshShape to store triangle properties 22 | class btMaterial 23 | { 24 | // public members so that materials can change due to world events 25 | public: 26 | btScalar m_friction; 27 | btScalar m_restitution; 28 | int pad[2]; 29 | 30 | btMaterial(){} 31 | btMaterial(btScalar fric, btScalar rest) { m_friction = fric; m_restitution = rest; } 32 | }; 33 | 34 | #endif // BT_MATERIAL_H 35 | 36 | -------------------------------------------------------------------------------- /include/glm/gtx/unsigned_int.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_unsigned_int extension is deprecated, include GLM_GTX_integer instead") 26 | #endif 27 | -------------------------------------------------------------------------------- /include/glm/core/intrinsic_exponential.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_exponential.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /include/glm/core/intrinsic_trigonometric.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_trigonometric.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /src/OpenGL/GLUniformBlock.cpp: -------------------------------------------------------------------------------- 1 | #include "GLUniformBlock.h" 2 | 3 | GLUniformBlock::GLUniformBlock(){} 4 | GLUniformBlock::~GLUniformBlock(){} 5 | 6 | //Other 7 | void GLUniformBlock::bindToProgram(GLuint program) 8 | { 9 | GLuint uniformBlockIndex = glGetUniformBlockIndex(program, this->name.c_str()); 10 | glUniformBlockBinding(program, uniformBlockIndex, this->bindingIndex); 11 | } 12 | //Setters 13 | void GLUniformBlock::setName(std::string name) 14 | { 15 | this->name = name; 16 | } 17 | void GLUniformBlock::createUBO() 18 | { 19 | GLuint ubo; 20 | glGenBuffers(1, &ubo); 21 | glBindBuffer(GL_UNIFORM_BUFFER, ubo); 22 | glBufferData(GL_UNIFORM_BUFFER, this->size, 0, GL_STREAM_DRAW); 23 | glBindBuffer(GL_UNIFORM_BUFFER, 0); 24 | glBindBufferRange(GL_UNIFORM_BUFFER, this->bindingIndex, ubo, 0, this->size); 25 | this->setUBO(ubo); 26 | } 27 | void GLUniformBlock::setUBO(GLuint ubo) 28 | { 29 | this->ubo = ubo; 30 | } 31 | void GLUniformBlock::setBindingIndex(int index) 32 | { 33 | this->bindingIndex = index; 34 | } 35 | void GLUniformBlock::setSize(int size) 36 | { 37 | this->size = size; 38 | } 39 | void GLUniformBlock::setData(void* data) 40 | { 41 | glBindBuffer(GL_UNIFORM_BUFFER, this->ubo); 42 | glBufferSubData(GL_UNIFORM_BUFFER, 0, this->size, data); 43 | glBindBuffer(GL_UNIFORM_BUFFER, 0); 44 | } 45 | 46 | //Getters 47 | std::string GLUniformBlock::getName() 48 | { 49 | return this->name; 50 | } 51 | GLuint GLUniformBlock::getUBO() 52 | { 53 | return this->ubo; 54 | } 55 | int GLUniformBlock::getBindingIndex() 56 | { 57 | return this->bindingIndex; 58 | } 59 | int GLUniformBlock::getSize() 60 | { 61 | return this->size; 62 | } -------------------------------------------------------------------------------- /include/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtc_swizzle 24 | /// @file glm/gtc/swizzle.inl 25 | /// @date 2009-06-14 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | namespace glm 30 | { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/OpenGL/Programs/GLProgram_Reflection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "GLProgram.h" 4 | 5 | class GLProgram_Reflection: public GLProgram 6 | { 7 | public: 8 | GLProgram_Reflection() : GLProgram(){} 9 | virtual ~GLProgram_Reflection(){} 10 | 11 | protected: 12 | virtual void bindUniformBlocks() 13 | { 14 | this->bindUniformBlock(GLUniformBlockHelper::TYPE_PROJECTION); 15 | } 16 | virtual void fillUniforms() 17 | { 18 | GLState* glState = Singleton::Instance(); 19 | 20 | //position texture 21 | int positionTexture = glState->positionTextureUnit; 22 | GLuint positionTextureUniform = glGetUniformLocation(this->program, "positionTexture"); 23 | glUniform1i(positionTextureUniform, positionTexture); 24 | 25 | //normal texture 26 | int normalTexture = glState->normalTextureUnit; 27 | GLuint normalTextureUniform = glGetUniformLocation(this->program, "normalTexture"); 28 | glUniform1i(normalTextureUniform, normalTexture); 29 | 30 | //other texture 31 | int otherTexture = glState->otherTextureUnit; 32 | GLuint otherTextureUniform = glGetUniformLocation(this->program, "otherTexture"); 33 | glUniform1i(otherTextureUniform, otherTexture); 34 | 35 | //depth texture 36 | int depthTexture = glState->depthTextureUnit; 37 | GLuint depthTextureUniform = glGetUniformLocation(this->program, "depthTexture"); 38 | glUniform1i(depthTextureUniform, depthTexture); 39 | 40 | //color buffer texture 41 | int colorBufferTexture = glState->colorBufferTextureUnit; 42 | GLuint colorBufferTextureUniform = glGetUniformLocation(this->program, "colorBufferTexture"); 43 | glUniform1i(colorBufferTextureUniform, colorBufferTexture); 44 | } 45 | }; -------------------------------------------------------------------------------- /include/bullet/LinearMath/btRandom.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ 3 | 4 | This software is provided 'as-is', without any express or implied warranty. 5 | In no event will the authors be held liable for any damages arising from the use of this software. 6 | Permission is granted to anyone to use this software for any purpose, 7 | including commercial applications, and to alter it and redistribute it freely, 8 | subject to the following restrictions: 9 | 10 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 11 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 12 | 3. This notice may not be removed or altered from any source distribution. 13 | */ 14 | 15 | 16 | 17 | #ifndef BT_GEN_RANDOM_H 18 | #define BT_GEN_RANDOM_H 19 | 20 | #ifdef MT19937 21 | 22 | #include 23 | #include 24 | 25 | #define GEN_RAND_MAX UINT_MAX 26 | 27 | SIMD_FORCE_INLINE void GEN_srand(unsigned int seed) { init_genrand(seed); } 28 | SIMD_FORCE_INLINE unsigned int GEN_rand() { return genrand_int32(); } 29 | 30 | #else 31 | 32 | #include 33 | 34 | #define GEN_RAND_MAX RAND_MAX 35 | 36 | SIMD_FORCE_INLINE void GEN_srand(unsigned int seed) { srand(seed); } 37 | SIMD_FORCE_INLINE unsigned int GEN_rand() { return rand(); } 38 | 39 | #endif 40 | 41 | #endif //BT_GEN_RANDOM_H 42 | 43 | -------------------------------------------------------------------------------- /include/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-01-07 5 | // Updated : 2008-10-05 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/extend.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | genType extend 14 | ( 15 | genType const & Origin, 16 | genType const & Source, 17 | genType const & Distance 18 | ) 19 | { 20 | return Origin + (Source - Origin) * Distance; 21 | } 22 | 23 | template 24 | detail::tvec2 extend 25 | ( 26 | detail::tvec2 const & Origin, 27 | detail::tvec2 const & Source, 28 | valType const & Distance 29 | ) 30 | { 31 | return Origin + (Source - Origin) * Distance; 32 | } 33 | 34 | template 35 | detail::tvec3 extend 36 | ( 37 | detail::tvec3 const & Origin, 38 | detail::tvec3 const & Source, 39 | valType const & Distance 40 | ) 41 | { 42 | return Origin + (Source - Origin) * Distance; 43 | } 44 | 45 | template 46 | detail::tvec4 extend 47 | ( 48 | detail::tvec4 const & Origin, 49 | detail::tvec4 const & Source, 50 | valType const & Distance 51 | ) 52 | { 53 | return Origin + (Source - Origin) * Distance; 54 | } 55 | }//namespace glm 56 | -------------------------------------------------------------------------------- /include/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2009-03-06 5 | // Updated : 2009-03-09 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/gradient_paint.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | valType radialGradient 14 | ( 15 | detail::tvec2 const & Center, 16 | valType const & Radius, 17 | detail::tvec2 const & Focal, 18 | detail::tvec2 const & Position 19 | ) 20 | { 21 | detail::tvec2 F = Focal - Center; 22 | detail::tvec2 D = Position - Focal; 23 | valType Radius2 = pow2(Radius); 24 | valType Fx2 = pow2(F.x); 25 | valType Fy2 = pow2(F.y); 26 | 27 | valType Numerator = (D.x * F.x + D.y * F.y) + sqrt(Radius2 * (pow2(D.x) + pow2(D.y)) - pow2(D.x * F.y - D.y * F.x)); 28 | valType Denominator = Radius2 - (Fx2 + Fy2); 29 | return Numerator / Denominator; 30 | } 31 | 32 | template 33 | valType linearGradient 34 | ( 35 | detail::tvec2 const & Point0, 36 | detail::tvec2 const & Point1, 37 | detail::tvec2 const & Position 38 | ) 39 | { 40 | detail::tvec2 Dist = Point1 - Point0; 41 | return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); 42 | } 43 | }//namespace glm 44 | -------------------------------------------------------------------------------- /include/srutil/delegate/detail/make_delegates.pl: -------------------------------------------------------------------------------- 1 | #/usr/bin/perl 2 | use strict; 3 | 4 | #configuration 5 | my $max_param_count = 10; 6 | 7 | #implementation 8 | open(OUTPUT, ">delegate_list.hpp") || die $!; 9 | print(OUTPUT "// Automaticly generaged by $0\n\n"); 10 | 11 | my @param_list; 12 | for (my $param_count = 0; $param_count <= $max_param_count; 13 | push(@param_list, ++$param_count)) 14 | { 15 | print(OUTPUT "// $param_count params\n"); 16 | 17 | print(OUTPUT "#define SRUTIL_DELEGATE_PARAM_COUNT $param_count\n"); 18 | 19 | print(OUTPUT "#define SRUTIL_DELEGATE_TEMPLATE_PARAMS ", 20 | join(", ", map({"typename A$_"} @param_list)), "\n"); 21 | 22 | print(OUTPUT "#define SRUTIL_DELEGATE_TEMPLATE_ARGS ", 23 | join(", ", map({"A$_"} @param_list)), "\n"); 24 | 25 | print(OUTPUT "#define SRUTIL_DELEGATE_PARAMS ", 26 | join(", ", map({"A$_ a$_"} @param_list)), "\n"); 27 | 28 | print(OUTPUT "#define SRUTIL_DELEGATE_ARGS ", 29 | join(",", map({"a$_"} @param_list)), "\n"); 30 | 31 | print(OUTPUT "#define SRUTIL_DELEGATE_INVOKER_INITIALIZATION_LIST ", 32 | join(",", map({"a$_(a$_)"} @param_list)), "\n"); 33 | 34 | print(OUTPUT "#define SRUTIL_DELEGATE_INVOKER_DATA ", 35 | map({"A$_ a$_;"} @param_list), "\n"); 36 | 37 | print(OUTPUT '#include "delegate_template.hpp"', "\n", 38 | "#undef SRUTIL_DELEGATE_PARAM_COUNT\n", 39 | "#undef SRUTIL_DELEGATE_TEMPLATE_PARAMS\n", 40 | "#undef SRUTIL_DELEGATE_TEMPLATE_ARGS\n", 41 | "#undef SRUTIL_DELEGATE_PARAMS\n", 42 | "#undef SRUTIL_DELEGATE_ARGS\n", 43 | "#undef SRUTIL_DELEGATE_INVOKER_INITIALIZATION_LIST\n", 44 | "#undef SRUTIL_DELEGATE_INVOKER_DATA\n", 45 | "\n"); 46 | } 47 | close(OUTPUT) || die $!; 48 | 0; 49 | -------------------------------------------------------------------------------- /include/glm/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-27 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/optimum_pow.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType pow2(const genType& x) 14 | { 15 | return x * x; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER genType pow3(const genType& x) 20 | { 21 | return x * x * x; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER genType pow4(const genType& x) 26 | { 27 | return x * x * x * x; 28 | } 29 | 30 | GLM_FUNC_QUALIFIER bool powOfTwo(int x) 31 | { 32 | return !(x & (x - 1)); 33 | } 34 | 35 | GLM_FUNC_QUALIFIER detail::tvec2 powOfTwo(const detail::tvec2& x) 36 | { 37 | return detail::tvec2( 38 | powOfTwo(x.x), 39 | powOfTwo(x.y)); 40 | } 41 | 42 | GLM_FUNC_QUALIFIER detail::tvec3 powOfTwo(const detail::tvec3& x) 43 | { 44 | return detail::tvec3( 45 | powOfTwo(x.x), 46 | powOfTwo(x.y), 47 | powOfTwo(x.z)); 48 | } 49 | 50 | GLM_FUNC_QUALIFIER detail::tvec4 powOfTwo(const detail::tvec4& x) 51 | { 52 | return detail::tvec4( 53 | powOfTwo(x.x), 54 | powOfTwo(x.y), 55 | powOfTwo(x.z), 56 | powOfTwo(x.w)); 57 | } 58 | }//namespace glm 59 | -------------------------------------------------------------------------------- /include/glm/gtx/vector_angle.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-30 5 | // Updated : 2008-09-29 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/vector_angle.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER typename genType::value_type angle 14 | ( 15 | genType const & x, 16 | genType const & y 17 | ) 18 | { 19 | return degrees(acos(dot(x, y))); 20 | } 21 | 22 | //! \todo epsilon is hard coded to 0.01 23 | template 24 | GLM_FUNC_QUALIFIER valType orientedAngle 25 | ( 26 | detail::tvec2 const & x, 27 | detail::tvec2 const & y 28 | ) 29 | { 30 | valType Angle = glm::degrees(acos(dot(x, y))); 31 | detail::tvec2 TransformedVector = glm::rotate(x, Angle); 32 | if(all(equalEpsilon(y, TransformedVector, valType(0.01)))) 33 | return Angle; 34 | else 35 | return -Angle; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER valType orientedAngle 40 | ( 41 | detail::tvec3 const & x, 42 | detail::tvec3 const & y, 43 | detail::tvec3 const & ref 44 | ) 45 | { 46 | valType Angle = glm::degrees(glm::acos(glm::dot(x, y))); 47 | 48 | if(glm::dot(ref, glm::cross(x, y)) < valType(0)) 49 | return -Angle; 50 | else 51 | return Angle; 52 | } 53 | }//namespace glm 54 | -------------------------------------------------------------------------------- /include/glm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(NAME glm) 2 | 3 | file(GLOB ROOT_SOURCE *.cpp) 4 | file(GLOB ROOT_INLINE *.inl) 5 | file(GLOB ROOT_HEADER *.hpp) 6 | 7 | file(GLOB_RECURSE CORE_SOURCE ./core/*.cpp) 8 | file(GLOB_RECURSE CORE_INLINE ./core/*.inl) 9 | file(GLOB_RECURSE CORE_HEADER ./core/*.hpp) 10 | 11 | file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp) 12 | file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl) 13 | file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp) 14 | 15 | file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp) 16 | file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl) 17 | file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp) 18 | 19 | file(GLOB_RECURSE VIRTREV_SOURCE ./virtrev/*.cpp) 20 | file(GLOB_RECURSE VIRTREV_INLINE ./virtrev/*.inl) 21 | file(GLOB_RECURSE VIRTREV_HEADER ./virtrev/*.hpp) 22 | 23 | source_group("Core Files" FILES ${CORE_SOURCE}) 24 | source_group("Core Files" FILES ${CORE_INLINE}) 25 | source_group("Core Files" FILES ${CORE_HEADER}) 26 | source_group("GTC Files" FILES ${GTC_SOURCE}) 27 | source_group("GTC Files" FILES ${GTC_INLINE}) 28 | source_group("GTC Files" FILES ${GTC_HEADER}) 29 | source_group("GTX Files" FILES ${GTX_SOURCE}) 30 | source_group("GTX Files" FILES ${GTX_INLINE}) 31 | source_group("GTX Files" FILES ${GTX_HEADER}) 32 | source_group("VIRTREV Files" FILES ${VIRTREV_SOURCE}) 33 | source_group("VIRTREV Files" FILES ${VIRTREV_INLINE}) 34 | source_group("VIRTREV Files" FILES ${VIRTREV_HEADER}) 35 | 36 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) 37 | 38 | add_executable(${NAME} 39 | ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} 40 | ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} 41 | ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} 42 | ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} 43 | ${VIRTREV_SOURCE} ${VIRTREV_INLINE} ${VIRTREV_HEADER}) 44 | -------------------------------------------------------------------------------- /include/bullet/BulletDynamics/Dynamics/btActionInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef _BT_ACTION_INTERFACE_H 17 | #define _BT_ACTION_INTERFACE_H 18 | 19 | class btIDebugDraw; 20 | class btCollisionWorld; 21 | 22 | #include "LinearMath/btScalar.h" 23 | #include "btRigidBody.h" 24 | 25 | ///Basic interface to allow actions such as vehicles and characters to be updated inside a btDynamicsWorld 26 | class btActionInterface 27 | { 28 | protected: 29 | 30 | static btRigidBody& getFixedBody(); 31 | 32 | 33 | public: 34 | 35 | virtual ~btActionInterface() 36 | { 37 | } 38 | 39 | virtual void updateAction( btCollisionWorld* collisionWorld, btScalar deltaTimeStep)=0; 40 | 41 | virtual void debugDraw(btIDebugDraw* debugDrawer) = 0; 42 | 43 | }; 44 | 45 | #endif //_BT_ACTION_INTERFACE_H 46 | 47 | -------------------------------------------------------------------------------- /include/bullet/LinearMath/btMotionState.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_MOTIONSTATE_H 17 | #define BT_MOTIONSTATE_H 18 | 19 | #include "btTransform.h" 20 | 21 | ///The btMotionState interface class allows the dynamics world to synchronize and interpolate the updated world transforms with graphics 22 | ///For optimizations, potentially only moving objects get synchronized (using setWorldPosition/setWorldOrientation) 23 | class btMotionState 24 | { 25 | public: 26 | 27 | virtual ~btMotionState() 28 | { 29 | 30 | } 31 | 32 | virtual void getWorldTransform(btTransform& worldTrans ) const =0; 33 | 34 | //Bullet only calls the update of worldtransform for active objects 35 | virtual void setWorldTransform(const btTransform& worldTrans)=0; 36 | 37 | 38 | }; 39 | 40 | #endif //BT_MOTIONSTATE_H 41 | -------------------------------------------------------------------------------- /src/SFMLCore.cpp: -------------------------------------------------------------------------------- 1 | #include "SFMLCore.h" 2 | 3 | SFMLCore::SFMLCore(void) 4 | { 5 | //Create the window 6 | int width = 1024; 7 | int height = 768; 8 | window = new sf::RenderWindow(); 9 | title = "OpenGLApplication"; 10 | window->Create(sf::VideoMode(width, height, 32), title); 11 | window->SetActive(); 12 | //window->EnableVerticalSync(true); 13 | //window->SetFramerateLimit(60); 14 | 15 | //Load GLDisplay 16 | GLDisplay* glDisplay = Singleton::Instance(); 17 | glDisplay->initialize(); 18 | glDisplay->resize(width,height); 19 | 20 | //Set GLDisplay world 21 | World* world = Singleton::Instance()->loadWorld("World1"); 22 | glDisplay->setWorld(world); 23 | glDisplay->initializePhysics(); 24 | 25 | //Handle events 26 | frameCount = 0; 27 | bool windowClosed = false; 28 | while (window->IsOpen()) 29 | { 30 | sf::Event myEvent; 31 | while (window->PollEvent(myEvent)) 32 | { 33 | Singleton::Instance()->processEvent(myEvent); 34 | if (myEvent.Type == sf::Event::Closed) 35 | { 36 | window->Close(); 37 | windowClosed = true; 38 | } 39 | } 40 | if(!windowClosed) 41 | { 42 | Singleton::Instance()->enterFrame(); 43 | window->Display(); 44 | this->showFPS(); 45 | } 46 | } 47 | } 48 | 49 | SFMLCore::~SFMLCore(void){} 50 | 51 | void SFMLCore::showFPS() 52 | { 53 | //Show fps 54 | frameCount++; 55 | float currentTime = clock.GetElapsedTime().AsSeconds(); 56 | 57 | if(currentTime >= 1.0f) 58 | { 59 | std::ostringstream ss; 60 | ss << title << " (fps: " << (frameCount/currentTime) << " )"; 61 | window->SetTitle(ss.str()); 62 | 63 | clock.Restart(); 64 | frameCount = 0; 65 | } 66 | } -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionShapes/btEmptyShape.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btEmptyShape.h" 17 | 18 | 19 | #include "btCollisionShape.h" 20 | 21 | 22 | btEmptyShape::btEmptyShape() : btConcaveShape () 23 | { 24 | m_shapeType = EMPTY_SHAPE_PROXYTYPE; 25 | } 26 | 27 | 28 | btEmptyShape::~btEmptyShape() 29 | { 30 | } 31 | 32 | 33 | ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version 34 | void btEmptyShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const 35 | { 36 | btVector3 margin(getMargin(),getMargin(),getMargin()); 37 | 38 | aabbMin = t.getOrigin() - margin; 39 | 40 | aabbMax = t.getOrigin() + margin; 41 | 42 | } 43 | 44 | void btEmptyShape::calculateLocalInertia(btScalar ,btVector3& ) const 45 | { 46 | btAssert(0); 47 | } 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/Gimpact/gim_geometry.h: -------------------------------------------------------------------------------- 1 | #ifndef GIM_GEOMETRY_H_INCLUDED 2 | #define GIM_GEOMETRY_H_INCLUDED 3 | 4 | /*! \file gim_geometry.h 5 | \author Francisco Leon Najera 6 | */ 7 | /* 8 | ----------------------------------------------------------------------------- 9 | This source file is part of GIMPACT Library. 10 | 11 | For the latest info, see http://gimpact.sourceforge.net/ 12 | 13 | Copyright (c) 2006 Francisco Leon Najera. C.C. 80087371. 14 | email: projectileman@yahoo.com 15 | 16 | This library is free software; you can redistribute it and/or 17 | modify it under the terms of EITHER: 18 | (1) The GNU Lesser General Public License as published by the Free 19 | Software Foundation; either version 2.1 of the License, or (at 20 | your option) any later version. The text of the GNU Lesser 21 | General Public License is included with this library in the 22 | file GIMPACT-LICENSE-LGPL.TXT. 23 | (2) The BSD-style license that is included with this library in 24 | the file GIMPACT-LICENSE-BSD.TXT. 25 | (3) The zlib/libpng license that is included with this library in 26 | the file GIMPACT-LICENSE-ZLIB.TXT. 27 | 28 | This library is distributed in the hope that it will be useful, 29 | but WITHOUT ANY WARRANTY; without even the implied warranty of 30 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files 31 | GIMPACT-LICENSE-LGPL.TXT, GIMPACT-LICENSE-ZLIB.TXT and GIMPACT-LICENSE-BSD.TXT for more details. 32 | 33 | ----------------------------------------------------------------------------- 34 | */ 35 | 36 | ///Additional Headers for Collision 37 | #include "gim_basic_geometry_operations.h" 38 | #include "gim_clip_polygon.h" 39 | #include "gim_box_collision.h" 40 | #include "gim_tri_collision.h" 41 | 42 | #endif // GIM_VECTOR_H_INCLUDED 43 | -------------------------------------------------------------------------------- /src/Objects/Cameras/Camera.cpp: -------------------------------------------------------------------------------- 1 | #include "Camera.h" 2 | 3 | std::string Camera::className = "Camera"; 4 | 5 | Camera::Camera(void) : Object(){} 6 | Camera::~Camera(void){} 7 | 8 | //Initialize 9 | void Camera::initialize(TiXmlElement* element) 10 | { 11 | Object::initialize(element); 12 | 13 | glm::vec3 cameraPos; 14 | TiXmlElement* cameraPosElement = element->FirstChildElement("cameraPos"); 15 | if(cameraPosElement) cameraPos = Utils::parseIntoVec3(cameraPosElement->FirstChild()->Value()); 16 | 17 | this->initialize(cameraPos); 18 | } 19 | void Camera::initialize(std::string name, glm::vec3 cameraPos) 20 | { 21 | Object::initialize(name); 22 | this->initialize(cameraPos); 23 | } 24 | void Camera::initialize(glm::vec3 cameraPos) 25 | { 26 | this->setCameraPos(cameraPos); 27 | } 28 | 29 | //Type 30 | std::string Camera::getClassname() 31 | { 32 | return Camera::className; 33 | } 34 | 35 | void Camera::CalcLookAtMatrix() 36 | { 37 | glm::vec3 rightDir = glm::normalize(glm::cross(this->lookDir, this->upDir)); 38 | glm::vec3 perpUpDir = glm::cross(rightDir, this->lookDir); 39 | 40 | glm::mat4 rotMat(1.0f); 41 | rotMat[0] = glm::vec4(rightDir, 0.0f); 42 | rotMat[1] = glm::vec4(perpUpDir, 0.0f); 43 | rotMat[2] = glm::vec4(-this->lookDir, 0.0f); 44 | 45 | rotMat = glm::transpose(rotMat); 46 | 47 | glm::mat4 transMat(1.0f); 48 | transMat[3] = glm::vec4(-this->cameraPos, 1.0f); 49 | 50 | this->worldToCameraMatrix = rotMat * transMat; 51 | } 52 | 53 | //Getters 54 | glm::mat4 Camera::getWorldToCameraMatrix() 55 | { 56 | return this->worldToCameraMatrix; 57 | } 58 | glm::vec3 Camera::getCameraPos(void) 59 | { 60 | return this->cameraPos; 61 | } 62 | glm::vec3 Camera::getLookDir(void) 63 | { 64 | return this->lookDir; 65 | } 66 | glm::vec3 Camera::getUpDir(void) 67 | { 68 | return this->upDir; 69 | } -------------------------------------------------------------------------------- /include/glm/core/type_vec.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_vec.hpp 25 | /// @date 2010-01-26 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type_vec 30 | #define glm_core_type_vec 31 | 32 | #include "type_gentype.hpp" 33 | 34 | namespace glm{ 35 | namespace detail 36 | { 37 | 38 | }//namespace detail 39 | }//namespace glm 40 | 41 | #endif//glm_core_type_vec 42 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionShapes/btBox2dShape.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btBox2dShape.h" 17 | 18 | 19 | //{ 20 | 21 | 22 | void btBox2dShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const 23 | { 24 | btTransformAabb(getHalfExtentsWithoutMargin(),getMargin(),t,aabbMin,aabbMax); 25 | } 26 | 27 | 28 | void btBox2dShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const 29 | { 30 | //btScalar margin = btScalar(0.); 31 | btVector3 halfExtents = getHalfExtentsWithMargin(); 32 | 33 | btScalar lx=btScalar(2.)*(halfExtents.x()); 34 | btScalar ly=btScalar(2.)*(halfExtents.y()); 35 | btScalar lz=btScalar(2.)*(halfExtents.z()); 36 | 37 | inertia.setValue(mass/(btScalar(12.0)) * (ly*ly + lz*lz), 38 | mass/(btScalar(12.0)) * (lx*lx + lz*lz), 39 | mass/(btScalar(12.0)) * (lx*lx + ly*ly)); 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /include/SFML/Graphics/BlendMode.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_BLENDMODE_HPP 26 | #define SFML_BLENDMODE_HPP 27 | 28 | namespace sf 29 | { 30 | //////////////////////////////////////////////////////////// 31 | /// \ingroup graphics 32 | /// \brief Available blending modes for drawing 33 | /// 34 | //////////////////////////////////////////////////////////// 35 | enum BlendMode 36 | { 37 | BlendAlpha, ///< Pixel = Source * Source.a + Dest * (1 - Source.a) 38 | BlendAdd, ///< Pixel = Source + Dest 39 | BlendMultiply, ///< Pixel = Source * Dest 40 | BlendNone ///< Pixel = Source 41 | }; 42 | 43 | } // namespace sf 44 | 45 | 46 | #endif // SFML_BLENDMODE_HPP 47 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2008 Erwin Coumans http://bulletphysics.com 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef __BT_ACTIVATING_COLLISION_ALGORITHM_H 17 | #define __BT_ACTIVATING_COLLISION_ALGORITHM_H 18 | 19 | #include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h" 20 | 21 | ///This class is not enabled yet (work-in-progress) to more aggressively activate objects. 22 | class btActivatingCollisionAlgorithm : public btCollisionAlgorithm 23 | { 24 | // btCollisionObject* m_colObj0; 25 | // btCollisionObject* m_colObj1; 26 | 27 | public: 28 | 29 | btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci); 30 | 31 | btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* colObj0,btCollisionObject* colObj1); 32 | 33 | virtual ~btActivatingCollisionAlgorithm(); 34 | 35 | }; 36 | #endif //__BT_ACTIVATING_COLLISION_ALGORITHM_H 37 | -------------------------------------------------------------------------------- /include/SFML/Audio/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_AUDIO_EXPORT_HPP 26 | #define SFML_AUDIO_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_AUDIO_EXPORTS) 38 | 39 | #define SFML_AUDIO_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_AUDIO_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_AUDIO_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /include/glm/core/hint.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/hint.hpp 25 | /// @date 2008-08-14 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type 30 | #define glm_core_type 31 | 32 | namespace glm 33 | { 34 | // Use dont_care, nicest and fastest to optimize implementations. 35 | class dont_care {}; 36 | class nicest {}; 37 | class fastest {}; 38 | }//namespace glm 39 | 40 | #endif//glm_core_type 41 | -------------------------------------------------------------------------------- /include/SFML/System/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SYSTEM_EXPORT_HPP 26 | #define SFML_SYSTEM_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_SYSTEM_EXPORTS) 38 | 39 | #define SFML_SYSTEM_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_SYSTEM_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_SYSTEM_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /include/SFML/Window/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_WINDOW_EXPORT_HPP 26 | #define SFML_WINDOW_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_WINDOW_EXPORTS) 38 | 39 | #define SFML_WINDOW_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_WINDOW_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_WINDOW_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /include/SFML/Network/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_NETWORK_EXPORT_HPP 26 | #define SFML_NETWORK_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_NETWORK_EXPORTS) 38 | 39 | #define SFML_NETWORK_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_NETWORK_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_NETWORK_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /include/SFML/Graphics/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_GRAPHICS_EXPORT_HPP 26 | #define SFML_GRAPHICS_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_GRAPHICS_EXPORTS) 38 | 39 | #define SFML_GRAPHICS_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_GRAPHICS_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_GRAPHICS_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_COLLISION_CREATE_FUNC 17 | #define BT_COLLISION_CREATE_FUNC 18 | 19 | #include "LinearMath/btAlignedObjectArray.h" 20 | class btCollisionAlgorithm; 21 | class btCollisionObject; 22 | 23 | struct btCollisionAlgorithmConstructionInfo; 24 | 25 | ///Used by the btCollisionDispatcher to register and create instances for btCollisionAlgorithm 26 | struct btCollisionAlgorithmCreateFunc 27 | { 28 | bool m_swapped; 29 | 30 | btCollisionAlgorithmCreateFunc() 31 | :m_swapped(false) 32 | { 33 | } 34 | virtual ~btCollisionAlgorithmCreateFunc(){}; 35 | 36 | virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& , btCollisionObject* body0,btCollisionObject* body1) 37 | { 38 | 39 | (void)body0; 40 | (void)body1; 41 | return 0; 42 | } 43 | }; 44 | #endif //BT_COLLISION_CREATE_FUNC 45 | 46 | -------------------------------------------------------------------------------- /include/glm/core/dummy.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/dummy.cpp 25 | /// @date 2011-01-19 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /// 28 | /// GLM is a header only library. There is nothing to compile. 29 | /// dummy.cpp exist only a wordaround for CMake file. 30 | /////////////////////////////////////////////////////////////////////////////////// 31 | 32 | #define GLM_MESSAGES 33 | #include "../glm.hpp" 34 | #include "../ext.hpp" 35 | 36 | //#error "GLM is a header only library" 37 | 38 | int main() 39 | { 40 | 41 | } 42 | -------------------------------------------------------------------------------- /include/glm/core/type_size.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_size.hpp 25 | /// @date 2008-10-05 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type_size 30 | #define glm_core_type_size 31 | 32 | #include 33 | 34 | namespace glm{ 35 | namespace detail 36 | { 37 | //typedef std::size_t size_t; 38 | typedef int sizeType; 39 | 40 | }//namespace detail 41 | }//namespace glm 42 | 43 | #endif//glm_core_type_size 44 | -------------------------------------------------------------------------------- /src/OpenGL/FrameBuffers/GLFramebuffer_DepthBuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "GLFramebuffer.h" 4 | 5 | class GLFramebuffer_DepthBuffer : public GLFramebuffer 6 | { 7 | public: 8 | 9 | GLFramebuffer_DepthBuffer() : GLFramebuffer(){} 10 | virtual ~GLFramebuffer_DepthBuffer(){} 11 | 12 | virtual void initialize() 13 | { 14 | GLFramebuffer::initialize(); 15 | 16 | //Screen dimensions 17 | GLView* glView = Singleton::Instance(); 18 | glm::ivec2 windowDimensions = glView->getWindowDimensions(); 19 | 20 | //Generate and bind fbo 21 | glGenFramebuffers(1, &fbo); 22 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); 23 | 24 | //Generate textures 25 | glGenTextures(1, &this->depthTexture); 26 | 27 | //Depth attachment 28 | glBindTexture(GL_TEXTURE_2D, depthTexture); 29 | glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, windowDimensions.x, windowDimensions.y, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL); 30 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 31 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 32 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 33 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 34 | glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthTexture, 0); 35 | 36 | //Set draw buffers 37 | this->bindForWriting(); 38 | 39 | //Error checking 40 | this->checkFBOErrors(); 41 | 42 | //Unbind FBO 43 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); 44 | } 45 | void bindForWriting() 46 | { 47 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); 48 | } 49 | void bindForReading(int textureUnit) 50 | { 51 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); 52 | 53 | //Depth 54 | glActiveTexture(GL_TEXTURE0 + textureUnit); 55 | glBindTexture(GL_TEXTURE_2D, this->depthTexture); 56 | } 57 | private: 58 | GLuint depthTexture; 59 | }; -------------------------------------------------------------------------------- /include/bullet/BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | 17 | #ifndef BT_CONVEX_PENETRATION_DEPTH_H 18 | #define BT_CONVEX_PENETRATION_DEPTH_H 19 | 20 | class btStackAlloc; 21 | class btVector3; 22 | #include "btSimplexSolverInterface.h" 23 | class btConvexShape; 24 | class btTransform; 25 | 26 | ///ConvexPenetrationDepthSolver provides an interface for penetration depth calculation. 27 | class btConvexPenetrationDepthSolver 28 | { 29 | public: 30 | 31 | virtual ~btConvexPenetrationDepthSolver() {}; 32 | virtual bool calcPenDepth( btSimplexSolverInterface& simplexSolver, 33 | const btConvexShape* convexA,const btConvexShape* convexB, 34 | const btTransform& transA,const btTransform& transB, 35 | btVector3& v, btVector3& pa, btVector3& pb, 36 | class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc 37 | ) = 0; 38 | 39 | 40 | }; 41 | #endif //BT_CONVEX_PENETRATION_DEPTH_H 42 | 43 | -------------------------------------------------------------------------------- /include/glm/gtx/component_wise.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-05-21 5 | // Updated : 2010-02-12 6 | // Licence : This source is under MIT License 7 | // File : gtx_component_wise.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER typename genType::value_type compAdd(genType const & v) 14 | { 15 | typename genType::size_type result = typename genType::value_type(0); 16 | for(typename genType::size_type i = 0; i < v.length(); ++i) 17 | result += v[i]; 18 | return result; 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER typename genType::value_type compMul(genType const & v) 23 | { 24 | typename genType::value_type result = typename genType::value_type(1); 25 | for(typename genType::size_type i = 0; i < v.length(); ++i) 26 | result *= v[i]; 27 | return result; 28 | } 29 | 30 | template 31 | GLM_FUNC_QUALIFIER typename genType::value_type compMin(genType const & v) 32 | { 33 | typename genType::value_type result = typename genType::value_type(v[0]); 34 | for(typename genType::size_type i = 1; i < v.length(); ++i) 35 | result = min(result, v[i]); 36 | return result; 37 | } 38 | 39 | template 40 | GLM_FUNC_QUALIFIER typename genType::value_type compMax(genType const & v) 41 | { 42 | typename genType::value_type result = typename genType::value_type(v[0]); 43 | for(typename genType::size_type i = 1; i < v.length(); ++i) 44 | result = max(result, v[i]); 45 | return result; 46 | } 47 | }//namespace glm 48 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionShapes/btTriangleCallback.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_TRIANGLE_CALLBACK_H 17 | #define BT_TRIANGLE_CALLBACK_H 18 | 19 | #include "LinearMath/btVector3.h" 20 | 21 | 22 | ///The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTriangles. 23 | ///This callback is called by processAllTriangles for all btConcaveShape derived class, such as btBvhTriangleMeshShape, btStaticPlaneShape and btHeightfieldTerrainShape. 24 | class btTriangleCallback 25 | { 26 | public: 27 | 28 | virtual ~btTriangleCallback(); 29 | virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex) = 0; 30 | }; 31 | 32 | class btInternalTriangleIndexCallback 33 | { 34 | public: 35 | 36 | virtual ~btInternalTriangleIndexCallback(); 37 | virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex) = 0; 38 | }; 39 | 40 | 41 | 42 | #endif //BT_TRIANGLE_CALLBACK_H 43 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Bullet Continuous Collision Detection and Physics Library 4 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 5 | 6 | This software is provided 'as-is', without any express or implied warranty. 7 | In no event will the authors be held liable for any damages arising from the use of this software. 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it freely, 10 | subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 13 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 14 | 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #ifndef OVERLAPPING_PAIR_CALLBACK_H 18 | #define OVERLAPPING_PAIR_CALLBACK_H 19 | 20 | class btDispatcher; 21 | struct btBroadphasePair; 22 | 23 | ///The btOverlappingPairCallback class is an additional optional broadphase user callback for adding/removing overlapping pairs, similar interface to btOverlappingPairCache. 24 | class btOverlappingPairCallback 25 | { 26 | public: 27 | virtual ~btOverlappingPairCallback() 28 | { 29 | 30 | } 31 | 32 | virtual btBroadphasePair* addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) = 0; 33 | 34 | virtual void* removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,btDispatcher* dispatcher) = 0; 35 | 36 | virtual void removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy0,btDispatcher* dispatcher) = 0; 37 | 38 | }; 39 | 40 | #endif //OVERLAPPING_PAIR_CALLBACK_H 41 | -------------------------------------------------------------------------------- /src/OpenGL/Programs/GLProgram_MotionBlur.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "GLProgram.h" 4 | 5 | class GLProgram_MotionBlur : public GLProgram 6 | { 7 | public: 8 | GLProgram_MotionBlur() : GLProgram(){} 9 | virtual ~GLProgram_MotionBlur(){} 10 | 11 | protected: 12 | virtual void bindUniformBlocks() 13 | { 14 | this->bindUniformBlock(GLUniformBlockHelper::TYPE_PROJECTION); 15 | } 16 | virtual void fillUniforms() 17 | { 18 | GLState* glState = Singleton::Instance(); 19 | 20 | 21 | //color buffer texture 22 | int colorBufferTexture = glState->colorBufferTextureUnit; 23 | GLuint colorBufferTextureUniform = glGetUniformLocation(this->program, "colorBufferTexture"); 24 | glUniform1i(colorBufferTextureUniform, colorBufferTexture); 25 | 26 | //depth texture 27 | int depthTexture = glState->depthTextureUnit; 28 | GLuint depthTextureUniform = glGetUniformLocation(this->program, "depthTexture"); 29 | glUniform1i(depthTextureUniform, depthTexture); 30 | 31 | //world to clip matrix 32 | glm::mat4 worldToClipMatrix = glState->cameraToClipMatrix*glState->worldToCameraMatrix; 33 | GLuint worldToClipMatrixUniform = glGetUniformLocation(this->program, "worldToClipMatrix"); 34 | glUniformMatrix4fv(worldToClipMatrixUniform, 1, GL_FALSE, glm::value_ptr(worldToClipMatrix)); 35 | 36 | //old world to clip matrix 37 | glm::mat4 oldWorldToClipMatrix = glState->cameraToClipMatrix*glState->oldWorldToCameraMatrix; 38 | GLuint oldWorldToClipMatrixUniform = glGetUniformLocation(this->program, "oldWorldToClipMatrix"); 39 | glUniformMatrix4fv(oldWorldToClipMatrixUniform, 1, GL_FALSE, glm::value_ptr(oldWorldToClipMatrix)); 40 | 41 | //clip to world matrix 42 | glm::mat4 clipToWorldMatrix = glm::inverse(worldToClipMatrix); 43 | GLuint clipToWorldMatrixUniform = glGetUniformLocation(this->program, "clipToWorldMatrix"); 44 | glUniformMatrix4fv(clipToWorldMatrixUniform, 1, GL_FALSE, glm::value_ptr(clipToWorldMatrix)); 45 | } 46 | }; -------------------------------------------------------------------------------- /include/SFML/Audio.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_AUDIO_HPP 26 | #define SFML_AUDIO_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | 42 | #endif // SFML_AUDIO_HPP 43 | 44 | //////////////////////////////////////////////////////////// 45 | /// \defgroup audio Audio module 46 | /// 47 | //////////////////////////////////////////////////////////// 48 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionDispatch/btCollisionConfiguration.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_COLLISION_CONFIGURATION 17 | #define BT_COLLISION_CONFIGURATION 18 | 19 | struct btCollisionAlgorithmCreateFunc; 20 | 21 | class btStackAlloc; 22 | class btPoolAllocator; 23 | 24 | ///btCollisionConfiguration allows to configure Bullet collision detection 25 | ///stack allocator size, default collision algorithms and persistent manifold pool size 26 | ///@todo: describe the meaning 27 | class btCollisionConfiguration 28 | { 29 | 30 | public: 31 | 32 | virtual ~btCollisionConfiguration() 33 | { 34 | } 35 | 36 | ///memory pools 37 | virtual btPoolAllocator* getPersistentManifoldPool() = 0; 38 | 39 | virtual btPoolAllocator* getCollisionAlgorithmPool() = 0; 40 | 41 | virtual btStackAlloc* getStackAllocator() = 0; 42 | 43 | virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1) =0; 44 | 45 | }; 46 | 47 | #endif //BT_COLLISION_CONFIGURATION 48 | 49 | -------------------------------------------------------------------------------- /include/SFML/Network.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_NETWORK_HPP 26 | #define SFML_NETWORK_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | 43 | #endif // SFML_NETWORK_HPP 44 | 45 | //////////////////////////////////////////////////////////// 46 | /// \defgroup network Network module 47 | /// 48 | //////////////////////////////////////////////////////////// 49 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2008 Erwin Coumans http://bulletphysics.com 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btActivatingCollisionAlgorithm.h" 17 | #include "btCollisionDispatcher.h" 18 | #include "btCollisionObject.h" 19 | 20 | btActivatingCollisionAlgorithm::btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci) 21 | :btCollisionAlgorithm(ci) 22 | //, 23 | //m_colObj0(0), 24 | //m_colObj1(0) 25 | { 26 | } 27 | btActivatingCollisionAlgorithm::btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* colObj0,btCollisionObject* colObj1) 28 | :btCollisionAlgorithm(ci) 29 | //, 30 | //m_colObj0(0), 31 | //m_colObj1(0) 32 | { 33 | // if (ci.m_dispatcher1->needsCollision(colObj0,colObj1)) 34 | // { 35 | // m_colObj0 = colObj0; 36 | // m_colObj1 = colObj1; 37 | // 38 | // m_colObj0->activate(); 39 | // m_colObj1->activate(); 40 | // } 41 | } 42 | 43 | btActivatingCollisionAlgorithm::~btActivatingCollisionAlgorithm() 44 | { 45 | // m_colObj0->activate(); 46 | // m_colObj1->activate(); 47 | } 48 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionDispatch/btInternalEdgeUtility.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef BT_INTERNAL_EDGE_UTILITY_H 3 | #define BT_INTERNAL_EDGE_UTILITY_H 4 | 5 | #include "LinearMath/btHashMap.h" 6 | #include "LinearMath/btVector3.h" 7 | 8 | #include "BulletCollision/CollisionShapes/btTriangleInfoMap.h" 9 | 10 | ///The btInternalEdgeUtility helps to avoid or reduce artifacts due to wrong collision normals caused by internal edges. 11 | ///See also http://code.google.com/p/bullet/issues/detail?id=27 12 | 13 | class btBvhTriangleMeshShape; 14 | class btCollisionObject; 15 | class btManifoldPoint; 16 | class btIDebugDraw; 17 | 18 | 19 | 20 | enum btInternalEdgeAdjustFlags 21 | { 22 | BT_TRIANGLE_CONVEX_BACKFACE_MODE = 1, 23 | BT_TRIANGLE_CONCAVE_DOUBLE_SIDED = 2, //double sided options are experimental, single sided is recommended 24 | BT_TRIANGLE_CONVEX_DOUBLE_SIDED = 4 25 | }; 26 | 27 | 28 | ///Call btGenerateInternalEdgeInfo to create triangle info, store in the shape 'userInfo' 29 | void btGenerateInternalEdgeInfo (btBvhTriangleMeshShape*trimeshShape, btTriangleInfoMap* triangleInfoMap); 30 | 31 | 32 | ///Call the btFixMeshNormal to adjust the collision normal, using the triangle info map (generated using btGenerateInternalEdgeInfo) 33 | ///If this info map is missing, or the triangle is not store in this map, nothing will be done 34 | void btAdjustInternalEdgeContacts(btManifoldPoint& cp, const btCollisionObject* trimeshColObj0,const btCollisionObject* otherColObj1, int partId0, int index0, int normalAdjustFlags = 0); 35 | 36 | ///Enable the BT_INTERNAL_EDGE_DEBUG_DRAW define and call btSetDebugDrawer, to get visual info to see if the internal edge utility works properly. 37 | ///If the utility doesn't work properly, you might have to adjust the threshold values in btTriangleInfoMap 38 | //#define BT_INTERNAL_EDGE_DEBUG_DRAW 39 | 40 | #ifdef BT_INTERNAL_EDGE_DEBUG_DRAW 41 | void btSetDebugDrawer(btIDebugDraw* debugDrawer); 42 | #endif //BT_INTERNAL_EDGE_DEBUG_DRAW 43 | 44 | 45 | #endif //BT_INTERNAL_EDGE_UTILITY_H 46 | 47 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_MINKOWSKI_PENETRATION_DEPTH_SOLVER_H 17 | #define BT_MINKOWSKI_PENETRATION_DEPTH_SOLVER_H 18 | 19 | #include "btConvexPenetrationDepthSolver.h" 20 | 21 | ///MinkowskiPenetrationDepthSolver implements bruteforce penetration depth estimation. 22 | ///Implementation is based on sampling the depth using support mapping, and using GJK step to get the witness points. 23 | class btMinkowskiPenetrationDepthSolver : public btConvexPenetrationDepthSolver 24 | { 25 | protected: 26 | 27 | static btVector3* getPenetrationDirections(); 28 | 29 | public: 30 | 31 | virtual bool calcPenDepth( btSimplexSolverInterface& simplexSolver, 32 | const btConvexShape* convexA,const btConvexShape* convexB, 33 | const btTransform& transA,const btTransform& transB, 34 | btVector3& v, btVector3& pa, btVector3& pb, 35 | class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc 36 | ); 37 | }; 38 | 39 | #endif //BT_MINKOWSKI_PENETRATION_DEPTH_SOLVER_H 40 | 41 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | EPA Copyright (c) Ricardo Padrela 2006 6 | 7 | This software is provided 'as-is', without any express or implied warranty. 8 | In no event will the authors be held liable for any damages arising from the use of this software. 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it freely, 11 | subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 14 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 15 | 3. This notice may not be removed or altered from any source distribution. 16 | */ 17 | #ifndef BT_GJP_EPA_PENETRATION_DEPTH_H 18 | #define BT_GJP_EPA_PENETRATION_DEPTH_H 19 | 20 | #include "btConvexPenetrationDepthSolver.h" 21 | 22 | ///EpaPenetrationDepthSolver uses the Expanding Polytope Algorithm to 23 | ///calculate the penetration depth between two convex shapes. 24 | class btGjkEpaPenetrationDepthSolver : public btConvexPenetrationDepthSolver 25 | { 26 | public : 27 | 28 | btGjkEpaPenetrationDepthSolver() 29 | { 30 | } 31 | 32 | bool calcPenDepth( btSimplexSolverInterface& simplexSolver, 33 | const btConvexShape* pConvexA, const btConvexShape* pConvexB, 34 | const btTransform& transformA, const btTransform& transformB, 35 | btVector3& v, btVector3& wWitnessOnA, btVector3& wWitnessOnB, 36 | class btIDebugDraw* debugDraw,btStackAlloc* stackAlloc ); 37 | 38 | private : 39 | 40 | }; 41 | 42 | #endif // BT_GJP_EPA_PENETRATION_DEPTH_H 43 | 44 | -------------------------------------------------------------------------------- /include/SFML/Network/SocketHandle.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SOCKETHANDLE_HPP 26 | #define SFML_SOCKETHANDLE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | #if defined(SFML_SYSTEM_WINDOWS) 34 | #include 35 | #endif 36 | 37 | 38 | namespace sf 39 | { 40 | //////////////////////////////////////////////////////////// 41 | // Define the low-level socket handle type, specific to 42 | // each platform 43 | //////////////////////////////////////////////////////////// 44 | #if defined(SFML_SYSTEM_WINDOWS) 45 | 46 | typedef UINT_PTR SocketHandle; 47 | 48 | #else 49 | 50 | typedef int SocketHandle; 51 | 52 | #endif 53 | 54 | } // namespace sf 55 | 56 | 57 | #endif // SFML_SOCKETHANDLE_HPP 58 | -------------------------------------------------------------------------------- /include/SFML/System/Sleep.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SLEEP_HPP 26 | #define SFML_SLEEP_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | //////////////////////////////////////////////////////////// 38 | /// \ingroup system 39 | /// \brief Make the current thread sleep for a given duration 40 | /// 41 | /// sf::Sleep is the best way to block a program or one of its 42 | /// threads, as it doesn't consume any CPU power. 43 | /// 44 | /// \param duration Time to sleep 45 | /// 46 | //////////////////////////////////////////////////////////// 47 | void SFML_SYSTEM_API Sleep(Time duration); 48 | 49 | } // namespace sf 50 | 51 | 52 | #endif // SFML_SLEEP_HPP 53 | -------------------------------------------------------------------------------- /include/SFML/Window.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SFML_WINDOW_HPP 26 | #define SFML_SFML_WINDOW_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | 44 | #endif // SFML_SFML_WINDOW_HPP 45 | 46 | //////////////////////////////////////////////////////////// 47 | /// \defgroup window Window module 48 | /// 49 | //////////////////////////////////////////////////////////// 50 | -------------------------------------------------------------------------------- /include/tinyxml/tinyxmlerror.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | www.sourceforge.net/projects/tinyxml 3 | Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any 7 | damages arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any 10 | purpose, including commercial applications, and to alter it and 11 | redistribute it freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must 14 | not claim that you wrote the original software. If you use this 15 | software in a product, an acknowledgment in the product documentation 16 | would be appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and 19 | must not be misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. 23 | */ 24 | 25 | #include "tinyxml.h" 26 | 27 | // The goal of the seperate error file is to make the first 28 | // step towards localization. tinyxml (currently) only supports 29 | // english error messages, but the could now be translated. 30 | // 31 | // It also cleans up the code a bit. 32 | // 33 | 34 | const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] = 35 | { 36 | "No error", 37 | "Error", 38 | "Failed to open file", 39 | "Error parsing Element.", 40 | "Failed to read Element name", 41 | "Error reading Element value.", 42 | "Error reading Attributes.", 43 | "Error: empty tag.", 44 | "Error reading end tag.", 45 | "Error parsing Unknown.", 46 | "Error parsing Comment.", 47 | "Error parsing Declaration.", 48 | "Error document empty.", 49 | "Error null (0) or unexpected EOF found in input stream.", 50 | "Error parsing CDATA.", 51 | "Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.", 52 | }; 53 | -------------------------------------------------------------------------------- /include/bullet/LinearMath/btMinMax.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ 3 | 4 | This software is provided 'as-is', without any express or implied warranty. 5 | In no event will the authors be held liable for any damages arising from the use of this software. 6 | Permission is granted to anyone to use this software for any purpose, 7 | including commercial applications, and to alter it and redistribute it freely, 8 | subject to the following restrictions: 9 | 10 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 11 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 12 | 3. This notice may not be removed or altered from any source distribution. 13 | */ 14 | 15 | 16 | 17 | #ifndef BT_GEN_MINMAX_H 18 | #define BT_GEN_MINMAX_H 19 | 20 | #include "LinearMath/btScalar.h" 21 | 22 | template 23 | SIMD_FORCE_INLINE const T& btMin(const T& a, const T& b) 24 | { 25 | return a < b ? a : b ; 26 | } 27 | 28 | template 29 | SIMD_FORCE_INLINE const T& btMax(const T& a, const T& b) 30 | { 31 | return a > b ? a : b; 32 | } 33 | 34 | template 35 | SIMD_FORCE_INLINE const T& btClamped(const T& a, const T& lb, const T& ub) 36 | { 37 | return a < lb ? lb : (ub < a ? ub : a); 38 | } 39 | 40 | template 41 | SIMD_FORCE_INLINE void btSetMin(T& a, const T& b) 42 | { 43 | if (b < a) 44 | { 45 | a = b; 46 | } 47 | } 48 | 49 | template 50 | SIMD_FORCE_INLINE void btSetMax(T& a, const T& b) 51 | { 52 | if (a < b) 53 | { 54 | a = b; 55 | } 56 | } 57 | 58 | template 59 | SIMD_FORCE_INLINE void btClamp(T& a, const T& lb, const T& ub) 60 | { 61 | if (a < lb) 62 | { 63 | a = lb; 64 | } 65 | else if (ub < a) 66 | { 67 | a = ub; 68 | } 69 | } 70 | 71 | #endif //BT_GEN_MINMAX_H 72 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp: -------------------------------------------------------------------------------- 1 | 2 | //Bullet Continuous Collision Detection and Physics Library 3 | //Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | 6 | // 7 | // btAxisSweep3 8 | // 9 | // Copyright (c) 2006 Simon Hobbs 10 | // 11 | // This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. 12 | // 13 | // Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 16 | // 17 | // 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 18 | // 19 | // 3. This notice may not be removed or altered from any source distribution. 20 | #include "btAxisSweep3.h" 21 | 22 | 23 | btAxisSweep3::btAxisSweep3(const btVector3& worldAabbMin,const btVector3& worldAabbMax, unsigned short int maxHandles, btOverlappingPairCache* pairCache, bool disableRaycastAccelerator) 24 | :btAxisSweep3Internal(worldAabbMin,worldAabbMax,0xfffe,0xffff,maxHandles,pairCache,disableRaycastAccelerator) 25 | { 26 | // 1 handle is reserved as sentinel 27 | btAssert(maxHandles > 1 && maxHandles < 32767); 28 | 29 | } 30 | 31 | 32 | bt32BitAxisSweep3::bt32BitAxisSweep3(const btVector3& worldAabbMin,const btVector3& worldAabbMax, unsigned int maxHandles , btOverlappingPairCache* pairCache , bool disableRaycastAccelerator) 33 | :btAxisSweep3Internal(worldAabbMin,worldAabbMax,0xfffffffe,0x7fffffff,maxHandles,pairCache,disableRaycastAccelerator) 34 | { 35 | // 1 handle is reserved as sentinel 36 | btAssert(maxHandles > 1 && maxHandles < 2147483647); 37 | } 38 | -------------------------------------------------------------------------------- /include/bullet/LinearMath/btGeometryUtil.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ 3 | 4 | This software is provided 'as-is', without any express or implied warranty. 5 | In no event will the authors be held liable for any damages arising from the use of this software. 6 | Permission is granted to anyone to use this software for any purpose, 7 | including commercial applications, and to alter it and redistribute it freely, 8 | subject to the following restrictions: 9 | 10 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 11 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 12 | 3. This notice may not be removed or altered from any source distribution. 13 | */ 14 | 15 | 16 | #ifndef BT_GEOMETRY_UTIL_H 17 | #define BT_GEOMETRY_UTIL_H 18 | 19 | #include "btVector3.h" 20 | #include "btAlignedObjectArray.h" 21 | 22 | ///The btGeometryUtil helper class provides a few methods to convert between plane equations and vertices. 23 | class btGeometryUtil 24 | { 25 | public: 26 | 27 | 28 | static void getPlaneEquationsFromVertices(btAlignedObjectArray& vertices, btAlignedObjectArray& planeEquationsOut ); 29 | 30 | static void getVerticesFromPlaneEquations(const btAlignedObjectArray& planeEquations , btAlignedObjectArray& verticesOut ); 31 | 32 | static bool isInside(const btAlignedObjectArray& vertices, const btVector3& planeNormal, btScalar margin); 33 | 34 | static bool isPointInsidePlanes(const btAlignedObjectArray& planeEquations, const btVector3& point, btScalar margin); 35 | 36 | static bool areVerticesBehindPlane(const btVector3& planeNormal, const btAlignedObjectArray& vertices, btScalar margin); 37 | 38 | }; 39 | 40 | 41 | #endif //BT_GEOMETRY_UTIL_H 42 | 43 | -------------------------------------------------------------------------------- /include/glm/core/_fixes.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/_fixes.hpp 25 | /// @date 2011-02-21 / 2011-11-22 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #include 30 | 31 | //! Workaround for compatibility with other libraries 32 | #ifdef max 33 | #undef max 34 | #endif 35 | 36 | //! Workaround for compatibility with other libraries 37 | #ifdef min 38 | #undef min 39 | #endif 40 | 41 | //! Workaround for Android 42 | #ifdef isnan 43 | #undef isnan 44 | #endif 45 | 46 | //! Workaround for Android 47 | #ifdef isinf 48 | #undef isinf 49 | #endif 50 | 51 | //! Workaround for Chrone Native Client 52 | #ifdef log2 53 | #undef log2 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | 17 | 18 | #ifndef BT_GJK_CONVEX_CAST_H 19 | #define BT_GJK_CONVEX_CAST_H 20 | 21 | #include "BulletCollision/CollisionShapes/btCollisionMargin.h" 22 | 23 | #include "LinearMath/btVector3.h" 24 | #include "btConvexCast.h" 25 | class btConvexShape; 26 | class btMinkowskiSumShape; 27 | #include "btSimplexSolverInterface.h" 28 | 29 | ///GjkConvexCast performs a raycast on a convex object using support mapping. 30 | class btGjkConvexCast : public btConvexCast 31 | { 32 | btSimplexSolverInterface* m_simplexSolver; 33 | const btConvexShape* m_convexA; 34 | const btConvexShape* m_convexB; 35 | 36 | public: 37 | 38 | btGjkConvexCast(const btConvexShape* convexA,const btConvexShape* convexB,btSimplexSolverInterface* simplexSolver); 39 | 40 | /// cast a convex against another convex object 41 | virtual bool calcTimeOfImpact( 42 | const btTransform& fromA, 43 | const btTransform& toA, 44 | const btTransform& fromB, 45 | const btTransform& toB, 46 | CastResult& result); 47 | 48 | }; 49 | 50 | #endif //BT_GJK_CONVEX_CAST_H 51 | -------------------------------------------------------------------------------- /include/bullet/BulletDynamics/Vehicle/btWheelInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/ 3 | * 4 | * Permission to use, copy, modify, distribute and sell this software 5 | * and its documentation for any purpose is hereby granted without fee, 6 | * provided that the above copyright notice appear in all copies. 7 | * Erwin Coumans makes no representations about the suitability 8 | * of this software for any purpose. 9 | * It is provided "as is" without express or implied warranty. 10 | */ 11 | #include "btWheelInfo.h" 12 | #include "BulletDynamics/Dynamics/btRigidBody.h" // for pointvelocity 13 | 14 | 15 | btScalar btWheelInfo::getSuspensionRestLength() const 16 | { 17 | 18 | return m_suspensionRestLength1; 19 | 20 | } 21 | 22 | void btWheelInfo::updateWheel(const btRigidBody& chassis,RaycastInfo& raycastInfo) 23 | { 24 | (void)raycastInfo; 25 | 26 | 27 | if (m_raycastInfo.m_isInContact) 28 | 29 | { 30 | btScalar project= m_raycastInfo.m_contactNormalWS.dot( m_raycastInfo.m_wheelDirectionWS ); 31 | btVector3 chassis_velocity_at_contactPoint; 32 | btVector3 relpos = m_raycastInfo.m_contactPointWS - chassis.getCenterOfMassPosition(); 33 | chassis_velocity_at_contactPoint = chassis.getVelocityInLocalPoint( relpos ); 34 | btScalar projVel = m_raycastInfo.m_contactNormalWS.dot( chassis_velocity_at_contactPoint ); 35 | if ( project >= btScalar(-0.1)) 36 | { 37 | m_suspensionRelativeVelocity = btScalar(0.0); 38 | m_clippedInvContactDotSuspension = btScalar(1.0) / btScalar(0.1); 39 | } 40 | else 41 | { 42 | btScalar inv = btScalar(-1.) / project; 43 | m_suspensionRelativeVelocity = projVel * inv; 44 | m_clippedInvContactDotSuspension = inv; 45 | } 46 | 47 | } 48 | 49 | else // Not in contact : position wheel in a nice (rest length) position 50 | { 51 | m_raycastInfo.m_suspensionLength = this->getSuspensionRestLength(); 52 | m_suspensionRelativeVelocity = btScalar(0.0); 53 | m_raycastInfo.m_contactNormalWS = -m_raycastInfo.m_wheelDirectionWS; 54 | m_clippedInvContactDotSuspension = btScalar(1.0); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /include/glm/core/intrinsic_trigonometric.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_trigonometric.hpp 25 | /// @date 2009-06-09 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_trigonometric 30 | #define glm_detail_intrinsic_trigonometric 31 | 32 | #include "setup.hpp" 33 | 34 | #if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | 42 | }//namespace detail 43 | }//namespace glm 44 | 45 | #include "intrinsic_trigonometric.inl" 46 | 47 | #endif//GLM_ARCH 48 | #endif//glm_detail_intrinsic_trigonometric 49 | -------------------------------------------------------------------------------- /include/bullet/BulletDynamics/Character/btCharacterControllerInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2008 Erwin Coumans http://bulletphysics.com 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_CHARACTER_CONTROLLER_INTERFACE_H 17 | #define BT_CHARACTER_CONTROLLER_INTERFACE_H 18 | 19 | #include "LinearMath/btVector3.h" 20 | #include "BulletDynamics/Dynamics/btActionInterface.h" 21 | 22 | class btCollisionShape; 23 | class btRigidBody; 24 | class btCollisionWorld; 25 | 26 | class btCharacterControllerInterface : public btActionInterface 27 | { 28 | public: 29 | btCharacterControllerInterface () {}; 30 | virtual ~btCharacterControllerInterface () {}; 31 | 32 | virtual void setWalkDirection(const btVector3& walkDirection) = 0; 33 | virtual void setVelocityForTimeInterval(const btVector3& velocity, btScalar timeInterval) = 0; 34 | virtual void reset () = 0; 35 | virtual void warp (const btVector3& origin) = 0; 36 | 37 | virtual void preStep ( btCollisionWorld* collisionWorld) = 0; 38 | virtual void playerStep (btCollisionWorld* collisionWorld, btScalar dt) = 0; 39 | virtual bool canJump () const = 0; 40 | virtual void jump () = 0; 41 | 42 | virtual bool onGround () const = 0; 43 | }; 44 | 45 | #endif //BT_CHARACTER_CONTROLLER_INTERFACE_H 46 | 47 | -------------------------------------------------------------------------------- /src/OpenGL/Programs/GLProgram_ShadowMap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "GLProgram.h" 4 | 5 | class GLProgram_ShadowMap : public GLProgram 6 | { 7 | public: 8 | GLProgram_ShadowMap() : GLProgram(){} 9 | virtual ~GLProgram_ShadowMap(){} 10 | 11 | protected: 12 | virtual void bindUniformBlocks() 13 | { 14 | this->bindUniformBlock(GLUniformBlockHelper::TYPE_PROJECTION); 15 | } 16 | virtual void fillUniforms() 17 | { 18 | GLState* glState = Singleton::Instance(); 19 | 20 | //position texture 21 | int positionTexture = glState->positionTextureUnit; 22 | GLuint positionTextureUniform = glGetUniformLocation(this->program, "positionTexture"); 23 | glUniform1i(positionTextureUniform, positionTexture); 24 | 25 | //shadow map texture 26 | int shadowMapTexture = glState->shadowMapTextureUnit; 27 | GLuint shadowMapTextureUniform = glGetUniformLocation(this->program, "shadowMapTexture"); 28 | glUniform1i(shadowMapTextureUniform,shadowMapTexture); 29 | 30 | //color buffer texture 31 | int colorBufferTexture = glState->colorBufferTextureUnit; 32 | GLuint colorBufferTextureUniform = glGetUniformLocation(this->program, "colorBufferTexture"); 33 | glUniform1i(colorBufferTextureUniform, colorBufferTexture); 34 | 35 | //depth texture 36 | int depthTexture = glState->depthTextureUnit; 37 | GLuint depthTextureUniform = glGetUniformLocation(this->program, "depthTexture"); 38 | glUniform1i(depthTextureUniform, depthTexture); 39 | 40 | //camera to world matrix 41 | glm::mat4 cameraToWorldMatrix = glm::inverse(glState->worldToCameraMatrix); 42 | GLuint cameraToWorldMatrixUniform = glGetUniformLocation(this->program, "cameraToWorldMatrix"); 43 | glUniformMatrix4fv(cameraToWorldMatrixUniform, 1, GL_FALSE, glm::value_ptr(cameraToWorldMatrix)); 44 | 45 | //light world to camera matrix 46 | glm::mat4 lightWorldToCameraMatrix = glState->lightWorldToCameraMatrix; 47 | GLuint lightWorldToCameraMatrixUniform = glGetUniformLocation(this->program, "lightWorldToCameraMatrix"); 48 | glUniformMatrix4fv(lightWorldToCameraMatrixUniform, 1, GL_FALSE, glm::value_ptr(lightWorldToCameraMatrix)); 49 | } 50 | }; -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionDispatch/btBoxBoxDetector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Box-Box collision detection re-distributed under the ZLib license with permission from Russell L. Smith 3 | * Original version is from Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. 4 | * All rights reserved. Email: russ@q12.org Web: www.q12.org 5 | 6 | Bullet Continuous Collision Detection and Physics Library 7 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 8 | 9 | This software is provided 'as-is', without any express or implied warranty. 10 | In no event will the authors be held liable for any damages arising from the use of this software. 11 | Permission is granted to anyone to use this software for any purpose, 12 | including commercial applications, and to alter it and redistribute it freely, 13 | subject to the following restrictions: 14 | 15 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 16 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | */ 19 | #ifndef BT_BOX_BOX_DETECTOR_H 20 | #define BT_BOX_BOX_DETECTOR_H 21 | 22 | 23 | class btBoxShape; 24 | #include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h" 25 | 26 | 27 | /// btBoxBoxDetector wraps the ODE box-box collision detector 28 | /// re-distributed under the Zlib license with permission from Russell L. Smith 29 | struct btBoxBoxDetector : public btDiscreteCollisionDetectorInterface 30 | { 31 | btBoxShape* m_box1; 32 | btBoxShape* m_box2; 33 | 34 | public: 35 | 36 | btBoxBoxDetector(btBoxShape* box1,btBoxShape* box2); 37 | 38 | virtual ~btBoxBoxDetector() {}; 39 | 40 | virtual void getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults=false); 41 | 42 | }; 43 | 44 | #endif //BT_BOX_BOX_DETECTOR_H 45 | -------------------------------------------------------------------------------- /include/glm/core/intrinsic_vector_relational.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_vector_relational.hpp 25 | /// @date 2009-06-09 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_vector_relational 30 | #define glm_detail_intrinsic_vector_relational 31 | 32 | #include "setup.hpp" 33 | 34 | #if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | 42 | }//namespace detail 43 | }//namespace glm 44 | 45 | #include "intrinsic_vector_relational.inl" 46 | 47 | #endif//GLM_ARCH 48 | #endif//glm_detail_intrinsic_vector_relational 49 | -------------------------------------------------------------------------------- /include/bullet/BulletCollision/CollisionShapes/btConvexPolyhedron.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2011 Advanced Micro Devices, Inc. http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | 17 | ///This file was written by Erwin Coumans 18 | 19 | 20 | #ifndef _BT_POLYHEDRAL_FEATURES_H 21 | #define _BT_POLYHEDRAL_FEATURES_H 22 | 23 | #include "LinearMath/btTransform.h" 24 | #include "LinearMath/btAlignedObjectArray.h" 25 | 26 | #define TEST_INTERNAL_OBJECTS 1 27 | 28 | 29 | struct btFace 30 | { 31 | btAlignedObjectArray m_indices; 32 | // btAlignedObjectArray m_connectedFaces; 33 | btScalar m_plane[4]; 34 | }; 35 | 36 | 37 | class btConvexPolyhedron 38 | { 39 | public: 40 | btConvexPolyhedron(); 41 | virtual ~btConvexPolyhedron(); 42 | 43 | btAlignedObjectArray m_vertices; 44 | btAlignedObjectArray m_faces; 45 | btAlignedObjectArray m_uniqueEdges; 46 | 47 | btVector3 m_localCenter; 48 | btVector3 m_extents; 49 | btScalar m_radius; 50 | btVector3 mC; 51 | btVector3 mE; 52 | 53 | void initialize(); 54 | bool testContainment() const; 55 | 56 | void project(const btTransform& trans, const btVector3& dir, btScalar& min, btScalar& max) const; 57 | }; 58 | 59 | 60 | #endif //_BT_POLYHEDRAL_FEATURES_H 61 | 62 | 63 | --------------------------------------------------------------------------------