瀏覽代碼

Refactoring. Wont compile

Panagiotis Christopoulos Charitos 15 年之前
父節點
當前提交
1ca77c3a89

文件差異過大導致無法顯示
+ 2 - 4
build/debug/Makefile


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

@@ -1,4 +1,4 @@
-sourcePaths = ["../../src/Scripting/", "../../src/Math/", "../../src/Misc/", "../../src/", "../../src/Renderer/", "../../src/Scene/", "../../src/Ui/", "../../src/Resources/", "../../src/Util/", "../../src/Scene/Controllers/", "../../src/Physics/", "../../src/Renderer/BufferObjects/", "../../src/Resources/Helpers/", "../../src/Resources/Core/", "../../src/Core/", "../../src/Scripting/Math", "../../src/Scripting/Util", "../../src/Scripting/Core", "../../src/Scripting/Scene", "../../src/Scripting/Renderer", "../../src/Input"]
+sourcePaths = ["../../src/Scripting/", "../../src/Math/", "../../src/Misc/", "../../src/", "../../src/Renderer/", "../../src/Scene/", "../../src/Ui/", "../../src/Resources/", "../../src/Util/", "../../src/Scene/Controllers/", "../../src/Physics/", "../../src/Renderer/BufferObjects/", "../../src/Resources/Helpers/", "../../src/Resources/Core/", "../../src/Core/", "../../src/Scripting/Math", "../../src/Scripting/Util", "../../src/Scripting/Core", "../../src/Scripting/Scene", "../../src/Scripting/Renderer", "../../src/Input", "../../src/Collision"]
 
 includePaths = []
 includePaths.append("./")

+ 8 - 0
src/Collision/Collision.h

@@ -0,0 +1,8 @@
+#ifndef COLLISION_H
+#define COLLISION_H
+
+#include "Plane.h"
+#include "Sphere.h"
+
+
+#endif

+ 1 - 3
src/Collision/CollisionShape.h

@@ -16,7 +16,7 @@ class CollisionShape
 			CST_LINE_SEG,
 			CST_RAY,
 			CST_PLANE,
-			CST_BSPHERE,
+			CST_SPHERE,
 			CST_AABB,
 			CST_OBB,
 			CST_NUM
@@ -27,8 +27,6 @@ class CollisionShape
 	public:
 		CollisionShape(CollisionShapeType type_): type(type_) {}
 
-		virtual void Render() = 0;
-
 		/// If the bounding volume intersects with the plane then the func returns 0, else it returns the distance. If the
 		/// distance is < 0 then the b.v. lies behind the plane and if > 0 then in front of it
 		virtual float testPlane(const Plane&) const = 0;

+ 64 - 0
src/Collision/Plane.cpp

@@ -0,0 +1,64 @@
+#include "Plane.h"
+#include "Exception.h"
+
+
+//======================================================================================================================
+// setFrom3Points                                                                                                      =
+//======================================================================================================================
+void Plane::setFrom3Points(const Vec3& p0, const Vec3& p1, const Vec3& p2)
+{
+	// get plane vectors
+	Vec3 u = p1 - p0;
+	Vec3 v = p2 - p0;
+
+	normal = u.cross(v);
+
+	// length of normal had better not be zero
+	RASSERT_THROW_EXCEPTION(isZero(normal.getLengthSquared()));
+
+	normal.normalize();
+	offset = normal.dot(p0); // ToDo: correct??
+}
+
+
+//======================================================================================================================
+// setFromPlaneEquation                                                                                                =
+//======================================================================================================================
+void Plane::setFromPlaneEquation(float a, float b, float c, float d)
+{
+	// normalize for cheap distance checks
+	float lensq = a * a + b * b + c * c;
+	// length of normal had better not be zero
+	RASSERT_THROW_EXCEPTION(isZero(lensq));
+
+	// recover gracefully
+	if(isZero(lensq))
+	{
+		normal = Vec3(1.0, 0.0, 0.0);
+		offset = 0.0;
+	}
+	else
+	{
+		float recip = invSqrt(lensq);
+		normal = Vec3(a * recip, b * recip, c * recip);
+		offset = d * recip;
+	}
+}
+
+
+//======================================================================================================================
+// getTransformed                                                                                                      =
+//======================================================================================================================
+Plane Plane::getTransformed(const Vec3& translate, const Mat3& rotate, float scale) const
+{
+	Plane plane;
+
+	// the normal
+	plane.normal = rotate * normal;
+
+	// the offset
+	Vec3 new_trans = rotate.getTransposed() * translate;
+	plane.offset = offset*scale + new_trans.dot(normal);
+
+	return plane;
+}

