Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

IMPLEMENTED: Transformation.GetMatrix,

Transformation.GetInverseMatrix, Node.Update
  • Loading branch information...
commit 8084e5291341b5e30dcb9a596e70dd177ef40053 1 parent e910b5f
@gnuvince authored
Showing with 2,895 additions and 6 deletions.
  1. +4 −0 .gitignore
  2. +7 −4 Application/Sources/Scene/Boat.cpp
  3. +3 −2 Application/Sources/Scene/MainScene.cpp
  4. +62 −0 CoreLib/Includes/CoreLib/BlinnPhongMaterial.h
  5. +108 −0 CoreLib/Includes/CoreLib/Camera.h
  6. +31 −0 CoreLib/Includes/CoreLib/CameraNode.h
  7. +80 −0 CoreLib/Includes/CoreLib/Color.h
  8. +16 −0 CoreLib/Includes/CoreLib/Color.inl
  9. +36 −0 CoreLib/Includes/CoreLib/Cone.h
  10. +35 −0 CoreLib/Includes/CoreLib/Cube.h
  11. +39 −0 CoreLib/Includes/CoreLib/CubeMap.h
  12. +36 −0 CoreLib/Includes/CoreLib/Cylinder.h
  13. +33 −0 CoreLib/Includes/CoreLib/DirectionalLight.h
  14. +32 −0 CoreLib/Includes/CoreLib/EnvironmentMaterial.h
  15. +21 −0 CoreLib/Includes/CoreLib/FileUtilities.h
  16. +46 −0 CoreLib/Includes/CoreLib/GLSLBlinnPhongProgram.h
  17. +34 −0 CoreLib/Includes/CoreLib/GLSLEnvironmentProgram.h
  18. +78 −0 CoreLib/Includes/CoreLib/GLSLProgram.h
  19. +33 −0 CoreLib/Includes/CoreLib/GLSLProgramFactory.h
  20. +40 −0 CoreLib/Includes/CoreLib/GLSLProgramManager.h
  21. +37 −0 CoreLib/Includes/CoreLib/GLSLShader.h
  22. +32 −0 CoreLib/Includes/CoreLib/Geometry.h
  23. +61 −0 CoreLib/Includes/CoreLib/GeometryBuffer.h
  24. +33 −0 CoreLib/Includes/CoreLib/GeometryRenderer.h
  25. +56 −0 CoreLib/Includes/CoreLib/HeightField.h
  26. +50 −0 CoreLib/Includes/CoreLib/Image2D.h
  27. +83 −0 CoreLib/Includes/CoreLib/Image2D.inl
  28. +21 −0 CoreLib/Includes/CoreLib/Image2DImporter.h
  29. +21 −0 CoreLib/Includes/CoreLib/Image2DPngImporter.h
  30. +45 −0 CoreLib/Includes/CoreLib/Light.h
  31. +30 −0 CoreLib/Includes/CoreLib/LightNode.h
  32. +64 −0 CoreLib/Includes/CoreLib/Log.h
  33. +68 −0 CoreLib/Includes/CoreLib/Log.inl
  34. +36 −0 CoreLib/Includes/CoreLib/Material.h
  35. +98 −0 CoreLib/Includes/CoreLib/Matrix3.h
  36. +21 −0 CoreLib/Includes/CoreLib/Matrix3.inl
  37. +104 −0 CoreLib/Includes/CoreLib/Matrix4.h
  38. +28 −0 CoreLib/Includes/CoreLib/Matrix4.inl
  39. +78 −0 CoreLib/Includes/CoreLib/Node.h
  40. +37 −0 CoreLib/Includes/CoreLib/Object.h
  41. +38 −0 CoreLib/Includes/CoreLib/Plane.h
  42. +26 −0 CoreLib/Includes/CoreLib/PointLight.h
  43. +65 −0 CoreLib/Includes/CoreLib/Quaternion.h
  44. +62 −0 CoreLib/Includes/CoreLib/RenderState.h
  45. +126 −0 CoreLib/Includes/CoreLib/Scene.h
  46. +36 −0 CoreLib/Includes/CoreLib/Sphere.h
  47. +36 −0 CoreLib/Includes/CoreLib/SpotLight.h
  48. +39 −0 CoreLib/Includes/CoreLib/StdDefinition.h
  49. +27 −0 CoreLib/Includes/CoreLib/TexturableMaterial.h
  50. +39 −0 CoreLib/Includes/CoreLib/Texture.h
  51. +39 −0 CoreLib/Includes/CoreLib/Texture2D.h
  52. +22 −0 CoreLib/Includes/CoreLib/Timer.h
  53. +86 −0 CoreLib/Includes/CoreLib/Transformation.h
  54. +51 −0 CoreLib/Includes/CoreLib/TurntableCamera.h
  55. +59 −0 CoreLib/Includes/CoreLib/Vector.h
  56. +76 −0 CoreLib/Includes/CoreLib/Vector2.h
  57. +14 −0 CoreLib/Includes/CoreLib/Vector2.inl
  58. +81 −0 CoreLib/Includes/CoreLib/Vector3.h
  59. +15 −0 CoreLib/Includes/CoreLib/Vector3.inl
  60. +82 −0 CoreLib/Includes/CoreLib/Vector4.h
  61. +16 −0 CoreLib/Includes/CoreLib/Vector4.inl
  62. +27 −0 CoreLib/Includes/CoreLib/Vertex.h
  63. +42 −0 CoreLib/Includes/CoreLib/VisualNode.h
  64. +10 −0 CoreLib/Sources/BaseTypes/Transformation.cpp
  65. +4 −0 CoreLib/Sources/Scene/Objects/Node.cpp
