Просмотр исходного кода

- Updating SDL
- Spliting the Mesh class to Mesh and MeshData

Panagiotis Christopoulos Charitos 15 лет назад
Родитель
Сommit
2f2bcf3e4a

+ 139 - 68
build/debug/Makefile

@@ -6,8 +6,8 @@ PHFLAGS =
 LFLAGS = -rdynamic -pg -L../../extern/lib-x86-64-linux -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lGLU -Wl,-Bdynamic -lGL -ljpeg -lSDL -lpng -lpython2.6 -lboost_system -lboost_python -lboost_filesystem -lboost_thread
 EXECUTABLE = anki
 INCPATH = -I./ -I../../src/Scripting/ -I../../src/Math/ -I../../src/Misc/ -I../../src/ -I../../src/Renderer/ -I../../src/Scene/ -I../../src/Ui/ -I../../src/Resources/ -I../../src/Util/ -I../../src/Scene/Controllers/ -I../../src/Physics/ -I../../src/Renderer/BufferObjects/ -I../../src/Resources/Helpers/ -I../../src/Resources/Core/ -I../../src/Core/ -I../../src/Scripting/Math -I../../src/Scripting/Util -I../../src/Scripting/Core -I../../src/Scripting/Scene -I../../src/Scripting/Renderer -I../../src/Input -I../../src/Collision -I../../extern/include -I../../extern/include/bullet -I/usr/include/python2.6 
-SOURCES = ../../src/Scripting//ScriptingEngine.cpp ../../src/Scripting//BoostPythonInterfaces.cpp ../../src/Misc//skybox.cpp ../../src/Misc//map.cpp ../../src/Misc//TestHeader.cpp ../../src//Main.cpp ../../src/Renderer//Smo.cpp ../../src/Renderer//Ez.cpp ../../src/Renderer//Ms.cpp ../../src/Renderer//Sm.cpp ../../src/Renderer//Pps.cpp ../../src/Renderer//Ssao.cpp ../../src/Renderer//Renderer.cpp ../../src/Renderer//Is.cpp ../../src/Renderer//MainRenderer.cpp ../../src/Renderer//Dbg.cpp ../../src/Renderer//Hdr.cpp ../../src/Renderer//Bs.cpp ../../src/Scene//MeshNode.cpp ../../src/Scene//SceneNode.cpp ../../src/Scene//SkelNode.cpp ../../src/Scene//Light.cpp ../../src/Scene//SkelModelNode.cpp ../../src/Scene//Camera.cpp ../../src/Scene//ParticleEmitter.cpp ../../src/Scene//Scene.cpp ../../src/Scene//SpotLight.cpp ../../src/Ui//Ui.cpp ../../src/Resources//ShaderProg.cpp ../../src/Resources//Material.cpp ../../src/Resources//Texture.cpp ../../src/Resources//SkelAnim.cpp ../../src/Resources//Extension.cpp ../../src/Resources//Skeleton.cpp ../../src/Resources//Script.cpp ../../src/Resources//LightData.cpp ../../src/Resources//Mesh.cpp ../../src/Resources//ParticleEmitterProps.cpp ../../src/Util//Scanner.cpp ../../src/Util//Util.cpp ../../src/Util//BinaryStream.cpp ../../src/Util//Exception.cpp ../../src/Scene/Controllers//Controller.cpp ../../src/Scene/Controllers//SkelAnimCtrl.cpp ../../src/Physics//Physics.cpp ../../src/Physics//RigidBody.cpp ../../src/Physics//PhyCharacter.cpp ../../src/Physics//DebugDrawer.cpp ../../src/Renderer/BufferObjects//BufferObject.cpp ../../src/Resources/Helpers//Image.cpp ../../src/Resources/Helpers//ShaderPrePreprocessor.cpp ../../src/Resources/Core//RsrcPtr.cpp ../../src/Resources/Core//RsrcContainers.cpp ../../src/Core//App.cpp ../../src/Core//StdinListener.cpp ../../src/Core//Object.cpp ../../src/Input/Input.cpp ../../src/Collision/Plane.cpp ../../src/Collision/Sphere.cpp 
-OBJECTS = ScriptingEngine.o BoostPythonInterfaces.o skybox.o map.o TestHeader.o Main.o Smo.o Ez.o Ms.o Sm.o Pps.o Ssao.o Renderer.o Is.o MainRenderer.o Dbg.o Hdr.o Bs.o MeshNode.o SceneNode.o SkelNode.o Light.o SkelModelNode.o Camera.o ParticleEmitter.o Scene.o SpotLight.o Ui.o ShaderProg.o Material.o Texture.o SkelAnim.o Extension.o Skeleton.o Script.o LightData.o Mesh.o ParticleEmitterProps.o Scanner.o Util.o BinaryStream.o Exception.o Controller.o SkelAnimCtrl.o Physics.o RigidBody.o PhyCharacter.o DebugDrawer.o BufferObject.o Image.o ShaderPrePreprocessor.o RsrcPtr.o RsrcContainers.o App.o StdinListener.o Object.o Input.o Plane.o Sphere.o 
+SOURCES = ../../src/Scripting//ScriptingEngine.cpp ../../src/Scripting//BoostPythonInterfaces.cpp ../../src/Misc//skybox.cpp ../../src/Misc//map.cpp ../../src/Misc//TestHeader.cpp ../../src//Main.cpp ../../src/Renderer//Smo.cpp ../../src/Renderer//Ez.cpp ../../src/Renderer//Ms.cpp ../../src/Renderer//Sm.cpp ../../src/Renderer//Pps.cpp ../../src/Renderer//Ssao.cpp ../../src/Renderer//Renderer.cpp ../../src/Renderer//Is.cpp ../../src/Renderer//MainRenderer.cpp ../../src/Renderer//Dbg.cpp ../../src/Renderer//Hdr.cpp ../../src/Renderer//Bs.cpp ../../src/Scene//MeshNode.cpp ../../src/Scene//SceneNode.cpp ../../src/Scene//SkelNode.cpp ../../src/Scene//Light.cpp ../../src/Scene//SkelModelNode.cpp ../../src/Scene//Camera.cpp ../../src/Scene//ParticleEmitter.cpp ../../src/Scene//Scene.cpp ../../src/Scene//SpotLight.cpp ../../src/Ui//Ui.cpp ../../src/Resources//ShaderProg.cpp ../../src/Resources//Material.cpp ../../src/Resources//Texture.cpp ../../src/Resources//SkelAnim.cpp ../../src/Resources//Extension.cpp ../../src/Resources//Skeleton.cpp ../../src/Resources//Script.cpp ../../src/Resources//LightData.cpp ../../src/Resources//Mesh.cpp ../../src/Resources//ParticleEmitterProps.cpp ../../src/Util//Scanner.cpp ../../src/Util//Util.cpp ../../src/Util//BinaryStream.cpp ../../src/Util//Exception.cpp ../../src/Scene/Controllers//Controller.cpp ../../src/Scene/Controllers//SkelAnimCtrl.cpp ../../src/Physics//Physics.cpp ../../src/Physics//RigidBody.cpp ../../src/Physics//PhyCharacter.cpp ../../src/Physics//DebugDrawer.cpp ../../src/Renderer/BufferObjects//BufferObject.cpp ../../src/Resources/Helpers//Image.cpp ../../src/Resources/Helpers//ShaderPrePreprocessor.cpp ../../src/Resources/Helpers//MeshData.cpp ../../src/Resources/Core//RsrcPtr.cpp ../../src/Resources/Core//RsrcContainers.cpp ../../src/Core//App.cpp ../../src/Core//StdinListener.cpp ../../src/Core//Object.cpp ../../src/Input/Input.cpp ../../src/Collision/Plane.cpp ../../src/Collision/Sphere.cpp 
+OBJECTS = ScriptingEngine.o BoostPythonInterfaces.o skybox.o map.o TestHeader.o Main.o Smo.o Ez.o Ms.o Sm.o Pps.o Ssao.o Renderer.o Is.o MainRenderer.o Dbg.o Hdr.o Bs.o MeshNode.o SceneNode.o SkelNode.o Light.o SkelModelNode.o Camera.o ParticleEmitter.o Scene.o SpotLight.o Ui.o ShaderProg.o Material.o Texture.o SkelAnim.o Extension.o Skeleton.o Script.o LightData.o Mesh.o ParticleEmitterProps.o Scanner.o Util.o BinaryStream.o Exception.o Controller.o SkelAnimCtrl.o Physics.o RigidBody.o PhyCharacter.o DebugDrawer.o BufferObject.o Image.o ShaderPrePreprocessor.o MeshData.o RsrcPtr.o RsrcContainers.o App.o StdinListener.o Object.o Input.o Plane.o Sphere.o 
 PRECOMPILED_HEADERS = 
 
 all: $(PRECOMPILED_HEADERS) $(SOURCES) $(EXECUTABLE)
@@ -240,6 +240,8 @@ BoostPythonInterfaces.o: ../../src/Scripting//BoostPythonInterfaces.cpp \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -445,6 +447,8 @@ skybox.o: ../../src/Misc//skybox.cpp ../../src/Misc//skybox.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -461,10 +465,21 @@ map.o: ../../src/Misc//map.cpp
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/Misc//map.cpp -o map.o
 
 TestHeader.o: ../../src/Misc//TestHeader.cpp \
- ../../src/Renderer/BufferObjects/Vbo.h \
- ../../src/Renderer/BufferObjects/BufferObject.h \
- ../../extern/include/GL/glew.h ../../src/Util/Exception.h \
- ../../src/Util/StdTypes.h
+ ../../src/Resources/Helpers/MeshData.h ../../src/Math/Math.h \
+ ../../src/Math/Vec2.h ../../src/Math/MathCommon.h \
+ ../../src/Util/StdTypes.h ../../src/Math/Vec2.inl.h \
+ ../../src/Math/MathCommon.inl.h ../../src/Math/Vec3.h \
+ ../../src/Math/Vec3.inl.h ../../src/Math/Vec4.h \
+ ../../src/Math/Vec4.inl.h ../../src/Math/Quat.h \
+ ../../src/Math/Quat.inl.h ../../src/Math/Axisang.h \
+ ../../src/Math/Axisang.inl.h ../../src/Math/Euler.h \
+ ../../src/Math/Euler.inl.h ../../src/Math/Mat3.h \
+ ../../src/Math/Mat3.inl.h ../../src/Math/Mat4.h \
+ ../../src/Math/Mat4.inl.h ../../src/Math/MathFuncs.h \
+ ../../src/Math/MathFuncs.inl.h ../../src/Math/Transform.h \
+ ../../src/Math/Transform.inl.h ../../src/Util/Exception.h \
+ ../../src/Util/Vec.h ../../src/Util/Exception.h \
+ ../../src/Util/Properties.h
 	@echo Compiling ../../src/Misc//TestHeader.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/Misc//TestHeader.cpp -o TestHeader.o
 
@@ -475,7 +490,35 @@ Main.o: ../../src//Main.cpp ../../src/Input/Input.h \
  ../../extern/include/SDL/SDL_platform.h \
  ../../extern/include/SDL/begin_code.h \
  ../../extern/include/SDL/close_code.h ../../src/Util/Vec.h \
- ../../src/Util/Exception.h ../../src/Core/App.h \
+ ../../src/Util/Exception.h ../../src/Math/Math.h ../../src/Math/Vec2.h \
+ ../../src/Math/MathCommon.h ../../src/Util/StdTypes.h \
+ ../../src/Math/Vec2.inl.h ../../src/Math/MathCommon.inl.h \
+ ../../src/Math/Vec3.h ../../src/Math/Vec3.inl.h ../../src/Math/Vec4.h \
+ ../../src/Math/Vec4.inl.h ../../src/Math/Quat.h \
+ ../../src/Math/Quat.inl.h ../../src/Math/Axisang.h \
+ ../../src/Math/Axisang.inl.h ../../src/Math/Euler.h \
+ ../../src/Math/Euler.inl.h ../../src/Math/Mat3.h \
+ ../../src/Math/Mat3.inl.h ../../src/Math/Mat4.h \
+ ../../src/Math/Mat4.inl.h ../../src/Math/MathFuncs.h \
+ ../../src/Math/MathFuncs.inl.h ../../src/Math/Transform.h \
+ ../../src/Math/Transform.inl.h ../../src/Util/Exception.h \
+ ../../src/Core/Object.h ../../src/Scene/Camera.h \
+ ../../src/Collision/Collision.h ../../src/Collision/Plane.h \
+ ../../src/Collision/CollisionShape.h ../../src/Util/Properties.h \
+ ../../src/Collision/Sphere.h ../../src/Scene/SceneNode.h \
+ ../../src/Renderer/Renderer.h ../../src/Renderer/BufferObjects/Fbo.h \
+ ../../extern/include/GL/glew.h ../../src/Resources/Texture.h \
+ ../../src/Resources/Core/Resource.h ../../src/Util/Util.h \
+ ../../src/Util/Vec.h ../../src/Util/StdTypes.h \
+ ../../src/Resources/ShaderProg.h ../../src/Util/CharPtrHashMap.h \
+ ../../src/Renderer/BufferObjects/Vbo.h \
+ ../../src/Renderer/BufferObjects/BufferObject.h \
+ ../../src/Resources/Core/RsrcPtr.h ../../src/Renderer/Ms.h \
+ ../../src/Renderer/RenderingStage.h ../../src/Renderer/Ez.h \
+ ../../src/Renderer/Is.h ../../src/Renderer/Sm.h ../../src/Renderer/Smo.h \
+ ../../src/Renderer/Pps.h ../../src/Renderer/Hdr.h \
+ ../../src/Renderer/Ssao.h ../../src/Renderer/Bs.h \
+ ../../src/Renderer/Dbg.h ../../src/Ui/Ui.h ../../src/Core/App.h \
  ../../extern/include/SDL/SDL.h ../../extern/include/SDL/SDL_main.h \
  ../../extern/include/SDL/SDL_atomic.h \
  ../../extern/include/SDL/SDL_audio.h \
@@ -497,41 +540,15 @@ Main.o: ../../src//Main.cpp ../../src/Input/Input.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
  ../../extern/include/SDL/SDL_version.h \
  ../../extern/include/SDL/SDL_revision.h \
  ../../extern/include/SDL/SDL_compat.h ../../src/Core/Object.h \
