瀏覽代碼

Working on a Bullet demo

Panagiotis Christopoulos Charitos 16 年之前
父節點
當前提交
851df9a4d0
共有 6 個文件被更改,包括 670 次插入270 次删除
  1. 300 269
      build/debug/Makefile
  2. 2 1
      build/debug/gen.cfg.py
  3. 106 0
      src/main.cpp
  4. 132 0
      src/renderer/BulletDebuger.cpp
  5. 37 0
      src/renderer/BulletDebuger.h
  6. 93 0
      src/renderer/r_dbg.cpp

+ 300 - 269
build/debug/Makefile

@@ -2,11 +2,11 @@ CXX = g++
 COMMONFLAGS = 
 CFLAGS = $(COMMONFLAGS) -c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -pipe -O0 -g3 -pg `sdl-config --cflags` -D_DEBUG_ -D_TERMINAL_COLORING__ -D_PLATFORM_LINUX_
 PHFLAGS = $(CFLAGS) -x c++-header
-LFLAGS = $(COMMONFLAGS) -rdynamic -L../../../bullet_svn/src/BulletSoftBody -L../../../bullet_svn/src/BulletDynamics -L../../../bullet_svn/src/BulletCollision -L../../../bullet_svn/src/LinearMath -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lSDL_image -lGLU -Wl,-Bdynamic -lSDL -lpthread -lGL -ljpeg -lpng -ltiff -lesd -lcaca -laa -ldirectfb -laudio -lpulse-simple
+LFLAGS = $(COMMONFLAGS) -rdynamic -L../../../bullet_svn/src/BulletSoftBody -L../../../bullet_svn/src/BulletDynamics -L../../../bullet_svn/src/BulletCollision -L../../../bullet_svn/src/LinearMath -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lSDL_image -lGLU -Wl,-Bdynamic -lSDL -lGL -ljpeg -lpng -ltiff
 EXECUTABLE = AnKi.bin
 INCPATH = -I../../src/math/ -I../../src/tokenizer/ -I../../src/uncategorized/ -I../../src/ -I../../src/renderer/ -I../../src/scene/ -I../../src/ui/ -I../../src/resources/ -I../../src/utility/ -I../../src/controllers/ -I../../../bullet_svn/src/ 
-SOURCES = ../../src/tokenizer//Scanner.cpp ../../src/uncategorized//input.cpp ../../src/uncategorized//skybox.cpp ../../src/uncategorized//particles.cpp ../../src/uncategorized//memory.cpp ../../src/uncategorized//engine_class.cpp ../../src/uncategorized//collision.cpp ../../src/uncategorized//map.cpp ../../src//main.cpp ../../src/renderer//r_ms.cpp ../../src/renderer//r_pps_hdr.cpp ../../src/renderer//r_pps.cpp ../../src/renderer//r_is_shadows.cpp ../../src/renderer//r_bs.cpp ../../src/renderer//r_ms_earlyz.cpp ../../src/renderer//renderer.cpp ../../src/renderer//r_pps_ssao.cpp ../../src/renderer//r_is.cpp ../../src/renderer//r_dbg.cpp ../../src/renderer//r_pps_lscatt.cpp ../../src/renderer//r_bs2.cpp ../../src/scene//mesh_node.cpp ../../src/scene//skel_node.cpp ../../src/scene//light.cpp ../../src/scene//skel_model_node.cpp ../../src/scene//node.cpp ../../src/scene//camera.cpp ../../src/scene//scene.cpp ../../src/ui//ui.cpp ../../src/resources//material.cpp ../../src/resources//texture.cpp ../../src/resources//skel_anim.cpp ../../src/resources//extension.cpp ../../src/resources//skeleton.cpp ../../src/resources//resource.cpp ../../src/resources//ShaderParser.cpp ../../src/resources//light_props.cpp ../../src/resources//mesh.cpp ../../src/resources//shader_prog.cpp ../../src/utility//app.cpp ../../src/utility//common.cpp ../../src/utility//util.cpp ../../src/controllers//controller.cpp ../../src/controllers//skel_anim_ctrl.cpp 
-OBJECTS = Scanner.o input.o skybox.o particles.o memory.o engine_class.o collision.o map.o main.o r_ms.o r_pps_hdr.o r_pps.o r_is_shadows.o r_bs.o r_ms_earlyz.o renderer.o r_pps_ssao.o r_is.o r_dbg.o r_pps_lscatt.o r_bs2.o mesh_node.o skel_node.o light.o skel_model_node.o node.o camera.o scene.o ui.o material.o texture.o skel_anim.o extension.o skeleton.o resource.o ShaderParser.o light_props.o mesh.o shader_prog.o app.o common.o util.o controller.o skel_anim_ctrl.o 
+SOURCES = ../../src/tokenizer//Scanner.cpp ../../src/uncategorized//input.cpp ../../src/uncategorized//engine_class.cpp ../../src/uncategorized//collision.cpp ../../src/uncategorized//skybox.cpp ../../src/uncategorized//map.cpp ../../src/uncategorized//memory.cpp ../../src/uncategorized//particles.cpp ../../src//main.cpp ../../src/renderer//renderer.cpp ../../src/renderer//r_is_shadows.cpp ../../src/renderer//r_is.cpp ../../src/renderer//r_ms_earlyz.cpp ../../src/renderer//BulletDebuger.cpp ../../src/renderer//r_pps.cpp ../../src/renderer//r_bs.cpp ../../src/renderer//r_dbg.cpp ../../src/renderer//r_ms.cpp ../../src/renderer//r_pps_lscatt.cpp ../../src/renderer//r_pps_hdr.cpp ../../src/renderer//r_bs2.cpp ../../src/renderer//r_pps_ssao.cpp ../../src/scene//skel_node.cpp ../../src/scene//skel_model_node.cpp ../../src/scene//camera.cpp ../../src/scene//node.cpp ../../src/scene//mesh_node.cpp ../../src/scene//light.cpp ../../src/scene//scene.cpp ../../src/ui//ui.cpp ../../src/resources//extension.cpp ../../src/resources//shader_prog.cpp ../../src/resources//material.cpp ../../src/resources//mesh.cpp ../../src/resources//skel_anim.cpp ../../src/resources//ShaderParser.cpp ../../src/resources//texture.cpp ../../src/resources//resource.cpp ../../src/resources//skeleton.cpp ../../src/resources//light_props.cpp ../../src/utility//app.cpp ../../src/utility//common.cpp ../../src/utility//util.cpp ../../src/controllers//skel_anim_ctrl.cpp ../../src/controllers//controller.cpp 
+OBJECTS = Scanner.o input.o engine_class.o collision.o skybox.o map.o memory.o particles.o main.o renderer.o r_is_shadows.o r_is.o r_ms_earlyz.o BulletDebuger.o r_pps.o r_bs.o r_dbg.o r_ms.o r_pps_lscatt.o r_pps_hdr.o r_bs2.o r_pps_ssao.o skel_node.o skel_model_node.o camera.o node.o mesh_node.o light.o scene.o ui.o extension.o shader_prog.o material.o mesh.o skel_anim.o ShaderParser.o texture.o resource.o skeleton.o light_props.o app.o common.o util.o skel_anim_ctrl.o controller.o 
 PRECOMPILED_HEADERS = 
 
 all: $(PRECOMPILED_HEADERS) $(SOURCES) $(EXECUTABLE)
@@ -43,39 +43,6 @@ input.o: ../../src/uncategorized//input.cpp \
 	@echo Compiling ../../src/uncategorized//input.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/uncategorized//input.cpp -o input.o
 