+ 59 - 1
src/Collision/Plane.h

@@ -14,9 +14,67 @@ class Plane: public CollisionShape
 
 	public:
 		Plane(): CollisionShape(CST_PLANE) {}
+		Plane(const Plane& b);
+		Plane(const Vec3& normal_, float offset_);
 
-		void setFrom3Vec3(const Vec3& p0, const Vec3& p1, const Vec3& p2);
+		/// @see setFrom3Points
+		Plane(const Vec3& p0, const Vec3& p1, const Vec3& p2);
+
+		/// @see setFromPlaneEquation
+		Plane(float a, float b, float c, float d);
+
+		/// Return the transformed
+		Plane getTransformed(const Vec3& translate, const Mat3& rotate, float scale) const;
+
+		/// It gives the distance between a point and a plane. if returns >0 then the point lies in front of the plane,
+		/// if <0 then it is behind and if =0 then it is co-planar
+		float test(const Vec3& point) const {return normal.dot(point) - offset;}
+
+		/// Get the distance from a point to this plane
+		float getDistance(const Vec3& point) const {return fabs(test(point));}
+
+		/// Returns the perpedicular point of a given point in this plane. Plane's normal and returned-point are
+		/// perpedicular
+		Vec3 getClosestPoint(const Vec3& point) const {return point - normal * test(point);}
+
+		/// Do nothing
+		float testPlane(const Plane&) const {return 0.0;}
+
+	private:
+		/// Set the plane from 3 points
+		void setFrom3Points(const Vec3& p0, const Vec3& p1, const Vec3& p2);
+
+		/// Set from plane equation is ax+by+cz+d
+		void setFromPlaneEquation(float a, float b, float c, float d);
 };
 
 
+inline Plane::Plane(const Plane& b):
+	CollisionShape(CST_PLANE),
+	normal(b.normal),
+	offset(b.offset)
+{}
+
+
+inline Plane::Plane(const Vec3& normal_, float offset_):
+	CollisionShape(CST_PLANE),
+	normal(normal_),
+	offset(offset_)
+{}
+
+
+inline Plane::Plane(const Vec3& p0, const Vec3& p1, const Vec3& p2):
+	CollisionShape(CST_PLANE)
+{
+	setFrom3Points(p0, p1, p2);
+}
+
+
+inline Plane::Plane(float a, float b, float c, float d):
+	CollisionShape(CST_PLANE)
+{
+	setFromPlaneEquation(a, b, c, d);
+}
+
+
 #endif

+ 82 - 0
src/Collision/Sphere.cpp

@@ -0,0 +1,82 @@
+#include "Sphere.h"
+#include "Plane.h"
+
+
+//======================================================================================================================
+// getTransformed                                                                                                      =
+//======================================================================================================================
+Sphere Sphere::getTransformed(const Vec3& translate, const Mat3& rotate, float scale) const
+{
+	Sphere newSphere;
+	newSphere.center = center.getTransformed(translate, rotate, scale);
+	newSphere.radius = radius * scale;
+	return newSphere;
+}
+
+
+//======================================================================================================================
+// testPlane                                                                                                           =
+//======================================================================================================================
+float Sphere::testPlane(const Plane& plane) const
+{
+	float dist = plane.test(center);
+
+	if(dist > radius)
+	{
+		return dist - radius;
+	}
+	else if(-dist > radius)
+	{
+		return dist + radius;
+	}
+	else
+	{
+		return 0.0;
+	}
+}
+
+//======================================================================================================================
+//                                                                                                                     =
+//======================================================================================================================
+void Sphere::set(const float* pointer, size_t stride, int count)
+{
+	void* tmpPtr = (void*)pointer;
+	Vec3 min(*(Vec3*)tmpPtr);
+	Vec3 max(*(Vec3*)tmpPtr);
+
+	// for all the Vec3 calc the max and min
+	for(int i=1; i<count; i++)
+	{
+		tmpPtr = (char*)tmpPtr + stride;
+
+		const Vec3& tmp = *((Vec3*)tmpPtr);
+
+		for(int j=0; j<3; j++)
+		{
+			if(tmp[j] > max[j])
+			{
+				max[j] = tmp[j];
+			}
+			else if(tmp[j] < min[j])
+			{
+				min[j] = tmp[j];
+			}
+		}
+	}
+
+	center = (min + max) * 0.5; // average
+
+	tmpPtr = (void*)pointer;
+	float maxDist = (*((Vec3*)tmpPtr) - center).getLengthSquared(); // max distance between center and the vec3 arr
+	for(int i=1; i<count; i++)
+	{
+		tmpPtr = (char*)tmpPtr + stride;
+
+		const Vec3& vertco = *((Vec3*)tmpPtr);
+		float dist = (vertco - center).getLengthSquared();
+		if(dist > maxDist)
+			maxDist = dist;
+	}
+
+	radius = M::sqrt(maxDist);
+}

