Panagiotis Christopoulos Charitos преди 15 години
родител
ревизия
2a504a2194

Файловите разлики са ограничени, защото са твърде много
+ 0 - 1
build/debug/Makefile


Файловите разлики са ограничени, защото са твърде много
+ 1 - 2
build/release/Makefile


+ 1 - 1
build/release/gen.cfg.py

@@ -9,6 +9,6 @@ executableName = "anki"
 
 compiler = "g++"
 
-compilerFlags = "-DDEBUG_ENABLED=0 -DPLATFORM_LINUX -DMATH_INTEL_SIMD -DREVISION=\\\"`svnversion -c ../..`\\\" -c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -Wno-long-long -pipe -fsingle-precision-constant -msse4 -s -msse4 -O3 -mtune=core2 -ffast-math"
+compilerFlags = "-DDEBUG_ENABLED=0 -DPLATFORM_LINUX -DMATH_INTEL_SIMD -DNDEBUG -DBOOST_DISABLE_ASSERTS -DREVISION=\\\"`svnversion -c ../..`\\\" -c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -Wno-long-long -pipe -fsingle-precision-constant -msse4 -O3 -mtune=core2 -ffast-math"
 
 linkerFlags = "-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"

+ 3 - 2
src/Main.cpp

@@ -152,8 +152,9 @@ void init()
 
 	// Sponza
 	ModelNode* sponza = new ModelNode();
-	sponza->init("maps/sponza/sponza.mdl");
-
+	//sponza->init("maps/sponza/sponza.mdl");
+	sponza->init("maps/sponza-crytek/sponza_crytek.mdl");
+	sponza->setLocalTransform(Transform(Vec3(0.0), Mat3::getIdentity(), 0.05));
 
 	// Pentagram
 	ModelNode* pentagram = new ModelNode();

+ 4 - 4
src/Math/MathFuncs.h

@@ -20,13 +20,13 @@ extern bool  isZero(float f); ///< The proper way to test if a float is zero
 
 /// mat4(t0,r0,s0)*mat4(t1,r1,s1) == mat4(tf,rf,sf)
 extern void combineTransformations(const Vec3& t0, const Mat3& r0, float s0, // in 0
-                                    const Vec3& t1, const Mat3& r1, float s1, // in 1
-                                    Vec3& tf, Mat3& rf, float& sf); // out
+                                   const Vec3& t1, const Mat3& r1, float s1, // in 1
+                                   Vec3& tf, Mat3& rf, float& sf); // out
 
 /// mat4(t0,r0, 1.0)*mat4(t1,r1, 1.0) == mat4(tf,rf,sf)
 extern void combineTransformations(const Vec3& t0, const Mat3& r0, // in 0
-                                    const Vec3& t1, const Mat3& r1, // in 1
-                                    Vec3& tf, Mat3& rf); // out
+                                   const Vec3& t1, const Mat3& r1, // in 1
+                                   Vec3& tf, Mat3& rf); // out
 
 
 } // end namespace

+ 3 - 3
src/Renderer/Dbg.cpp

@@ -20,7 +20,8 @@ Dbg::Dbg(Renderer& r_):
 	showSkeletonsEnabled(true),
 	showCamerasEnabled(true),
 	showVisibilityBoundingShapesFlag(true),
-	sceneDbgDrawer(*this)
+	sceneDbgDrawer(*this),
+	collisionDbgDrawer(*this)
 {}
 
 
@@ -277,8 +278,7 @@ void Dbg::run()
 				if(showVisibilityBoundingShapesFlag)
 				{
 					const RenderableNode& rnode = static_cast<const RenderableNode&>(*node);
-					setModelMat(Mat4(rnode.getBoundingShapeWSpace().getCenter(), Mat3::getIdentity(), 1.0));
-					drawSphere(rnode.getBoundingShapeWSpace().getRadius());
+					collisionDbgDrawer.draw(rnode.getBoundingShapeWSpace());
 				}
 				break;
 			default:

+ 4 - 0
src/Renderer/Dbg.h

@@ -11,6 +11,7 @@
 #include "Vbo.h"
 #include "Vao.h"
 #include "SceneDbgDrawer.h"