-skybox.o: ../../src/uncategorized//skybox.cpp \
- ../../src/uncategorized//skybox.h ../../src/utility/common.h \
- ../../src/uncategorized/memory.h ../../src/resources/texture.h \
- ../../src/resources/resource.h ../../src/uncategorized/engine_class.h \
- ../../src/utility/util.h ../../src/utility/common.h \
- ../../src/math/gmath.h ../../src/math/vec2.h \
- ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
- ../../src/math/m_dflt_header.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/m_misc.h \
- ../../src/math/m_misc.inl.h ../../src/resources/resource.h \
- ../../src/renderer/renderer.h ../../src/resources/shader_prog.h \
- ../../src/scene/camera.h ../../src/uncategorized/collision.h \
- ../../src/scene/node.h ../../src/scene/scene.h \
- ../../src/uncategorized/skybox.h
-	@echo Compiling ../../src/uncategorized//skybox.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/uncategorized//skybox.cpp -o skybox.o
-
-particles.o: ../../src/uncategorized//particles.cpp
-	@echo Compiling ../../src/uncategorized//particles.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/uncategorized//particles.cpp -o particles.o
-
-memory.o: ../../src/uncategorized//memory.cpp \
- ../../src/uncategorized//memory.h ../../src/utility/common.h \
- ../../src/uncategorized/memory.h
-	@echo Compiling ../../src/uncategorized//memory.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/uncategorized//memory.cpp -o memory.o
-
 engine_class.o: ../../src/uncategorized//engine_class.cpp \
  ../../src/uncategorized//engine_class.h ../../src/utility/common.h \
  ../../src/uncategorized/memory.h
@@ -102,6 +69,29 @@ collision.o: ../../src/uncategorized//collision.cpp \
 	@echo Compiling ../../src/uncategorized//collision.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/uncategorized//collision.cpp -o collision.o
 
+skybox.o: ../../src/uncategorized//skybox.cpp \
+ ../../src/uncategorized//skybox.h ../../src/utility/common.h \
+ ../../src/uncategorized/memory.h ../../src/resources/texture.h \
+ ../../src/resources/resource.h ../../src/uncategorized/engine_class.h \
+ ../../src/utility/util.h ../../src/utility/common.h \
+ ../../src/math/gmath.h ../../src/math/vec2.h \
+ ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
+ ../../src/math/m_dflt_header.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/m_misc.h \
+ ../../src/math/m_misc.inl.h ../../src/resources/resource.h \
+ ../../src/renderer/renderer.h ../../src/resources/shader_prog.h \
+ ../../src/scene/camera.h ../../src/uncategorized/collision.h \
+ ../../src/scene/node.h ../../src/scene/scene.h \
+ ../../src/uncategorized/skybox.h
+	@echo Compiling ../../src/uncategorized//skybox.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/uncategorized//skybox.cpp -o skybox.o
+
 map.o: ../../src/uncategorized//map.cpp ../../src/uncategorized//map.h \
  ../../src/utility/common.h ../../src/uncategorized/memory.h \
  ../../src/uncategorized//collision.h ../../src/math/gmath.h \
@@ -124,6 +114,16 @@ map.o: ../../src/uncategorized//map.cpp ../../src/uncategorized//map.h \
 	@echo Compiling ../../src/uncategorized//map.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/uncategorized//map.cpp -o map.o
 
+memory.o: ../../src/uncategorized//memory.cpp \
+ ../../src/uncategorized//memory.h ../../src/utility/common.h \
+ ../../src/uncategorized/memory.h
+	@echo Compiling ../../src/uncategorized//memory.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/uncategorized//memory.cpp -o memory.o
+
+particles.o: ../../src/uncategorized//particles.cpp
+	@echo Compiling ../../src/uncategorized//particles.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/uncategorized//particles.cpp -o particles.o
+
 main.o: ../../src//main.cpp ../../src/utility/common.h \
  ../../src/uncategorized/memory.h ../../src/uncategorized/input.h \
  ../../src/utility/app.h ../../src/utility/common.h \
@@ -280,35 +280,13 @@ main.o: ../../src//main.cpp ../../src/utility/common.h \
  ../../../bullet_svn/src/BulletDynamics/Vehicle/btVehicleRaycaster.h \
  ../../../bullet_svn/src/BulletDynamics/Vehicle/btWheelInfo.h \
  ../../../bullet_svn/src/BulletDynamics/Dynamics/btActionInterface.h \
- ../../../bullet_svn/src/BulletDynamics/Dynamics/btRigidBody.h
+ ../../../bullet_svn/src/BulletDynamics/Dynamics/btRigidBody.h \
+ ../../src/renderer/BulletDebuger.h \
+ ../../../bullet_svn/src/LinearMath/btIDebugDraw.h
 	@echo Compiling ../../src//main.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src//main.cpp -o main.o
 
-r_ms.o: ../../src/renderer//r_ms.cpp ../../src/renderer//renderer.h \
- ../../src/utility/common.h ../../src/uncategorized/memory.h \
- ../../src/math/gmath.h ../../src/math/vec2.h \
- ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
- ../../src/math/m_dflt_header.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/m_misc.h \
- ../../src/math/m_misc.inl.h ../../src/resources/shader_prog.h \
- ../../src/resources/resource.h ../../src/uncategorized/engine_class.h \
- ../../src/utility/util.h ../../src/utility/common.h \
- ../../src/scene/camera.h ../../src/uncategorized/collision.h \
- ../../src/scene/node.h ../../src/scene/scene.h \
- ../../src/uncategorized/skybox.h ../../src/resources/texture.h \
- ../../src/resources/mesh.h ../../src/renderer/vbo.h \
- ../../src/renderer//r_private.h ../../src/renderer//fbo.h \
- ../../src/resources/material.h ../../src/scene/mesh_node.h
-	@echo Compiling ../../src/renderer//r_ms.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_ms.cpp -o r_ms.o
-
-r_pps_hdr.o: ../../src/renderer//r_pps_hdr.cpp \
+renderer.o: ../../src/renderer//renderer.cpp \
  ../../src/renderer//renderer.h ../../src/utility/common.h \
  ../../src/uncategorized/memory.h ../../src/math/gmath.h \
  ../../src/math/vec2.h ../../src/math/forward_decls.h \
@@ -324,34 +302,11 @@ r_pps_hdr.o: ../../src/renderer//r_pps_hdr.cpp \
  ../../src/resources/resource.h ../../src/uncategorized/engine_class.h \
  ../../src/utility/util.h ../../src/utility/common.h \
  ../../src/scene/camera.h ../../src/uncategorized/collision.h \
- ../../src/scene/node.h ../../src/resources/resource.h \
- ../../src/resources/texture.h ../../src/scene/scene.h \
- ../../src/uncategorized/skybox.h ../../src/renderer//r_private.h \
- ../../src/renderer//fbo.h
-	@echo Compiling ../../src/renderer//r_pps_hdr.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_pps_hdr.cpp -o r_pps_hdr.o
-
-r_pps.o: ../../src/renderer//r_pps.cpp ../../src/renderer//renderer.h \
- ../../src/utility/common.h ../../src/uncategorized/memory.h \
- ../../src/math/gmath.h ../../src/math/vec2.h \
- ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
- ../../src/math/m_dflt_header.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/m_misc.h \
- ../../src/math/m_misc.inl.h ../../src/resources/shader_prog.h \
- ../../src/resources/resource.h ../../src/uncategorized/engine_class.h \
- ../../src/utility/util.h ../../src/utility/common.h \
- ../../src/scene/camera.h ../../src/uncategorized/collision.h \
- ../../src/scene/node.h ../../src/resources/resource.h \
- ../../src/resources/texture.h ../../src/renderer//r_private.h \
- ../../src/renderer//fbo.h
-	@echo Compiling ../../src/renderer//r_pps.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_pps.cpp -o r_pps.o
+ ../../src/scene/node.h ../../src/resources/texture.h \
+ ../../src/scene/scene.h ../../src/uncategorized/skybox.h \
+ ../../src/renderer//r_private.h ../../src/utility/app.h
+	@echo Compiling ../../src/renderer//renderer.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//renderer.cpp -o renderer.o
 
 r_is_shadows.o: ../../src/renderer//r_is_shadows.cpp \
  ../../src/renderer//renderer.h ../../src/utility/common.h \
@@ -377,7 +332,7 @@ r_is_shadows.o: ../../src/renderer//r_is_shadows.cpp \
 	@echo Compiling ../../src/renderer//r_is_shadows.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_is_shadows.cpp -o r_is_shadows.o
 
-r_bs.o: ../../src/renderer//r_bs.cpp ../../src/renderer//renderer.h \
+r_is.o: ../../src/renderer//r_is.cpp ../../src/renderer//renderer.h \
  ../../src/utility/common.h ../../src/uncategorized/memory.h \
  ../../src/math/gmath.h ../../src/math/vec2.h \
  ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