+ 66 - 0
src/Collision/Sphere.h

@@ -0,0 +1,66 @@
+#ifndef SPHERE_H
+#define SPHERE_H
+
+#include "CollisionShape.h"
+#include "Properties.h"
+#include "Math.h"
+
+
+class Plane;
+
+
+/// Sphere collision shape
+class Sphere: public CollisionShape
+{
+	PROPERTY_RW(Vec3, center, setCenter, getCenter)
+	PROPERTY_RW(float, radius, setRadius, getRadius)
+
+	public:
+		/// Default constructor
+		Sphere(): CollisionShape(CST_SPHERE) {}
+
+		/// Copy constructor
+		Sphere(const Sphere& other);
+
+		/// Constructor
+		Sphere(const Vec3& center_, float radius_);
+
+		/// @see set
+		Sphere(const float* pointer, size_t stride, int count);
+
+		Sphere getTransformed(const Vec3& translate, const Mat3& rotate, float scale) const;
+
+		/// @see CollisionShape::testPlane
+		float testPlane(const Plane& plane) const;
+
+	private:
+		/// Set from Vec3 array
+		/// @param pointer The start of the array
+		/// @param stride The space between the elements
+		/// @param count The number of 3D vectors
+		void set(const float* pointer, size_t stride, int count);
+};
+
+
+inline Sphere::Sphere(const Sphere& b):
+	CollisionShape(CST_SPHERE),
+	center(b.center),
+	radius(b.radius)
+{}
+
+
+inline Sphere::Sphere(const Vec3& center_, float radius_):
+	CollisionShape(CST_SPHERE),
+	center(center_),
+	radius(radius_)
+{}
+
+
+inline Sphere::Sphere(const float* pointer, size_t stride, int count):
+	CollisionShape(CST_SPHERE)
+{
+	set(pointer, stride, count);
+}
+
+
+#endif

+ 34 - 26
src/Scene/Camera.cpp

@@ -67,22 +67,22 @@ void Camera::calcLSpaceFrustumPlanes()
 {
 	float c, s; // cos & sine
 
-	sinCos(PI+fovX/2, s, c);
+	sinCos(PI + fovX / 2, s, c);
 	// right
-	lspaceFrustumPlanes[FP_RIGHT] = plane_t(Vec3(c, 0.0, s), 0.0);
+	lspaceFrustumPlanes[FP_RIGHT] = Plane(Vec3(c, 0.0, s), 0.0);
 	// left
-	lspaceFrustumPlanes[FP_LEFT] = plane_t(Vec3(-c, 0.0, s), 0.0);
+	lspaceFrustumPlanes[FP_LEFT] = Plane(Vec3(-c, 0.0, s), 0.0);
 
-	sinCos((3*PI-fovY)*0.5, s, c);
+	sinCos((3 * PI - fovY) * 0.5, s, c);
 	// top
-	lspaceFrustumPlanes[FP_TOP] = plane_t(Vec3(0.0, s, c), 0.0);
+	lspaceFrustumPlanes[FP_TOP] = Plane(Vec3(0.0, s, c), 0.0);
 	// bottom
-	lspaceFrustumPlanes[FP_BOTTOM] = plane_t(Vec3(0.0, -s, c), 0.0);
+	lspaceFrustumPlanes[FP_BOTTOM] = Plane(Vec3(0.0, -s, c), 0.0);
 
 	// near
-	lspaceFrustumPlanes[FP_NEAR] = plane_t(Vec3(0.0, 0.0, -1.0), zNear);
+	lspaceFrustumPlanes[FP_NEAR] = Plane(Vec3(0.0, 0.0, -1.0), zNear);
 	// far
-	lspaceFrustumPlanes[FP_FAR] = plane_t(Vec3(0.0, 0.0, 1.0), -zFar);
+	lspaceFrustumPlanes[FP_FAR] = Plane(Vec3(0.0, 0.0, 1.0), -zFar);
 }
 
 