- ../../src/Core/MessageHandler.h ../../src/Util/StdTypes.h \
- ../../src/Util/Properties.h ../../src/Util/Exception.h \
- ../../src/Math/Math.h ../../src/Math/Vec2.h ../../src/Math/MathCommon.h \
- ../../src/Math/Vec2.inl.h ../../src/Math/MathCommon.inl.h \
- ../../src/Math/Vec3.h ../../src/Math/Vec3.inl.h ../../src/Math/Vec4.h \
- ../../src/Math/Vec4.inl.h ../../src/Math/Quat.h \
- ../../src/Math/Quat.inl.h ../../src/Math/Axisang.h \
- ../../src/Math/Axisang.inl.h ../../src/Math/Euler.h \
- ../../src/Math/Euler.inl.h ../../src/Math/Mat3.h \
- ../../src/Math/Mat3.inl.h ../../src/Math/Mat4.h \
- ../../src/Math/Mat4.inl.h ../../src/Math/MathFuncs.h \
- ../../src/Math/MathFuncs.inl.h ../../src/Math/Transform.h \
- ../../src/Math/Transform.inl.h ../../src/Scene/Camera.h \
- ../../src/Collision/Collision.h ../../src/Collision/Plane.h \
- ../../src/Collision/CollisionShape.h ../../src/Collision/Sphere.h \
- ../../src/Scene/SceneNode.h ../../src/Core/Object.h \
- ../../src/Renderer/Renderer.h ../../src/Renderer/BufferObjects/Fbo.h \
- ../../extern/include/GL/glew.h ../../src/Resources/Texture.h \
- ../../src/Resources/Core/Resource.h ../../src/Util/Util.h \
- ../../src/Util/Vec.h ../../src/Util/StdTypes.h \
- ../../src/Resources/ShaderProg.h ../../src/Util/CharPtrHashMap.h \
- ../../src/Renderer/BufferObjects/Vbo.h \
- ../../src/Renderer/BufferObjects/BufferObject.h \
- ../../src/Resources/Core/RsrcPtr.h ../../src/Renderer/Ms.h \
- ../../src/Renderer/RenderingStage.h ../../src/Renderer/Ez.h \
- ../../src/Renderer/Is.h ../../src/Renderer/Sm.h ../../src/Renderer/Smo.h \
- ../../src/Renderer/Pps.h ../../src/Renderer/Hdr.h \
- ../../src/Renderer/Ssao.h ../../src/Renderer/Bs.h \
- ../../src/Renderer/Dbg.h ../../src/Ui/Ui.h ../../src/Resources/Mesh.h \
+ ../../src/Core/MessageHandler.h ../../src/Resources/Mesh.h \
  ../../src/Scene/Light.h ../../src/Scene/Camera.h \
  ../../src/Resources/LightData.h ../../src/Resources/Texture.h \
  ../../src/Scene/PointLight.h ../../src/Scene/Light.h \
@@ -774,6 +791,8 @@ Ez.o: ../../src/Renderer//Ez.cpp ../../src/Renderer//Ez.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -972,6 +991,8 @@ Ms.o: ../../src/Renderer//Ms.cpp ../../src/Renderer//Ms.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -1173,6 +1194,8 @@ Sm.o: ../../src/Renderer//Sm.cpp ../../src/Renderer//Sm.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -1444,6 +1467,8 @@ Renderer.o: ../../src/Renderer//Renderer.cpp \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -1644,6 +1669,8 @@ Is.o: ../../src/Renderer//Is.cpp ../../src/Renderer//Is.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -1838,6 +1865,8 @@ MainRenderer.o: ../../src/Renderer//MainRenderer.cpp \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -1902,6 +1931,8 @@ Dbg.o: ../../src/Renderer//Dbg.cpp ../../src/Renderer//Dbg.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -2131,6 +2162,8 @@ Bs.o: ../../src/Renderer//Bs.cpp ../../src/Renderer//Bs.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -2328,6 +2361,8 @@ MeshNode.o: ../../src/Scene//MeshNode.cpp ../../src/Scene//MeshNode.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -2531,6 +2566,8 @@ SceneNode.o: ../../src/Scene//SceneNode.cpp ../../src/Scene//SceneNode.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -2588,6 +2625,8 @@ SkelNode.o: ../../src/Scene//SkelNode.cpp ../../src/Scene//SkelNode.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -2656,6 +2695,8 @@ Light.o: ../../src/Scene//Light.cpp ../../src/Scene//Light.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -2763,6 +2804,8 @@ Camera.o: ../../src/Scene//Camera.cpp ../../src/Scene//Camera.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -2961,6 +3004,8 @@ ParticleEmitter.o: ../../src/Scene//ParticleEmitter.cpp \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -3219,6 +3264,8 @@ Ui.o: ../../src/Ui//Ui.cpp ../../src/Ui//Ui.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -3275,6 +3322,8 @@ ShaderProg.o: ../../src/Resources//ShaderProg.cpp \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -3333,6 +3382,8 @@ Material.o: ../../src/Resources//Material.cpp \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -3685,6 +3736,8 @@ Controller.o: ../../src/Scene/Controllers//Controller.cpp \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -3742,6 +3795,8 @@ SkelAnimCtrl.o: ../../src/Scene/Controllers//SkelAnimCtrl.cpp \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -4289,6 +4344,8 @@ DebugDrawer.o: ../../src/Physics//DebugDrawer.cpp \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -4445,6 +4502,26 @@ ShaderPrePreprocessor.o: \
 	@echo Compiling ../../src/Resources/Helpers//ShaderPrePreprocessor.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/Resources/Helpers//ShaderPrePreprocessor.cpp -o ShaderPrePreprocessor.o
 
+MeshData.o: ../../src/Resources/Helpers//MeshData.cpp \
+ ../../src/Resources/Helpers//MeshData.h ../../src/Math/Math.h \
+ ../../src/Math/Vec2.h ../../src/Math/MathCommon.h \
+ ../../src/Util/StdTypes.h ../../src/Math/Vec2.inl.h \
+ ../../src/Math/MathCommon.inl.h ../../src/Math/Vec3.h \
+ ../../src/Math/Vec3.inl.h ../../src/Math/Vec4.h \
+ ../../src/Math/Vec4.inl.h ../../src/Math/Quat.h \
+ ../../src/Math/Quat.inl.h ../../src/Math/Axisang.h \
+ ../../src/Math/Axisang.inl.h ../../src/Math/Euler.h \
+ ../../src/Math/Euler.inl.h ../../src/Math/Mat3.h \
+ ../../src/Math/Mat3.inl.h ../../src/Math/Mat4.h \
+ ../../src/Math/Mat4.inl.h ../../src/Math/MathFuncs.h \
+ ../../src/Math/MathFuncs.inl.h ../../src/Math/Transform.h \
+ ../../src/Math/Transform.inl.h ../../src/Util/Exception.h \
+ ../../src/Util/Vec.h ../../src/Util/Exception.h \
+ ../../src/Util/Properties.h ../../src/Util/BinaryStream.h \
+ ../../src/Util/StdTypes.h
+	@echo Compiling ../../src/Resources/Helpers//MeshData.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/Resources/Helpers//MeshData.cpp -o MeshData.o
+
 RsrcPtr.o: ../../src/Resources/Core//RsrcPtr.cpp \
  ../../src/Resources/Core//RsrcPtr.h ../../src/Util/Exception.h \
  ../../src/Resources/Core//RsrcContainer.h ../../src/Util/Vec.h \
@@ -4532,6 +4609,8 @@ App.o: ../../src/Core//App.cpp ../../extern/include/GL/glew.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
@@ -4695,7 +4774,8 @@ App.o: ../../src/Core//App.cpp ../../extern/include/GL/glew.h \
  ../../src/Renderer/Pps.h ../../src/Renderer/Hdr.h \
  ../../src/Renderer/Ssao.h ../../src/Renderer/Bs.h \
  ../../src/Renderer/Dbg.h ../../src/Scripting/ScriptingEngine.h \
- ../../src/Core//StdinListener.h ../../src/Core//Messaging.h
+ ../../src/Core//StdinListener.h ../../src/Core//Messaging.h \
+ ../../src/Input/Input.h ../../extern/include/SDL/SDL_scancode.h
 	@echo Compiling ../../src/Core//App.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/Core//App.cpp -o App.o
 
@@ -4711,13 +4791,27 @@ Object.o: ../../src/Core//Object.cpp ../../src/Core//Object.h \
 	@echo Compiling ../../src/Core//Object.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/Core//Object.cpp -o Object.o
 
-Input.o: ../../src/Input/Input.cpp ../../extern/include/SDL/SDL.h \
- ../../extern/include/SDL/SDL_main.h \
+Input.o: ../../src/Input/Input.cpp ../../src/Input/Input.h \
+ ../../extern/include/SDL/SDL_scancode.h \
  ../../extern/include/SDL/SDL_stdinc.h \
  ../../extern/include/SDL/SDL_config.h \
  ../../extern/include/SDL/SDL_platform.h \
  ../../extern/include/SDL/begin_code.h \
- ../../extern/include/SDL/close_code.h \
+ ../../extern/include/SDL/close_code.h ../../src/Util/Vec.h \
+ ../../src/Util/Exception.h ../../src/Math/Math.h ../../src/Math/Vec2.h \
+ ../../src/Math/MathCommon.h ../../src/Util/StdTypes.h \
+ ../../src/Math/Vec2.inl.h ../../src/Math/MathCommon.inl.h \
+ ../../src/Math/Vec3.h ../../src/Math/Vec3.inl.h ../../src/Math/Vec4.h \
+ ../../src/Math/Vec4.inl.h ../../src/Math/Quat.h \
+ ../../src/Math/Quat.inl.h ../../src/Math/Axisang.h \
+ ../../src/Math/Axisang.inl.h ../../src/Math/Euler.h \
+ ../../src/Math/Euler.inl.h ../../src/Math/Mat3.h \
+ ../../src/Math/Mat3.inl.h ../../src/Math/Mat4.h \
+ ../../src/Math/Mat4.inl.h ../../src/Math/MathFuncs.h \
+ ../../src/Math/MathFuncs.inl.h ../../src/Math/Transform.h \
+ ../../src/Math/Transform.inl.h ../../src/Util/Exception.h \
+ ../../src/Core/Object.h ../../extern/include/SDL/SDL.h \
+ ../../extern/include/SDL/SDL_main.h \
  ../../extern/include/SDL/SDL_atomic.h \
  ../../extern/include/SDL/SDL_audio.h \
  ../../extern/include/SDL/SDL_error.h \
@@ -4738,39 +4832,16 @@ Input.o: ../../src/Input/Input.cpp ../../extern/include/SDL/SDL.h \
  ../../extern/include/SDL/SDL_mouse.h \
  ../../extern/include/SDL/SDL_joystick.h \
  ../../extern/include/SDL/SDL_quit.h \
+ ../../extern/include/SDL/SDL_gesture.h \
+ ../../extern/include/SDL/SDL_touch.h \
  ../../extern/include/SDL/SDL_loadso.h \
  ../../extern/include/SDL/SDL_power.h \
  ../../extern/include/SDL/SDL_timer.h \
  ../../extern/include/SDL/SDL_version.h \
  ../../extern/include/SDL/SDL_revision.h \
- ../../extern/include/SDL/SDL_compat.h ../../src/Input/Input.h \
- ../../extern/include/SDL/SDL_scancode.h ../../src/Util/Vec.h \
- ../../src/Util/Exception.h ../../src/Core/App.h ../../src/Core/Object.h \
- ../../src/Core/MessageHandler.h ../../src/Util/StdTypes.h \
- ../../src/Util/Properties.h ../../src/Util/Exception.h \
- ../../src/Math/Math.h ../../src/Math/Vec2.h ../../src/Math/MathCommon.h \
- ../../src/Math/Vec2.inl.h ../../src/Math/MathCommon.inl.h \
- ../../src/Math/Vec3.h ../../src/Math/Vec3.inl.h ../../src/Math/Vec4.h \
- ../../src/Math/Vec4.inl.h ../../src/Math/Quat.h \
- ../../src/Math/Quat.inl.h ../../src/Math/Axisang.h \
- ../../src/Math/Axisang.inl.h ../../src/Math/Euler.h \
- ../../src/Math/Euler.inl.h ../../src/Math/Mat3.h \
- ../../src/Math/Mat3.inl.h ../../src/Math/Mat4.h \
- ../../src/Math/Mat4.inl.h ../../src/Math/MathFuncs.h \
- ../../src/Math/MathFuncs.inl.h ../../src/Math/Transform.h \
- ../../src/Math/Transform.inl.h ../../src/Renderer/Renderer.h \
- ../../src/Renderer/BufferObjects/Fbo.h ../../extern/include/GL/glew.h \
- ../../src/Resources/Texture.h ../../src/Resources/Core/Resource.h \
- ../../src/Util/Util.h ../../src/Util/Vec.h ../../src/Util/StdTypes.h \
- ../../src/Resources/ShaderProg.h ../../src/Util/CharPtrHashMap.h \
- ../../src/Renderer/BufferObjects/Vbo.h \
- ../../src/Renderer/BufferObjects/BufferObject.h \
- ../../src/Resources/Core/RsrcPtr.h ../../src/Core/Object.h \
- ../../src/Renderer/Ms.h ../../src/Renderer/RenderingStage.h \
- ../../src/Renderer/Ez.h ../../src/Renderer/Is.h ../../src/Renderer/Sm.h \
- ../../src/Renderer/Smo.h ../../src/Renderer/Pps.h \
- ../../src/Renderer/Hdr.h ../../src/Renderer/Ssao.h \
- ../../src/Renderer/Bs.h ../../src/Renderer/Dbg.h
+ ../../extern/include/SDL/SDL_compat.h ../../src/Core/App.h \
+ ../../src/Core/Object.h ../../src/Core/MessageHandler.h \
+ ../../src/Util/Properties.h
 	@echo Compiling ../../src/Input/Input.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/Input/Input.cpp -o Input.o
 

+ 5 - 6
extern/include/SDL/SDL.h