@@ -396,11 +351,11 @@ r_bs.o: ../../src/renderer//r_bs.cpp ../../src/renderer//renderer.h \
  ../../src/scene/node.h ../../src/scene/scene.h \
  ../../src/uncategorized/skybox.h ../../src/resources/texture.h \
  ../../src/resources/mesh.h ../../src/renderer/vbo.h \
- ../../src/renderer//r_private.h ../../src/resources/resource.h \
- ../../src/renderer//fbo.h ../../src/scene/mesh_node.h \
- ../../src/resources/material.h
-	@echo Compiling ../../src/renderer//r_bs.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_bs.cpp -o r_bs.o
+ ../../src/scene/light.h ../../src/scene/camera.h \
+ ../../src/resources/resource.h ../../src/renderer//r_private.h \
+ ../../src/renderer//fbo.h ../../src/resources/light_props.h
+	@echo Compiling ../../src/renderer//r_is.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_is.cpp -o r_is.o
 
 r_ms_earlyz.o: ../../src/renderer//r_ms_earlyz.cpp \
  ../../src/renderer//renderer.h ../../src/utility/common.h \
@@ -425,9 +380,18 @@ r_ms_earlyz.o: ../../src/renderer//r_ms_earlyz.cpp \
 	@echo Compiling ../../src/renderer//r_ms_earlyz.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_ms_earlyz.cpp -o r_ms_earlyz.o
 
-renderer.o: ../../src/renderer//renderer.cpp \
- ../../src/renderer//renderer.h ../../src/utility/common.h \
- ../../src/uncategorized/memory.h ../../src/math/gmath.h \
+BulletDebuger.o: ../../src/renderer//BulletDebuger.cpp \
+ ../../src/renderer//BulletDebuger.h ../../src/utility/common.h \
+ ../../src/uncategorized/memory.h \
+ ../../../bullet_svn/src/LinearMath/btIDebugDraw.h \
+ ../../../bullet_svn/src/LinearMath/btVector3.h \
+ ../../../bullet_svn/src/LinearMath/btScalar.h \
+ ../../../bullet_svn/src/LinearMath/btMinMax.h \
+ ../../../bullet_svn/src/LinearMath/btTransform.h \
+ ../../../bullet_svn/src/LinearMath/btMatrix3x3.h \
+ ../../../bullet_svn/src/LinearMath/btQuaternion.h \
+ ../../../bullet_svn/src/LinearMath/btQuadWord.h \
+ ../../src/renderer//renderer.h ../../src/math/gmath.h \
  ../../src/math/vec2.h ../../src/math/forward_decls.h \
  ../../src/math/vec2.inl.h ../../src/math/m_dflt_header.h \
  ../../src/math/vec3.h ../../src/math/vec3.inl.h ../../src/math/vec4.h \
@@ -441,18 +405,16 @@ renderer.o: ../../src/renderer//renderer.cpp \
  ../../src/resources/resource.h ../../src/uncategorized/engine_class.h \
  ../../src/utility/util.h ../../src/utility/common.h \
  ../../src/scene/camera.h ../../src/uncategorized/collision.h \
- ../../src/scene/node.h ../../src/resources/texture.h \
- ../../src/scene/scene.h ../../src/uncategorized/skybox.h \
- ../../src/renderer//r_private.h ../../src/utility/app.h
-	@echo Compiling ../../src/renderer//renderer.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//renderer.cpp -o renderer.o
+ ../../src/scene/node.h
+	@echo Compiling ../../src/renderer//BulletDebuger.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//BulletDebuger.cpp -o BulletDebuger.o
 
-r_pps_ssao.o: ../../src/renderer//r_pps_ssao.cpp \
- ../../src/renderer//renderer.h ../../src/utility/common.h \
- ../../src/uncategorized/memory.h ../../src/math/gmath.h \
- ../../src/math/vec2.h ../../src/math/forward_decls.h \
- ../../src/math/vec2.inl.h ../../src/math/m_dflt_header.h \
- ../../src/math/vec3.h ../../src/math/vec3.inl.h ../../src/math/vec4.h \
+r_pps.o: ../../src/renderer//r_pps.cpp ../../src/renderer//renderer.h \
+ ../../src/utility/common.h ../../src/uncategorized/memory.h \
+ ../../src/math/gmath.h ../../src/math/vec2.h \
+ ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
+ ../../src/math/m_dflt_header.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 \
@@ -464,13 +426,12 @@ r_pps_ssao.o: ../../src/renderer//r_pps_ssao.cpp \
  ../../src/utility/util.h ../../src/utility/common.h \
  ../../src/scene/camera.h ../../src/uncategorized/collision.h \
  ../../src/scene/node.h ../../src/resources/resource.h \
- ../../src/resources/texture.h ../../src/scene/scene.h \
- ../../src/uncategorized/skybox.h ../../src/renderer//r_private.h \
+ ../../src/resources/texture.h ../../src/renderer//r_private.h \
  ../../src/renderer//fbo.h
-	@echo Compiling ../../src/renderer//r_pps_ssao.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_pps_ssao.cpp -o r_pps_ssao.o
+	@echo Compiling ../../src/renderer//r_pps.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_pps.cpp -o r_pps.o
 
-r_is.o: ../../src/renderer//r_is.cpp ../../src/renderer//renderer.h \
+r_bs.o: ../../src/renderer//r_bs.cpp ../../src/renderer//renderer.h \
  ../../src/utility/common.h ../../src/uncategorized/memory.h \
  ../../src/math/gmath.h ../../src/math/vec2.h \
  ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
@@ -489,11 +450,11 @@ r_is.o: ../../src/renderer//r_is.cpp ../../src/renderer//renderer.h \
  ../../src/scene/node.h ../../src/scene/scene.h \
  ../../src/uncategorized/skybox.h ../../src/resources/texture.h \
  ../../src/resources/mesh.h ../../src/renderer/vbo.h \
- ../../src/scene/light.h ../../src/scene/camera.h \
- ../../src/resources/resource.h ../../src/renderer//r_private.h \
- ../../src/renderer//fbo.h ../../src/resources/light_props.h
-	@echo Compiling ../../src/renderer//r_is.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_is.cpp -o r_is.o
+ ../../src/renderer//r_private.h ../../src/resources/resource.h \
+ ../../src/renderer//fbo.h ../../src/scene/mesh_node.h \
+ ../../src/resources/material.h
+	@echo Compiling ../../src/renderer//r_bs.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_bs.cpp -o r_bs.o
 
 r_dbg.o: ../../src/renderer//r_dbg.cpp ../../src/renderer//renderer.h \
  ../../src/utility/common.h ../../src/uncategorized/memory.h \
@@ -519,6 +480,30 @@ r_dbg.o: ../../src/renderer//r_dbg.cpp ../../src/renderer//renderer.h \
 	@echo Compiling ../../src/renderer//r_dbg.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_dbg.cpp -o r_dbg.o
 
+r_ms.o: ../../src/renderer//r_ms.cpp ../../src/renderer//renderer.h \
+ ../../src/utility/common.h ../../src/uncategorized/memory.h \
+ ../../src/math/gmath.h ../../src/math/vec2.h \
+ ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
+ ../../src/math/m_dflt_header.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/m_misc.h \
+ ../../src/math/m_misc.inl.h ../../src/resources/shader_prog.h \
+ ../../src/resources/resource.h ../../src/uncategorized/engine_class.h \
+ ../../src/utility/util.h ../../src/utility/common.h \
+ ../../src/scene/camera.h ../../src/uncategorized/collision.h \
+ ../../src/scene/node.h ../../src/scene/scene.h \
+ ../../src/uncategorized/skybox.h ../../src/resources/texture.h \
+ ../../src/resources/mesh.h ../../src/renderer/vbo.h \
+ ../../src/renderer//r_private.h ../../src/renderer//fbo.h \
+ ../../src/resources/material.h ../../src/scene/mesh_node.h
+	@echo Compiling ../../src/renderer//r_ms.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_ms.cpp -o r_ms.o
+
 r_pps_lscatt.o: ../../src/renderer//r_pps_lscatt.cpp \
  ../../src/renderer//renderer.h ../../src/utility/common.h \
  ../../src/uncategorized/memory.h ../../src/math/gmath.h \