@@ -93,9 +93,9 @@ void Camera::updateWSpaceFrustumPlanes()
 {
 	for(uint i=0; i<6; i++)
 	{
-		wspaceFrustumPlanes[i] = lspaceFrustumPlanes[i].Transformed(getWorldTransform().origin,
-		                                                            getWorldTransform().rotation,
-		                                                            getWorldTransform().scale);
+		wspaceFrustumPlanes[i] = lspaceFrustumPlanes[i].getTransformed(getWorldTransform().origin,
+		                                                               getWorldTransform().rotation,
+		                                                               getWorldTransform().scale);
 	}
 }
 
@@ -104,11 +104,15 @@ void Camera::updateWSpaceFrustumPlanes()
 // insideFrustum                                                                                                       =
 //======================================================================================================================
 /// Check if the volume is inside the frustum cliping planes
-bool Camera::insideFrustum(const bvolume_t& bvol) const
+bool Camera::insideFrustum(const CollisionShape& bvol) const
 {
 	for(uint i=0; i<6; i++)
-		if(bvol.PlaneTest(wspaceFrustumPlanes[i]) < 0.0)
+	{
+		if(bvol.testPlane(wspaceFrustumPlanes[i]) < 0.0)
+		{
 			return false;
+		}
+	}
 
 	return true;
 }