@@ -121,8 +121,7 @@ extern "C" {
 /*@}*/
 
 /**
- *  This function loads the SDL dynamically linked library and initializes 
- *  the subsystems specified by \c flags (and those satisfying dependencies).
+ *  This function initializes  the subsystems specified by \c flags
  *  Unless the ::SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
  *  signal handlers for some commonly ignored fatal signals (like SIGSEGV).
  */
@@ -139,16 +138,16 @@ extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
 extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
 
 /**
- *  This function returns mask of the specified subsystems which have
- *  been initialized.
+ *  This function returns a mask of the specified subsystems which have
+ *  previously been initialized.
  *  
  *  If \c flags is 0, it returns a mask of all initialized subsystems.
  */
 extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
 
 /**
- *  This function cleans up all initialized subsystems and unloads the
- *  dynamically linked library.  You should call it upon all exit conditions.
+ *  This function cleans up all initialized subsystems. You should
+ *  call it upon all exit conditions.
  */
 extern DECLSPEC void SDLCALL SDL_Quit(void);
 

+ 2 - 2
extern/include/SDL/SDL_clipboard.h

@@ -53,14 +53,14 @@ extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
  *
  * \sa SDL_SetClipboardText()
  */
-extern DECLSPEC char * SDLCALL SDL_GetClipboardText();
+extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
 
 /**
  * \brief Returns whether the clipboard has text
  *
  * \sa SDL_GetClipboardText()
  */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText();
+extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
 
 
 /* Ends C function definitions when using C++ */

+ 8 - 0
extern/include/SDL/SDL_config.h

@@ -137,6 +137,8 @@
 #define HAVE_SNPRINTF 1
 #define HAVE_VSNPRINTF 1
 #define HAVE_M_PI /**/
+#define HAVE_ATAN 1
+#define HAVE_ATAN2 1
 #define HAVE_CEIL 1
 #define HAVE_COPYSIGN 1
 #define HAVE_COS 1
@@ -273,12 +275,18 @@
 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER "libXrender.so.1"
 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT "libXi.so.6"
 /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS */
+/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE */
+/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES */
 #define SDL_VIDEO_DRIVER_X11_VIDMODE 1
 #define SDL_VIDEO_DRIVER_X11_XINERAMA 1
 #define SDL_VIDEO_DRIVER_X11_XRANDR 1
 #define SDL_VIDEO_DRIVER_X11_XINPUT 1
 /* #undef SDL_VIDEO_DRIVER_X11_SCRNSAVER */
 #define SDL_VIDEO_DRIVER_X11_XV 1
+#define SDL_VIDEO_DRIVER_X11_XRENDER 1
+/* #undef SDL_VIDEO_DRIVER_X11_XDAMAGE */
+/* #undef SDL_VIDEO_DRIVER_X11_XFIXES */
+#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
 
 /* #undef SDL_VIDEO_RENDER_D3D */
 /* #undef SDL_VIDEO_RENDER_GDI */

+ 5 - 0
extern/include/SDL/SDL_endian.h

@@ -40,6 +40,10 @@
 /*@}*/
 
 #ifndef SDL_BYTEORDER           /* Not defined in SDL_config.h? */
+#ifdef __linux__
+#include <endian.h>
+#define SDL_BYTEORDER  __BYTE_ORDER
+#else /* __linux __ */
 #if defined(__hppa__) || \
     defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
     (defined(__MIPS__) && defined(__MISPEB__)) || \
@@ -49,6 +53,7 @@
 #else
 #define SDL_BYTEORDER	SDL_LIL_ENDIAN
 #endif
+#endif /* __linux __ */
 #endif /* !SDL_BYTEORDER */
 
 

+ 1 - 1
extern/include/SDL/SDL_error.h

@@ -41,7 +41,7 @@ extern "C" {
 
 /* Public functions */
 extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
-extern DECLSPEC char *SDLCALL SDL_GetError(void);
+extern DECLSPEC const char *SDLCALL SDL_GetError(void);
 extern DECLSPEC void SDLCALL SDL_ClearError(void);
 
 /**

+ 101 - 5
extern/include/SDL/SDL_events.h

@@ -36,6 +36,8 @@
 #include "SDL_mouse.h"
 #include "SDL_joystick.h"
 #include "SDL_quit.h"
+#include "SDL_gesture.h"
+#include "SDL_touch.h"
 
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
@@ -90,11 +92,28 @@ typedef enum
     SDL_JOYBUTTONDOWN,          /**< Joystick button pressed */
     SDL_JOYBUTTONUP,            /**< Joystick button released */
 
+    /* Touch events */
+    SDL_FINGERDOWN      = 0x700,
+    SDL_FINGERUP,
+    SDL_FINGERMOTION,
+    SDL_TOUCHBUTTONDOWN,
+    SDL_TOUCHBUTTONUP,    
+
+    /* Gesture events */
+    SDL_DOLLARGESTURE   = 0x800,
+    SDL_DOLLARRECORD,
+    SDL_MULTIGESTURE,
+
+    /* Clipboard events */
+
+    SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
+
     /* Obsolete events */
     SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */
     SDL_EVENT_COMPAT2,
     SDL_EVENT_COMPAT3,
 
+
     /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
      *  and should be allocated with SDL_RegisterEvents()
      */
@@ -129,7 +148,7 @@ typedef struct SDL_KeyboardEvent
     Uint32 type;        /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
     Uint32 windowID;    /**< The window with keyboard focus, if any */
     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
-    Uint8 padding1;
+    Uint8 repeat;       /**< Non-zero if this is a key repeat */
     Uint8 padding2;
     Uint8 padding3;
     SDL_keysym keysym;  /**< The key that was pressed or released */
@@ -260,6 +279,79 @@ typedef struct SDL_JoyButtonEvent
     Uint8 padding1;
 } SDL_JoyButtonEvent;
 
+
+/**
+ *  \brief Touch finger motion/finger event structure (event.tmotion.*)
+ */
+typedef struct SDL_TouchFingerEvent
+{
+    Uint32 type;        /**< ::SDL_FINGERMOTION OR 
+			   SDL_FINGERDOWN OR SDL_FINGERUP*/
+    Uint32 windowID;    /**< The window with mouse focus, if any */
+    SDL_TouchID touchId;        /**< The touch device id */
+    SDL_FingerID fingerId;
+    Uint8 state;        /**< The current button state */
+    Uint8 padding1;
+    Uint8 padding2;
+    Uint8 padding3;
+    Uint16 x;
+    Uint16 y;
+    Sint16 dx;
+    Sint16 dy;
+    Uint16 pressure;
+} SDL_TouchFingerEvent;
+
+
+/**
+ *  \brief Touch finger motion/finger event structure (event.tmotion.*)
+ */
+typedef struct SDL_TouchButtonEvent
+{
+    Uint32 type;        /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */
+    Uint32 windowID;    /**< The window with mouse focus, if any */
+    SDL_TouchID touchId;        /**< The touch device index */
+    Uint8 state;        /**< The current button state */
+    Uint8 button;        /**< The button changing state */
+    Uint8 padding1;
+    Uint8 padding2;
+} SDL_TouchButtonEvent;
+
+
+
+/**
+ *  \brief Multiple Finger Gesture Event
+ */
+typedef struct SDL_MultiGestureEvent
+{
+    Uint32 type;        /**< ::SDL_MULTIGESTURE */
+    Uint32 windowID;    /**< The window with mouse focus, if any */
+    SDL_TouchID touchId;        /**< The touch device index */
+    float dTheta;
+    float dDist;
+    float x;  //currently 0...1. Change to screen coords?
+    float y;  
+    Uint16 numFingers;
+    Uint16 padding;
+} SDL_MultiGestureEvent;
+
+typedef struct SDL_DollarGestureEvent
+{
+    Uint32 type;        /**< ::SDL_DOLLARGESTURE */
+    Uint32 windowID;    /**< The window with mouse focus, if any */
+    SDL_TouchID touchId;        /**< The touch device index */
+    SDL_GestureID gestureId;
+    Uint32 numFingers;
+    float error;
+  /*
+    //TODO: Enable to give location?
+    float x;  //currently 0...1. Change to screen coords?
+    float y;  
+  */
+} SDL_DollarGestureEvent;
+
+
+
+
 /**
  *  \brief The "quit requested" event
  */
@@ -342,6 +434,10 @@ typedef union SDL_Event
     SDL_QuitEvent quit;             /**< Quit request event data */
     SDL_UserEvent user;             /**< Custom event data */
     SDL_SysWMEvent syswm;           /**< System dependent window event data */
+    SDL_TouchFingerEvent tfinger;   /**< Touch finger event data */
+    SDL_TouchButtonEvent tbutton;   /**< Touch button event data */
+    SDL_MultiGestureEvent mgesture; /**< Multi Finger Gesture data*/
+    SDL_DollarGestureEvent dgesture; /**< Multi Finger Gesture data*/
 
     /** Temporarily here for backwards compatibility */
     /*@{*/
@@ -379,12 +475,12 @@ typedef enum
  *  the back of the event queue.
  *  
  *  If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
- *  of the event queue, matching \c mask, will be returned and will not
- *  be removed from the queue.
+ *  of the event queue, within the specified minimum and maximum type,
+ *  will be returned and will not be removed from the queue.
  *  
  *  If \c action is ::SDL_GETEVENT, up to \c numevents events at the front 
- *  of the event queue, matching \c mask, will be returned and will be
- *  removed from the queue.
+ *  of the event queue, within the specified minimum and maximum type,
+ *  will be returned and will be removed from the queue.
  *  
  *  \return The number of events actually stored, or -1 if there was an error.
  *  

+ 92 - 0
extern/include/SDL/SDL_gesture.h

@@ -0,0 +1,92 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2010 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    [email protected]
+*/
+
+/**
+ *  \file SDL_gesture.h
+ *  
+ *  Include file for SDL gesture event handling.
+ */
+
+#ifndef _SDL_gesture_h
+#define _SDL_gesture_h
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+
+#include "SDL_touch.h"
+
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+typedef Sint64 SDL_GestureID;
+
+/* Function prototypes */
+
+/**
+ *  \brief Begin Recording a gesture on the specified touch, or all touches (-1)
+ *
+ *
+ */
+extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
+
+
+/**
+ *  \brief Save all currently loaded Dollar Gesture templates
+ *
+ *
+ */
+extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *src);
+
+/**
+ *  \brief Save a currently loaded Dollar Gesture template
+ *
+ *
+ */
+extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *src);
+
+
+/**
+ *  \brief Load Dollar Gesture templates from a file
+ *
+ *
+ */
+extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_gesture_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

Разница между файлами не показана из-за своего большого размера
+ 835 - 109
extern/include/SDL/SDL_opengl.h


+ 5 - 0
extern/include/SDL/SDL_platform.h

@@ -65,6 +65,11 @@
 #undef __LINUX__
 #define __LINUX__	1
 #endif
+#if defined(ANDROID)
+#undef __ANDROID__
+#undef __LINUX__ /*do we need to do this?*/
+#define __ANDROID__ 1
+#endif
 
 #if defined(__APPLE__)
 /* lets us know what version of Mac OS X we're compiling on */

+ 1 - 1
extern/include/SDL/SDL_revision.h

@@ -1 +1 @@
-#define SDL_REVISION "hg-4498:3d91e31fcf71"
+#define SDL_REVISION "hg-4906:67acc9ab60ff"

+ 1 - 1
extern/include/SDL/SDL_rwops.h

@@ -65,7 +65,7 @@ typedef struct SDL_RWops
                             size_t size, size_t maxnum);
 
     /**
-     *  Write exactly \c num objects each of size \c objsize from the area
+     *  Write exactly \c num objects each of size \c size from the area
      *  pointed at by \c ptr to data source.
      *  
      *  \return the number of objects written, or 0 at error or end of file.

+ 148 - 0
extern/include/SDL/SDL_shape.h

@@ -0,0 +1,148 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 2010 Eli Gottlieb
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Eli Gottlieb
+    [email protected]
+*/
+
+#ifndef _SDL_shape_h
+#define _SDL_shape_h
+
+#include "SDL_stdinc.h"
+#include "SDL_pixels.h"
+#include "SDL_rect.h"
+#include "SDL_surface.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+/** \file SDL_shape.h
+ *
+ * Header file for the shaped window API.
+ */
+
+#define SDL_NONSHAPEABLE_WINDOW -1
+#define SDL_INVALID_SHAPE_ARGUMENT -2
+#define SDL_WINDOW_LACKS_SHAPE -3
+
+/**
+ *  \brief Create a window that can be shaped with the specified position, dimensions, and flags.
+ *  
+ *  \param title The title of the window, in UTF-8 encoding.
+ *  \param x     The x position of the window, ::SDL_WINDOWPOS_CENTERED, or 
+ *               ::SDL_WINDOWPOS_UNDEFINED.
+ *  \param y     The y position of the window, ::SDL_WINDOWPOS_CENTERED, or 
+ *               ::SDL_WINDOWPOS_UNDEFINED.
+ *  \param w     The width of the window.
+ *  \param h     The height of the window.
+ *  \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: 
+ *               ::SDL_WINDOW_OPENGL,     ::SDL_WINDOW_INPUT_GRABBED,
+ *               ::SDL_WINDOW_SHOWN,      ::SDL_WINDOW_RESIZABLE,
+ *               ::SDL_WINDOW_MAXIMIZED,  ::SDL_WINDOW_MINIMIZED,
+ *		 ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
+ *  
+ *  \return The window created, or NULL if window creation failed.
+ *  
+ *  \sa SDL_DestroyWindow()
+ */
+extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
+
+/**
+ * \brief Return whether the given window is a shaped window. 
+ *
+ * \param window The window to query for being shaped.
+ *
+ * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
+ * \sa SDL_CreateShapedWindow
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
+
+/** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */
+typedef enum {
+	/** \brief The default mode, a binarized alpha cutoff of 1. */
+	ShapeModeDefault,
+	/** \brief A binarized alpha cutoff with a given integer value. */
+	ShapeModeBinarizeAlpha,
+	/** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */
+	ShapeModeReverseBinarizeAlpha,
+	/** \brief A color key is applied. */
+	ShapeModeColorKey
+} WindowShapeMode;
+
+#define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
+
+/** \brief A union containing parameters for shaped windows. */
+typedef union {
+	/** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
+	Uint8 binarizationCutoff;
+	SDL_Color colorKey;
+} SDL_WindowShapeParams;
+
+/** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */
+typedef struct SDL_WindowShapeMode {
+	/** \brief The mode of these window-shape parameters. */
+	WindowShapeMode mode;
+	/** \brief Window-shape parameters. */
+	SDL_WindowShapeParams parameters;
+} SDL_WindowShapeMode;
+
+/**
+ * \brief Set the shape and parameters of a shaped window.
+ *
+ * \param window The shaped window whose parameters should be set.
+ * \param shape A surface encoding the desired shape for the window.
+ * \param shape_mode The parameters to set for the shaped window.
+ *
+ * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
+ *           if the SDL_Window* given does not reference a valid shaped window.
+ *
+ * \sa SDL_WindowShapeMode
+ * \sa SDL_GetShapedWindowMode.
+ */
+extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
+
+/**
+ * \brief Get the shape parameters of a shaped window.
+ *
+ * \param window The shaped window whose parameters should be retrieved.
+ * \param shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape.
+ *
+ * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
+ *           data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
+ *           the SDL_Window* given is a shapeable window currently lacking a shape.
+ *
+ * \sa SDL_WindowShapeMode
+ * \sa SDL_SetWindowShape
+ */
+extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_shape_h */

+ 34 - 4
extern/include/SDL/SDL_stdinc.h

@@ -174,9 +174,10 @@ SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
 SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
 SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
 SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
-#ifndef __NINTENDODS__          /* TODO: figure out why the following happens:
-                                   include/SDL_stdinc.h:150: error: size of array 'SDL_dummy_uint64' is negative
-                                   include/SDL_stdinc.h:151: error: size of array 'SDL_dummy_sint64' is negative */
+#if !defined(__NINTENDODS__) && !defined(__ANDROID__)
+/* TODO: figure out why the following happens:
+ include/SDL_stdinc.h:150: error: size of array 'SDL_dummy_uint64' is negative
+ include/SDL_stdinc.h:151: error: size of array 'SDL_dummy_sint64' is negative */
 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
 #endif
@@ -195,7 +196,8 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
 
 /** \cond */
 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
-#ifndef __NINTENDODS__          /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
+#if !defined(__NINTENDODS__) && !defined(__ANDROID__) 
+   /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
 typedef enum
 {
     DUMMY_ENUM_VALUE
@@ -470,6 +472,19 @@ extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
 extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t * string);
 #endif
 
+#ifdef HAVE_WCSLCPY
+#define SDL_wcslcpy      wcslcpy
+#else
+extern DECLSPEC size_t SDLCALL SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen);
+#endif
+
+#ifdef HAVE_WCSLCAT
+#define SDL_wcslcat      wcslcat
+#else
+extern DECLSPEC size_t SDLCALL SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen);
+#endif
+
+
 #ifdef HAVE_STRLCPY
 #define SDL_strlcpy     strlcpy
 #else