@@ -542,6 +527,29 @@ r_pps_lscatt.o: ../../src/renderer//r_pps_lscatt.cpp \
 	@echo Compiling ../../src/renderer//r_pps_lscatt.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_pps_lscatt.cpp -o r_pps_lscatt.o
 
+r_pps_hdr.o: ../../src/renderer//r_pps_hdr.cpp \
+ ../../src/renderer//renderer.h ../../src/utility/common.h \
+ ../../src/uncategorized/memory.h ../../src/math/gmath.h \
+ ../../src/math/vec2.h ../../src/math/forward_decls.h \
+ ../../src/math/vec2.inl.h ../../src/math/m_dflt_header.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/m_misc.h \
+ ../../src/math/m_misc.inl.h ../../src/resources/shader_prog.h \
+ ../../src/resources/resource.h ../../src/uncategorized/engine_class.h \
+ ../../src/utility/util.h ../../src/utility/common.h \
+ ../../src/scene/camera.h ../../src/uncategorized/collision.h \
+ ../../src/scene/node.h ../../src/resources/resource.h \
+ ../../src/resources/texture.h ../../src/scene/scene.h \
+ ../../src/uncategorized/skybox.h ../../src/renderer//r_private.h \
+ ../../src/renderer//fbo.h
+	@echo Compiling ../../src/renderer//r_pps_hdr.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_pps_hdr.cpp -o r_pps_hdr.o
+
 r_bs2.o: ../../src/renderer//r_bs2.cpp ../../src/renderer//renderer.h \
  ../../src/utility/common.h ../../src/uncategorized/memory.h \
  ../../src/math/gmath.h ../../src/math/vec2.h \
@@ -567,31 +575,28 @@ r_bs2.o: ../../src/renderer//r_bs2.cpp ../../src/renderer//renderer.h \
 	@echo Compiling ../../src/renderer//r_bs2.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_bs2.cpp -o r_bs2.o
 
-mesh_node.o: ../../src/scene//mesh_node.cpp ../../src/scene//mesh_node.h \
- ../../src/utility/common.h ../../src/uncategorized/memory.h \
- ../../src/scene//node.h ../../src/math/gmath.h ../../src/math/vec2.h \
- ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
- ../../src/math/m_dflt_header.h ../../src/math/vec3.h \
- ../../src/math/vec3.inl.h ../../src/math/vec4.h \
+r_pps_ssao.o: ../../src/renderer//r_pps_ssao.cpp \
+ ../../src/renderer//renderer.h ../../src/utility/common.h \
+ ../../src/uncategorized/memory.h ../../src/math/gmath.h \
+ ../../src/math/vec2.h ../../src/math/forward_decls.h \
+ ../../src/math/vec2.inl.h ../../src/math/m_dflt_header.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/m_misc.h \
- ../../src/math/m_misc.inl.h ../../src/resources/material.h \
+ ../../src/math/m_misc.inl.h ../../src/resources/shader_prog.h \
  ../../src/resources/resource.h ../../src/uncategorized/engine_class.h \
  ../../src/utility/util.h ../../src/utility/common.h \
- ../../src/resources/resource.h ../../src/resources/mesh.h \
- ../../src/renderer/vbo.h ../../src/uncategorized/collision.h \
- ../../src/renderer/renderer.h ../../src/resources/shader_prog.h \
- ../../src/scene/camera.h ../../src/scene/node.h \
- ../../src/scene//skel_node.h ../../src/controllers/controller.h \
- ../../src/resources/skeleton.h ../../src/controllers/mesh_skel_ctrl.h \
- ../../src/controllers/controller.h \
- ../../src/controllers/skel_anim_ctrl.h
-	@echo Compiling ../../src/scene//mesh_node.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/scene//mesh_node.cpp -o mesh_node.o
+ ../../src/scene/camera.h ../../src/uncategorized/collision.h \
+ ../../src/scene/node.h ../../src/resources/resource.h \
+ ../../src/resources/texture.h ../../src/scene/scene.h \
+ ../../src/uncategorized/skybox.h ../../src/renderer//r_private.h \
+ ../../src/renderer//fbo.h
+	@echo Compiling ../../src/renderer//r_pps_ssao.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/renderer//r_pps_ssao.cpp -o r_pps_ssao.o
 
 skel_node.o: ../../src/scene//skel_node.cpp ../../src/scene//skel_node.h \
  ../../src/utility/common.h ../../src/uncategorized/memory.h \
@@ -616,28 +621,6 @@ skel_node.o: ../../src/scene//skel_node.cpp ../../src/scene//skel_node.h \
 	@echo Compiling ../../src/scene//skel_node.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/scene//skel_node.cpp -o skel_node.o
 
-light.o: ../../src/scene//light.cpp ../../src/scene//light.h \
- ../../src/utility/common.h ../../src/uncategorized/memory.h \
- ../../src/resources/texture.h ../../src/resources/resource.h \
- ../../src/uncategorized/engine_class.h ../../src/utility/util.h \
- ../../src/utility/common.h ../../src/scene//node.h \
- ../../src/math/gmath.h ../../src/math/vec2.h \
- ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
- ../../src/math/m_dflt_header.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/m_misc.h \
- ../../src/math/m_misc.inl.h ../../src/scene//camera.h \
- ../../src/uncategorized/collision.h ../../src/renderer/renderer.h \
- ../../src/resources/shader_prog.h ../../src/scene/camera.h \
- ../../src/resources/light_props.h
-	@echo Compiling ../../src/scene//light.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/scene//light.cpp -o light.o
-
 skel_model_node.o: ../../src/scene//skel_model_node.cpp \
  ../../src/scene//skel_model_node.h ../../src/utility/common.h \
  ../../src/uncategorized/memory.h ../../src/scene//mesh_node.h \
@@ -661,6 +644,26 @@ skel_model_node.o: ../../src/scene//skel_model_node.cpp \
 	@echo Compiling ../../src/scene//skel_model_node.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/scene//skel_model_node.cpp -o skel_model_node.o
 
+camera.o: ../../src/scene//camera.cpp ../../src/scene//camera.h \
+ ../../src/utility/common.h ../../src/uncategorized/memory.h \
+ ../../src/uncategorized/collision.h ../../src/math/gmath.h \
+ ../../src/math/vec2.h ../../src/math/forward_decls.h \
+ ../../src/math/vec2.inl.h ../../src/math/m_dflt_header.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/m_misc.h \
+ ../../src/math/m_misc.inl.h ../../src/scene//node.h \
+ ../../src/renderer/renderer.h ../../src/resources/shader_prog.h \
+ ../../src/resources/resource.h ../../src/uncategorized/engine_class.h \
+ ../../src/utility/util.h ../../src/utility/common.h \
+ ../../src/scene/camera.h
+	@echo Compiling ../../src/scene//camera.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/scene//camera.cpp -o camera.o
+
 node.o: ../../src/scene//node.cpp ../../src/scene//node.h \
  ../../src/utility/common.h ../../src/uncategorized/memory.h \
  ../../src/math/gmath.h ../../src/math/vec2.h \
@@ -682,25 +685,53 @@ node.o: ../../src/scene//node.cpp ../../src/scene//node.h \
 	@echo Compiling ../../src/scene//node.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/scene//node.cpp -o node.o
 
-camera.o: ../../src/scene//camera.cpp ../../src/scene//camera.h \
+mesh_node.o: ../../src/scene//mesh_node.cpp ../../src/scene//mesh_node.h \
  ../../src/utility/common.h ../../src/uncategorized/memory.h \
- ../../src/uncategorized/collision.h ../../src/math/gmath.h \
- ../../src/math/vec2.h ../../src/math/forward_decls.h \
- ../../src/math/vec2.inl.h ../../src/math/m_dflt_header.h \
- ../../src/math/vec3.h ../../src/math/vec3.inl.h ../../src/math/vec4.h \
+ ../../src/scene//node.h ../../src/math/gmath.h ../../src/math/vec2.h \
+ ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
+ ../../src/math/m_dflt_header.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/m_misc.h \
- ../../src/math/m_misc.inl.h ../../src/scene//node.h \
- ../../src/renderer/renderer.h ../../src/resources/shader_prog.h \
+ ../../src/math/m_misc.inl.h ../../src/resources/material.h \
  ../../src/resources/resource.h ../../src/uncategorized/engine_class.h \
  ../../src/utility/util.h ../../src/utility/common.h \