@@ -119,12 +123,12 @@ bool Camera::insideFrustum(const bvolume_t& bvol) const
 //======================================================================================================================
 bool Camera::insideFrustum(const Camera& cam) const
 {
-	//** get five points. These points are the tips of the given camera **
+	// get five points. These points are the tips of the given camera
 	Vec3 points[5];
 
 	// get 3 sample floats
-	float x = cam.getZFar() / tan((PI-cam.getFovX())/2);
-	float y = tan(cam.getFovY()/2) * cam.getZFar();
+	float x = cam.getZFar() / tan((PI - cam.getFovX())/2);
+	float y = tan(cam.getFovY() / 2) * cam.getZFar();
 	float z = -cam.getZFar();
 
 	// the actual points in local space
@@ -136,20 +140,26 @@ bool Camera::insideFrustum(const Camera& cam) const
 
 	// transform them to the given camera's world space (exept the eye)
 	for(uint i=0; i<4; i++)
+	{
 		points[i].transform(getWorldTransform());
+	}
 
-
-	//** the collision code **
+	// the collision code
 	for(uint i=0; i<6; i++) // for the 6 planes
 	{
 		int failed = 0;
 
 		for(uint j=0; j<5; j++) // for the 5 points
 		{
-			if(wspaceFrustumPlanes[i].Test(points[j]) < 0.0)
+			if(wspaceFrustumPlanes[i].test(points[j]) < 0.0)
+			{
 				++failed;
+			}
+		}
+		if(failed == 5)
+		{
+			return false; // if all points are behind the plane then the cam is not in frustum
 		}
-		if(failed == 5) return false; // if all points are behind the plane then the cam is not in frustum
 	}
 
 	return true;
@@ -161,9 +171,9 @@ bool Camera::insideFrustum(const Camera& cam) const
 //======================================================================================================================
 void Camera::calcProjectionMatrix()
 {
-	float f = 1.0/tan(fovY*0.5f); // f = cot(fovY/2)
+	float f = 1.0 / tan(fovY * 0.5); // f = cot(fovY/2)
 
-	projectionMat(0, 0) = f*fovY/fovX; // = f/aspectRatio;
+	projectionMat(0, 0) = f * fovY / fovX; // = f/aspectRatio;
 	projectionMat(0, 1) = 0.0;
 	projectionMat(0, 2) = 0.0;
 	projectionMat(0, 3) = 0.0;
@@ -173,8 +183,8 @@ void Camera::calcProjectionMatrix()
 	projectionMat(1, 3) = 0.0;
 	projectionMat(2, 0) = 0.0;
 	projectionMat(2, 1) = 0.0;
-	projectionMat(2, 2) = (zFar+zNear) / (zNear-zFar);
-	projectionMat(2, 3) = (2.0f*zFar*zNear) / (zNear-zFar);
+	projectionMat(2, 2) = (zFar + zNear) / ( zNear - zFar);
+	projectionMat(2, 3) = (2.0f * zFar * zNear) / (zNear - zFar);
 	projectionMat(3, 0) = 0.0;
 	projectionMat(3, 1) = 0.0;
 	projectionMat(3, 2) = -1.0;
@@ -213,5 +223,3 @@ void Camera::updateTrf()
 	updateWSpaceFrustumPlanes();
 }
 
-
-

+ 46 - 50
src/Scene/Camera.h

@@ -2,15 +2,11 @@
 #define CAMERA_H
 
 #include <fstream>
-#include <cstring>
-#include "Common.h"
-#include "collision.h"
+#include "Collision.h"
 #include "SceneNode.h"
 
 
-/**
- * @brief Camera SceneNode
- */
+/// Camera SceneNode
 class Camera: public SceneNode
 {
 	public:
@@ -24,44 +20,14 @@ class Camera: public SceneNode
 			FP_FAR
 		};
 
-		// Fovx is the angle in the y axis (imagine the cam positioned in the default OGL pos)
-		// Note that fovX > fovY (most of the time) and aspectRatio = fovX/fovY
-		// fovX and fovY in rad
-		float fovX, fovY;
-		float zNear, zFar;
-
-		// the frustum planes in local and world space
-		plane_t lspaceFrustumPlanes[6];
-		plane_t wspaceFrustumPlanes[6];
-
-		// matrices
-		Mat4 projectionMat;
-		Mat4 viewMat;
-
-		/**
-		 * Used in deferred shading for the calculation of view vector (see CalcViewVector). The reason we store this matrix here is
-		 * that we dont want it to be re-calculated all the time but only when the projection params (fovX, fovY, zNear, zFar) change.
-		 * Fortunately the projection params change rarely. Note that the Camera as we all know re-calculates the matrices only when the
-		 * parameters change!!
-		 */
-		Mat4 invProjectionMat;
-
-		// misc
-		void calcProjectionMatrix();
-		void updateViewMatrix();
-		void calcLSpaceFrustumPlanes();
-		void updateWSpaceFrustumPlanes();
-
 	public:
 		// constructors and destuctors
 		Camera(float fovx_, float fovy_, float znear_, float zfar_, SceneNode* parent = NULL);
 		Camera(SceneNode* parent = NULL): SceneNode(SNT_CAMERA, parent) {}
-		~Camera() throw() {}
+		~Camera() {}
 
-		/**
-		 * @name Accessors
-		 */
-		/**@{*/
+		/// @name Accessors
+		//// @{
 		void setFovX (float fovx_)  { fovX=fovx_; calcProjectionMatrix(); calcLSpaceFrustumPlanes(); }
 		void setFovY (float fovy_)  { fovY=fovy_; calcProjectionMatrix(); calcLSpaceFrustumPlanes(); }
 		void setZNear(float znear_) { zNear=znear_; calcProjectionMatrix(); calcLSpaceFrustumPlanes(); }
@@ -74,26 +40,56 @@ class Camera: public SceneNode
 		const Mat4& getProjectionMatrix() const { return projectionMat; }
 		const Mat4& getViewMatrix() const { return viewMat; }
 		const Mat4& getInvProjectionMatrix() const { return invProjectionMat; } ///< See the declaration of invProjectionMat for info
-		/**@}*/
+		//// @}
 
-		// misc
 		void lookAtPoint(const Vec3& point);
 		void updateTrf();
 		void render();
 		void init(const char*) {}
 
-		// frustum stuff
+		/// @name Frustum checks
+		/// @{
 
-		/**
-		 * Check if the given camera is inside the frustum clipping planes. This is used mainly to test if the projected
-		 * lights are visible
-		 */
-		bool insideFrustum(const bvolume_t& vol) const;
+		/// Check if the given camera is inside the frustum clipping planes. This is used mainly to test if the projected
+		/// lights are visible
+		bool insideFrustum(const CollisionShape& vol) const;
 
-		/**
-		 * Check if another camera is inside our view (used for projected lights)
-		 */
+		/// Check if another camera is inside our view (used for projected lights)
 		bool insideFrustum(const Camera& cam) const;
+		/// @}
+
+	private:
+		/// @name Angles
+		/// fovX is the angle in the y axis (imagine the cam positioned in the default OGL pos) Note that fovX > fovY
+		/// (most of the time) and aspectRatio = fovX/fovY
+		/// @{
+		float fovX, fovY;
+		/// @}
+
+		float zNear, zFar;
+
+		/// @name The frustum planes in local and world space
+		/// @{
+		Plane lspaceFrustumPlanes[6];
+		Plane wspaceFrustumPlanes[6];
+		/// @}
+
+		/// @name Matrices
+		/// @{
+		Mat4 projectionMat;
+		Mat4 viewMat;
+
+		/// Used in deferred shading for the calculation of view vector (see CalcViewVector). The reason we store this
+		/// matrix here is that we dont want it to be re-calculated all the time but only when the projection params
+		/// (fovX, fovY, zNear, zFar) change. Fortunately the projection params change rarely. Note that the Camera as we
+		/// all know re-calculates the matrices only when the parameters change!!
+		Mat4 invProjectionMat;
+		/// @}
+
+		void calcProjectionMatrix();
+		void updateViewMatrix();
+		void calcLSpaceFrustumPlanes();
+		void updateWSpaceFrustumPlanes();
 };
 
 