@@ -477,6 +492,9 @@ extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src,
                                            size_t maxlen);
 #endif
 
+extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src,
+                                            size_t dst_bytes);
+
 #ifdef HAVE_STRLCAT
 #define SDL_strlcat    strlcat
 #else
@@ -676,6 +694,18 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen,
 #define M_PI    3.14159265358979323846264338327950288   /* pi */
 #endif
 
+#ifdef HAVE_ATAN
+#define SDL_atan        atan
+#else
+extern DECLSPEC double SDLCALL SDL_atan(double x);
+#endif
+
+#ifdef HAVE_ATAN2
+#define SDL_atan2       atan2
+#else
+extern DECLSPEC double SDLCALL SDL_atan2(double y, double x);
+#endif
+
 #ifdef HAVE_CEIL
 #define SDL_ceil        ceil
 #else

+ 79 - 124
extern/include/SDL/SDL_syswm.h

@@ -54,6 +54,11 @@ extern "C" {
 struct SDL_SysWMinfo;
 #else
 
+#if defined(SDL_VIDEO_DRIVER_WIN32)
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
 /* This is the structure for custom window manager events */
 #if defined(SDL_VIDEO_DRIVER_X11)
 #if defined(__APPLE__) && defined(__MACH__)
@@ -69,16 +74,34 @@ struct SDL_SysWMinfo;
 #undef Cursor
 #endif
 
+#endif /* defined(SDL_VIDEO_DRIVER_X11) */
+
+#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
+#include <directfb/directfb.h>
+#endif
+
+#if defined(SDL_VIDEO_DRIVER_COCOA)
+#ifdef __OBJC__
+#include <Cocoa/Cocoa.h>
+#else
+typedef struct _NSWindow NSWindow;
+#endif
+#endif
+
 /** 
- *  These are the various supported subsystems under UNIX.
+ *  These are the various supported windowing subsystems
  */
 typedef enum
 {
-    SDL_SYSWM_X11
+    SDL_SYSWM_UNKNOWN,
+    SDL_SYSWM_WINDOWS,
+    SDL_SYSWM_X11,
+    SDL_SYSWM_DIRECTFB,
+    SDL_SYSWM_COCOA,
 } SDL_SYSWM_TYPE;
 
 /**
- *  The UNIX custom event structure.
+ *  The custom event structure.
  */
 struct SDL_SysWMmsg
 {
@@ -86,12 +109,35 @@ struct SDL_SysWMmsg
     SDL_SYSWM_TYPE subsystem;
     union
     {
-        XEvent xevent;
-    } event;
+#if defined(SDL_VIDEO_DRIVER_WIN32)
+        struct {
+            HWND hwnd;                  /**< The window for the message */
+            UINT msg;                   /**< The type of message */
+            WPARAM wParam;              /**< WORD message parameter */
+            LPARAM lParam;              /**< LONG message parameter */
+        } win;
+#endif
+#if defined(SDL_VIDEO_DRIVER_X11)
+        struct {
+            XEvent event;
+        } x11;
+#endif
+#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
+        struct {
+            DFBEvent event;
+        } dfb;
+#endif
+#if defined(SDL_VIDEO_DRIVER_COCOA)
+        struct
+        {
+            /* No Cocoa window events yet */
+        } cocoa;
+#endif
+    } /*msg*/;
 };
 
 /**
- *  The UNIX custom window manager information structure.
+ *  The custom window manager information structure.
  *
  *  When this structure is returned, it holds information about which
  *  low level system it is using, and will be one of SDL_SYSWM_TYPE.
@@ -102,127 +148,36 @@ struct SDL_SysWMinfo
     SDL_SYSWM_TYPE subsystem;
     union
     {
+#if defined(SDL_VIDEO_DRIVER_WIN32)
         struct
         {
-            Display *display;   /**< The X11 display */
-            Window window;      /**< The X11 display window */
-            /**
-             *  These locking functions should be called around
-             *  any X11 functions using the display variable.
-             *  They lock the event thread, so should not be
-             *  called around event functions or from event filters.
-             */
-            /*@{*/
-            void (*lock_func) (void);
-            void (*unlock_func) (void);
-            /*@}*/
-
-            /**
-             *  Introduced in SDL 1.0.2.
-             */
-            /*@{*/
-            Window fswindow;    /**< The X11 fullscreen window */
-            Window wmwindow;    /**< The X11 managed input window */
-            /*@}*/
+            HWND window;                /**< The window handle */
+        } win;
+#endif
+#if defined(SDL_VIDEO_DRIVER_X11)
+        struct
+        {
+            Display *display;           /**< The X11 display */
+            Window window;              /**< The X11 window */
         } x11;
-    } info;
-};
-
-#elif defined(SDL_VIDEO_DRIVER_WIN32)
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-/**
- *  The windows custom event structure.
- */
-struct SDL_SysWMmsg
-{
-    SDL_version version;
-    HWND hwnd;                  /**< The window for the message */
-    UINT msg;                   /**< The type of message */
-    WPARAM wParam;              /**< WORD message parameter */
-    LPARAM lParam;              /**< LONG message parameter */
-};
-
-/**
- *  The windows custom window manager information structure.
- */
-struct SDL_SysWMinfo
-{
-    SDL_version version;
-    HWND window;                /**< The Win32 display window */
-};
-
-#elif defined(SDL_VIDEO_DRIVER_RISCOS)
-
-/**
- *  RISC OS custom event structure.
- */
-struct SDL_SysWMmsg
-{
-    SDL_version version;
-    int eventCode;              /**< The window for the message */
-    int pollBlock[64];
-};
-
-/**
- *  The RISC OS custom window manager information structure.
- */
-struct SDL_SysWMinfo
-{
-    SDL_version version;
-    int wimpVersion;            /**< Wimp version running under */
-    int taskHandle;             /**< The RISC OS task handle */
-    int window;                 /**< The RISC OS display window */
-};
-
-#elif defined(SDL_VIDEO_DRIVER_PHOTON) || defined(SDL_VIDEO_DRIVER_QNXGF)
-#include <sys/neutrino.h>
-#if defined(SDL_VIDEO_OPENGL_ES)
-#include <gf/gf.h>
-#endif /* SDL_VIDEO_OPENGL_ES */
-#include <Ph.h>
-
-/**
- * The QNX custom event structure.
- */
-struct SDL_SysWMmsg
-{
-    SDL_version version;
-    int data;
-};
-
-/**
- *  The QNX Photon custom window manager information structure.
- */
-struct SDL_SysWMinfo
-{
-    SDL_version version;
-    int data;
-};
-
-#else
-
-/**
- *  The generic custom event structure.
- */
-struct SDL_SysWMmsg
-{
-    SDL_version version;
-    int data;
-};
-
-/**
- *  The generic custom window manager information structure.
- */
-struct SDL_SysWMinfo
-{
-    SDL_version version;
-    int data;
+#endif
+#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
+        struct
+        {
+            IDirectFB *dfb;             /**< The directfb main interface */
+            IDirectFBWindow *window;    /**< The directfb window handle */
+            IDirectFBSurface *surface;  /**< The directfb client surface */
+        } dfb;
+#endif
+#if defined(SDL_VIDEO_DRIVER_COCOA)
+        struct
+        {
+            NSWindow *window;           /* The Cocoa window */
+        } cocoa;
+#endif
+    } /*info*/;
 };
 
-#endif /* video driver type */
-
 #endif /* SDL_PROTOTYPES_ONLY */
 
 typedef struct SDL_SysWMinfo SDL_SysWMinfo;
@@ -231,7 +186,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
 /**
  *  \brief This function allows access to driver-dependent window information.
  *  
- *  \param windowID The window about which information is being requested
+ *  \param window The window about which information is being requested
  *  \param info This structure must be initialized with the SDL version, and is 
  *              then filled in with information about the given window.
  *  
@@ -240,7 +195,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
  *  
  *  You typically use this function like this:
  *  \code
- *  SDL_SysWMInfo info;
+ *  SDL_SysWMinfo info;
  *  SDL_VERSION(&info.version);
  *  if ( SDL_GetWindowWMInfo(&info) ) { ... }
  *  \endcode

+ 7 - 2
extern/include/SDL/SDL_thread.h

@@ -50,6 +50,11 @@ typedef struct SDL_Thread SDL_Thread;
 /* The SDL thread ID */
 typedef unsigned long SDL_threadID;
 
+/* The function passed to SDL_CreateThread()
+   It is passed a void* user context parameter and returns an int.
+ */
+typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
+
 #if defined(__WIN32__) && !defined(HAVE_LIBC)
 /**
  *  \file SDL_thread.h
@@ -100,7 +105,7 @@ typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
  *  Create a thread.
  */
 extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThread(int (SDLCALL * f) (void *), void *data,
+SDL_CreateThread(SDL_ThreadFunction fn, void *data,
                  pfnSDL_CurrentBeginThread pfnBeginThread,
                  pfnSDL_CurrentEndThread pfnEndThread);
 
@@ -125,7 +130,7 @@ SDL_CreateThread(int (SDLCALL * f) (void *), void *data,
  *  Create a thread.
  */
 extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThread(int (SDLCALL * fn) (void *), void *data);
+SDL_CreateThread(SDL_ThreadFunction fn, void *data);
 
 #endif
 

+ 125 - 0
extern/include/SDL/SDL_touch.h

@@ -0,0 +1,125 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2010 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    [email protected]
+*/
+
+/**
+ *  \file SDL_touch.h
+ *  
+ *  Include file for SDL touch event handling.
+ */
+
+#ifndef _SDL_touch_h
+#define _SDL_touch_h
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+
+typedef Sint64 SDL_TouchID;
+typedef Sint64 SDL_FingerID;
+
+
+struct SDL_Finger {
+  SDL_FingerID id;
+  Uint16 x;
+  Uint16 y;
+  Uint16 pressure;
+  Uint16 xdelta;
+  Uint16 ydelta;
+  Uint16 last_x, last_y,last_pressure;  /* the last reported coordinates */
+  SDL_bool down;
+};
+
+typedef struct SDL_Touch SDL_Touch;
+typedef struct SDL_Finger SDL_Finger;
+
+
+struct SDL_Touch {
+  
+  /* Free the touch when it's time */
+  void (*FreeTouch) (SDL_Touch * touch);
+  
+  /* data common for tablets */
+  float pressure_max, pressure_min;
+  float x_max,x_min;
+  float y_max,y_min;
+  Uint16 xres,yres,pressureres;
+  float native_xres,native_yres,native_pressureres;
+  float tilt;                   /* for future use */
+  float rotation;               /* for future use */
+  
+  /* Data common to all touch */
+  SDL_TouchID id;
+  SDL_Window *focus;
+  
+  char *name;
+  Uint8 buttonstate;
+  SDL_bool relative_mode;
+  SDL_bool flush_motion;
+
+  int num_fingers;
+  int max_fingers;
+  SDL_Finger** fingers;
+    
+  void *driverdata;
+};
+
+
+
+/* Function prototypes */
+
+/**
+ *  \brief Get the touch object at the given id.
+ *
+ *
+ */
+  extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
+
+
+
+/**
+ *  \brief Get the finger object of the given touch, at the given id.
+ *
+ *
+ */
+  extern 
+  DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_mouse_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 7 - 7
extern/include/SDL/SDL_version.h

@@ -112,12 +112,11 @@ typedef struct SDL_version
 
 /**
  *  \brief Get the version of SDL that is linked against your program.
- *  
- *  If you are using a shared library (DLL) version of SDL, then it is
- *  possible that it will be different than the version you compiled against.
  *
- *  This is a real function; the macro SDL_VERSION() tells you what version
- *  of SDL you compiled against:
+ *  If you are linking to SDL dynamically, then it is possible that the
+ *  current version will be different than the version you compiled against.
+ *  This function returns the current version, while SDL_VERSION() is a
+ *  macro that tells you what version you compiled with.
  *  
  *  \code
  *  SDL_version compiled;
@@ -140,8 +139,9 @@ extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
 /**
  *  \brief Get the code revision of SDL that is linked against your program.
  *
- *  This is an arbitrary string (a hash value, actually), and is only useful
- *  in comparing against other revisions. It is NOT an incrementing number.
+ *  Returns an arbitrary string (a hash value) uniquely identifying the
+ *  exact revision of the SDL library in use, and is only useful in comparing
+ *  against other revisions. It is NOT an incrementing number.
  */
 extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
 

+ 26 - 26
extern/include/SDL/SDL_video.h

@@ -189,7 +189,7 @@ typedef struct SDL_RendererInfo
     Uint32 blend_modes;         /**< A mask of supported blend modes */
     Uint32 scale_modes;         /**< A mask of supported scale modes */
     Uint32 num_texture_formats; /**< The number of available texture formats */
-    Uint32 texture_formats[20]; /**< The available texture formats */
+    Uint32 texture_formats[50]; /**< The available texture formats */
     int max_texture_width;      /**< The maximimum texture width */
     int max_texture_height;     /**< The maximimum texture height */
 } SDL_RendererInfo;
@@ -568,7 +568,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
 extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
 
 /**
- *  \brief Get the numeric ID of the window, for logging purposes.
+ *  \brief Get the numeric ID of a window, for logging purposes.
  */
 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window);
 