- ../../src/scene/camera.h
-	@echo Compiling ../../src/scene//camera.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/scene//camera.cpp -o camera.o
+ ../../src/resources/resource.h ../../src/resources/mesh.h \
+ ../../src/renderer/vbo.h ../../src/uncategorized/collision.h \
+ ../../src/renderer/renderer.h ../../src/resources/shader_prog.h \
+ ../../src/scene/camera.h ../../src/scene/node.h \
+ ../../src/scene//skel_node.h ../../src/controllers/controller.h \
+ ../../src/resources/skeleton.h ../../src/controllers/mesh_skel_ctrl.h \
+ ../../src/controllers/controller.h \
+ ../../src/controllers/skel_anim_ctrl.h
+	@echo Compiling ../../src/scene//mesh_node.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/scene//mesh_node.cpp -o mesh_node.o
+
+light.o: ../../src/scene//light.cpp ../../src/scene//light.h \
+ ../../src/utility/common.h ../../src/uncategorized/memory.h \
+ ../../src/resources/texture.h ../../src/resources/resource.h \
+ ../../src/uncategorized/engine_class.h ../../src/utility/util.h \
+ ../../src/utility/common.h ../../src/scene//node.h \
+ ../../src/math/gmath.h ../../src/math/vec2.h \
+ ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
+ ../../src/math/m_dflt_header.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/m_misc.h \
+ ../../src/math/m_misc.inl.h ../../src/scene//camera.h \
+ ../../src/uncategorized/collision.h ../../src/renderer/renderer.h \
+ ../../src/resources/shader_prog.h ../../src/scene/camera.h \
+ ../../src/resources/light_props.h
+	@echo Compiling ../../src/scene//light.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/scene//light.cpp -o light.o
 
 scene.o: ../../src/scene//scene.cpp ../../src/scene//scene.h \
  ../../src/utility/common.h ../../src/uncategorized/memory.h \
@@ -746,6 +777,36 @@ ui.o: ../../src/ui//ui.cpp ../../src/ui//ui.h ../../src/utility/common.h \
 	@echo Compiling ../../src/ui//ui.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/ui//ui.cpp -o ui.o
 
+extension.o: ../../src/resources//extension.cpp \
+ ../../src/resources//extension.h ../../src/utility/common.h \
+ ../../src/uncategorized/memory.h ../../src/resources//resource.h \
+ ../../src/uncategorized/engine_class.h ../../src/utility/util.h \
+ ../../src/utility/common.h
+	@echo Compiling ../../src/resources//extension.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//extension.cpp -o extension.o
+
+shader_prog.o: ../../src/resources//shader_prog.cpp \
+ ../../src/resources//shader_prog.h ../../src/utility/common.h \
+ ../../src/uncategorized/memory.h ../../src/resources//resource.h \
+ ../../src/uncategorized/engine_class.h ../../src/utility/util.h \
+ ../../src/utility/common.h ../../src/renderer/renderer.h \
+ ../../src/math/gmath.h ../../src/math/vec2.h \
+ ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
+ ../../src/math/m_dflt_header.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/m_misc.h \
+ ../../src/math/m_misc.inl.h ../../src/resources/shader_prog.h \
+ ../../src/scene/camera.h ../../src/uncategorized/collision.h \
+ ../../src/scene/node.h ../../src/resources//ShaderParser.h \
+ ../../src/resources//texture.h
+	@echo Compiling ../../src/resources//shader_prog.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//shader_prog.cpp -o shader_prog.o
+
 material.o: ../../src/resources//material.cpp \
  ../../src/resources//material.h ../../src/utility/common.h \
  ../../src/uncategorized/memory.h ../../src/math/gmath.h \
@@ -769,11 +830,8 @@ material.o: ../../src/resources//material.cpp \
 	@echo Compiling ../../src/resources//material.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//material.cpp -o material.o
 
-texture.o: ../../src/resources//texture.cpp \
- ../../src/resources//texture.h ../../src/utility/common.h \
- ../../src/uncategorized/memory.h ../../src/resources//resource.h \
- ../../src/uncategorized/engine_class.h ../../src/utility/util.h \
- ../../src/utility/common.h ../../src/renderer/renderer.h \
+mesh.o: ../../src/resources//mesh.cpp ../../src/resources//mesh.h \
+ ../../src/utility/common.h ../../src/uncategorized/memory.h \
  ../../src/math/gmath.h ../../src/math/vec2.h \
  ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
  ../../src/math/m_dflt_header.h ../../src/math/vec3.h \
@@ -784,11 +842,16 @@ texture.o: ../../src/resources//texture.cpp \
  ../../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/m_misc.h \
- ../../src/math/m_misc.inl.h ../../src/resources/shader_prog.h \
- ../../src/resources/resource.h ../../src/scene/camera.h \
- ../../src/uncategorized/collision.h ../../src/scene/node.h
-	@echo Compiling ../../src/resources//texture.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//texture.cpp -o texture.o
+ ../../src/math/m_misc.inl.h ../../src/renderer/vbo.h \
+ ../../src/resources//resource.h ../../src/uncategorized/engine_class.h \
+ ../../src/utility/util.h ../../src/utility/common.h \
+ ../../src/uncategorized/collision.h ../../src/renderer/renderer.h \
+ ../../src/resources/shader_prog.h ../../src/resources/resource.h \
+ ../../src/scene/camera.h ../../src/scene/node.h \
+ ../../src/tokenizer/Scanner.h ../../src/tokenizer/parser.h \
+ ../../src/tokenizer/Scanner.h
+	@echo Compiling ../../src/resources//mesh.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//mesh.cpp -o mesh.o
 
 skel_anim.o: ../../src/resources//skel_anim.cpp \
  ../../src/resources//skel_anim.h ../../src/utility/common.h \
@@ -809,32 +872,34 @@ skel_anim.o: ../../src/resources//skel_anim.cpp \
 	@echo Compiling ../../src/resources//skel_anim.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//skel_anim.cpp -o skel_anim.o
 
-extension.o: ../../src/resources//extension.cpp \
- ../../src/resources//extension.h ../../src/utility/common.h \
+ShaderParser.o: ../../src/resources//ShaderParser.cpp \
+ ../../src/resources//ShaderParser.h ../../src/utility/common.h \
+ ../../src/uncategorized/memory.h ../../src/tokenizer/Scanner.h \
+ ../../src/tokenizer/parser.h ../../src/tokenizer/Scanner.h \
+ ../../src/utility/util.h ../../src/utility/common.h
+	@echo Compiling ../../src/resources//ShaderParser.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//ShaderParser.cpp -o ShaderParser.o
+
+texture.o: ../../src/resources//texture.cpp \
+ ../../src/resources//texture.h ../../src/utility/common.h \
  ../../src/uncategorized/memory.h ../../src/resources//resource.h \
  ../../src/uncategorized/engine_class.h ../../src/utility/util.h \
- ../../src/utility/common.h
-	@echo Compiling ../../src/resources//extension.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//extension.cpp -o extension.o
-
-skeleton.o: ../../src/resources//skeleton.cpp \
- ../../src/resources//skeleton.h ../../src/utility/common.h \
- ../../src/uncategorized/memory.h ../../src/math/gmath.h \
- ../../src/math/vec2.h ../../src/math/forward_decls.h \
- ../../src/math/vec2.inl.h ../../src/math/m_dflt_header.h \
- ../../src/math/vec3.h ../../src/math/vec3.inl.h ../../src/math/vec4.h \
+ ../../src/utility/common.h ../../src/renderer/renderer.h \
+ ../../src/math/gmath.h ../../src/math/vec2.h \
+ ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
+ ../../src/math/m_dflt_header.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/m_misc.h \
- ../../src/math/m_misc.inl.h ../../src/resources//resource.h \
- ../../src/uncategorized/engine_class.h ../../src/utility/util.h \
- ../../src/utility/common.h ../../src/tokenizer/Scanner.h \
- ../../src/tokenizer/parser.h ../../src/tokenizer/Scanner.h
-	@echo Compiling ../../src/resources//skeleton.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//skeleton.cpp -o skeleton.o
+ ../../src/math/m_misc.inl.h ../../src/resources/shader_prog.h \
+ ../../src/resources/resource.h ../../src/scene/camera.h \
+ ../../src/uncategorized/collision.h ../../src/scene/node.h
+	@echo Compiling ../../src/resources//texture.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//texture.cpp -o texture.o
 
 resource.o: ../../src/resources//resource.cpp \
  ../../src/resources//resource.h ../../src/utility/common.h \