+ 6 - 10
src/Scene/ParticleEmitter.h

@@ -2,7 +2,7 @@
 #define PARTICLEEMITTER_H
 
 #include <boost/ptr_container/ptr_vector.hpp>
-#include "Common.h"
+#include <memory>
 #include "SceneNode.h"
 #include "MeshNode.h"
 #include "GhostNode.h"
@@ -12,20 +12,16 @@
 class RigidBody;
 
 
-/**
- * The particle emitter scene node. This scene node emitts @ref ParticleEmitter:Particle particle nodes in space.
- */
+/// The particle emitter scene node. This scene node emitts @ref ParticleEmitter:Particle particle nodes in space.
 class ParticleEmitter: public SceneNode, public ParticleEmitterPropsStruct
 {
 	public:
-		/**
-		 * The scene node particle class
-		 */
+		/// The scene node particle class
 		class Particle: public GhostNode
 		{
 			public:
 				float timeOfDeath; ///< Life of death. If < 0.0 then dead. In seconds
-				auto_ptr<RigidBody> body;
+				std::auto_ptr<RigidBody> body;
 
 				Particle();
 				void render();
@@ -37,8 +33,8 @@ class ParticleEmitter: public SceneNode, public ParticleEmitterPropsStruct
 		void init(const char* filename);
 
 	private:
-		auto_ptr<btCollisionShape> collShape;
-		ptr_vector<Particle> particles;
+		std::auto_ptr<btCollisionShape> collShape;
+		boost::ptr_vector<Particle> particles;
 		float timeOfPrevUpdate;
 		float timeOfPrevEmittion;
 		RsrcPtr<ParticleEmitterProps> particleEmitterProps; ///< The resource

+ 11 - 4
src/Scene/Scene.cpp

@@ -1,4 +1,5 @@
 #include <algorithm>
+#include "Exception.h"
 #include "Scene.h"
 #include "SkelNode.h"
 #include "Camera.h"
@@ -89,14 +90,14 @@ void Scene::unregisterNode(SceneNode* node)
 //======================================================================================================================
 void Scene::registerController(Controller* controller)
 {
-	DEBUG_ERR(std::find(controllers.begin(), controllers.end(), controller) != controllers.end());
+	RASSERT_THROW_EXCEPTION(std::find(controllers.begin(), controllers.end(), controller) != controllers.end());
 	controllers.push_back(controller);
 }
 
 void Scene::unregisterController(Controller* controller)
 {
 	Vec<Controller*>::iterator it = std::find(controllers.begin(), controllers.end(), controller);
-	DEBUG_ERR(it == controllers.end());
+	RASSERT_THROW_EXCEPTION(it == controllers.end());
 	controllers.erase(it);
 }
 
@@ -106,7 +107,7 @@ void Scene::unregisterController(Controller* controller)
 //======================================================================================================================
 void Scene::updateAllWorldStuff()
 {
-	DEBUG_ERR(nodes.size() > 1024);
+	RASSERT_THROW_EXCEPTION(nodes.size() > 1024);
 	SceneNode* queue [1024];
 	uint head = 0, tail = 0;
 	uint num = 0;
@@ -114,8 +115,12 @@ void Scene::updateAllWorldStuff()
 
 	// put the roots
 	for(uint i=0; i<nodes.size(); i++)
+	{
 		if(nodes[i]->parent == NULL)
+		{
 			queue[tail++] = nodes[i]; // queue push
+		}
+	}
 
 	// loop
 	while(head != tail) // while queue not empty
@@ -128,10 +133,12 @@ void Scene::updateAllWorldStuff()
 		++num;
 
 		for(uint i=0; i<obj->childs.size(); i++)
+		{
 			queue[tail++] = obj->childs[i];
+		}
 	}
 
-	DEBUG_ERR(num != nodes.size());
+	RASSERT_THROW_EXCEPTION(num != nodes.size());
 }
 
 

部分文件因文件數量過多而無法顯示