@@ -583,7 +583,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id);
 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
 
 /**
- *  \brief Set the title of the window, in UTF-8 format.
+ *  \brief Set the title of a window, in UTF-8 format.
  *  
  *  \sa SDL_GetWindowTitle()
  */
@@ -591,14 +591,14 @@ extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
                                                 const char *title);
 
 /**
- *  \brief Get the title of the window, in UTF-8 format.
+ *  \brief Get the title of a window, in UTF-8 format.
  *  
  *  \sa SDL_SetWindowTitle()
  */
 extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
 
 /**
- *  \brief Set the icon of the window.
+ *  \brief Set the icon for a window.
  *  
  *  \param icon The icon for the window.
  */
@@ -606,7 +606,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
                                                SDL_Surface * icon);
 
 /**
- *  \brief Associate an arbitrary pointer with the window.
+ *  \brief Associate an arbitrary pointer with a window.
  *  
  *  \sa SDL_GetWindowData()
  */
@@ -614,14 +614,14 @@ extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_Window * window,
                                                void *userdata);
 
 /**
- *  \brief Retrieve the data pointer associated with the window.
+ *  \brief Retrieve the data pointer associated with a window.
  *  
  *  \sa SDL_SetWindowData()
  */
 extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window);
 
 /**
- *  \brief Set the position of the window.
+ *  \brief Set the position of a window.
  *  
  *  \param window The window to reposition.
  *  \param x        The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or
@@ -637,7 +637,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
                                                    int x, int y);
 
 /**
- *  \brief Get the position of the window.
+ *  \brief Get the position of a window.
  *  
  *  \sa SDL_SetWindowPosition()
  */
@@ -645,7 +645,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
                                                    int *x, int *y);
 
 /**
- *  \brief Set the size of the window's client area.
+ *  \brief Set the size of a window's client area.
  *  
  *  \note You can't change the size of a fullscreen window, it automatically
  *        matches the size of the display mode.
@@ -656,7 +656,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
                                                int h);
 
 /**
- *  \brief Get the size of the window's client area.
+ *  \brief Get the size of a window's client area.
  *  
  *  \sa SDL_SetWindowSize()
  */
@@ -664,33 +664,33 @@ extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
                                                int *h);
 
 /**
- *  \brief Show the window.
+ *  \brief Show a window.
  *  
  *  \sa SDL_HideWindow()
  */
 extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
 
 /**
- *  \brief Hide the window.
+ *  \brief Hide a window.
  *  
  *  \sa SDL_ShowWindow()
  */
 extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
 
 /**
- *  \brief Raise the window above other windows and set the input focus.
+ *  \brief Raise a window above other windows and set the input focus.
  */
 extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
 
 /**
- *  \brief Make the window as large as possible.
+ *  \brief Make a window as large as possible.
  *  
  *  \sa SDL_RestoreWindow()
  */
 extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
 
 /**
- *  \brief Minimize the window to an iconic representation.
+ *  \brief Minimize a window to an iconic representation.
  *  
  *  \sa SDL_RestoreWindow()
  */
@@ -705,7 +705,7 @@ extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
 extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
 
 /**
- *  \brief Set the window's fullscreen state.
+ *  \brief Set a window's fullscreen state.
  *  
  *  \return 0 on success, or -1 if setting the display mode failed.
  *  
@@ -716,7 +716,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
                                                     int fullscreen);
 
 /**
- *  \brief Set the window's input grab mode.
+ *  \brief Set a window's input grab mode.
  *  
  *  \param mode This is 1 to grab input, and 0 to release input.
  *  
@@ -726,7 +726,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
                                                int mode);
 
 /**
- *  \brief Get the window's input grab mode.
+ *  \brief Get a window's input grab mode.
  *  
  *  \return This returns 1 if input is grabbed, and 0 otherwise.
  *  
@@ -1164,7 +1164,7 @@ extern DECLSPEC int SDLCALL SDL_RenderClear(void);
 extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(int x, int y);
 
 /**
- *  \brief Draw some number of points on the current rendering target.
+ *  \brief Draw multiple points on the current rendering target.
  *  
  *  \param points The points to draw
  *  \param count The number of points to draw
@@ -1198,7 +1198,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLines(const SDL_Point * points,
                                                 int count);
 
 /**
- *  \brief Draw a rectangle on the current rendering target with the drawing color.
+ *  \brief Draw a rectangle on the current rendering target.
  *  
  *  \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
  *  
@@ -1207,14 +1207,14 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLines(const SDL_Point * points,
 extern DECLSPEC int SDLCALL SDL_RenderDrawRect(const SDL_Rect * rect);
 
 /**
- *  \brief Draw some number of rectangles in the current rendering target with the drawing color.
+ *  \brief Draw some number of rectangles on the current rendering target.
  *  
  *  \param rects A pointer to an array of destination rectangles.
  *  \param count The number of rectangles.
  *  
  *  \return 0 on success, or -1 if there is no rendering context current.
  */
-extern DECLSPEC int SDLCALL SDL_RenderDrawRects(const SDL_Rect ** rect, int count);
+extern DECLSPEC int SDLCALL SDL_RenderDrawRects(const SDL_Rect ** rects, int count);
 
 /**
  *  \brief Fill a rectangle on the current rendering target with the drawing color.
@@ -1227,7 +1227,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRects(const SDL_Rect ** rect, int coun
 extern DECLSPEC int SDLCALL SDL_RenderFillRect(const SDL_Rect * rect);
 
 /**
- *  \brief Fill some number of rectangles in the current rendering target with the drawing color.
+ *  \brief Fill some number of rectangles on the current rendering target with the drawing color.
  *  
  *  \param rects A pointer to an array of destination rectangles.
  *  \param count The number of rectangles.
@@ -1311,7 +1311,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Window * window);
 
 /**
- *  \brief Returns whether the screensaver is currently enabled (default off).
+ *  \brief Returns whether the screensaver is currently enabled (default on).
  *  
  *  \sa SDL_EnableScreenSaver()
  *  \sa SDL_DisableScreenSaver()
@@ -1430,7 +1430,7 @@ extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
 extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
 
 /**
- * \brief Swap the OpenGL buffers for the window, if double-buffering is 
+ * \brief Swap the OpenGL buffers for a window, if double-buffering is 
  *        supported.
  */
 extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window);

BIN
extern/lib-x86-64-linux/libSDL-1.3.so.0.0.0


+ 6 - 3
src/Core/App.cpp

@@ -11,6 +11,7 @@
 #include "StdinListener.h"
 #include "MessageHandler.h"
 #include "Messaging.h"
+#include "Input.h"
 
 
 bool App::isCreated = false;
@@ -102,6 +103,7 @@ App::App(int argc, char* argv[], Object* parent):
 	scene = new Scene(this);
 	stdinListener = new StdinListener(this);
 	stdinListener->start();
+	input = new Input(this);
 
 	// other
 	activeCam = NULL;
@@ -138,7 +140,7 @@ void App::initWindow()
 
 	// OpenWindow
 	windowId = SDL_CreateWindow("AnKi Engine", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, windowW, windowH,
-	                             SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
+	                            SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
 
 	if(!windowId)
 	{
@@ -152,7 +154,7 @@ void App::initWindow()
 	iconImage = SDL_LoadBMP("gfx/icon.bmp");
 	if(iconImage == NULL)
 	{
-		throw EXCEPTION("Cannot load window icon");
+		WARNING("Cannot load window icon");
 	}
 	else
 	{
@@ -215,8 +217,9 @@ void App::waitForNextFrame()
 		SDL_Delay(time - now);
 	}
 	else
+	{
 		time = now;
-
+	}
 }
 
 

+ 21 - 21
src/Core/App.h

@@ -15,16 +15,15 @@ class StdinListener;
 class Scene;
 class MainRenderer;
 class Camera;
+class Input;
 
 
 /// The one and only global variable
 extern class App* app;
 
 
-/**
- * This class holds all the global objects of the application and its also responsible for some of the SDL stuff.
- * It should be singleton
- */
+/// This class holds all the global objects of the application and its also responsible for some of the SDL stuff.
+/// It should be singleton
 class App: public Object
 {
 	PROPERTY_R(uint, windowW, getWindowWidth) ///< The main window width
@@ -43,10 +42,8 @@ class App: public Object
 		void togleFullScreen();
 		void swapBuffers();
 
-		/**
-		 * The func pools the stdinListener for string in the console, if there are any it executes them with
-		 * scriptingEngine
-		 */
+		/// The func pools the stdinListener for string in the console, if there are any it executes them with
+		/// scriptingEngine
 		void execStdinScpripts();
 
 		static void printAppInfo();
@@ -54,10 +51,8 @@ class App: public Object
 		uint getDesktopWidth() const;
 		uint getDesktopHeight() const;
 
-		/**
-		 * @name Accessors
-		 */
-		/**@{*/
+		/// @name Accessors
+		/// @{
 		bool isTerminalColoringEnabled() const;
 		Scene& getScene();
 		ScriptingEngine& getScriptingEngine();
@@ -66,11 +61,10 @@ class App: public Object
 		Camera* getActiveCam() {return activeCam;}
 		void setActiveCam(Camera* cam) {activeCam = cam;}
 		MessageHandler& getMessageHandler();
-		/**@}*/
+		Input& getInput();
+		/// @}
 
-		/**
-		 * @return Returns the number of milliseconds since SDL library initialization
-		 */
+		/// @return Returns the number of milliseconds since SDL library initialization
 		static uint getTicks();
 
 	private:
@@ -83,16 +77,15 @@ class App: public Object
 		bool fullScreenFlag;
 		Camera* activeCam; ///< Pointer to the current camera
 
-		/**
-		 * @name Pointers to serious subsystems
-		 */
-		/**@{*/
+		/// @name Pointers to serious subsystems
+		/// @{
 		Scene* scene;
 		ScriptingEngine* scriptingEngine;
 		MainRenderer* mainRenderer;
 		StdinListener* stdinListener;
 		MessageHandler* messageHandler;
-		/**@}*/
+		Input* input;
+		/// @}
 
 		void parseCommandLineArgs(int argc, char* argv[]);
 
@@ -142,4 +135,11 @@ inline MessageHandler& App::getMessageHandler()
 }
 
 
+inline Input& App::getInput()
+{
+	RASSERT_THROW_EXCEPTION(input == NULL);
+	return *input;
+}
+
+
 #endif

+ 5 - 4
src/Core/Messaging.h

@@ -6,11 +6,12 @@
 #include "MessageHandler.h"
 
 
-#define INFO(x) \
-	app->getMessageHandler().write(__FILE__, __LINE__, __func__, std::string("Info: ") + x)
+#define MESSAGE(x) \
+	app->getMessageHandler().write(__FILE__, __LINE__, __func__, std::string() + x)
 
-#define WARNING(x) \
-	app->getMessageHandler().write(__FILE__, __LINE__, __func__, std::string("Warning: ") + x)
+#define INFO(x) MESSAGE(std::string("Info: ") + x)
+
+#define WARNING(x) MESSAGE(std::string("Warning: ") + x)
 
 
 #endif

+ 30 - 31
src/Input/Input.cpp

@@ -1,29 +1,27 @@
-#include <SDL/SDL.h>
 #include "Input.h"
-#include "Renderer.h"
-
-
-namespace I {
-
+#include <SDL/SDL.h>
+#include "App.h"
 
 
 //======================================================================================================================
-// VARS                                                                                                                =
+// Constructor                                                                                                         =
 //======================================================================================================================
-Vec<short> keys(SDL_NUM_SCANCODES, 0);
-Vec<short> mouseBtns(8, 0);
-Vec2 mousePosNdc;
-Vec2 mousePos;
-Vec2 mouseVelocity;
-
-bool warpMouse = false;
-bool hideCursor = true;
+Input::Input(Object* parent):
+	Object(parent),
+	keys(SDL_NUM_SCANCODES, 0),
+	mouseBtns(8, 0),
+	warpMouse(false),
+	hideCursor(true),
+	parentApp(parent)
+{
+	reset();
+}
 
 
 //======================================================================================================================
 // reset                                                                                                               =
 //======================================================================================================================
-void reset(void)
+void Input::reset(void)
 {
 	RASSERT_THROW_EXCEPTION(keys.size() < 1);
 	RASSERT_THROW_EXCEPTION(mouseBtns.size() < 1);
@@ -34,15 +32,19 @@ void reset(void)
 }
 
 
-/*
-=======================================================================================================================================
-handleEvents                                                                                                           =
-=======================================================================================================================================
-*/
-void handleEvents()
+//======================================================================================================================
+// handleEvents                                                                                                        =
+//======================================================================================================================
+void Input::handleEvents()
 {
-	if(hideCursor) SDL_ShowCursor(SDL_DISABLE);
-	else             SDL_ShowCursor(SDL_ENABLE);
+	if(hideCursor)
+	{
+		SDL_ShowCursor(SDL_DISABLE);
+	}
+	else
+	{
+		SDL_ShowCursor(SDL_ENABLE);
+	}
 
 	// add the times a key is bying pressed
 	for(uint x=0; x<keys.size(); x++)
@@ -56,6 +58,7 @@ void handleEvents()
 
 
 	mouseVelocity = Vec2(0.0);
+	App* app_ = static_cast<App*>(parentApp);
 
 	SDL_Event event_;
 	while(SDL_PollEvent(&event_))
@@ -85,8 +88,8 @@ void handleEvents()
 				mousePos.x = event_.button.x;
 				mousePos.y = event_.button.y;
 
-				mousePosNdc.x = (2.0 * mousePos.x) / (float)app->getWindowWidth() - 1.0;
-				mousePosNdc.y = 1.0 - (2.0 * mousePos.y) / (float)app->getWindowHeight();
+				mousePosNdc.x = (2.0 * mousePos.x) / (float)app_->getWindowWidth() - 1.0;
+				mousePosNdc.y = 1.0 - (2.0 * mousePos.y) / (float)app_->getWindowHeight();
 
 				if(warpMouse)
 				{
@@ -103,7 +106,7 @@ void handleEvents()
 			}
 
 			case SDL_QUIT:
-				app->quit(1);
+				app_->quit(1);
 				break;
 		}
 	}
@@ -114,7 +117,3 @@ void handleEvents()
 	//cout << mouseBtns[SDL_BUTTON_LEFT] << endl;
 
 }