@@ -858,13 +923,24 @@ resource.o: ../../src/resources//resource.cpp \
 	@echo Compiling ../../src/resources//resource.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//resource.cpp -o resource.o
 
-ShaderParser.o: ../../src/resources//ShaderParser.cpp \
- ../../src/resources//ShaderParser.h ../../src/utility/common.h \
- ../../src/uncategorized/memory.h ../../src/tokenizer/Scanner.h \
- ../../src/tokenizer/parser.h ../../src/tokenizer/Scanner.h \
- ../../src/utility/util.h ../../src/utility/common.h
-	@echo Compiling ../../src/resources//ShaderParser.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//ShaderParser.cpp -o ShaderParser.o
+skeleton.o: ../../src/resources//skeleton.cpp \
+ ../../src/resources//skeleton.h ../../src/utility/common.h \
+ ../../src/uncategorized/memory.h ../../src/math/gmath.h \
+ ../../src/math/vec2.h ../../src/math/forward_decls.h \
+ ../../src/math/vec2.inl.h ../../src/math/m_dflt_header.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/m_misc.h \
+ ../../src/math/m_misc.inl.h ../../src/resources//resource.h \
+ ../../src/uncategorized/engine_class.h ../../src/utility/util.h \
+ ../../src/utility/common.h ../../src/tokenizer/Scanner.h \
+ ../../src/tokenizer/parser.h ../../src/tokenizer/Scanner.h
+	@echo Compiling ../../src/resources//skeleton.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//skeleton.cpp -o skeleton.o
 
 light_props.o: ../../src/resources//light_props.cpp \
  ../../src/resources//light_props.h ../../src/utility/common.h \
@@ -885,51 +961,6 @@ light_props.o: ../../src/resources//light_props.cpp \
 	@echo Compiling ../../src/resources//light_props.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//light_props.cpp -o light_props.o
 
-mesh.o: ../../src/resources//mesh.cpp ../../src/resources//mesh.h \
- ../../src/utility/common.h ../../src/uncategorized/memory.h \
- ../../src/math/gmath.h ../../src/math/vec2.h \
- ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
- ../../src/math/m_dflt_header.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/m_misc.h \
- ../../src/math/m_misc.inl.h ../../src/renderer/vbo.h \
- ../../src/resources//resource.h ../../src/uncategorized/engine_class.h \
- ../../src/utility/util.h ../../src/utility/common.h \
- ../../src/uncategorized/collision.h ../../src/renderer/renderer.h \
- ../../src/resources/shader_prog.h ../../src/resources/resource.h \
- ../../src/scene/camera.h ../../src/scene/node.h \
- ../../src/tokenizer/Scanner.h ../../src/tokenizer/parser.h \
- ../../src/tokenizer/Scanner.h
-	@echo Compiling ../../src/resources//mesh.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//mesh.cpp -o mesh.o
-
-shader_prog.o: ../../src/resources//shader_prog.cpp \
- ../../src/resources//shader_prog.h ../../src/utility/common.h \
- ../../src/uncategorized/memory.h ../../src/resources//resource.h \
- ../../src/uncategorized/engine_class.h ../../src/utility/util.h \
- ../../src/utility/common.h ../../src/renderer/renderer.h \
- ../../src/math/gmath.h ../../src/math/vec2.h \
- ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
- ../../src/math/m_dflt_header.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/m_misc.h \
- ../../src/math/m_misc.inl.h ../../src/resources/shader_prog.h \
- ../../src/scene/camera.h ../../src/uncategorized/collision.h \
- ../../src/scene/node.h ../../src/resources//ShaderParser.h \
- ../../src/resources//texture.h
-	@echo Compiling ../../src/resources//shader_prog.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/resources//shader_prog.cpp -o shader_prog.o
-
 app.o: ../../src/utility//app.cpp ../../src/utility//app.h \
  ../../src/utility//common.h ../../src/uncategorized/memory.h \
  ../../src/utility/common.h
@@ -947,26 +978,6 @@ util.o: ../../src/utility//util.cpp ../../src/utility//util.h \
 	@echo Compiling ../../src/utility//util.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/utility//util.cpp -o util.o
 
-controller.o: ../../src/controllers//controller.cpp \
- ../../src/controllers//controller.h ../../src/utility/common.h \
- ../../src/uncategorized/memory.h ../../src/scene/scene.h \
- ../../src/uncategorized/skybox.h ../../src/resources/texture.h \
- ../../src/resources/resource.h ../../src/uncategorized/engine_class.h \
- ../../src/utility/util.h ../../src/utility/common.h \
- ../../src/math/gmath.h ../../src/math/vec2.h \
- ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
- ../../src/math/m_dflt_header.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/m_misc.h \
- ../../src/math/m_misc.inl.h
-	@echo Compiling ../../src/controllers//controller.cpp...
-	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/controllers//controller.cpp -o controller.o
-
 skel_anim_ctrl.o: ../../src/controllers//skel_anim_ctrl.cpp \
  ../../src/controllers//skel_anim_ctrl.h ../../src/utility/common.h \
  ../../src/uncategorized/memory.h ../../src/controllers//controller.h \
@@ -990,6 +1001,26 @@ skel_anim_ctrl.o: ../../src/controllers//skel_anim_ctrl.cpp \
 	@echo Compiling ../../src/controllers//skel_anim_ctrl.cpp...
 	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/controllers//skel_anim_ctrl.cpp -o skel_anim_ctrl.o
 
+controller.o: ../../src/controllers//controller.cpp \
+ ../../src/controllers//controller.h ../../src/utility/common.h \
+ ../../src/uncategorized/memory.h ../../src/scene/scene.h \
+ ../../src/uncategorized/skybox.h ../../src/resources/texture.h \
+ ../../src/resources/resource.h ../../src/uncategorized/engine_class.h \
+ ../../src/utility/util.h ../../src/utility/common.h \
+ ../../src/math/gmath.h ../../src/math/vec2.h \
+ ../../src/math/forward_decls.h ../../src/math/vec2.inl.h \
+ ../../src/math/m_dflt_header.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/m_misc.h \
+ ../../src/math/m_misc.inl.h
+	@echo Compiling ../../src/controllers//controller.cpp...
+	@$(CXX) $(INCPATH) $(CFLAGS) ../../src/controllers//controller.cpp -o controller.o
+
 clean:
 	rm -f *.o
 	rm -f *.gch

+ 2 - 1
build/debug/gen.cfg.py

@@ -9,4 +9,5 @@ compiler = "g++"
 common_flags = ""
 compiler_flags = "-c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -pipe -O0 -g3 -pg `sdl-config --cflags` -D_DEBUG_ -D_TERMINAL_COLORING__ -D_PLATFORM_LINUX_"
 precompiled_headers_flags = "-x c++-header"
-linker_flags = "-rdynamic -L../../../bullet_svn/src/BulletSoftBody -L../../../bullet_svn/src/BulletDynamics -L../../../bullet_svn/src/BulletCollision -L../../../bullet_svn/src/LinearMath -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lSDL_image -lGLU -Wl,-Bdynamic -lSDL -lpthread -lGL -ljpeg -lpng -ltiff -lesd -lcaca -laa -ldirectfb -laudio -lpulse-simple" # a few libs are now static
+#linker_flags = "-rdynamic -L../../../bullet_svn/src/BulletSoftBody -L../../../bullet_svn/src/BulletDynamics -L../../../bullet_svn/src/BulletCollision -L../../../bullet_svn/src/LinearMath -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lSDL_image -lGLU -Wl,-Bdynamic -lSDL -lpthread -lGL -ljpeg -lpng -ltiff -lesd -lcaca -laa -ldirectfb -laudio -lpulse-simple" # a few libs are now static
+linker_flags = "-rdynamic -L../../../bullet_svn/src/BulletSoftBody -L../../../bullet_svn/src/BulletDynamics -L../../../bullet_svn/src/BulletCollision -L../../../bullet_svn/src/LinearMath -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lSDL_image -lGLU -Wl,-Bdynamic -lSDL -lGL -ljpeg -lpng -ltiff" # a few libs are now static