+#include "CollisionDbgDrawer.h"
 #include "Properties.h"
 
 
@@ -63,6 +64,9 @@ class Dbg: public RenderingPass
 		Vbo colorsVbo;
 		Vao vao;
 		SceneDbgDrawer sceneDbgDrawer;
+		CollisionDbgDrawer collisionDbgDrawer;
+
+
 		/// This is a container of some precalculated spheres. Its a map that from sphere complexity it returns a vector
 		/// of lines (Vec3s in pairs)
 		std::map<uint, Vec<Vec3> > complexityToPreCalculatedSphere;

+ 36 - 0
src/Renderer/Drawers/CollisionDbgDrawer.cpp

@@ -0,0 +1,36 @@
+#include "CollisionDbgDrawer.h"
+#include "Dbg.h"
+#include "Collision.h"
+
+
+//======================================================================================================================
+// draw (Sphere)                                                                                                       =
+//======================================================================================================================
+void CollisionDbgDrawer::draw(const Sphere& sphere)
+{
+	dbg.setModelMat(Mat4(sphere.getCenter(), Mat3::getIdentity(), 1.0));
+	dbg.drawSphere(sphere.getRadius());
+}
+
+
+//======================================================================================================================
+// draw (Obb)                                                                                                          =
+//======================================================================================================================
+void CollisionDbgDrawer::draw(const Obb& obb)
+{
+	Mat4 scale(Mat4::getIdentity());
+	scale(0, 0) = obb.getExtend().x();
+	scale(1, 1) = obb.getExtend().y();
+	scale(2, 2) = obb.getExtend().z();
+
+	Mat4 rot(obb.getRotation());
+
+	Mat4 trs(obb.getCenter());
+
+	Mat4 tsl;
+	tsl = Mat4::combineTransformations(rot, scale);
+	tsl = Mat4::combineTransformations(trs, tsl);
+
+	dbg.setModelMat(tsl);
+	dbg.drawCube();
+}

+ 28 - 0
src/Renderer/Drawers/CollisionDbgDrawer.h

@@ -0,0 +1,28 @@
+#ifndef COLLISION_DBG_DRAWER_H
+#define COLLISION_DBG_DRAWER_H
+
+
+class Dbg;
+class Sphere;
+class Obb;
+
+
+/// Contains methods to render the collision shapes
+class CollisionDbgDrawer
+{
+	public:
+		/// Constructor
+		CollisionDbgDrawer(Dbg& dbg_): dbg(dbg_) {}
+
+		/// Draw Sphere
+		virtual void draw(const Sphere& sphere);
+
+		/// Draw Obb
+		virtual void draw(const Obb& obb);
+
+	private:
+		Dbg& dbg; ///< The debug stage
+};
+
+
+#endif

+ 1 - 6
src/Renderer/Drawers/SceneDbgDrawer.h

@@ -14,7 +14,7 @@ class SceneDbgDrawer
 {
 	public:
 		/// Constructor
-		SceneDbgDrawer(Dbg& dbg_);
+		SceneDbgDrawer(Dbg& dbg_): dbg(dbg_) {}
 
 		/// Draw a Camera
 		virtual void drawCamera(const Camera& cam) const;
@@ -33,9 +33,4 @@ class SceneDbgDrawer
 };
 
 
-inline SceneDbgDrawer::SceneDbgDrawer(Dbg& dbg_):
-	dbg(dbg_)
-{}
-
-
 #endif

+ 1 - 1
src/Renderer/MainRenderer.cpp

@@ -100,7 +100,7 @@ void MainRenderer::render(Camera& cam_)
 	glDisable(GL_DEPTH_TEST);
 	glDisable(GL_BLEND);
 	sProg->bind();
-	//sProg->findUniVar("rasterImage")->setTexture(ms.getDiffuseFai(), 0);
+	//sProg->findUniVar("rasterImage")->setTexture(ms.getNormalFai(), 0);
 	sProg->findUniVar("rasterImage")->setTexture(pps.getPostPassFai(), 0);
 	drawQuad();
 }

Някои файлове не бяха показани, защото твърде много файлове са промени