-
-
-
-} // end namespace

+ 21 - 14
src/Input/Input.h

@@ -3,26 +3,33 @@
 
 #include <SDL/SDL_scancode.h>
 #include "Vec.h"
-#include "App.h"
 #include "Math.h"
+#include "Object.h"
+
 
 /// Handle the SDL input
-namespace I {
+class Input: public Object
+{
+	public:
+		Input(Object* parent);
+
+		// keys and btns
+		Vec<short> keys;  ///< Shows the current key state. 0: unpressed, 1: pressed once, n is >1: kept pressed 'n' times continuously
+		Vec<short> mouseBtns; ///< Mouse btns. Supporting 3 btns & wheel. @see keys
 
-extern void reset();
-extern void handleEvents();
+		void reset();
+		void handleEvents();
 
-// keys and btns
-extern Vec<short> keys;  ///< Shows the current key state. 0: unpressed, 1: pressed once, n is >1: kept pressed 'n' times continuously
-extern Vec<short> mouseBtns;    ///< Mouse btns. Supporting 3 btns & wheel. Works the same as above
+		// mouse stuff
+		Vec2 mousePosNdc; ///< The coords are in the NDC space
+		Vec2 mousePos;     ///< The coords are in the window space. (0, 0) is in the upper left corner
+		Vec2 mouseVelocity;
+		bool warpMouse;
+		bool hideCursor;
 
-// mouse stuff
-extern Vec2 mousePosNdc; ///< The coords are in the NDC space
-extern Vec2 mousePos;     ///< The coords are in the window space. (0, 0) is in the upper left corner
-extern Vec2 mouseVelocity;
-extern bool warpMouse;
-extern bool hideCursor;
+	private:
+		Object* parentApp; ///< Hold the parrent here cause we use him
+};
 
-} // end namespace
 
 #endif

+ 41 - 36
src/Main.cpp