+ 106 - 0
src/main.cpp

@@ -31,6 +31,7 @@
 #include "light_props.h"
 #include "btBulletCollisionCommon.h"
 #include "btBulletDynamicsCommon.h"
+#include "BulletDebuger.h"
 
 
 // map (hard coded)
@@ -57,11 +58,112 @@ class floor_t: public camera_t
 
 // Physics
 btDefaultCollisionConfiguration* collisionConfiguration;
+btCollisionDispatcher* dispatcher;
+btDbvtBroadphase* broadphase;
+btSequentialImpulseConstraintSolver* sol;
+btDiscreteDynamicsWorld* dynamicsWorld;
+BulletDebuger debugDrawer;
+
+#define ARRAY_SIZE_X 5
+#define ARRAY_SIZE_Y 5
+#define ARRAY_SIZE_Z 5
+
+#define MAX_PROXIES (ARRAY_SIZE_X*ARRAY_SIZE_Y*ARRAY_SIZE_Z + 1024)
+
+#define SCALING 1.
+#define START_POS_X -5
+#define START_POS_Y -5
+#define START_POS_Z -3
 
 
 void initPhysics()
 {
 	collisionConfiguration = new btDefaultCollisionConfiguration();
+	dispatcher = new	btCollisionDispatcher(collisionConfiguration);
+	broadphase = new btDbvtBroadphase();
+	sol = new btSequentialImpulseConstraintSolver;
+	dynamicsWorld = new btDiscreteDynamicsWorld( dispatcher, broadphase, sol, collisionConfiguration );
+
+	dynamicsWorld->setGravity(btVector3(0,-10,0));
+
+	btCollisionShape* groundShape = new btBoxShape(btVector3(btScalar(50.),btScalar(50.),btScalar(50.)));
+
+	btTransform groundTransform;
+	groundTransform.setIdentity();
+	groundTransform.setOrigin(btVector3(0,-50,0));
+
+	//We can also use DemoApplication::localCreateRigidBody, but for clarity it is provided here:
+	{
+		btScalar mass(0.);
+
+		//rigidbody is dynamic if and only if mass is non zero, otherwise static
+		bool isDynamic = (mass != 0.f);
+
+		btVector3 localInertia(0,0,0);
+		if (isDynamic)
+			groundShape->calculateLocalInertia(mass,localInertia);
+
+		//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
+		btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
+		btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,groundShape,localInertia);
+		btRigidBody* body = new btRigidBody(rbInfo);
+
+		//add the body to the dynamics world
+		dynamicsWorld->addRigidBody(body);
+	}
+
+
+	{
+		//create a few dynamic rigidbodies
+		// Re-using the same collision is better for memory usage and performance
+
+		btCollisionShape* colShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));
+		//btCollisionShape* colShape = new btSphereShape(btScalar(1.));
+
+		/// Create Dynamic Objects
+		btTransform startTransform;
+		startTransform.setIdentity();
+
+		btScalar	mass(1.f);
+
+		//rigidbody is dynamic if and only if mass is non zero, otherwise static
+		bool isDynamic = (mass != 0.f);
+
+		btVector3 localInertia(0,0,0);
+		if (isDynamic)
+			colShape->calculateLocalInertia(mass,localInertia);
+
+		float start_x = START_POS_X - ARRAY_SIZE_X/2;
+		float start_y = START_POS_Y;
+		float start_z = START_POS_Z - ARRAY_SIZE_Z/2;
+
+		for (int k=0;k<ARRAY_SIZE_Y;k++)
+		{
+			for (int i=0;i<ARRAY_SIZE_X;i++)
+			{
+				for(int j = 0;j<ARRAY_SIZE_Z;j++)
+				{
+					startTransform.setOrigin(SCALING*btVector3(
+										btScalar(2.0*i + start_x),
+										btScalar(20+2.0*k + start_y),
+										btScalar(2.0*j + start_z)));
+
+
+					//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
+					btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
+					btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,colShape,localInertia);
+					btRigidBody* body = new btRigidBody(rbInfo);
+
+					body->setActivationState(ISLAND_SLEEPING);
+
+					dynamicsWorld->addRigidBody(body);
+					body->setActivationState(ISLAND_SLEEPING);
+				}
+			}
+		}
+	}
+
+	dynamicsWorld->setDebugDrawer(&debugDrawer);
 }
 
 