View
4 .gitignore
@@ -1 +1,5 @@
*.o
+*.d
+core.*
+*.a
+Application
View
11 Application/Sources/Scene/Boat.cpp
@@ -1,5 +1,6 @@
#include "Boat.h"
#include "MainWindow.h"
+#include "CoreLib/Cube.h"
using namespace CoreLib;
@@ -16,6 +17,8 @@ Boat::Boat()
// un Node<real> vous pouvez attacher ses
// sous-objet à l'aide de la méthode this->AddChild(...)
///////////////////////////////////////
+ Cube<real> *platform = new Cube<real>(10, 2, 10);
+ this->AddChild(platform);
// Size definition
///////////////////////////////////////
@@ -63,9 +66,9 @@ void Boat::Animate( const WaterSurface& waterSurface, real time, real dt )
{
///////////////////////////////////////
// IFT3355
- // Ici vous devrez gérer la rotation et
+ // Ici vous devrez gérer la rotation et
// la translation dû au mouvement de l'eau.
- // La méthode GetGlobalWithHeight() de la
+ // La méthode GetGlobalWithHeight() de la
// classe parent HeightFieldprend une
// position dans le repère global en entrée et
// retourne la même position, mais en ajustant la
@@ -83,14 +86,14 @@ void Boat::Animate( const WaterSurface& waterSurface, real time, real dt )
real Boat::GetSizeZ() const
{
- // Vous pouvez remplacer cette valeur au besoin.
+ // Vous pouvez remplacer cette valeur au besoin.
//Elle doit correspondre à la taille de la coque du bateau
return 2;
}
real Boat::GetSizeX() const
{
- // Vous pouvez remplacer cette valeur au besoin.
+ // Vous pouvez remplacer cette valeur au besoin.
//Elle doit correspondre à la taille de la coque du bateau
return 1;
}
View
5 Application/Sources/Scene/MainScene.cpp
@@ -88,8 +88,9 @@ void MainScene::CreateCamera()
// Lorsque le bateau sera fonctionnel,
// vous devrez lui attacher la caméra, remplaçant
// donc la ligne ci-dessous
- ///////////////////////////////////////
- mSceneGraph.AddChild( &mCamera );
+ ///////////////////////////////////////
+ mBoat.AddChild( &mCamera );
+ //mSceneGraph.AddChild( &mCamera );
}
void MainScene::CreateLights()
View
62 CoreLib/Includes/CoreLib/BlinnPhongMaterial.h
@@ -0,0 +1,62 @@
+#ifndef _CORELIB_BLINNPHONGMATERIAL_H_
+#define _CORELIB_BLINNPHONGMATERIAL_H_
+
+#include "StdDefinition.h"
+#include "Material.h"
+#include "Color.h"
+#include "Texture2D.h"
+#include "TexturableMaterial.h"
+#include "CubeMap.h"
+#include <vector>
+
+namespace CoreLib
+{
+
+template<typename real>
+class GLSLProgram;
+
+template<typename real>
+class BlinnPhongMaterial : public Material, public TexturableMaterial
+{
+public:
+ BlinnPhongMaterial();
+
+ virtual Material::Type GetMaterialType() const;
+ virtual void Setup();
+
+ // 'Setters'
+ void SetSurface( const Color<real>& surface );
+ void SetSpecular( const Color<real>& specular );
+ void SetReflection( const Color<real>& reflection );
+ void SetRefraction( const Color<real>& refraction );
+ void SetRefractionIndex( real refractionIndex );
+ void SetShininess( real shininess );
+ void SetWireframe( bool isWireframe );
+ void SetEnvironment( CubeMap* environment );
+
+ // 'Getters'
+ const Color<real>& GetSurface() const;
+ const Color<real>& GetSpecular() const;
+ const Color<real>& GetReflection() const;
+ const Color<real>& GetRefraction() const;
+ real GetRefractionIndex() const;
+ real GetShininess() const;
+ bool IsWireframe() const;
+ const CubeMap* GetEnvironment() const;
+
+private:
+ Color<real> mSurface;
+ Color<real> mSpecular;
+ Color<real> mReflection;
+ Color<real> mRefraction;
+ real mRefractionIndex;
+ real mShininess;
+ bool mIsWireframe;
+ CubeMap* mEnvironment;
+};
+
+}
+
+#endif //_CORELIB_PHONGMATERIAL_H_
+
+
View
108 CoreLib/Includes/CoreLib/Camera.h
@@ -0,0 +1,108 @@
+#ifndef _CORELIB_CAMERA_H_
+#define _CORELIB_CAMERA_H_
+
+#include "StdDefinition.h"
+#include "CameraNode.h"
+#include "Matrix4.h"
+#include "Transformation.h"
+#include "Vector2.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class Camera : public CameraNode<real>
+{
+public:
+ enum CameraType
+ {
+ TypeStandard,
+ TypeTurntable
+ };
+
+ typedef Object::ObjectType ObjectType;
+
+public:
+ Camera();
+ virtual ~Camera();
+
+ virtual ObjectType GetObjectType() const;
+ virtual CameraType GetCameraType() const;
+ virtual void Update();
+
+ void SetFieldOfView( real fieldOview );
+ void SetAspectRatio( real aspectRatio );
+ void SetNearClipping( real nearClipping );
+ void SetFarClipping( real farClipping );
+ void SetPerspective();
+ void SetPerspective( real fieldOview, real aspectRatio, real nearClipping, real farClipping );
+ void SetViewHeight( real viewHeight );
+ void SetOrthogonal();
+ void SetOrthogonal( real viewHeight, real aspectRatio, real nearClipping, real farClipping );
+ void SetFocalDistance( real focalDistance );
+ void SetLensRadius( real lensRadius );
+ void SetViewport( const Vector2<int>& position, const Vector2<int>& size );
+
+ virtual const Matrix4<real>& GetProjectionMatrix();
+ virtual const Matrix4<real>& GetViewportMatrix();
+ const Matrix4<real>& GetCameraMatrix();
+
+ Vector3<real> GetPosition() const;
+ const Vector2<int>& GetViewportPosition() const;
+ const Vector2<int>& GetViewportSize() const;
+ real GetFocalDistance() const;
+ real GetLensRadius() const;
+ real GetNearClipping() const;
+ real GetFarClipping() const;
+ bool IsPerspective() const;
+ bool IsOrthogonal() const;
+
+protected:
+ enum DirtyMatrix
+ {
+ eProjectionMatrix = 1,
+ eViewportMatrix = 2,
+ eCameraMatrix = 4
+ };
+
+ enum ProjectionType
+ {
+ ePerspective = 1,
+ eOrthogonal = 2
+ };
+
+protected:
+ void SetDirtyOn( DirtyMatrix dirtyMatrix );
+ void SetDirtyOff( DirtyMatrix dirtyMatrix );
+ bool IsDirty( DirtyMatrix dirtyMatrix ) const;
+
+private:
+ DirtyMatrix mDirtyBits;
+ Matrix4<real> mProjectionMatrix;
+ Matrix4<real> mViewportMatrix;
+ Matrix4<real> mCameraMatrix;
+
+ // Projection information
+ ProjectionType mProjectionType;
+ Vector2<int> mViewportPosition;
+ Vector2<int> mViewportSize;
+ real mAspectRatio;
+ real mNearClipping;
+ real mFarClipping;
+
+ // Perspective camera
+ real mFieldOfView;
+
+ // Orthogonal camera
+ real mViewHeight;
+
+ // Depth of field
+ real mFocalDistance;
+ real mLensRadius;
+};
+
+}
+
+#endif //_CORELIB_CAMERA_H_
+
+
View
31 CoreLib/Includes/CoreLib/CameraNode.h
@@ -0,0 +1,31 @@
+#ifndef _CORELIB_CAMERANODE_H_
+#define _CORELIB_CAMERANODE_H_
+
+#include "StdDefinition.h"
+#include "Node.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class CameraNode : public Node<real>
+{
+public:
+ typedef typename Node<real>::NodeType NodeType;
+
+public:
+ CameraNode();
+ virtual ~CameraNode();
+
+ virtual NodeType GetNodeType() const;
+ virtual void Update();
+ virtual void Render();
+
+private:
+};
+
+}
+
+#endif //_CORELIB_CAMERANODE_H_
+
+
View
80 CoreLib/Includes/CoreLib/Color.h
@@ -0,0 +1,80 @@
+#ifndef _CORELIB_COLOR_H_
+#define _CORELIB_COLOR_H_
+
+#include "StdDefinition.h"
+#include <iostream>
+#include <cmath>
+#include <cassert>
+
+namespace CoreLib
+{
+
+template<typename real>
+class Color
+{
+public:
+ // Constructors
+ Color( void );
+ Color( const Color& color );
+ Color( const real elements[4] );
+ Color( real in_R, real in_G, real in_B, real in_A );
+ template<typename real_> Color( const Color<real_>& color );
+
+ // Access functions
+ real& R();
+ real& G();
+ real& B();
+ real& A();
+ const real& R() const;
+ const real& G() const;
+ const real& B() const;
+ const real& A() const;
+ void R( real in_R );
+ void G( real in_G );
+ void B( real in_B );
+ void A( real in_A );
+
+ const real& operator[]( int index ) const;
+ real& operator[]( int index );
+ const real& operator()( int index ) const;
+ real& operator()( int index );
+
+ void Black();
+ void White();
+
+ // Operators
+ Color operator + ( const Color& color ) const;
+ Color operator - ( const Color& color ) const;
+ Color operator * ( const Color& color ) const;
+ Color operator * ( real constant ) const;
+ Color operator / ( real constant ) const;
+ Color operator - ( ) const;
+
+ Color& operator += ( const Color& color );
+ Color& operator -= ( const Color& color );
+ Color& operator *= ( const Color& color );
+ Color& operator *= ( real constant );
+ Color& operator /= ( real constant );
+
+ friend std::ostream& operator << ( std::ostream& ioStream, const Color<real>& color )
+ {
+ ioStream << "( " << color[0] << ", " << color[1] << ", " << color[2] << ", " << color[3] << " )";
+ return ioStream;
+ }
+
+ friend Color operator * ( real constant, const Color<real>& color )
+ {
+ return Color<real>( color.mElements[0] * constant, color.mElements[1] * constant, color.mElements[2] * constant, color.mElements[3] * constant );
+ }
+
+private:
+ real mElements[4];
+};
+
+}
+
+#include "Color.inl"
+
+#endif //_CORELIB_COLOR_H_
+
+
View
16 CoreLib/Includes/CoreLib/Color.inl
@@ -0,0 +1,16 @@
+namespace CoreLib
+{
+
+template<typename real>
+template<typename real_>
+Color<real>::Color( const Color<real_>& color )
+{
+ mElements[0] = color[0];
+ mElements[1] = color[1];
+ mElements[2] = color[2];
+ mElements[3] = color[3];
+}
+
+}
+
+
View
36 CoreLib/Includes/CoreLib/Cone.h
@@ -0,0 +1,36 @@
+#ifndef _CORELIB_CONE_H_
+#define _CORELIB_CONE_H_
+
+#include "StdDefinition.h"
+#include "Geometry.h"
+#include "GeometryBuffer.h"
+#include <vector>
+
+namespace CoreLib
+{
+
+template<typename real>
+class Cone : public Geometry<real>
+{
+public:
+ Cone();
+ Cone( real height, real radius, uint radiusSubdivisions );
+ virtual ~Cone();
+
+ virtual void Render();
+
+ void SetSizes( real height, real radius, uint radiusSubdivisions );
+
+private:
+ void InvalidateGeometry();
+
+private:
+ real mHeight;
+ real mRadius;
+ uint mRadiusSubdivisions;
+ GeometryBuffer<real>* mGeometryBuffer;
+};
+
+}
+
+#endif // _CORELIB_CONE_H_
View
35 CoreLib/Includes/CoreLib/Cube.h
@@ -0,0 +1,35 @@
+#ifndef _CORELIB_CUBE_H_
+#define _CORELIB_CUBE_H_
+
+#include "StdDefinition.h"
+#include "Geometry.h"
+#include "GeometryBuffer.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class Cube : public Geometry<real>
+{
+public:
+ Cube();
+ Cube( real sizeX, real sizeY, real sizeZ );
+ virtual ~Cube();
+
+ virtual void Render();
+
+ void SetSizes( real sizeX, real sizeY, real sizeZ );
+
+private:
+ void InvalidateGeometry();
+
+private:
+ real mSizeX;
+ real mSizeY;
+ real mSizeZ;
+ GeometryBuffer<real>* mGeometryBuffer;
+};
+
+}
+
+#endif // _CORELIB_CUBE_H_
View
39 CoreLib/Includes/CoreLib/CubeMap.h
@@ -0,0 +1,39 @@
+#ifndef _CORELIB_SKYBOX_H_
+#define _CORELIB_SKYBOX_H_
+
+#include "StdDefinition.h"
+#include "Image2D.h"
+#include "Texture.h"
+#include <string>
+
+namespace CoreLib
+{
+
+class CubeMap : public Texture
+{
+public:
+ typedef Texture::TextureType TextureType;
+
+public:
+ CubeMap( const std::string& imagesPath );
+ CubeMap( const Image2D& image );
+ virtual ~CubeMap();
+
+ virtual TextureType GetTextureType() const;
+
+private:
+ CubeMap();
+
+ bool Load( const std::string& imagesPath );
+ void LoadToGL();
+
+private:
+ bool mIsLoaded;
+ Image2D mImages[6];
+};
+
+}
+
+#endif //_CORELIB_SKYBOX_H_
+
+
View
36 CoreLib/Includes/CoreLib/Cylinder.h
@@ -0,0 +1,36 @@
+#ifndef _CORELIB_CYLINDER_H_
+#define _CORELIB_CYLINDER_H_
+
+#include "StdDefinition.h"
+#include "Geometry.h"
+#include "GeometryBuffer.h"
+#include <vector>
+
+namespace CoreLib
+{
+
+template<typename real>
+class Cylinder : public Geometry<real>
+{
+public:
+ Cylinder();
+ Cylinder( real height, real radius, uint radiusSubdivisions );
+ virtual ~Cylinder();
+
+ virtual void Render();
+
+ void SetSizes( real height, real radius, uint radiusSubdivisions );
+
+private:
+ void InvalidateGeometry();
+
+private:
+ real mHeight;
+ real mRadius;
+ uint mRadiusSubdivisions;
+ GeometryBuffer<real>* mGeometryBuffer;
+};
+
+}
+
+#endif // _CORELIB_CYLINDER_H_
View
33 CoreLib/Includes/CoreLib/DirectionalLight.h
@@ -0,0 +1,33 @@
+#ifndef _CORELIB_DIRECTIONALLIGHT_H_
+#define _CORELIB_DIRECTIONALLIGHT_H_
+
+#include "StdDefinition.h"
+#include "Light.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class DirectionalLight : public Light<real>
+{
+public:
+ typedef typename Light<real>::LightType LightType;
+
+public:
+ DirectionalLight();
+ DirectionalLight( const Color<real>& intensity, const Color<real>& ambient, const Vector3<real> direction );
+ virtual ~DirectionalLight();
+
+ virtual LightType GetLightType() const;
+
+ void SetDirection( const Vector3<real>& direction );
+
+ const Vector3<real>& GetDirection() const;
+
+private:
+ Vector3<real> mDirection;
+};
+
+}
+
+#endif //_CORELIB_DIRECTIONALLIGHT_H_
View
32 CoreLib/Includes/CoreLib/EnvironmentMaterial.h
@@ -0,0 +1,32 @@
+#ifndef _CORELIB_ENVIRONMENTMATERIAL_H_
+#define _CORELIB_ENVIRONMENTMATERIAL_H_
+
+#include "StdDefinition.h"
+#include "CubeMap.h"
+#include "Material.h"
+#include "TexturableMaterial.h"
+#include <vector>
+
+namespace CoreLib
+{
+
+template<typename real>
+class GLSLProgram;
+
+template<typename real>
+class EnvironmentMaterial : public Material, public TexturableMaterial
+{
+public:
+ EnvironmentMaterial();
+
+ virtual Material::Type GetMaterialType() const;
+ virtual void Setup();
+
+ virtual void SetTexture( Texture* texture );
+};
+
+}
+
+#endif //_CORELIB_PHONGMATERIAL_H_
+
+
View
21 CoreLib/Includes/CoreLib/FileUtilities.h
@@ -0,0 +1,21 @@
+#ifndef _CORELIB_FILEUTLITIES_H_
+#define _CORELIB_FILEUTLITIES_H_
+
+#include "StdDefinition.h"
+#include <string>
+
+namespace CoreLib
+{
+
+class FileUtilities
+{
+public:
+ static bool FileToString( const std::string& filename, std::string& oFileString );
+ static std::string GetFileExtenstion( const std::string& filename );
+ static void ReplaceFileExtension( std::string& ioFilename, const std::string& validExtension );
+ static void RemoveFileExtension( std::string& ioFilename );
+};
+
+}
+
+#endif //_CORELIB_FILEUTLITIES_H_
View
46 CoreLib/Includes/CoreLib/GLSLBlinnPhongProgram.h
@@ -0,0 +1,46 @@
+#ifndef _CORELIB_GLSLBLINNPHONGPROGRAM_H_
+#define _CORELIB_GLSLBLINNPHONGPROGRAM_H_
+
+#include "StdDefinition.h"
+#include "GLSLProgram.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class GLSLBlinnPhongProgram : public GLSLProgram<real>
+{
+public:
+ typedef typename GLSLProgram<real>::ProgramType ProgramType;
+
+public:
+ GLSLBlinnPhongProgram( const std::vector<GLSLShader<real>*>& shaders );
+ virtual ~GLSLBlinnPhongProgram();
+
+ virtual ProgramType GetProgramType() const;
+
+protected:
+ virtual void GetUniformLocations();
+ virtual void SetupProgram();
+
+private:
+ int mMaterialSurfaceLocation;
+ int mMaterialSpecularLocation;
+ int mMaterialShininessLocation;
+ int mMaterialReflectionLocation;
+ int mMaterialRefractionLocation;
+ int mMaterialRefractionIndexLocation;
+ int mMaterialUseTexture2DLocation;
+ int mMaterialUseTexture3DLocation;
+ int mMaterialUseTextureCubeLocation;
+ int mTexture2DLocation;
+ int mTexture3DLocation;
+ int mTextureCubeLocation;
+ int mEnvironmentLocation;
+};
+
+}
+
+#endif //_CORELIB_GLSLPHONGPROGRAM_H_
+
+
View
34 CoreLib/Includes/CoreLib/GLSLEnvironmentProgram.h
@@ -0,0 +1,34 @@
+#ifndef _CORELIB_GLSLENVIRONMENTPROGRAM_H_
+#define _CORELIB_GLSLENVIRONMENTPROGRAM_H_
+
+#include "StdDefinition.h"
+#include "GLSLProgram.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class GLSLEnvironmentProgram : public GLSLProgram<real>
+{
+public:
+ typedef typename GLSLProgram<real>::ProgramType ProgramType;
+
+public:
+ GLSLEnvironmentProgram( const std::vector<GLSLShader<real>*>& shaders );
+ virtual ~GLSLEnvironmentProgram();
+
+ virtual ProgramType GetProgramType() const;
+
+protected:
+ virtual void GetUniformLocations();
+ virtual void SetupProgram();
+
+private:
+ int mEnvironmentLocation;
+};
+
+}
+
+#endif //_CORELIB_GLSLENVIRONMENTPROGRAM_H_
+
+
View
78 CoreLib/Includes/CoreLib/GLSLProgram.h
@@ -0,0 +1,78 @@
+#ifndef _CORELIB_GLSLPROGRAM_H_
+#define _CORELIB_GLSLPROGRAM_H_
+
+#include "StdDefinition.h"
+#include "GLSLShader.h"
+#include "Light.h"
+#include <vector>
+
+namespace CoreLib
+{
+
+template<typename real>
+class GLSLProgram
+{
+public:
+ enum ProgramType
+ {
+ TypeBlinnPhong = 0,
+ TypeEnvironment,
+ NbPrograms
+ };
+
+ typedef std::vector<GLSLShader<real>*> GLSLShaderVector;
+
+public:
+ GLSLProgram( const GLSLShaderVector& shaders );
+ virtual ~GLSLProgram();
+
+ virtual ProgramType GetProgramType() const=0;
+
+ void Setup();
+ bool IsLinked() const;
+ uint GetHandle() const;
+
+protected:
+ virtual void GetUniformLocations();
+ virtual void SetupProgram()=0;
+
+ void SetupDefautState();
+ void SetupLights();
+ void SetupCamera();
+
+ void SetupDirectionalLight( uint index, Light<real>* light );
+ void SetupPointLight( uint index, Light<real>* light );
+ void SetupSpotLight( uint index, Light<real>* light );
+
+private:
+ bool mLinked;
+ uint mHandle;
+ GLSLShaderVector mShaders;
+
+ // Uniform locations
+ struct LightLocation
+ {
+ int enabled;
+ int type;
+ int position;
+ int direction;
+ int intensity;
+ int ambient;
+ int aperture;
+ };
+
+ std::vector<LightLocation> mLightLocations;
+ int mNbLightsLocation;
+ int mModelMatrixLocation;
+ int mViewMatrixLocation;
+ int mProjectionMatrixLocation;
+ int mModelViewProjectionMatrixLocation;
+ int mNormalMatrixLocation;
+ int mCameraPositionLocation;
+};
+
+}
+
+#endif //_CORELIB_GLSLPROGRAM_H_
+
+
View
33 CoreLib/Includes/CoreLib/GLSLProgramFactory.h
@@ -0,0 +1,33 @@
+#ifndef _CORELIB_GLSLPROGRAMFACTORY_H_
+#define _CORELIB_GLSLPROGRAMFACTORY_H_
+
+#include "StdDefinition.h"
+#include "GLSLProgram.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class GLSLProgramFactory
+{
+public:
+ typedef typename GLSLProgram<real>::ProgramType ProgramType;
+
+public:
+ static GLSLProgram<real>* CreateProgram( ProgramType programType );
+
+private:
+ GLSLProgramFactory();
+
+ typedef typename GLSLProgram<real>::GLSLShaderVector GLSLShaderVector;
+
+private:
+ static GLSLProgram<real>* CreateBlinnPhongProgram();
+ static GLSLProgram<real>* CreateEnvironmentProgram();
+};
+
+}
+
+#endif //_CORELIB_GLSLPROGRAMFACTORY_H_
+
+
View
40 CoreLib/Includes/CoreLib/GLSLProgramManager.h
@@ -0,0 +1,40 @@
+#ifndef _CORELIB_GLSLPROGRAMMANAGER_H_
+#define _CORELIB_GLSLPROGRAMMANAGER_H_
+
+#include "StdDefinition.h"
+#include "GLSLProgram.h"
+#include <vector>
+
+namespace CoreLib
+{
+
+template<typename real>
+class GLSLProgramManager
+{
+public:
+ typedef typename GLSLProgram<real>::ProgramType ProgramType;
+
+public:
+ ~GLSLProgramManager();
+
+ static void Create();
+ static void Destroy();
+ static GLSLProgramManager<real>* Get();
+
+ GLSLProgram<real>* GetProgram( ProgramType programType );
+
+private:
+ GLSLProgramManager();
+
+private:
+ std::vector<GLSLProgram<real>*> mPrograms;
+
+ // Singleton instance
+ static GLSLProgramManager<real>* sInstance;
+};
+
+}
+
+#endif //_CORELIB_GLSLPROGRAMMANAGER_H_
+
+
View
37 CoreLib/Includes/CoreLib/GLSLShader.h
@@ -0,0 +1,37 @@
+#ifndef _CORELIB_GLSLSHADER_H_
+#define _CORELIB_GLSLSHADER_H_
+
+#include "StdDefinition.h"
+#include <string>
+
+namespace CoreLib
+{
+
+template<typename real>
+class GLSLShader
+{
+public:
+ enum Stage
+ {
+ StageVertex,
+ StageFragment
+ };
+
+public:
+ GLSLShader( const std::string& filename, Stage stage );
+ virtual ~GLSLShader();
+
+ bool IsCompiled() const;
+ uint GetHandle() const;
+
+private:
+ Stage mStage;
+ bool mCompiled;
+ uint mHandle;
+};
+
+}
+
+#endif //_CORELIB_GLSLSHADER_H_
+
+
View
32 CoreLib/Includes/CoreLib/Geometry.h
@@ -0,0 +1,32 @@
+#ifndef _CORELIB_GEOMETRY_H_
+#define _CORELIB_GEOMETRY_H_
+
+#include "StdDefinition.h"
+#include "VisualNode.h"
+#include "GeometryRenderer.h"
+#include "Vector3.h"
+
+namespace CoreLib
+{
+
+// Forward declaration
+template<typename real>
+class VisualNode;
+
+template<typename real>
+class Geometry : public VisualNode<real>
+{
+public:
+ Geometry();
+ Geometry( const Geometry& geometry );
+ virtual ~Geometry();
+
+ void PrepareRender();
+ virtual void Render();
+};
+
+}
+
+#endif //_CORELIB_GEOMETRY_H_
+
+
View
61 CoreLib/Includes/CoreLib/GeometryBuffer.h
@@ -0,0 +1,61 @@
+#ifndef _CORELIB_GEOMETRYBUFFER_H_
+#define _CORELIB_GEOMETRYBUFFER_H_
+
+#include "StdDefinition.h"
+#include "Vertex.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class GeometryBuffer
+{
+public:
+ enum BufferUsage
+ {
+ UsageStatic,
+ UsageDynamic
+ };
+
+ enum GeometryType
+ {
+ TypeLines,
+ TypeTriangles
+ };
+
+public:
+ GeometryBuffer( const Vertex<real>* vertices, const uint* indices, uint nbVertices, uint nbIndices, GeometryType geometryType, BufferUsage bufferUsage );
+ virtual ~GeometryBuffer();
+
+ virtual void Render();
+
+ void HasNormals( bool bHasNormals );
+ void HasTexCoords( bool bHasTexCoords );
+ void HasColors( bool bHasColors );
+
+ void UpdateVertices( const Vertex<real>* vertices, uint nbVertices );
+ void UpdateIndices( const uint* indices, uint nbIndices );
+
+private:
+ uint GetGLGeometryType();
+ uint GetGLBufferUsage();
+
+private:
+ GeometryType mGeometryType;
+ BufferUsage mBufferUsage;
+ uint mVertexBufferHandle;
+ uint mIndexBufferHandle;
+
+ uint mNbVertices;
+ uint mNbIndices;
+
+ bool mHasNormals;
+ bool mHasTexCoords;
+ bool mHasColors;
+};
+
+}
+
+#endif //_CORELIB_GEOMETRYBUFFER_H_
+
+
View
33 CoreLib/Includes/CoreLib/GeometryRenderer.h
@@ -0,0 +1,33 @@
+#ifndef _CORELIB_GEOMETRYRENDERER_H_
+#define _CORELIB_GEOMETRYRENDERER_H_
+
+#include "StdDefinition.h"
+
+namespace CoreLib
+{
+
+class GeometryRenderer
+{
+public:
+ enum RendererType
+ {
+ TypeTetMeshStandard,
+ TypeTetMeshEnergyThreshold,
+ TypeTetMeshMarchingTetrahedra,
+ TypeTetMeshWholeElement,
+ TypeTriMeshStandard,
+ TypeVoxelsStandard,
+ TypeWireMeshStandard
+ };
+
+public:
+ virtual ~GeometryRenderer() {}
+
+ virtual void Render()=0;
+ virtual void InvalidateGeometry()=0;
+ virtual RendererType GetRendererType()=0;
+};
+
+}
+
+#endif //_CORELIB_GEOMETRYRENDERER_H_
View
56 CoreLib/Includes/CoreLib/HeightField.h
@@ -0,0 +1,56 @@
+#ifndef _CORELIB_HEIGHTFIELD_H_
+#define _CORELIB_HEIGHTFIELD_H_
+
+#include "StdDefinition.h"
+#include "Geometry.h"
+#include "GeometryBuffer.h"
+#include "Vector2.h"
+
+//////////////////////////////////////////////////////
+// Note : The order ZXY is prefered over XZY to ensure
+// an even permutation of XYZ, Y being the height.
+
+namespace CoreLib
+{
+
+template<typename real>
+class HeightField : public Geometry<real>
+{
+public:
+ HeightField();
+ HeightField( real sizeZ, real sizeX, uint nbZData, uint nbXData );
+ virtual ~HeightField();
+
+ virtual void Render();
+
+ void SetSizes( real sizeZ, real sizeX, uint nbZData, uint nbXData );
+ uint GetNbZData() const;
+ uint GetNbXData() const;
+ Vector2<real> GetZXLocalPosition( uint zIndex, uint xIndex ) const;
+ Vector3<real> GetGlobalWithHeight( const Vector3<real>& globalPosition ) const;
+ Vector3<real> GetGlobalNormal( const Vector3<real>& globalPosition ) const;
+
+ void BeginEditHeights();
+ void SetHeight( uint zIndex, uint xIndex, real height );
+ void EndEditHeights();
+
+private:
+ void InvalidateGeometry();
+
+ Vector3<real> GetNormal( uint zIndex, uint xIndex );
+
+private:
+ real mSizeZ;
+ real mSizeX;
+ uint mNbZData;
+ uint mNbXData;
+ bool mEditMode;
+ std::vector<real> mHeights;
+ std::vector<Vertex<real> > mVertices;
+ std::vector<uint> mFaces;
+ GeometryBuffer<real>* mGeometryBuffer;
+};
+
+}
+
+#endif // _CORELIB_HEIGHTFIELD_H_
View
50 CoreLib/Includes/CoreLib/Image2D.h
@@ -0,0 +1,50 @@
+#ifndef _CORELIB_IMAGE2D_H_
+#define _CORELIB_IMAGE2D_H_
+
+#include "StdDefinition.h"
+#include "Color.h"
+#include <string>
+#include <vector>
+
+namespace CoreLib
+{
+
+class Image2D
+{
+public:
+ struct Pixel { unsigned char color[3]; };
+
+ typedef std::vector<Pixel> PixelVector;
+
+public:
+ Image2D();
+ Image2D( uint width, uint height );
+ virtual ~Image2D();
+
+ void Create( uint width, uint height );
+ bool Load( const std::string& filename );
+ void Clear();
+
+ uint GetWidth() const;
+ uint GetHeight() const;
+ const PixelVector& GetPixels() const;
+ PixelVector& GetPixels();
+ const unsigned char* GetBuffer() const;
+ unsigned char* GetBuffer();
+
+ template<typename real> void SetPixel( uint x, uint y, const Color<real>& color );
+ template<typename real> Color<real> GetPixel( real x, real y ) const;
+
+protected:
+ uint mWidth;
+ uint mHeight;
+ PixelVector mPixels;
+};
+
+}
+
+#include "Image2D.inl"
+
+#endif //_CORELIB_IMAGE2D_H_
+
+
View
83 CoreLib/Includes/CoreLib/Image2D.inl
@@ -0,0 +1,83 @@
+namespace CoreLib
+{
+
+template<typename real>
+void Image2D::SetPixel( uint x, uint y, const Color<real>& color )
+{
+ assert( ( x < mWidth ) && ( y < mHeight ) );
+
+ uint index = y * mWidth + x;
+
+ for ( uint i=0 ; i<3 ; ++i )
+ {
+ unsigned char ucColor;
+
+ if ( color[i] <= 0 )
+ ucColor = 0;
+ else if ( color[i] >= 1 )
+ ucColor = 255;
+ else
+ ucColor = (unsigned char)( color[i] * 255.0 );
+
+ mPixels[index].color[i] = ucColor;
+
+ }
+}
+
+template<typename real>
+Color<real> Image2D::GetPixel( real x, real y ) const
+{
+ x *= mWidth;
+ y *= mHeight;
+ int x0 = (int)floor( x );
+ int x1 = (int)ceil( x );
+ int y0 = (int)floor( y );
+ int y1 = (int)ceil( y );
+
+ if ( x0 < 0 )
+ {
+ x = 0;
+ x0 = 0;
+ x1 = 1;
+ }
+ else if ( x0 >= (int)mWidth - 1 )
+ {
+ x = mWidth - 1;
+ x0 = mWidth - 2;
+ x1 = mWidth - 1;
+ }
+
+ if ( y0 < 0 )
+ {
+ y = 0;
+ y0 = 0;
+ y1 = 1;
+ }
+ else if ( y0 >= (int)mHeight - 1 )
+ {
+ y = mHeight - 1;
+ y0 = mHeight - 2;
+ y1 = mHeight - 1;
+ }
+
+ real propx = x - x0;
+ real propy = y - y0;
+
+ uint i00 = y0 * mWidth + x0;
+ uint i10 = y0 * mWidth + x1;
+ uint i01 = y1 * mWidth + x0;
+ uint i11 = y1 * mWidth + x1;
+ Color<real> c00 = Color<real>( mPixels[i00].color[0], mPixels[i00].color[1], mPixels[i00].color[2] ) / 255.0;
+ Color<real> c10 = Color<real>( mPixels[i10].color[0], mPixels[i10].color[1], mPixels[i10].color[2] ) / 255.0;
+ Color<real> c01 = Color<real>( mPixels[i01].color[0], mPixels[i01].color[1], mPixels[i01].color[2] ) / 255.0;
+ Color<real> c11 = Color<real>( mPixels[i11].color[0], mPixels[i11].color[1], mPixels[i11].color[2] ) / 255.0;
+
+ Color<real> cx0 = c00 * (1-propx) + c10 * propx;
+ Color<real> cx1 = c01 * (1-propx) + c11 * propx;
+
+ return cx0 * (1-propy) + cx1 * propy;
+}
+
+}
+
+
View
21 CoreLib/Includes/CoreLib/Image2DImporter.h
@@ -0,0 +1,21 @@
+#ifndef _CORELIB_IMAGE2DIMPORTER_H_
+#define _CORELIB_IMAGE2DIMPORTER_H_
+
+#include "StdDefinition.h"
+#include "Image2D.h"
+#include <string>
+
+namespace CoreLib
+{
+
+class Image2DImporter
+{
+public:
+ bool Import( const std::string& filename, Image2D& oImage );
+};
+
+}
+
+#endif //_CORELIB_IMAGE2DIMPORTER_H_
+
+
View
21 CoreLib/Includes/CoreLib/Image2DPngImporter.h
@@ -0,0 +1,21 @@
+#ifndef _CORELIB_IMAGE2DPNGIMPORTER_H_
+#define _CORELIB_IMAGE2DPNGIMPORTER_H_
+
+#include "StdDefinition.h"
+#include "Image2D.h"
+#include <string>
+
+namespace CoreLib
+{
+
+class Image2DPngImporter
+{
+public:
+ bool Import( const std::string& filename, Image2D& oImage );
+};
+
+}
+
+#endif //_CORELIB_IMAGE2DPNGIMPORTER_H_
+
+
View
45 CoreLib/Includes/CoreLib/Light.h
@@ -0,0 +1,45 @@
+#ifndef _CORELIB_LIGHT_H_
+#define _CORELIB_LIGHT_H_
+
+#include "StdDefinition.h"
+#include "Vector4.h"
+#include "Color.h"
+#include "LightNode.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class Light : public LightNode<real>
+{
+public:
+ enum LightType
+ {
+ TypeDirectional = 0,
+ TypePoint,
+ TypeSpot,
+ };
+
+public:
+ Light();
+ Light( const Color<real>& intensity, const Color<real>& ambient );
+ virtual ~Light();
+
+ virtual LightType GetLightType() const=0;
+
+ void SetIntensity( const Color<real>& intensity );
+ void SetAmbient( const Color<real>& ambient );
+
+ const Color<real>& GetIntensity() const;
+ const Color<real>& GetAmbient() const;
+
+private:
+ Color<real> mIntensity;
+ Color<real> mAmbient;
+};
+
+}
+
+#endif //_CORELIB_LIGHT_H_
+
+
View
30 CoreLib/Includes/CoreLib/LightNode.h
@@ -0,0 +1,30 @@
+#ifndef _CORELIB_LIGHTNODE_H_
+#define _CORELIB_LIGHTNODE_H_
+
+#include "StdDefinition.h"
+#include "Node.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class LightNode : public Node<real>
+{
+public:
+ typedef typename Node<real>::NodeType NodeType;
+
+public:
+ LightNode();
+ virtual ~LightNode();
+
+ virtual NodeType GetNodeType() const;
+ virtual void Render();
+
+private:
+};
+
+}
+
+#endif //_CORELIB_LIGHTNODE_H_
+
+
View
64 CoreLib/Includes/CoreLib/Log.h
@@ -0,0 +1,64 @@
+#ifndef _CORELIB_LOG_H_
+#define _CORELIB_LOG_H_
+
+#include "StdDefinition.h"
+#include <string>
+#include <iostream>
+
+namespace CoreLib
+{
+
+class Log
+{
+public:
+ enum StdFunctions
+ {
+ EndLine,
+ CarriageReturn,
+ Flush
+ };
+
+public:
+ class IStream
+ {
+ public:
+ virtual void LogWrite( const std::string& string )=0;
+ virtual void LogEndLine()=0;
+ virtual void LogCarriageReturn()=0;
+ virtual void LogFlush()=0;
+ };
+
+public:
+ static void Create();
+ static void Destroy();
+ static Log& Get();
+
+ void Enable();
+ void Disable();
+
+ void SetStream( IStream* stream );
+
+ template<typename Type>
+ Log& operator << ( const Type& element );
+
+private:
+ Log();
+
+private:
+ typedef std::ostream& ( *StandardEndLine )( std::ostream& );
+
+private:
+ uint mEnabled;
+ IStream* mStream;
+
+ // Singleton instance
+ static Log* sInstance;
+};
+
+}
+
+#include "Log.inl"
+
+#endif //_CORELIB_LOG_H_
+
+
View
68 CoreLib/Includes/CoreLib/Log.inl
@@ -0,0 +1,68 @@
+#include <sstream>
+
+namespace CoreLib
+{
+
+template<typename Type>
+inline Log& Log::operator << ( const Type& element )
+{
+ if ( mEnabled )
+ {
+ std::stringstream stream( std::stringstream::in | std::stringstream::out );
+ std::string finalString;
+
+ stream << element;
+
+ do
+ {
+ char c = stream.get();
+
+ if ( !stream )
+ break;
+
+ finalString += c;
+ } while ( true );
+
+ mStream->LogWrite( finalString );
+ }
+
+ return *this;
+}
+
+template<>
+inline Log& Log::operator << ( const char* const& element )
+{
+ if ( mEnabled )
+ mStream->LogWrite( std::string( element ) );
+
+ return *this;
+}
+
+template<>
+inline Log& Log::operator << ( const std::string& element )
+{
+ if ( mEnabled )
+ mStream->LogWrite( element );
+
+ return *this;
+}
+
+template<>
+inline Log& Log::operator << ( const StdFunctions& element )
+{
+ if ( mEnabled )
+ {
+ switch( element )
+ {
+ case EndLine: mStream->LogEndLine(); break;
+ case CarriageReturn: mStream->LogCarriageReturn(); break;
+ case Flush: mStream->LogFlush(); break;
+ }
+ }
+
+ return *this;
+}
+
+}
+
+
View
36 CoreLib/Includes/CoreLib/Material.h
@@ -0,0 +1,36 @@
+#ifndef _CORELIB_MATERIAL_H_
+#define _CORELIB_MATERIAL_H_
+
+#include "StdDefinition.h"
+#include "Object.h"
+
+namespace CoreLib
+{
+
+class Material : public Object
+{
+public:
+ enum Type
+ {
+ TypeBlinnPhong,
+ TypeEnvironment,
+ TypeOrenNayarBlinn,
+ TypeWire
+ };
+
+ typedef Object::ObjectType ObjectType;
+
+public:
+ virtual ~Material();
+
+ virtual ObjectType GetObjectType() const;
+ virtual Type GetMaterialType() const=0;
+
+ virtual void Setup()=0;
+};
+
+}
+
+#endif //_CORELIB_MATERIAL_H_
+
+
View
98 CoreLib/Includes/CoreLib/Matrix3.h
@@ -0,0 +1,98 @@
+#ifndef _CORELIB_MATRIX3_H_
+#define _CORELIB_MATRIX3_H_
+
+#include "StdDefinition.h"
+#include "Vector3.h"
+#include <iostream>
+#include <cassert>
+#include <cstring>
+
+namespace CoreLib
+{
+
+template<typename real>
+class Matrix3
+{
+public:
+ enum MatrixType
+ {
+ TypeIdentity,
+ TypeZero
+ };
+
+public:
+ // Constructors
+ Matrix3();
+ Matrix3( real mn[3][3] );
+ Matrix3( real mn[3*3] );
+ Matrix3( real e11, real e12, real e13,
+ real e21, real e22, real e23,
+ real e31, real e32, real e33 );
+ Matrix3( const Vector3<real>& v0, const Vector3<real>& v1, const Vector3<real>& v2, bool bColumn );
+ Matrix3( MatrixType matrixType );
+ template<typename real_> Matrix3( const Matrix3<real_>& matrix );
+
+ // Access functions
+ real& operator() ( uint i, uint j );
+ const real& operator() ( uint i, uint j ) const;
+ const real* GetArray() const;
+ void GetArray( float oMatrix[9] ) const;
+
+ // Matrix functions
+ real Determinant() const;
+ void Inverse();
+ real Trace();
+ void SetIdentity();
+ void SetZero();
+ void Transpose();
+ Matrix3<real> Transposed() const;
+
+ // Use these functions to create or to combine transformation matrices
+ void SetRotation( const Vector3<real>& axis, real radians ); // M = R
+ void SetScale( real scaleX, real scaleY, real scaleZ ); // M = S
+ void PreRotate( const Vector3<real>& axis, real radians ); // M = R * M
+ void PreScale( real scaleX, real scaleY, real scaleZ ); // M = S * M
+ void PostRotate( const Vector3<real>& axis, real radians ); // M = M * R
+ void PostScale( real scaleX, real scaleY, real scaleZ ); // M = M * S
+
+ // Operators
+ Matrix3 operator * ( real scalar ) const;
+ Matrix3 operator / ( real scalar ) const;
+ Matrix3 operator + ( const Matrix3& matrix ) const;
+ Matrix3 operator - ( const Matrix3& matrix ) const;
+ Matrix3 operator * ( const Matrix3& matrix ) const;
+ Vector3<real> operator * ( const Vector3<real>& vector ) const;
+
+ Matrix3& operator *= ( real scalar );
+ Matrix3& operator /= ( real scalar );
+ Matrix3& operator *= ( const Matrix3& matrix );
+ Matrix3& operator += ( const Matrix3& matrix );
+ Matrix3& operator -= ( const Matrix3& matrix );
+ Matrix3& operator = ( const Matrix3& matrix );
+
+ static Matrix3 DyadicProduct( const Vector3<real> v0, const Vector3<real> v1 );
+
+ friend std::ostream& operator << ( std::ostream& ioStream, const Matrix3<real>& matrix )
+ {
+ for ( uint i=0 ; i<3 ; ++i )
+ {
+ ioStream << "| " << matrix(i,0) << ", " << matrix(i,1) << ", " << matrix(i,2) << " |";
+
+ if ( i != 2 )
+ ioStream << std::endl;
+ }
+
+ return ioStream;
+ }
+
+private:
+ real mElements[3][3];
+};
+
+}
+
+#include "Matrix3.inl"
+
+#endif //_CORELIB_MATRIX3_H_
+
+
View
21 CoreLib/Includes/CoreLib/Matrix3.inl
@@ -0,0 +1,21 @@
+namespace CoreLib
+{
+
+template<typename real>
+template<typename real_>
+Matrix3<real>::Matrix3( const Matrix3<real_>& matrix )
+{
+ mElements[0][0] = matrix(0,0);
+ mElements[0][1] = matrix(0,1);
+ mElements[0][2] = matrix(0,2);
+ mElements[1][0] = matrix(1,0);
+ mElements[1][1] = matrix(1,1);
+ mElements[1][2] = matrix(1,2);
+ mElements[2][0] = matrix(2,0);
+ mElements[2][1] = matrix(2,1);
+ mElements[2][2] = matrix(2,2);
+}
+
+}
+
+
View
104 CoreLib/Includes/CoreLib/Matrix4.h
@@ -0,0 +1,104 @@
+#ifndef _CORELIB_MATRIX4_H_
+#define _CORELIB_MATRIX4_H_
+
+#include "StdDefinition.h"
+#include "Vector3.h"
+#include "Matrix3.h"
+#include <iostream>
+#include <cassert>
+#include <cstring>
+
+namespace CoreLib
+{
+
+template<typename real>
+class Matrix4
+{
+public:
+ enum MatrixType
+ {
+ TypeIdentity,
+ TypeZero
+ };
+
+public:
+ // Constructors
+ Matrix4();
+ Matrix4( real mn[4][4] );
+ Matrix4( real mn[4*4] );
+ Matrix4( real e11, real e12, real e13, real e14,
+ real e21, real e22, real e23, real e24,
+ real e31, real e32, real e33, real e34,
+ real e41, real e42, real e43, real e44 );
+ Matrix4( MatrixType matrixType );
+ template<typename real_> Matrix4( const Matrix4<real_>& matrix );
+
+ // Access functions
+ real& operator() ( uint i, uint j );
+ const real& operator() ( uint i, uint j ) const;
+ const real* GetArray() const;
+ void GetArray( float oMatrix[16] ) const;
+
+ // Matrix functions
+ void Inverse();
+ void LUDecomposition( Matrix4& oMatrixL, Matrix4& oMatrixU ); // For matrix inversion
+ void Transpose();
+ void SetIdentity();
+ void SetZero();
+ Matrix3<real> SubMatrix3( uint row, uint column ) const;
+
+ Matrix4 Transposed() const;
+
+ // Use these functions to create or to combine transformation matrices
+ void SetRotation( const Vector3<real>& axis, real radians ); // M = R
+ void SetTranslation( const Vector3<real>& translation ); // M = T
+ void SetScale( real scaleX, real scaleY, real scaleZ ); // M = S
+ void PreRotate( const Vector3<real>& axis, real radians ); // M = R * M
+ void PreTranslate( const Vector3<real>& translation ); // M = T * M
+ void PreScale( real scaleX, real scaleY, real scaleZ ); // M = S * M
+ void PostRotate( const Vector3<real>& axis, real radians ); // M = M * R
+ void PostTranslate( const Vector3<real>& translation ); // M = M * T
+ void PostScale( real scaleX, real scaleY, real scaleZ ); // M = M * S
+
+ // Operators
+ Matrix4 operator * ( real scalar ) const;
+ Matrix4 operator / ( real scalar ) const;
+ Matrix4 operator + ( const Matrix4& matrix ) const;
+ Matrix4 operator - ( const Matrix4& matrix ) const;
+ Matrix4 operator * ( const Matrix4& matrix ) const;
+ Vector3<real> operator * ( const Vector3<real>& vector ) const; // Homogeneous coordinates multiplication assuming (x,y,z,1)
+ Vector3<real> operator ^ ( const Vector3<real>& vector ) const; // Vector multiplication assuming (x,y,z,0)
+
+ Matrix4& operator *= ( real scalar );
+ Matrix4& operator /= ( real scalar );
+ Matrix4& operator *= ( const Matrix4& matrix );
+ Matrix4& operator += ( const Matrix4& matrix );
+ Matrix4& operator -= ( const Matrix4& matrix );
+ Matrix4& operator = ( const Matrix4& matrix );
+
+ bool operator != ( const Matrix4& matrix ) const;
+
+ friend std::ostream& operator << ( std::ostream& ioStream, const Matrix4<real>& matrix )
+ {
+ for ( uint i=0 ; i<4 ; ++i )
+ {
+ ioStream << "| " << matrix(i,0) << ", " << matrix(i,1) << ", " << matrix(i,2) << ", " << matrix(i,3) << " |";
+
+ if ( i != 3 )
+ ioStream << std::endl;
+ }
+
+ return ioStream;
+ }
+
+private:
+ real mElements[4][4];
+};
+
+}
+
+#include "Matrix4.inl"
+
+#endif //_CORELIB_MATRIX4_H_
+
+
View
28 CoreLib/Includes/CoreLib/Matrix4.inl
@@ -0,0 +1,28 @@
+namespace CoreLib
+{
+
+template<typename real>
+template<typename real_>
+Matrix4<real>::Matrix4( const Matrix4<real_>& matrix )
+{
+ mElements[0][0] = matrix(0,0);
+ mElements[0][1] = matrix(0,1);
+ mElements[0][2] = matrix(0,2);
+ mElements[0][3] = matrix(0,3);
+ mElements[1][0] = matrix(1,0);
+ mElements[1][1] = matrix(1,1);
+ mElements[1][2] = matrix(1,2);
+ mElements[1][3] = matrix(1,3);
+ mElements[2][0] = matrix(2,0);
+ mElements[2][1] = matrix(2,1);
+ mElements[2][2] = matrix(2,2);
+ mElements[2][3] = matrix(2,3);
+ mElements[3][0] = matrix(3,0);
+ mElements[3][1] = matrix(3,1);
+ mElements[3][2] = matrix(3,2);
+ mElements[3][3] = matrix(3,3);
+}
+
+}
+
+
View
78 CoreLib/Includes/CoreLib/Node.h
@@ -0,0 +1,78 @@
+#ifndef _CORELIB_NODE_H_
+#define _CORELIB_NODE_H_
+
+#include "StdDefinition.h"
+#include "Transformation.h"
+#include "Object.h"
+#include <vector>
+#include <cassert>
+
+namespace CoreLib
+{
+
+template<typename real>
+class Node : public Object
+{
+public:
+ enum NodeType
+ {
+ TypeCamera,
+ TypeImplicit,
+ TypeLight,
+ TypeStandard,
+ TypeVisual
+ };
+
+ typedef std::vector<Node*> NodeVector;
+ typedef Object::ObjectType ObjectType;
+
+public:
+ Node();
+ Node(const Transformation<real>& localTransformation );
+ virtual ~Node();
+
+ virtual ObjectType GetObjectType() const;
+ virtual NodeType GetNodeType() const;
+
+ // Update/Render the node and his children
+ virtual void Update();
+ virtual void Render();
+
+ // 'Setters'
+ void SetLocalTransformation( const Transformation<real>& transformation );
+
+ // 'Getters'
+ Transformation<real>& GetLocalTransformation();
+ const Transformation<real>& GetLocalTransformation() const;
+ const Matrix4<real>& GetLocalToGlobal() const;
+ const Matrix4<real>& GetGlobalToLocal() const;
+ NodeVector& GetChildren();
+ const NodeVector& GetChildren() const;
+
+ // Chidlren
+ void AddChild( Node* child );
+ void RemoveChild( Node* child );
+
+ // Parent node
+ Node* GetParent();
+ const Node* GetParent() const;
+
+protected:
+ // Parent node
+ void SetParent( Node* parent );
+
+protected:
+ Node* mParent;
+
+ Transformation<real> mLocalTransformation;
+ Matrix4<real> mGlobalToLocal;
+ Matrix4<real> mLocalToGlobal;
+
+ NodeVector mChildren;
+};
+
+}
+
+#endif //_CORELIB_NODE_H_
+
+
View
37 CoreLib/Includes/CoreLib/Object.h
@@ -0,0 +1,37 @@
+#ifndef _CORELIB_OBJECT_H_
+#define _CORELIB_OBJECT_H_
+
+#include "StdDefinition.h"
+#include <string>
+
+namespace CoreLib
+{
+
+class Object
+{
+public:
+ enum ObjectType
+ {
+ TypeCamera,
+ TypeMaterial,
+ TypeNode,
+ TypeTexture
+ };
+
+public:
+ virtual ~Object();
+
+ virtual ObjectType GetObjectType() const=0;
+
+ void SetName( const std::string& name );
+ const std::string& GetName() const;
+
+private:
+ std::string mName;
+};
+
+}
+
+#endif //_CORELIB_OBJECT_H_
+
+
View
38 CoreLib/Includes/CoreLib/Plane.h
@@ -0,0 +1,38 @@
+#ifndef _CORELIB_PLANE_H_
+#define _CORELIB_PLANE_H_
+
+#include "StdDefinition.h"
+#include "Geometry.h"
+#include "GeometryBuffer.h"
+
+//////////////////////////////////////////////////////
+// Note : The order ZXY is prefered over XZY to ensure
+// an even permutation of XYZ.
+
+namespace CoreLib
+{
+
+template<typename real>
+class Plane : public Geometry<real>
+{
+public:
+ Plane();
+ Plane( real sizeZ, real sizeX );
+ virtual ~Plane();
+
+ virtual void Render();
+
+ void SetSizes( real sizeZ, real sizeX );
+
+private:
+ void InvalidateGeometry();
+
+private:
+ real mSizeZ;
+ real mSizeX;
+ GeometryBuffer<real>* mGeometryBuffer;
+};
+
+}
+
+#endif // _CORELIB_PLANE_H_
View
26 CoreLib/Includes/CoreLib/PointLight.h
@@ -0,0 +1,26 @@
+#ifndef _CORELIB_POINTLIGHT_H_
+#define _CORELIB_POINTLIGHT_H_
+
+#include "StdDefinition.h"
+#include "Light.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class PointLight : public Light<real>
+{
+public:
+ typedef typename Light<real>::LightType LightType;
+
+public:
+ PointLight();
+ PointLight( const Color<real>& intensity, const Color<real>& ambient );
+ virtual ~PointLight();
+
+ virtual LightType GetLightType() const;
+};
+
+}
+
+#endif //_CORELIB_POINTLIGHT_H_
View
65 CoreLib/Includes/CoreLib/Quaternion.h
@@ -0,0 +1,65 @@
+#ifndef _CORELIB_QUATERNION_H_
+#define _CORELIB_QUATERNION_H_
+
+#include "StdDefinition.h"
+#include "Vector3.h"
+#include "Matrix3.h"
+#include "Matrix4.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class Quaternion
+{
+public:
+ Quaternion();
+ Quaternion( real realPart, const Vector3<real>& imaginary );
+ Quaternion( real realPart, real imX, real imY, real imZ );
+
+ // Quaternion functions
+ real SquaredLength( void ) const;
+ real Length( void ) const;
+ void Normalize( void );
+ Quaternion Normalized( void ) const;
+ void Zero();
+ void Exp();
+ void Log();
+ void ToMatrix( Matrix3<real>& oMatrix ) const;
+ void ToMatrix( Matrix4<real>& oMatrix ) const;
+ void ToInverseMatrix( Matrix3<real>& oMatrix ) const;
+ void ToInverseMatrix( Matrix4<real>& oMatrix ) const;
+ void SetRotation( const Vector3<real>& axis, real radians );
+ Vector3<real> RotateVector( const Vector3<real>& vector ) const;
+
+ // Operators
+ Quaternion operator + ( const Quaternion& quaternion ) const;
+ Quaternion operator - ( const Quaternion& quaternion ) const;
+ Quaternion operator * ( const Quaternion& quaternion ) const;
+ Quaternion operator / ( const Quaternion& quaternion ) const;
+ Quaternion operator * ( real constant ) const;
+ Quaternion operator / ( real constant ) const;
+ Quaternion operator - ( ) const;
+
+ Quaternion& operator += ( const Quaternion& quaternion );
+ Quaternion& operator -= ( const Quaternion& quaternion );
+ Quaternion& operator *= ( const Quaternion& quaternion );
+ Quaternion& operator /= ( const Quaternion& quaternion );
+ Quaternion& operator *= ( real constant );
+ Quaternion& operator /= ( real constant );
+
+ friend Quaternion operator * ( real constant, const Quaternion<real>& quaternion )
+ {
+ return Quaternion<real>( quaternion.mReal * constant, quaternion.mImaginary * constant );
+ }
+
+private:
+ real mReal;
+ Vector3<real> mImaginary;
+};
+
+}
+
+#endif //_CORELIB_QUATERNION_H_
+
+
View
62 CoreLib/Includes/CoreLib/RenderState.h
@@ -0,0 +1,62 @@
+#ifndef _CORELIB_RENDERSTATE_H_
+#define _CORELIB_RENDERSTATE_H_
+
+#include "StdDefinition.h"
+#include "Camera.h"
+#include "Light.h"
+#include "Material.h"
+#include "Matrix4.h"
+#include "Vector3.h"
+#include <vector>
+
+namespace CoreLib
+{
+
+template<typename real>
+class RenderState
+{
+public:
+ static void Create();
+ static void Destroy();
+ static RenderState<real>* Get();
+
+ void SetCamera( Camera<real>* camera );
+ void SetLights( const std::vector<Light<real>*>& lights );
+ void SetMaterial( const Material* material );
+ void SetModelMatrix( const Matrix4<real>& modelMatrix );
+
+ Camera<real>* GetCamera();
+ const std::vector<Light<real>* >* GetLights() const;
+ const Material* GetMaterial() const;
+ const Matrix4<float>& GetModelMatrix() const;
+
+ uint GetGLType() const;
+
+ void EnablePositionAttribute();
+ void EnableNormalAttribute();
+ void EnableTexCoordAttribute();
+ void EnableColorAttribute();
+
+ void DisablePositionAttribute();
+ void DisableNormalAttribute();
+ void DisableTexCoordAttribute();
+ void DisableColorAttribute();
+
+private:
+ RenderState();
+
+private:
+ Camera<real>* mCamera;
+ const std::vector<Light<real>* >* mLights;
+ const Material* mMaterial;
+ Matrix4<float> mModelMatrix;
+
+ // Singleton instance
+ static RenderState<real>* sInstance;
+};
+
+}
+
+#endif //_CORELIB_RENDERSTATE_H_
+
+
View
126 CoreLib/Includes/CoreLib/Scene.h
@@ -0,0 +1,126 @@
+#ifndef _CORELIB_SCENE_H_
+#define _CORELIB_SCENE_H_
+
+#include "StdDefinition.h"
+#include "Camera.h"
+#include "CubeMap.h"
+#include "Geometry.h"
+#include "Light.h"
+#include "Material.h"
+#include "Node.h"
+#include "Texture.h"
+#include <string>
+#include <vector>
+#include <map>
+
+namespace CoreLib
+{
+
+template<typename real>
+class Scene
+{
+public:
+ typedef std::vector<Camera<real>*> CameraVector;
+ typedef std::vector<Light<real>*> LightVector;
+ typedef std::vector<Material*> MaterialVector;
+ typedef std::vector<Node<real>*> NodeVector;
+ typedef std::vector<Texture*> TextureVector;
+
+public:
+ Scene();
+ virtual ~Scene();
+
+ void Clear();
+
+ // Main loop functions
+ void Render();
+
+ // Set scene info
+ void SetBackground( const Color<real>& background );
+ void SetSceneGraphNode( Node<real>* sceneGraph );
+ void SetActiveCamera( Camera<real>* camera );
+
+ // Get scene info (const)
+ const Color<real>& GetBackground() const;
+ const Node<real>* GetSceneGraphNode() const;
+ const Camera<real>* GetActiveCamera() const;
+ Material* GetDefaultMaterial();
+
+ // Get scene info (non-const)
+ Color<real>& GetBackground();
+ Node<real>* GetSceneGraphNode();
+ Camera<real>* GetActiveCamera();
+
+ // Add entities
+ void AddLight( Light<real>* light );
+ void AddMaterial( Material* material );
+ void AddCamera( Camera<real>* camera );
+ void AddTexture( Texture* texture );
+
+ // Delete entities
+ void DeleteNode( const std::string& name );
+ void DeleteMaterial( const std::string& name );
+ void DeleteCamera( const std::string& name );
+ void DeleteTexture( const std::string& name );
+
+ // Get entity vectors
+ NodeVector& GetNodes();
+ MaterialVector& GetMaterials();
+ CameraVector& GetCameras();
+ TextureVector& GetTextures();
+
+ // Get entities by name
+ Node<real>* GetNode( const std::string& name );
+ Material* GetMaterial( const std::string& name );
+ Camera<real>* GetCamera( const std::string& name );
+ Texture* GetTexture( const std::string& name );
+
+ // Get unique names
+ std::string GetUniqueNodeName( const std::string& prefix ) const;
+ std::string GetUniqueTextureName( const std::string& prefix ) const;
+
+ // Defaults
+ static Color<real> GetBackgroundDefault();
+
+private:
+ // Update camera and lights states
+ void InitRender();
+ void UpdateCamera();
+ void UpdateLights();
+
+ void RemoveLight( LightNode<real>* light );
+
+private:
+ typedef std::map<std::string, Material*> MaterialMap;
+ typedef std::map<std::string, Node<real>*> NodeMap;
+ typedef std::map<std::string, Camera<real>*> CameraMap;
+ typedef std::map<std::string, Texture*> TextureMap;
+
+private:
+ // Scene info
+ Color<real> mBackground;
+ Node<real>* mSceneGraph;
+ Camera<real>* mActiveCamera;
+ Material* mDefaultMaterial;
+
+ // Scene entities lists
+ NodeVector mNodes;
+ MaterialVector mMaterials;
+ CameraVector mCameras;
+ TextureVector mTextures;
+
+ // Scene entities maps
+ NodeMap mNodeMap;
+ MaterialMap mMaterialMap;
+ CameraMap mCameraMap;
+ TextureMap mTextureMap;
+
+ // Light vector
+ LightVector mLights;
+};
+
+}
+
+#endif //_CORELIB_SCENE_H_
+
+
View
36 CoreLib/Includes/CoreLib/Sphere.h
@@ -0,0 +1,36 @@
+#ifndef _CORELIB_SPHERE_H_
+#define _CORELIB_SPHERE_H_
+
+#include "StdDefinition.h"
+#include "Geometry.h"
+#include "GeometryBuffer.h"
+#include <vector>
+
+namespace CoreLib
+{
+
+template<typename real>
+class Sphere : public Geometry<real>
+{
+public:
+ Sphere();
+ Sphere( real radius, uint latitudeSubdivisions, uint longitudeSubdivisions );
+ virtual ~Sphere();
+
+ virtual void Render();
+
+ void SetSizes( real radius, uint latitudeSubdivisions, uint longitudeSubdivisions );
+
+private:
+ void InvalidateGeometry();
+
+private:
+ real mRadius;
+ uint mLatitudeSubdivisions;
+ uint mLongitudeSubdivisions;
+ GeometryBuffer<real>* mGeometryBuffer;
+};
+
+}
+
+#endif // _CORELIB_SPHERE_H_
View
36 CoreLib/Includes/CoreLib/SpotLight.h
@@ -0,0 +1,36 @@
+#ifndef _CORELIB_SPOTLIGHT_H_
+#define _CORELIB_SPOTLIGHT_H_
+
+#include "StdDefinition.h"
+#include "Light.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class SpotLight : public Light<real>
+{
+public:
+ typedef typename Light<real>::LightType LightType;
+
+public:
+ SpotLight();
+ SpotLight( const Color<real>& intensity, const Color<real>& ambient, const Vector3<real>& direction, real aperture );
+ virtual ~SpotLight();
+
+ virtual LightType GetLightType() const;
+
+ void SetDirection( const Vector3<real>& direction );
+ void SetAperture( real aperture );
+
+ const Vector3<real>& GetDirection() const;
+ real GetAperture() const;
+
+private:
+ Vector3<real> mDirection;
+ real mAperture;
+};
+
+}
+
+#endif //_CORELIB_SPOTLIGHT_H_
View
39 CoreLib/Includes/CoreLib/StdDefinition.h
@@ -0,0 +1,39 @@
+#ifndef _CORELIB_STDDEFINITION_H_
+#define _CORELIB_STDDEFINITION_H_
+
+// Definitions
+#ifndef NULL
+#define NULL 0
+#endif
+
+// Macros
+#define UnusedParameter( param ) (void)param
+
+// Type definition
+typedef unsigned int uint;
+
+namespace CoreLib
+{
+
+// Constants
+static const double PI = 3.14159265358979323846264338327950288419716939937510582097494;
+
+// Generic functions
+template<typename ReturnType, typename TypeArg>
+ReturnType sign( TypeArg arg )
+{
+ if ( arg < 0 )
+ return -1;
+
+ return 1;
+}
+
+}
+
+// Explicit specialization
+#define ExplicitInstantiationReal( C ) template class C<float>; template class C<double>;
+#define ExplicitInstantiationInt( C ) template class C<int>; template class C<uint>;
+
+#endif // _CORELIB_STDDEFINITION_H_
+
+
View
27 CoreLib/Includes/CoreLib/TexturableMaterial.h
@@ -0,0 +1,27 @@
+#ifndef _CORELIB_TEXTURABLEMATERIAL_H_
+#define _CORELIB_TEXTURABLEMATERIAL_H_
+
+#include "StdDefinition.h"
+#include "Texture.h"
+
+namespace CoreLib
+{
+
+class TexturableMaterial
+{
+public:
+ TexturableMaterial();
+
+ // 'Setters'
+ virtual void SetTexture( Texture* texture );
+
+ // 'Getters'
+ const Texture* GetTexture() const;
+
+private:
+ Texture* mTexture;
+};
+
+}
+
+#endif //_CORELIB_TEXTURABLEMATERIAL_H_
View
39 CoreLib/Includes/CoreLib/Texture.h
@@ -0,0 +1,39 @@
+#ifndef _CORELIB_TEXTURE_H_
+#define _CORELIB_TEXTURE_H_
+
+#include "StdDefinition.h"
+#include "Object.h"
+
+namespace CoreLib
+{
+
+class Texture : public Object
+{
+public:
+ enum TextureType
+ {
+ TypeTexture2D,
+ TypeTexture3D,
+ TypeCubeMap,
+ };
+
+ typedef Object::ObjectType ObjectType;
+
+public:
+ Texture();
+ virtual ~Texture();
+
+ virtual ObjectType GetObjectType() const;
+ virtual TextureType GetTextureType() const=0;
+
+ int GetTextureHandle() const { return mTextureHandle; }
+
+protected:
+ uint mTextureHandle;
+};
+
+}
+
+#endif //_CORELIB_TEXTURE_H_
+
+
View
39 CoreLib/Includes/CoreLib/Texture2D.h
@@ -0,0 +1,39 @@
+#ifndef _CORELIB_TEXTURE2D_H_
+#define _CORELIB_TEXTURE2D_H_
+
+#include "StdDefinition.h"
+#include "Texture.h"
+#include "Image2D.h"
+#include <string>
+
+namespace CoreLib
+{
+
+class Texture2D : public Texture
+{
+public:
+ typedef Texture::TextureType TextureType;
+
+public:
+ Texture2D( const std::string& imagePath );
+ Texture2D( const Image2D& image );
+ virtual ~Texture2D();
+
+ virtual TextureType GetTextureType() const;
+
+protected:
+ Texture2D();
+
+ bool Load( const std::string& imagePath );
+ void LoadToGL();
+
+protected:
+ bool mIsLoaded;
+ Image2D mImage;
+};
+
+}
+
+#endif //_CORELIB_TEXTURE2D_H_
+
+
View
22 CoreLib/Includes/CoreLib/Timer.h
@@ -0,0 +1,22 @@
+#ifndef _CORELIB_TIMER_H_
+#define _CORELIB_TIMER_H_
+
+#include "StdDefinition.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class Timer
+{
+public:
+ Timer();
+
+ static real GetClockTime();
+};
+
+}
+
+#endif //_CORELIB_TIMER_H_
+
+
View
86 CoreLib/Includes/CoreLib/Transformation.h
@@ -0,0 +1,86 @@
+#ifndef _CORELIB_TRANSFORMATION_H_
+#define _CORELIB_TRANSFORMATION_H_
+
+#include "StdDefinition.h"
+#include "Vector3.h"
+#include "Matrix4.h"
+#include "Quaternion.h"
+
+namespace CoreLib
+{
+
+template<typename real>
+class Transformation
+{
+public:
+ Transformation();
+
+ // Rotation
+ void RotateX( real angle );
+ void SetRotationX( real angle );
+ void RotateY( real angle );
+ void SetRotationY( real angle );
+ void RotateZ( real angle );
+ void SetRotationZ( real angle );
+ void RotateAxis( const Vector3<real>& axis, real angle );
+ void SetRotationAxis( const Vector3<real>& axis, real angle );
+ void Rotate( const Quaternion<real>& rotation );
+ void SetRotation( const Quaternion<real>& rotation );
+
+ // Scaling
+ void Scale( real uniformScale );
+ void SetScale( real uniformScale );
+ void Scale( real scaleX, real scaleY, real scaleZ );
+ void SetScale( real scaleX, real scaleY, real scaleZ );
+ void ScaleX( real scaleX );
+ void SetScaleX( real scaleX );
+ void ScaleY( real scaleY );
+ void SetScaleY( real scaleY );
+ void ScaleZ( real scaleZ );
+ void SetScaleZ( real scaleZ );
+
+ // Translation
+ void Translate( const Vector3<real>& translation );
+ void SetTranslation( const Vector3<real>& translation );
+
+ // Total transformation matrix
+ Matrix4<real> GetMatrix() const;
+ Matrix4<real> GetInverseMatrix() const;
+
+ // Partial transformation matrices
+ Matrix4<real> GetRotation() const;
+ Matrix4<real> GetInverseRotation() const;
+ Matrix4<real> GetTranslation() const;