@@ -253,7 +253,7 @@ void mainLoop()
 	do
 	{
 		float crntTime = App::getTicks() / 1000.0;
-		I::handleEvents();
+		app->getInput().handleEvents();
 
 		float dist = 0.2;
 		float ang = toRad(3.0);
@@ -262,45 +262,45 @@ void mainLoop()
 		// move the camera
 		static SceneNode* mover = app->getActiveCam();
 
-		if(I::keys[SDL_SCANCODE_1]) mover = app->getActiveCam();
-		if(I::keys[SDL_SCANCODE_2]) mover = point_lights[0];
-		if(I::keys[SDL_SCANCODE_3]) mover = spot_lights[0];
-		if(I::keys[SDL_SCANCODE_4]) mover = point_lights[1];
-		if(I::keys[SDL_SCANCODE_5]) mover = spot_lights[1];
-		if(I::keys[SDL_SCANCODE_6]) mover = partEmitter;
-		if(I::keys[SDL_SCANCODE_M] == 1) I::warpMouse = !I::warpMouse;
-
-		if(I::keys[SDL_SCANCODE_A]) mover->moveLocalX(-dist);
-		if(I::keys[SDL_SCANCODE_D]) mover->moveLocalX(dist);
-		if(I::keys[SDL_SCANCODE_LSHIFT]) mover->moveLocalY(dist);
-		if(I::keys[SDL_SCANCODE_SPACE]) mover->moveLocalY(-dist);
-		if(I::keys[SDL_SCANCODE_W]) mover->moveLocalZ(-dist);
-		if(I::keys[SDL_SCANCODE_S]) mover->moveLocalZ(dist);
-		if(!I::warpMouse)
+		if(app->getInput().keys[SDL_SCANCODE_1]) mover = app->getActiveCam();
+		if(app->getInput().keys[SDL_SCANCODE_2]) mover = point_lights[0];
+		if(app->getInput().keys[SDL_SCANCODE_3]) mover = spot_lights[0];
+		if(app->getInput().keys[SDL_SCANCODE_4]) mover = point_lights[1];
+		if(app->getInput().keys[SDL_SCANCODE_5]) mover = spot_lights[1];
+		if(app->getInput().keys[SDL_SCANCODE_6]) mover = partEmitter;
+		if(app->getInput().keys[SDL_SCANCODE_M] == 1) app->getInput().warpMouse = !app->getInput().warpMouse;
+
+		if(app->getInput().keys[SDL_SCANCODE_A]) mover->moveLocalX(-dist);
+		if(app->getInput().keys[SDL_SCANCODE_D]) mover->moveLocalX(dist);
+		if(app->getInput().keys[SDL_SCANCODE_LSHIFT]) mover->moveLocalY(dist);
+		if(app->getInput().keys[SDL_SCANCODE_SPACE]) mover->moveLocalY(-dist);
+		if(app->getInput().keys[SDL_SCANCODE_W]) mover->moveLocalZ(-dist);
+		if(app->getInput().keys[SDL_SCANCODE_S]) mover->moveLocalZ(dist);
+		if(!app->getInput().warpMouse)
 		{
-			if(I::keys[SDL_SCANCODE_UP]) mover->rotateLocalX(ang);
-			if(I::keys[SDL_SCANCODE_DOWN]) mover->rotateLocalX(-ang);
-			if(I::keys[SDL_SCANCODE_LEFT]) mover->rotateLocalY(ang);
-			if(I::keys[SDL_SCANCODE_RIGHT]) mover->rotateLocalY(-ang);
+			if(app->getInput().keys[SDL_SCANCODE_UP]) mover->rotateLocalX(ang);
+			if(app->getInput().keys[SDL_SCANCODE_DOWN]) mover->rotateLocalX(-ang);
+			if(app->getInput().keys[SDL_SCANCODE_LEFT]) mover->rotateLocalY(ang);
+			if(app->getInput().keys[SDL_SCANCODE_RIGHT]) mover->rotateLocalY(-ang);
 		}
 		else
 		{
 			float accel = 44.0;
-			mover->rotateLocalX(ang * I::mouseVelocity.y * accel);
-			mover->rotateLocalY(-ang * I::mouseVelocity.x * accel);
+			mover->rotateLocalX(ang * app->getInput().mouseVelocity.y * accel);
+			mover->rotateLocalY(-ang * app->getInput().mouseVelocity.x * accel);
 		}
-		if(I::keys[SDL_SCANCODE_Q]) mover->rotateLocalZ(ang);
-		if(I::keys[SDL_SCANCODE_E]) mover->rotateLocalZ(-ang);
-		if(I::keys[SDL_SCANCODE_PAGEUP]) mover->getLocalTransform().scale += scale ;
-		if(I::keys[SDL_SCANCODE_PAGEDOWN]) mover->getLocalTransform().scale -= scale ;
+		if(app->getInput().keys[SDL_SCANCODE_Q]) mover->rotateLocalZ(ang);
+		if(app->getInput().keys[SDL_SCANCODE_E]) mover->rotateLocalZ(-ang);
+		if(app->getInput().keys[SDL_SCANCODE_PAGEUP]) mover->getLocalTransform().scale += scale ;
+		if(app->getInput().keys[SDL_SCANCODE_PAGEDOWN]) mover->getLocalTransform().scale -= scale ;
 
-		if(I::keys[SDL_SCANCODE_K]) app->getActiveCam()->lookAtPoint(point_lights[0]->getWorldTransform().origin);
+		if(app->getInput().keys[SDL_SCANCODE_K]) app->getActiveCam()->lookAtPoint(point_lights[0]->getWorldTransform().origin);
 
-		if(I::keys[SDL_SCANCODE_I])
+		if(app->getInput().keys[SDL_SCANCODE_I])
 			character->moveForward(0.1);
 
 
-		if(I::keys[SDL_SCANCODE_O] == 1)
+		if(app->getInput().keys[SDL_SCANCODE_O] == 1)
 		{
 			btRigidBody* body = static_cast<btRigidBody*>(boxes[0]);
 			//body->getMotionState()->setWorldTransform(toBt(Mat4(Vec3(0.0, 10.0, 0.0), Mat3::getIdentity(), 1.0)));
@@ -309,7 +309,7 @@ void mainLoop()
 			body->forceActivationState(ACTIVE_TAG);
 		}
 
-		if(I::keys[SDL_SCANCODE_Y] == 1)
+		if(app->getInput().keys[SDL_SCANCODE_Y] == 1)
 		{
 			INFO("Exec script");
 			app->getScriptingEngine().exposeVar("app", app);
@@ -336,11 +336,11 @@ void mainLoop()
 		/*Ui::printf("Mover: Pos(%.2f %.2f %.2f) Angs(%.2f %.2f %.2f)", mover->translationWspace.x, mover->translationWspace.y, mover->translationWspace.z,
 								 toDegrees(Euler(mover->rotationWspace).x), toDegrees(Euler(mover->rotationWspace).y), toDegrees(Euler(mover->rotationWspace).z));*/
 
-		if(I::keys[SDL_SCANCODE_ESCAPE])
+		if(app->getInput().keys[SDL_SCANCODE_ESCAPE])
 			break;
-		if(I::keys[SDL_SCANCODE_F11])
+		if(app->getInput().keys[SDL_SCANCODE_F11])
 			app->togleFullScreen();
-		if(I::keys[SDL_SCANCODE_F12] == 1)
+		if(app->getInput().keys[SDL_SCANCODE_F12] == 1)
 			app->getMainRenderer().takeScreenshot("gfx/screenshot.jpg");
 
 		/*char str[128];
@@ -357,7 +357,12 @@ void mainLoop()
 			app->waitForNextFrame();
 		}
 		else
-			if(app->getMainRenderer().getFramesNum() == 5000) break;
+		{
+			if(app->getMainRenderer().getFramesNum() == 5000)
+			{
+				break;
+			}
+		}
 	}while(true);
 
 	INFO("Exiting main loop (" + boost::lexical_cast<std::string>(App::getTicks() - ticks) + ")");
@@ -382,8 +387,8 @@ int main(int argc, char* argv[])
 	}
 	catch(std::exception& e)
 	{
-		std::cerr << e.what() << std::endl;
-		abort();
+		MESSAGE("Error: " + e.what());
+		//abort();
 		return 1;
 	}
 }

+ 1 - 1
src/Misc/TestHeader.cpp

@@ -1 +1 @@
-#include "Vbo.h"
+#include "MeshData.h"

+ 283 - 0
src/Resources/Helpers/MeshData.cpp

@@ -0,0 +1,283 @@
+#include <fstream>
+#include <cstring>
+#include <boost/lexical_cast.hpp>
+#include "MeshData.h"
+#include "BinaryStream.h"
+
+
+//======================================================================================================================
+// load                                                                                                                =
+//======================================================================================================================
+void MeshData::load(const char* filename)
+{
+	// Try
+	try
+	{
+		// Open the file
+		std::fstream file(filename, std::fstream::in | std::fstream::binary);
+
+		if(!file.is_open())
+		{
+			throw EXCEPTION("Cannot open file \"" + filename + "\"");
+		}
+
+		BinaryStream bs(file.rdbuf());
+
+		// Magic word
+		char magic[8];
+		bs.read(magic, 8);
+		if(bs.fail() || memcmp(magic, "ANKIMESH", 8))
+		{
+			throw EXCEPTION("Incorrect magic word");
+		}
+
+		// Mesh name
+		std::string meshName = bs.readString();
+
+		// Material name
+		materialName = bs.readString();
+
+		// Verts num
+		uint vertsNum = bs.readUint();
+		vertCoords.resize(vertsNum);
+
+		// Vert coords
+		for(uint i=0; i<vertCoords.size(); i++)
+		{
+			for(uint j=0; j<3; j++)
+			{
+				vertCoords[i][j] = bs.readFloat();
+			}
+		}
+
+		// Faces num
+		uint facesNum = bs.readUint();
+		tris.resize(facesNum);
+
+		// Faces IDs
+		for(uint i=0; i<tris.size(); i++)
+		{
+			for(uint j=0; j<3; j++)
+			{
+				tris[i].vertIds[j] = bs.readUint();
+
+				// a sanity check
+				if(tris[i].vertIds[j] >= vertCoords.size())
+				{
+					throw EXCEPTION("Vert index out of bounds" + boost::lexical_cast<std::string>(tris[i].vertIds[j]) +
+					                     " (" + boost::lexical_cast<std::string>(i) + ", " +
+					                     boost::lexical_cast<std::string>(j) + ")");
+				}
+			}
+		}
+
+		// Tex coords num
+		uint texCoordsNum = bs.readUint();
+		texCoords.resize(texCoordsNum);
+
+		// Tex coords
+		for(uint i=0; i<texCoords.size(); i++)
+		{
+			for(uint j=0; j<2; j++)
+			{
+				texCoords[i][j] = bs.readFloat();
+			}
+		}
+
+		// Vert weights num
+		uint vertWeightsNum = bs.readUint();
+		vertWeights.resize(vertWeightsNum);
+
+		// Vert weights
+		for(uint i=0; i<vertWeights.size(); i++)
+		{
+			// get the bone connections num
+			uint boneConnections = bs.readUint();
+
+			// we treat as error if one vert doesnt have a bone
+			if(boneConnections < 1)
+			{
+				throw EXCEPTION("Vert " + boost::lexical_cast<std::string>(i) + " sould have at least one bone");
+			}
+
+			// and here is another possible error
+			if(boneConnections > VertexWeight::MAX_BONES_PER_VERT)
+			{
+				uint tmp = VertexWeight::MAX_BONES_PER_VERT;
+				throw EXCEPTION("Cannot have more than " +
+				                     boost::lexical_cast<std::string>(tmp) + " bones per vertex");
+			}
+			vertWeights[i].bonesNum = boneConnections;
+
+			// for all the weights of the current vertes
+			for(uint j=0; j<vertWeights[i].bonesNum; j++)
+			{
+				// read bone id
+				uint boneId = bs.readUint();
+				vertWeights[i].boneIds[j] = boneId;
+
+				// read the weight of that bone
+				float weight = bs.readFloat();
+				vertWeights[i].weights[j] = weight;
+			}
+		} // end for all vert weights
+
+		doPostLoad();
+	}
+	catch(Exception& e)
+	{
+		throw EXCEPTION("File \"" + filename + "\": " + e.what());
+	}
+}
+
+
+//======================================================================================================================
+// doPostLoad                                                                                                          =
+//======================================================================================================================
+void MeshData::doPostLoad()
+{
+	// Sanity checks
+	if(vertCoords.size() < 1 || tris.size() < 1)
+	{
+		throw EXCEPTION("Vert coords and tris must be filled");
+	}
+	if(texCoords.size() != 0 && texCoords.size() != vertCoords.size())
+	{
+		throw EXCEPTION("Tex coords num must be zero or equal to the vertex coords num");
+	}
+	if(vertWeights.size() != 0 && vertWeights.size() != vertCoords.size())
+	{
+		throw EXCEPTION("Vert weights num must be zero or equal to the vertex coords num");
+	}
+
+	createAllNormals();
+	createVertTangents();
+	createVertIndeces();
+}
+
+
+//======================================================================================================================
+// createFaceNormals                                                                                                   =
+//======================================================================================================================
+void MeshData::createVertIndeces()
+{
+	vertIndeces.resize(tris.size() * 3);
+	for(uint i=0; i<tris.size(); i++)
+	{
+		vertIndeces[i * 3 + 0] = tris[i].vertIds[0];
+		vertIndeces[i * 3 + 1] = tris[i].vertIds[1];
+		vertIndeces[i * 3 + 2] = tris[i].vertIds[2];
+	}
+}
+
+
+//======================================================================================================================
+// createFaceNormals                                                                                                   =
+//======================================================================================================================
+void MeshData::createFaceNormals()
+{
+	for(uint i=0; i<tris.size(); i++)
+	{
+		Triangle& tri = tris[i];
+		const Vec3& v0 = vertCoords[tri.vertIds[0]];
+		const Vec3& v1 = vertCoords[tri.vertIds[1]];
+		const Vec3& v2 = vertCoords[tri.vertIds[2]];
+
+		tri.normal = (v1 - v0).cross(v2 - v0);
+
+		tri.normal.normalize();
+	}
+}
+
+
+//======================================================================================================================
+// createVertNormals                                                                                                   =
+//======================================================================================================================
+void MeshData::createVertNormals()
+{
+	vertNormals.resize(vertCoords.size());
+
+	for(uint i=0; i<vertCoords.size(); i++)
+	{
+		vertNormals[i] = Vec3(0.0, 0.0, 0.0);
+	}
+
+	for(uint i=0; i<tris.size(); i++)
+	{
+		const Triangle& tri = tris[i];
+		vertNormals[tri.vertIds[0]] += tri.normal;
+		vertNormals[tri.vertIds[1]] += tri.normal;
+		vertNormals[tri.vertIds[2]] += tri.normal;
+	}
+
+	for(uint i=0; i<vertNormals.size(); i++)
+	{
+		vertNormals[i].normalize();
+	}
+}
+
+
+//======================================================================================================================
+// createVertTangents                                                                                                  =
+//======================================================================================================================
+void MeshData::createVertTangents()
+{
+	vertTangents.resize(vertCoords.size(), Vec4(0.0)); // alloc
+	Vec<Vec3> bitagents(vertCoords.size(), Vec3(0.0));
+
+	for(uint i=0; i<tris.size(); i++)
+	{
+		const Triangle& tri = tris[i];
+		const int i0 = tri.vertIds[0];
+		const int i1 = tri.vertIds[1];
+		const int i2 = tri.vertIds[2];
+		const Vec3& v0 = vertCoords[i0];
+		const Vec3& v1 = vertCoords[i1];
+		const Vec3& v2 = vertCoords[i2];
+		Vec3 edge01 = v1 - v0;
+		Vec3 edge02 = v2 - v0;
+		Vec2 uvedge01 = texCoords[i1] - texCoords[i0];
+		Vec2 uvedge02 = texCoords[i2] - texCoords[i0];
+
+
+		float det = (uvedge01.y * uvedge02.x) - (uvedge01.x * uvedge02.y);
+		if(isZero(det))
+		{
+			//WARNING(getRsrcName() << ": det == " << fixed << det);
+			det = 0.0001;
+		}
+		else
+		{
+			det = 1.0 / det;
+		}
+
+		Vec3 t = (edge02 * uvedge01.y - edge01 * uvedge02.y) * det;
+		Vec3 b = (edge02 * uvedge01.x - edge01 * uvedge02.x) * det;
+		t.normalize();
+		b.normalize();
+
+		vertTangents[i0] += Vec4(t, 1.0);
+		vertTangents[i1] += Vec4(t, 1.0);
+		vertTangents[i2] += Vec4(t, 1.0);
+
+		bitagents[i0] += b;
+		bitagents[i1] += b;
+		bitagents[i2] += b;
+	}
+
+	for(uint i=0; i<vertTangents.size(); i++)
+	{
+		Vec3 t = Vec3(vertTangents[i]);
+		const Vec3& n = vertNormals[i];
+		Vec3& b = bitagents[i];
+
+		//t = t - n * n.dot(t);
+		t.normalize();
+
+		b.normalize();
+
+		float w = ((n.cross(t)).dot(b) < 0.0) ? 1.0 : -1.0;
+
+		vertTangents[i] = Vec4(t, w);
+	}
+}

+ 87 - 0
src/Resources/Helpers/MeshData.h

@@ -0,0 +1,87 @@
+#ifndef MESH_DATA_H
+#define MESH_DATA_H
+
+#include <string>
+#include "Math.h"
+#include "StdTypes.h"
+#include "Vec.h"
+#include "Properties.h"
+
+
+/// Mesh data. This class loads the mesh file and the Mesh class loads it to the GPU
+///
+/// Binary file format:
+///
+/// @code
+/// <magic:ANKIMESH>
+/// <string:meshName>
+/// <string:material>
+/// <uint:vertsNum>
+/// <float:vert[0].x> <float:vert[0].y> <float:vert[0].z> ...
+/// <float:vert[vertsNum-1].x> <float:vert[vertsNum-1].y> <float:vert[vertsNum-1].z>
+/// <uint:facesNum>
+/// <uint:tri[0].vertIds[0]> <uint:tri[0].vertIds[1]> <uint:tri[0].vertIds[2]> ...
+/// <uint:tri[facesNum-1].vertIds[0]> <uint:tri[facesNum-1].vertIds[1]> <uint:tri[facesNum-1].vertIds[2]>
+/// @endcode
+class MeshData
+{
+	public:
+		/// Vertex weight for skeletan animation
+		class VertexWeight
+		{
+			public:
+				static const uint MAX_BONES_PER_VERT = 4; ///< Dont change or change the skinning code in shader
+
+				/// @todo change the vals to uint when change drivers
+				float bonesNum;
+				float boneIds[MAX_BONES_PER_VERT];
+				float weights[MAX_BONES_PER_VERT];
+		};
+
+		/// Triangle
+		class Triangle
+		{
+			public:
+				uint vertIds[3]; ///< an array with the vertex indexes in the mesh class
+				Vec3 normal;
+		};
+
+
+	PROPERTY_R(Vec<Vec3>, vertCoords, getVertCoords) ///< Loaded from file
+	PROPERTY_R(Vec<Vec3>, vertNormals, getVertNormals) ///< Generated
+	PROPERTY_R(Vec<Vec4>, vertTangents, getVertTangents) ///< Generated
+	PROPERTY_R(Vec<Vec2>, texCoords, getTexCoords) ///< Optional. One for every vert so we can use vertex arrays & VBOs
+	PROPERTY_R(Vec<VertexWeight>, vertWeights, getVertWeights) ///< Optional
+	PROPERTY_R(Vec<Triangle>, tris, getTris) ///< Required
+	PROPERTY_R(Vec<ushort>, vertIndeces, getVertIndeces) ///< Generated. Used for vertex arrays & VBOs
+	PROPERTY_R(std::string, materialName, getMaterialName) ///< Required. If empty then mesh not renderable
+
+	public:
+		MeshData(const char* filename) {load(filename);}
+		~MeshData() {}
+
+	private:
+		/// Load the mesh data from a binary file
+		/// @exception Exception
+		void load(const char* filename);
+
+		void createFaceNormals();
+		void createVertNormals();
+		void createAllNormals();
+		void createVertTangents();
+		void createVertIndeces();
+
+		/// This func does some sanity checks and creates normals, tangents, VBOs etc
+		/// @exception Exception
+		void doPostLoad();
+};
+
+
+inline void MeshData::createAllNormals()
+{
+	createFaceNormals();
+	createVertNormals();
+}
+
+
+#endif

+ 39 - 300
src/Resources/Mesh.cpp

@@ -2,10 +2,7 @@
 #include <boost/lexical_cast.hpp>
 #include "Mesh.h"
 #include "Material.h"
-#include "BinaryStream.h"
-
-
-#define MESH_EXCEPTION(x) EXCEPTION("Mesh \"" + filename + "\": " + x)
+#include "MeshData.h"
 
 
 //======================================================================================================================
@@ -13,307 +10,42 @@
 //======================================================================================================================
 void Mesh::load(const char* filename)
 {
-	// Try
-	try
-	{
-		// Open the file
-		std::fstream file(filename, std::fstream::in | std::fstream::binary);
-
-		if(!file.is_open())
-		{
-			throw EXCEPTION("Cannot open file \"" + filename + "\"");
-		}
-
-		BinaryStream bs(file.rdbuf());
+	MeshData meshData(filename);
 
-		// Magic word
-		char magic[8];
-		bs.read(magic, 8);
-		if(bs.fail() || memcmp(magic, "ANKIMESH", 8))
-		{
-			throw MESH_EXCEPTION("Incorrect magic word");
-		}
+	vertIdsNum = meshData.getVertIndeces().size();
 
-		// Mesh name
-		std::string meshName = bs.readString();
+	try
+	{
+		material.loadRsrc(meshData.getMaterialName().c_str());
 
-		// Material name
-		std::string materialName = bs.readString();
-		if(materialName.length() > 0)
+		if(isRenderable())
 		{
-			material.loadRsrc(materialName.c_str());
-		}
+			createVbos(meshData);
 
-		// Verts num
-		uint vertsNum = bs.readUint();
-		vertCoords.resize(vertsNum);
+			//
+			// Sanity checks
+			//
 
-		// Vert coords
-		for(uint i=0; i<vertCoords.size(); i++)
-		{
-			for(uint j=0; j<3; j++)
+			// shader needs text coords and mesh does not have any
+			if(material->stdAttribVars[Material::SAV_TEX_COORDS] != NULL && !vbos.texCoords.isCreated())
 			{
-				vertCoords[i][j] = bs.readFloat();
+				throw EXCEPTION("The shader program (\"" + material->shaderProg->getRsrcName() +
+												"\") needs texture coord information that the mesh (\"" +
+												getRsrcName() + "\") doesn't have");
 			}
-		}
-
-		// Faces num
-		uint facesNum = bs.readUint();
-		tris.resize(facesNum);
 
-		// Faces IDs
-		for(uint i=0; i<tris.size(); i++)
-		{
-			for(uint j=0; j<3; j++)
-			{
-				tris[i].vertIds[j] = bs.readUint();
-
-				// a sanity check
-				if(tris[i].vertIds[j] >= vertCoords.size())
-				{
-					throw MESH_EXCEPTION("Vert index out of bounds" + boost::lexical_cast<std::string>(tris[i].vertIds[j]) +
-					                     " (" + boost::lexical_cast<std::string>(i) + ", " +
-					                     boost::lexical_cast<std::string>(j) + ")");
-				}
-			}
-		}
-
-		// Tex coords num
-		uint texCoordsNum = bs.readUint();
-		texCoords.resize(texCoordsNum);
-
-		// Tex coords
-		for(uint i=0; i<texCoords.size(); i++)
-		{
-			for(uint j=0; j<2; j++)
+			// shader has HW skinning and mesh does not have vert weights
+			if(material->hasHWSkinning() && !vbos.vertWeights.isCreated())
 			{
-				texCoords[i][j] = bs.readFloat();
+				throw EXCEPTION("The shader program (\"" + material->shaderProg->getRsrcName() +
+												"\") needs vertex weights that the mesh (\"" +
+												getRsrcName() + "\") doesn't have");
 			}
 		}
-
-		// Vert weights num
-		uint vertWeightsNum = bs.readUint();
-		vertWeights.resize(vertWeightsNum);
-
-		// Vert weights
-		for(uint i=0; i<vertWeights.size(); i++)
-		{
-			// get the bone connections num
-			uint boneConnections = bs.readUint();
-
-			// we treat as error if one vert doesnt have a bone
-			if(boneConnections < 1)
-			{
-				throw MESH_EXCEPTION("Vert " + boost::lexical_cast<std::string>(i) + " sould have at least one bone");
-			}
-
-			// and here is another possible error
-			if(boneConnections > VertexWeight::MAX_BONES_PER_VERT)
-			{
-				uint tmp = VertexWeight::MAX_BONES_PER_VERT;
-				throw MESH_EXCEPTION("Cannot have more than " +
-				                     boost::lexical_cast<std::string>(tmp) + " bones per vertex");
-			}
-			vertWeights[i].bonesNum = boneConnections;
-
-			// for all the weights of the current vertes
-			for(uint j=0; j<vertWeights[i].bonesNum; j++)
-			{
-				// read bone id
-				uint boneId = bs.readUint();
-				vertWeights[i].boneIds[j] = boneId;
-
-				// read the weight of that bone
-				float weight = bs.readFloat();
-				vertWeights[i].weights[j] = weight;
-			}
-		} // end for all vert weights
-
-
-		doPostLoad();
 	}
 	catch(Exception& e)
 	{
-		throw MESH_EXCEPTION(e.what());
-	}
-}
-
-
-//======================================================================================================================
-// doPostLoad                                                                                                          =
-//======================================================================================================================
-void Mesh::doPostLoad()
-{
-	// Sanity checks
-	if(vertCoords.size()<1 || tris.size()<1)
-	{
-		throw EXCEPTION("Vert coords and tris must be filled");
-	}
-	if(texCoords.size()!=0 && texCoords.size()!=vertCoords.size())
-	{
-		throw EXCEPTION("Tex coords num must be zero or equal to vertex coords num");
-	}
-	if(vertWeights.size()!=0 && vertWeights.size()!=vertCoords.size())
-	{
-		throw EXCEPTION("Vert weights num must be zero or equal to vertex coords num");
-	}
-
-	if(isRenderable())
-	{
-		createAllNormals();
-		if(texCoords.size() > 0)
-		{
-			createVertTangents();
-		}
-		createVertIndeces();
-		createVbos();
-
-		// Sanity checks continued
-		if(material->stdAttribVars[Material::SAV_TEX_COORDS] != NULL && !vbos.texCoords.isCreated())
-		{
-			throw EXCEPTION("The shader program (\"" + material->shaderProg->getRsrcName() +
-						          "\") needs texture coord information that the mesh (\"" +
-						          getRsrcName() + "\") doesn't have");
-		}
-
-		if(material->hasHWSkinning() && !vbos.vertWeights.isCreated())
-		{
-			throw EXCEPTION("The shader program (\"" + material->shaderProg->getRsrcName() +
-						          "\") needs vertex weights that the mesh (\"" +
-						          getRsrcName() + "\") doesn't have");
-		}
-	}
-}
-
-
-//======================================================================================================================
-// createFaceNormals                                                                                                   =
-//======================================================================================================================
-void Mesh::createVertIndeces()
-{
-	RASSERT_THROW_EXCEPTION(vertIndeces.size() > 0);
-
-	vertIndeces.resize(tris.size() * 3);
-	for(uint i=0; i<tris.size(); i++)
-	{
-		vertIndeces[i*3+0] = tris[i].vertIds[0];
-		vertIndeces[i*3+1] = tris[i].vertIds[1];
-		vertIndeces[i*3+2] = tris[i].vertIds[2];
-	}
-}
-
-
-//======================================================================================================================
-// createFaceNormals                                                                                                   =
-//======================================================================================================================
-void Mesh::createFaceNormals()
-{
-	for(uint i=0; i<tris.size(); i++)
-	{
-		Triangle& tri = tris[i];
-		const Vec3& v0 = vertCoords[tri.vertIds[0]];
-		const Vec3& v1 = vertCoords[tri.vertIds[1]];
-		const Vec3& v2 = vertCoords[tri.vertIds[2]];
-
-		tri.normal = (v1 - v0).cross(v2 - v0);
-
-		tri.normal.normalize();
-	}
-}
-
-
-//======================================================================================================================
-// createVertNormals                                                                                                   =
-//======================================================================================================================
-void Mesh::createVertNormals()
-{
-	vertNormals.resize(vertCoords.size()); // alloc
-
-	for(uint i=0; i<vertCoords.size(); i++)
-		vertNormals[i] = Vec3(0.0, 0.0, 0.0);
-
-	for(uint i=0; i<tris.size(); i++)
-	{
-		const Triangle& tri = tris[i];
-		vertNormals[tri.vertIds[0]] += tri.normal;
-		vertNormals[tri.vertIds[1]] += tri.normal;
-		vertNormals[tri.vertIds[2]] += tri.normal;
-	}
-
-	for(uint i=0; i<vertNormals.size(); i++)
-	{
-		vertNormals[i].normalize();
-	}
-}
-
-
-//======================================================================================================================
-// createVertTangents                                                                                                  =
-//======================================================================================================================
-void Mesh::createVertTangents()
-{
-	vertTangents.resize(vertCoords.size()); // alloc
-
-	Vec<Vec3> bitagents(vertCoords.size());
-
-	for(uint i=0; i<vertTangents.size(); i++)
-	{
-		vertTangents[i] = Vec4(0.0);
-		bitagents[i] = Vec3(0.0);
-	}
-
-	for(uint i=0; i<tris.size(); i++)
-	{
-		const Triangle& tri = tris[i];
-		const int i0 = tri.vertIds[0];
-		const int i1 = tri.vertIds[1];
-		const int i2 = tri.vertIds[2];
-		const Vec3& v0 = vertCoords[i0];
-		const Vec3& v1 = vertCoords[i1];
-		const Vec3& v2 = vertCoords[i2];
-		Vec3 edge01 = v1 - v0;
-		Vec3 edge02 = v2 - v0;
-		Vec2 uvedge01 = texCoords[i1] - texCoords[i0];
-		Vec2 uvedge02 = texCoords[i2] - texCoords[i0];
-
-
-		float det = (uvedge01.y * uvedge02.x) - (uvedge01.x * uvedge02.y);
-		if(isZero(det))
-		{
-			//WARNING(getRsrcName() << ": det == " << fixed << det);
-			det = 0.0001;
-		}
-		else
-			det = 1.0 / det;
-
-		Vec3 t = (edge02 * uvedge01.y - edge01 * uvedge02.y) * det;
-		Vec3 b = (edge02 * uvedge01.x - edge01 * uvedge02.x) * det;
-		t.normalize();
-		b.normalize();
-
-		vertTangents[i0] += Vec4(t, 1.0);
-		vertTangents[i1] += Vec4(t, 1.0);
-		vertTangents[i2] += Vec4(t, 1.0);
-
-		bitagents[i0] += b;
-		bitagents[i1] += b;
-		bitagents[i2] += b;
-	}
-
-	for(uint i=0; i<vertTangents.size(); i++)
-	{
-		Vec3 t = Vec3(vertTangents[i]);
-		const Vec3& n = vertNormals[i];
-		Vec3& b = bitagents[i];
-
-		//t = t - n * n.dot(t);
-		t.normalize();
-
-		b.normalize();
-
-		float w = ((n.cross(t)).dot(b) < 0.0) ? 1.0 : -1.0;
-
-		vertTangents[i] = Vec4(t, w);
+		throw EXCEPTION("Mesh \"" + filename + "\": " + e.what());
 	}
 }
 
@@ -321,24 +53,31 @@ void Mesh::createVertTangents()
 //======================================================================================================================
 // createVbos                                                                                                          =
 //======================================================================================================================
-void Mesh::createVbos()
+void Mesh::createVbos(const MeshData& meshData)
 {
-	vbos.vertIndeces.create(GL_ELEMENT_ARRAY_BUFFER, vertIndeces.getSizeInBytes(), &vertIndeces[0], GL_STATIC_DRAW);
-	vbos.vertCoords.create(GL_ARRAY_BUFFER, vertCoords.getSizeInBytes(), &vertCoords[0], GL_STATIC_DRAW);
-	vbos.vertNormals.create(GL_ARRAY_BUFFER, vertNormals.getSizeInBytes(), &vertNormals[0], GL_STATIC_DRAW);
-	if(vertTangents.size() > 1)
+	vbos.vertIndeces.create(GL_ELEMENT_ARRAY_BUFFER, meshData.getVertIndeces().getSizeInBytes(),
+	                        &meshData.getVertIndeces()[0], GL_STATIC_DRAW);
+	vbos.vertCoords.create(GL_ARRAY_BUFFER, meshData.getVertCoords().getSizeInBytes(),
+	                       &meshData.getVertCoords()[0], GL_STATIC_DRAW);
+	vbos.vertNormals.create(GL_ARRAY_BUFFER, meshData.getVertNormals().getSizeInBytes(),
+	                        &meshData.getVertNormals()[0], GL_STATIC_DRAW);
+
+	if(meshData.getVertTangents().size() > 1)
 	{
-		vbos.vertTangents.create(GL_ARRAY_BUFFER, vertTangents.getSizeInBytes(), &vertTangents[0], GL_STATIC_DRAW);
+		vbos.vertTangents.create(GL_ARRAY_BUFFER, meshData.getVertTangents().getSizeInBytes(),
+		                         &meshData.getVertTangents()[0], GL_STATIC_DRAW);
 	}
 
-	if(texCoords.size() > 1)
+	if(meshData.getTexCoords().size() > 1)
 	{
-		vbos.texCoords.create(GL_ARRAY_BUFFER, texCoords.getSizeInBytes(), &texCoords[0], GL_STATIC_DRAW);
+		vbos.texCoords.create(GL_ARRAY_BUFFER, meshData.getTexCoords().getSizeInBytes(),
+		                      &meshData.getTexCoords()[0], GL_STATIC_DRAW);
 	}
 
-	if(vertWeights.size() > 1)
+	if(meshData.getVertWeights().size() > 1)
 	{
-		vbos.vertWeights.create(GL_ARRAY_BUFFER, vertWeights.getSizeInBytes(), &vertWeights[0], GL_STATIC_DRAW);
+		vbos.vertWeights.create(GL_ARRAY_BUFFER, meshData.getVertWeights().getSizeInBytes(),
+		                        &meshData.getVertWeights()[0], GL_STATIC_DRAW);
 	}
 }
 

+ 9 - 72
src/Resources/Mesh.h

@@ -8,53 +8,14 @@
 
 
 class Material;
+class MeshData;
 
 
 /// Mesh Resource. If the material name is empty then the mesh wont be rendered and no VBOs will be created
-///
-/// Binary file format:
-///
-/// @code
-/// <magic:ANKIMESH>
-/// <string:meshName>
-/// <string:material>
-/// <uint:vertsNum>
-/// <float:vert[0].x> <float:vert[0].y> <float:vert[0].z> ...
-/// <float:vert[vertsNum-1].x> <float:vert[vertsNum-1].y> <float:vert[vertsNum-1].z>
-/// <uint:facesNum>
-/// <uint:tri[0].vertIds[0]> <uint:tri[0].vertIds[1]> <uint:tri[0].vertIds[2]> ...
-/// <uint:tri[facesNum-1].vertIds[0]> <uint:tri[facesNum-1].vertIds[1]> <uint:tri[facesNum-1].vertIds[2]>
-/// @endcode
 class Mesh: public Resource
 {
 	public:
-		/**
-		 * Vertex weight for skeletan animation
-		 */
-		class VertexWeight
-		{
-			public:
-				static const uint MAX_BONES_PER_VERT = 4; ///< Dont change or change the skinning code in shader
-
-				// ToDo: change the vals to uint when change drivers
-				float bonesNum;
-				float boneIds[MAX_BONES_PER_VERT];
-				float weights[MAX_BONES_PER_VERT];
-		};
-
-		/**
-		 * Triangle
-		 */
-		class Triangle
-		{
-			public:
-				uint vertIds[3]; // an array with the vertex indexes in the mesh class
-				Vec3 normal;
-		};
-
-		/**
-		 * The VBOs in a structure
-		 */
+		/// The VBOs in a structure
 		struct Vbos
 		{
 			Vbo vertCoords;
@@ -65,48 +26,24 @@ class Mesh: public Resource
 			Vbo vertWeights;
 		};
 
+	PROPERTY_R(uint, vertIdsNum, getVertIdsNum)
+
 	public:
-		Vec<Vec3>         vertCoords; ///< Required
-		Vec<Vec3>         vertNormals; ///< Generated if renderable
-		Vec<Vec4>         vertTangents; ///< Generated if renderable
-		Vec<Vec2>         texCoords;    ///< Optional. One for every vert so we can use vertex arrays & VBOs
-		Vec<VertexWeight> vertWeights; ///< Optional
-		Vec<Triangle>     tris; ///< Required
-		Vec<ushort>       vertIndeces; ///< Generated if renderable. Used for vertex arrays & VBOs
-		Vbos              vbos; ///< Generated if renderable
 		RsrcPtr<Material> material; ///< Required. If empty then mesh not renderable
+		Vbos vbos;
 
-		Mesh();
+		Mesh(): Resource(RT_MESH) {}
 		~Mesh() {}
+
+		/// Implements @ref Resource::load
 		void load(const char* filename);
 
 		/// The mesh is renderable when the material is loaded
 		bool isRenderable() const;
 
 	private:
-		void createFaceNormals();
-		void createVertNormals();
-		void createAllNormals();
-		void createVertTangents();
-		void createVertIndeces();
-		void createVbos();
-
-		/// This func does some sanity checks and creates normals, tangents, VBOs etc
-		/// @exception Exception
-		void doPostLoad();
+		void createVbos(const MeshData& meshData);
 };
 
 
-inline Mesh::Mesh():
-	Resource(RT_MESH)
-{}
-
-
-inline void Mesh::createAllNormals()
-{
-	createFaceNormals();
-	createVertNormals();
-}
-
-
 #endif

+ 5 - 4
src/Scene/MeshNode.cpp

@@ -8,6 +8,7 @@
 #include "SkelAnimCtrl.h"
 #include "App.h"
 #include "MainRenderer.h"
+#include "MeshData.h" // For some sizeof
 
 
 #define BUFFER_OFFSET(i) ((char *)NULL + (i))
@@ -49,17 +50,17 @@ void MeshNode::render(Material* mtl) const
 		loc = mtl->stdAttribVars[Material::SAV_VERT_WEIGHT_BONES_NUM]->getLoc();
 		glEnableVertexAttribArray(loc);
 		locs[locsNum++] = loc;
-		glVertexAttribPointer(loc, 1, GL_FLOAT, GL_FALSE, sizeof(Mesh::VertexWeight), BUFFER_OFFSET(0));
+		glVertexAttribPointer(loc, 1, GL_FLOAT, GL_FALSE, sizeof(MeshData::VertexWeight), BUFFER_OFFSET(0));
 
 		loc = mtl->stdAttribVars[Material::SAV_VERT_WEIGHT_BONE_IDS]->getLoc();
 		glEnableVertexAttribArray(loc);
 		locs[locsNum++] = loc;
-		glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, sizeof(Mesh::VertexWeight), BUFFER_OFFSET(4));
+		glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, sizeof(MeshData::VertexWeight), BUFFER_OFFSET(4));
 
 		loc = mtl->stdAttribVars[Material::SAV_VERT_WEIGHT_WEIGHTS]->getLoc();
 		glEnableVertexAttribArray(loc);
 		locs[locsNum++] = loc;