@@ -72,6 +174,8 @@ void Init()
 {
 	PRINT( "Engine initializing..." );
 
+	initPhysics();
+
 	srand( unsigned(time(NULL)) );
 	MathSanityChecks();
 
@@ -202,6 +306,8 @@ int main( int /*argc*/, char* /*argv*/[] )
 		scene::UpdateAllControllers();
 		scene::UpdateAllWorldStuff();
 
+		dynamicsWorld->stepSimulation( 1 );
+
 		r::Render( *main_cam );
 
 		//map.octree.root->bounding_box.Render();

+ 132 - 0
src/renderer/BulletDebuger.cpp

@@ -0,0 +1,132 @@
+#include "BulletDebuger.h"
+#include "renderer.h"
+
+BulletDebuger::BulletDebuger() :
+	m_debugMode( 0 )
+{
+}
+
+void BulletDebuger::drawLine( const btVector3& from, const btVector3& to, const btVector3& fromColor, const btVector3& toColor )
+{
+	glBegin( GL_LINES);
+	glColor3f( fromColor.getX(), fromColor.getY(), fromColor.getZ() );
+	glVertex3d( from.getX(), from.getY(), from.getZ() );
+	glColor3f( toColor.getX(), toColor.getY(), toColor.getZ() );
+	glVertex3d( to.getX(), to.getY(), to.getZ() );
+	glEnd();
+}
+
+void BulletDebuger::drawLine( const btVector3& from, const btVector3& to, const btVector3& color )
+{
+	drawLine( from, to, color, color );
+}
+
+void BulletDebuger::drawSphere( const btVector3& p, btScalar radius, const btVector3& color )
+{
+	glColor4f( color.getX(), color.getY(), color.getZ(), btScalar( 1.0f ) );
+	glPushMatrix();
+	glTranslatef( p.getX(), p.getY(), p.getZ() );
+
+	int lats = 5;
+	int longs = 5;
+
+	int i, j;
+	for( i = 0; i <= lats; i++ )
+	{
+		btScalar lat0 = SIMD_PI * ( -btScalar( 0.5 ) + ( btScalar )( i - 1 ) / lats );
+		btScalar z0 = radius * sin( lat0 );
+		btScalar zr0 = radius * cos( lat0 );
+
+		btScalar lat1 = SIMD_PI * ( -btScalar( 0.5 ) + (btScalar)i / lats );
+		btScalar z1 = radius * sin( lat1 );
+		btScalar zr1 = radius * cos( lat1 );
+
+		glBegin( GL_QUAD_STRIP);
+		for( j = 0; j <= longs; j++ )
+		{
+			btScalar lng = 2 * SIMD_PI * ( btScalar )( j - 1 ) / longs;
+			btScalar x = cos( lng );
+			btScalar y = sin( lng );
+
+			glNormal3f( x * zr0, y * zr0, z0 );
+			glVertex3f( x * zr0, y * zr0, z0 );
+			glNormal3f( x * zr1, y * zr1, z1 );
+			glVertex3f( x * zr1, y * zr1, z1 );
+		}
+		glEnd();
+	}
+
+	glPopMatrix();
+}
+
+void BulletDebuger::drawBox( const btVector3& boxMin, const btVector3& boxMax, const btVector3& color, btScalar alpha )
+{
+	btVector3 halfExtent = ( boxMax - boxMin ) * btScalar( 0.5f );
+	btVector3 center = ( boxMax + boxMin ) * btScalar( 0.5f );
+	//glEnable(GL_BLEND);     // Turn blending On
+	//glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+	glColor4f( color.getX(), color.getY(), color.getZ(), alpha );
+	glPushMatrix();
+	glTranslatef( center.getX(), center.getY(), center.getZ() );
+	glScaled( 2 * halfExtent[0], 2 * halfExtent[1], 2 * halfExtent[2] );
+	//	glutSolidCube(1.0);
+	glPopMatrix();
+	//glDisable(GL_BLEND);
+}
+
+void BulletDebuger::drawTriangle( const btVector3& a, const btVector3& b, const btVector3& c, const btVector3& color, btScalar alpha )
+{
+	//	if (m_debugMode > 0)
+	{
+		const btVector3 n = btCross( b - a, c - a ).normalized();
+		glBegin( GL_TRIANGLES);
+		glColor4f( color.getX(), color.getY(), color.getZ(), alpha );
+		glNormal3d( n.getX(), n.getY(), n.getZ() );
+		glVertex3d( a.getX(), a.getY(), a.getZ() );
+		glVertex3d( b.getX(), b.getY(), b.getZ() );
+		glVertex3d( c.getX(), c.getY(), c.getZ() );
+		glEnd();
+	}
+}
+
+void BulletDebuger::setDebugMode( int debugMode )
+{
+	m_debugMode = debugMode;
+
+}
+
+void BulletDebuger::draw3dText( const btVector3& location, const char* textString )
+{
+	glRasterPos3f( location.x(), location.y(), location.z() );
+	//BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),textString);
+}
+
+void BulletDebuger::reportErrorWarning( const char* warningString )
+{
+	printf( "%s\n", warningString );
+}
+
+void BulletDebuger::drawContactPoint( const btVector3& pointOnB, const btVector3& normalOnB, btScalar distance, int lifeTime,
+                                      const btVector3& color )
+{
+
+	{
+		btVector3 to = pointOnB + normalOnB * distance;
+		const btVector3&from = pointOnB;
+		glColor4f( color.getX(), color.getY(), color.getZ(), 1.f );
+		//glColor4f(0,0,0,1.f);
+
+		glBegin( GL_LINES);
+		glVertex3d( from.getX(), from.getY(), from.getZ() );
+		glVertex3d( to.getX(), to.getY(), to.getZ() );
+		glEnd();
+
+		glRasterPos3f( from.x(), from.y(), from.z() );
+		char buf[12];
+		sprintf( buf, " %d", lifeTime );
+		//BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf);
+
+
+	}
+}
+

+ 37 - 0
src/renderer/BulletDebuger.h

@@ -0,0 +1,37 @@
+#ifndef _BULLETDEBUGER_H_
+#define _BULLETDEBUGER_H_
+
+#include "common.h"
+#include <LinearMath/btIDebugDraw.h>
+
+
+
+class BulletDebuger: public btIDebugDraw
+{
+	private:
+		int m_debugMode;
+
+	public:
+		BulletDebuger();
+
+		virtual void	drawLine(const btVector3& from,const btVector3& to,const btVector3& fromColor, const btVector3& toColor);
+		virtual void	drawLine(const btVector3& from,const btVector3& to,const btVector3& color);
+
+		virtual void	drawSphere (const btVector3& p, btScalar radius, const btVector3& color);
+		virtual void	drawBox (const btVector3& boxMin, const btVector3& boxMax, const btVector3& color, btScalar alpha);
+
+		virtual void	drawTriangle(const btVector3& a,const btVector3& b,const btVector3& c,const btVector3& color,btScalar alpha);
+
+		virtual void	drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color);
+
+		virtual void	reportErrorWarning(const char* warningString);
+
+		virtual void	draw3dText(const btVector3& location,const char* textString);
+
+		virtual void	setDebugMode(int debugMode);
+
+		virtual int		getDebugMode() const { return m_debugMode; }
+};
+
+
+#endif

+ 93 - 0
src/renderer/r_dbg.cpp

@@ -8,6 +8,97 @@
 #include "skel_node.h"
 
 
+#include "btBulletCollisionCommon.h"
+#include "btBulletDynamicsCommon.h"
+#include "BulletDebuger.h"
+
+extern btDefaultCollisionConfiguration* collisionConfiguration;
+extern btCollisionDispatcher* dispatcher;
+extern btDbvtBroadphase* broadphase;
+extern btSequentialImpulseConstraintSolver* sol;
+extern btDiscreteDynamicsWorld* dynamicsWorld;
+
+void renderscene( int pass )
+{
+	btScalar m[16];
+	btMatrix3x3 rot;
+	rot.setIdentity();
+	const int numObjects = dynamicsWorld->getNumCollisionObjects();
+	btVector3 wireColor( 1, 0, 0 );
+	for( int i = 0; i < numObjects; i++ )
+	{
+		btCollisionObject* colObj = dynamicsWorld->getCollisionObjectArray()[i];
+		btRigidBody* body = btRigidBody::upcast( colObj );
+		if( body && body->getMotionState() )
+		{
+			btDefaultMotionState* myMotionState = (btDefaultMotionState*)body->getMotionState();
+			myMotionState->m_graphicsWorldTrans.getOpenGLMatrix( m );
+			rot = myMotionState->m_graphicsWorldTrans.getBasis();
+		}
+		else
+		{
+			colObj->getWorldTransform().getOpenGLMatrix( m );
+			rot = colObj->getWorldTransform().getBasis();
+		}
+		btVector3 wireColor( 1.f, 1.0f, 0.5f ); //wants deactivation
+		if( i & 1 ) wireColor = btVector3( 0.f, 0.0f, 1.f );
+		///color differently for active, sleeping, wantsdeactivation states
+		if( colObj->getActivationState() == 1 ) //active
+		{
+			if( i & 1 )
+			{
+				wireColor += btVector3( 1.f, 0.f, 0.f );
+			}
+			else
+			{
+				wireColor += btVector3( .5f, 0.f, 0.f );
+			}
+		}
+		if( colObj->getActivationState() == 2 ) //ISLAND_SLEEPING
+		{
+			if( i & 1 )
+			{
+				wireColor += btVector3( 0.f, 1.f, 0.f );
+			}
+			else
+			{
+				wireColor += btVector3( 0.f, 0.5f, 0.f );
+			}
+		}
+
+		btVector3 aabbMin, aabbMax;
+		dynamicsWorld->getBroadphase()->getBroadphaseAabb( aabbMin, aabbMax );
+
+		aabbMin -= btVector3( BT_LARGE_FLOAT, BT_LARGE_FLOAT, BT_LARGE_FLOAT );
+		aabbMax += btVector3( BT_LARGE_FLOAT, BT_LARGE_FLOAT, BT_LARGE_FLOAT );
+		//		printf("aabbMin=(%f,%f,%f)\n",aabbMin.getX(),aabbMin.getY(),aabbMin.getZ());
+		//		printf("aabbMax=(%f,%f,%f)\n",aabbMax.getX(),aabbMax.getY(),aabbMax.getZ());
+		//		m_dynamicsWorld->getDebugDrawer()->drawAabb(aabbMin,aabbMax,btVector3(1,1,1));
+
+
+		if( 1 )
+		{
+			switch( pass )
+			{
+				case 0:
+					//m_shapeDrawer->drawOpenGL( m, colObj->getCollisionShape(), wireColor, getDebugMode(), aabbMin, aabbMax );
+					break;
+				case 1:
+					//m_shapeDrawer->drawShadow( m, m_sundirection * rot, colObj->getCollisionShape(), aabbMin, aabbMax );
+					break;
+				case 2:
+					//m_shapeDrawer->drawOpenGL( m, colObj->getCollisionShape(), wireColor * btScalar( 0.3 ), 0, aabbMin, aabbMax );
+					break;
+			}
+		}
+	}
+}
+
+
+
+
+
+
 namespace r {
 namespace dbg {
 
@@ -102,6 +193,8 @@ void RunStage( const camera_t& cam )
 	// the sun
 	//RenderSun();
 
+	renderscene(1);
+
 
 	// unbind
 	fbo.Unbind();