-		glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, sizeof(Mesh::VertexWeight), BUFFER_OFFSET(20));
+		glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, sizeof(MeshData::VertexWeight), BUFFER_OFFSET(20));
 	}
 
 	if(mtl->stdAttribVars[Material::SAV_POSITION] != NULL)
@@ -100,7 +101,7 @@ void MeshNode::render(Material* mtl) const
 
 	mesh->vbos.vertIndeces.bind();
 
-	glDrawElements(GL_TRIANGLES, mesh->vertIndeces.size(), GL_UNSIGNED_SHORT, 0);
+	glDrawElements(GL_TRIANGLES, mesh->getVertIdsNum(), GL_UNSIGNED_SHORT, 0);
 
 	// disable
 	for(int i=0; i<locsNum; i++)

+ 1 - 1
src/Util/Exception.cpp

@@ -9,7 +9,7 @@
 void Exception::init(const char* err_, const char* file, int line, const char* func)
 {
 	char tmpStr[1024];
-	sprintf(tmpStr, "(%s:%d %s) Exception: %s", file, line, func, err_);
+	sprintf(tmpStr, "(%s:%d %s) %s", file, line, func, err_);
 	//sprintf(tmpStr, "%s", err_);
 	err = tmpStr;
 }

Некоторые файлы не были показаны из-за большого количества измененных файлов