소스 검색

- A small fix in the FATAL
- Renamed DEBUG to DEBUG_ENABLED
- Working on the debug stage

Panagiotis Christopoulos Charitos 15 년 전
부모
커밋
ac86ccb98d
17개의 변경된 파일519개의 추가작업 그리고 592개의 파일을 삭제
  1. 4 3
      .cproject
  2. 398 389
      build/debug/Makefile
  3. 1 1
      build/debug/gen.cfg.py
  4. 2 7
      shaders/Dbg.glsl
  5. 2 3
      src/Main.cpp
  6. 54 53
      src/Math/MathFuncs.inl.h
  7. 9 6
      src/Misc/collision.cpp
  8. 3 3
      src/Misc/memory.cpp
  9. 19 71
      src/Renderer/Dbg.cpp
  10. 2 2
      src/Renderer/Renderer.h
  11. 0 3
      src/Scene/Camera.cpp
  12. 2 17
      src/Scene/Light.cpp
  13. 1 11
      src/Scene/ParticleEmitter.cpp
  14. 4 16
      src/Util/App.cpp
  15. 1 2
      src/Util/App.h
  16. 11 0
      src/Util/Common.cpp
  17. 6 5
      src/Util/Common.h

+ 4 - 3
.cproject

@@ -24,8 +24,8 @@
 <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.851455675" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
 <option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1618169758" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
 <option id="gnu.cpp.compiler.exe.debug.option.debugging.level.1895811470" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
-<option id="gnu.cpp.compiler.option.preprocessor.def.1744709041" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
-<listOptionValue builtIn="false" value="DEBUG"/>
+<option id="gnu.cpp.compiler.option.preprocessor.def.1744709041" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
+<listOptionValue builtIn="false" value="DEBUG_ENABLED"/>
 </option>
 <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.513886517" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
 </tool>
@@ -986,8 +986,9 @@
 <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.765681496" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
 <option id="gnu.cpp.compiler.exe.release.option.optimization.level.650507739" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
 <option id="gnu.cpp.compiler.exe.release.option.debugging.level.854860454" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
-<option id="gnu.cpp.compiler.option.preprocessor.def.571956268" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
+<option id="gnu.cpp.compiler.option.preprocessor.def.571956268" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
 <listOptionValue builtIn="false" value="DEBUG"/>
+<listOptionValue builtIn="false" value="DEBUG_ENABLED"/>
 </option>
 <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1164998817" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
 </tool>

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 398 - 389
build/debug/Makefile


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

@@ -7,6 +7,6 @@ precompiledHeaders = []
 executableName = "AnKi.bin"
 compiler = "g++"
 commonFlags_ = ""
-compilerFlags = "-c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -pipe -O0 -g3 -pg -fsingle-precision-constant -DDEBUG -DPLATFORM_LINUX -DREVISION=\\\"`svnversion -c ../..`\\\" "
+compilerFlags = "-c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -pipe -O0 -g3 -pg -fsingle-precision-constant -DDEBUG_ENABLED -DPLATFORM_LINUX -DREVISION=\\\"`svnversion -c ../..`\\\" "
 precompiledHeadersFlags = compilerFlags + " -x "
 linkerFlags = "-rdynamic -L../../../SDL-hg/build/.libs -L../../../glew/lib -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 -lSDL -Wl,-Bdynamic -lGL -ljpeg -lpng -ltiff"

+ 2 - 7
shaders/Dbg.glsl

@@ -2,24 +2,19 @@
 
 #pragma anki attribute position 0
 attribute vec3 position;
-#pragma anki attribute color 1
-attribute vec3 color;
 
 uniform mat4 modelViewProjectionMat;
 
-varying vec3 colorV2f;
-
 void main()
 {
-	colorV2f = color;
 	gl_Position = modelViewProjectionMat * vec4( position, 1.0 );
 }
 
 #pragma anki fragShaderBegins
 
-varying vec3 colorV2f;
+uniform vec4 color = vec4( 0.5 );
 
 void main()
 {
-	gl_FragData[0].rgb = colorV2f;
+	gl_FragData[0] = color;
 }

+ 2 - 3
src/Main.cpp

@@ -37,7 +37,7 @@
 #include "RendererInitializer.h"
 #include "MainRenderer.h"
 
-App* app = NULL;
+App* app = NULL; ///< The only global var. App constructor sets it
 
 // map (hard coded)
 MeshNode* floor__,* sarge,* horse,* crate;
@@ -296,8 +296,7 @@ void init()
 //======================================================================================================================
 int main( int argc, char* argv[] )
 {
-	app = new App;
-	app->init( argc, argv );
+	new App( argc, argv );
 
 	init();
 

+ 54 - 53
src/Math/MathFuncs.inl.h

@@ -11,7 +11,7 @@ inline void mathSanityChecks()
 	if( sizeof(Vec2)!=fs*2 || sizeof(Vec3)!=fs*3 || sizeof(Vec4)!=fs*4 || sizeof(Quat)!=fs*4 ||
 	    sizeof(Euler)!=fs*3 || sizeof(Mat3)!=fs*9 || sizeof(Mat4)!=fs*16 )
 	{
-		FATAL("Your compiler does class alignment");
+		FATAL( "Your compiler does class alignment" );
 	}
 }
 
@@ -48,63 +48,64 @@ inline float invSqrt( float f )
 
 
 // polynomialSinQuadrant
-#if !defined(DEBUG)
-	/**
-	 * Used in sinCos
-	 */
-	inline static float polynomialSinQuadrant( float a )
-	{
-		return a * ( 1.0 + a * a * (-0.16666 + a * a * (0.0083143 - a * a * 0.00018542)));
-	}
-#endif
+/**
+ * Used in sinCos
+ */
+inline static float polynomialSinQuadrant( float a )
+{
+	return a * ( 1.0 + a * a * (-0.16666 + a * a * (0.0083143 - a * a * 0.00018542)));
+}
 
 
 // Sine and Cosine
 inline void sinCos( float a, float& sina, float& cosa )
 {
-	#ifdef DEBUG
-		sina = M::sin(a);
-		cosa = M::cos(a);
-	#else
-		bool negative = false;
-		if (a < 0.0)
-		{
-			a = -a;
-			negative = true;
-		}
-		const float kTwoOverPi = 1.0 / (PI/2.0);
-		float floatA = kTwoOverPi * a;
-		int intA = (int)floatA;
-
-		const float k_rational_half_pi = 201 / 128.0;
-		const float kRemainderHalfPi = 4.8382679e-4;
-
-		floatA = (a - k_rational_half_pi * intA) - kRemainderHalfPi * intA;
-
-		float floatAMinusHalfPi = (floatA - k_rational_half_pi) - kRemainderHalfPi;
-
-		switch( intA & 3 )
-		{
-			case 0: // 0 - Pi/2
-				sina = polynomialSinQuadrant(floatA);
-				cosa = polynomialSinQuadrant(-floatAMinusHalfPi);
-				break;
-			case 1: // Pi/2 - Pi
-				sina = polynomialSinQuadrant(-floatAMinusHalfPi);
-				cosa = polynomialSinQuadrant(-floatA);
-				break;
-			case 2: // Pi - 3Pi/2
-				sina = polynomialSinQuadrant(-floatA);
-				cosa = polynomialSinQuadrant(floatAMinusHalfPi);
-				break;
-			case 3: // 3Pi/2 - 2Pi
-				sina = polynomialSinQuadrant(floatAMinusHalfPi);
-				cosa = polynomialSinQuadrant(floatA);
-				break;
-		};
-
-		if( negative )
-			sina = -sina;
+	bool negative = false;
+	if (a < 0.0)
+	{
+		a = -a;
+		negative = true;
+	}
+	const float kTwoOverPi = 1.0 / (PI/2.0);
+	float floatA = kTwoOverPi * a;
+	int intA = (int)floatA;
+
+	const float k_rational_half_pi = 201 / 128.0;
+	const float kRemainderHalfPi = 4.8382679e-4;
+
+	floatA = (a - k_rational_half_pi * intA) - kRemainderHalfPi * intA;
+
+	float floatAMinusHalfPi = (floatA - k_rational_half_pi) - kRemainderHalfPi;
+
+	switch( intA & 3 )
+	{
+		case 0: // 0 - Pi/2
+			sina = polynomialSinQuadrant(floatA);
+			cosa = polynomialSinQuadrant(-floatAMinusHalfPi);
+			break;
+		case 1: // Pi/2 - Pi
+			sina = polynomialSinQuadrant(-floatAMinusHalfPi);
+			cosa = polynomialSinQuadrant(-floatA);
+			break;
+		case 2: // Pi - 3Pi/2
+			sina = polynomialSinQuadrant(-floatA);
+			cosa = polynomialSinQuadrant(floatAMinusHalfPi);
+			break;
+		case 3: // 3Pi/2 - 2Pi
+			sina = polynomialSinQuadrant(floatAMinusHalfPi);
+			cosa = polynomialSinQuadrant(floatA);
+			break;
+	};
+
+	if( negative )
+		sina = -sina;
+
+	// a unit test
+	#if defined( DEBUG_ENABLED )
+		float sina_ = M::sin(a);
+		float cosa_ = M::cos(a);
+
+		DEBUG_ERR( isZero( sina_ - sina ) || isZero( cosa_ - cosa ) );
 	#endif
 }
 

+ 9 - 6
src/Misc/collision.cpp

@@ -906,7 +906,8 @@ render
 */
 void bsphere_t::Render()
 {
-	glPushMatrix();
+	/// @todo
+	/*glPushMatrix();
 
 	glTranslatef( center.x, center.y, center.z );
 
@@ -914,7 +915,7 @@ void bsphere_t::Render()
 
 	app->getMainRenderer()->dbg.renderSphere( radius, 24, Vec3(1.0) );
 
-	glPopMatrix();
+	glPopMatrix();*/
 }
 
 
@@ -1186,7 +1187,8 @@ render
 */
 void aabb_t::Render()
 {
-	glPushMatrix();
+	/// @todo
+	/*glPushMatrix();
 
 	Vec3 sub( max-min );
 	Vec3 center( (max+min)*0.5 );
@@ -1205,7 +1207,7 @@ void aabb_t::Render()
 		glVertex3fv( &min[0] );
 		glColor3fv( &Vec3( 0.0, 1.0, 0.0 )[0] );
 		glVertex3fv( &max[0] );
-	glEnd();
+	glEnd();*/
 }
 
 
@@ -1637,7 +1639,8 @@ render
 */
 void obb_t::Render()
 {
-	glPushMatrix();
+	/// @todo
+	/*glPushMatrix();
 
 	glTranslatef( center.x, center.y, center.z ); // translate
 	app->getMainRenderer()->multMatrix( Mat4(rotation) ); // rotate
@@ -1652,7 +1655,7 @@ void obb_t::Render()
 		glVertex3fv( &Vec3(1.0, 1.0, 1.0)[0] );
 	glEnd();
 
-	glPopMatrix();
+	glPopMatrix();*/
 }
 
 

+ 3 - 3
src/Misc/memory.cpp

@@ -30,7 +30,7 @@ namespace mem {
 #endif
 
 
-#ifdef DEBUG
+#ifdef DEBUG_ENABLED
 	#define SANITY_CHECKS SanityChecks();
 	#define PRINT_CALL_INFO(x) { if(mem::print_call_info) INFO(x) }
 #else
@@ -286,7 +286,7 @@ init
 */
 static void init()
 {
-#ifdef DEBUG
+#ifdef DEBUG_ENABLED
 	memset( buffer, (char)0xCC, buffer_size );
 #endif
 
@@ -622,7 +622,7 @@ static void FreeBlock( mem_block_t* crnt )
 
 	free_size += crnt->size;
 
-#ifdef DEBUG
+#ifdef DEBUG_ENABLED
 	memset( crnt->addr, (char)0xCC, crnt->size );
 #endif
 

+ 19 - 71
src/Renderer/Dbg.cpp

@@ -76,8 +76,11 @@ void Renderer::Dbg::renderGrid()
 //======================================================================================================================
 // renderSphere                                                                                                        =
 //======================================================================================================================
-void Renderer::Dbg::renderSphere( float radius, int complexity, const Vec3& color )
+void Renderer::Dbg::renderSphere( const Transform& trf, const Vec4& color, int complexity )
 {
+	sProg->findUniVar( "color" )->setVec4( &color );
+
+	const float radius = 1.0;
 	const float twopi  = M::PI*2;
 	const float pidiv2 = M::PI/2;
 
@@ -121,8 +124,8 @@ void Renderer::Dbg::renderSphere( float radius, int complexity, const Vec3& colo
 			py = radius * ey;
 			pz = radius * ez;
 
-			positions.push_back( Vec3(px, py, pz) );
-			normals.push_back( Vec3(ex, ey, ez) );
+			positions.push_back( Vec3(px, py, pz).getTransformed( trf ) );
+			normals.push_back( trf.getRotation() * Vec3(ex, ey, ez) );
 			texCoodrs.push_back( Vec2(-(j/(float)complexity), 2*(i+1)/(float)complexity) );
 
 			ex = costheta1 * costheta3;
@@ -132,42 +135,30 @@ void Renderer::Dbg::renderSphere( float radius, int complexity, const Vec3& colo
 			py = radius * ey;
 			pz = radius * ez;
 
-			positions.push_back( Vec3(px, py, pz) );
-			normals.push_back( Vec3(ex, ey, ez) );
+			positions.push_back( Vec3(px, py, pz).getTransformed( trf ) );
+			normals.push_back( trf.getRotation() * Vec3(ex, ey, ez) );
 			texCoodrs.push_back( Vec2(-(j/(float)complexity), 2*i/(float)complexity) );
 		}
 	}
 
-	Vec<Vec3> colors( positions.size(), color );
-
-
 	glEnableVertexAttribArray( 0 );
-	glEnableVertexAttribArray( 1 );
 	glVertexAttribPointer( 0, 3, GL_FLOAT, false, 0, &(positions[0][0]) );
-	glVertexAttribPointer( 1, 3, GL_FLOAT, false, 0, &(colors[0][0]) );
 	glDrawArrays( GL_TRIANGLES, 0, positions.size() );
 	glDisableVertexAttribArray( 0 );
-	glDisableVertexAttribArray( 1 );
-
-	glEnableClientState( GL_VERTEX_ARRAY );
-	glEnableClientState( GL_NORMAL_ARRAY );
-	glVertexPointer( 3, GL_FLOAT, 0, &positions[0][0] );
-	glNormalPointer( GL_FLOAT, 0, &normals[0][0] );
-	glDrawArrays( GL_QUAD_STRIP, 0, positions.size() );
-	glDisableClientState( GL_VERTEX_ARRAY );
-	glDisableClientState( GL_NORMAL_ARRAY );
 }
 
 
 //======================================================================================================================
 // renderCube                                                                                                          =
 //======================================================================================================================
-void Renderer::Dbg::renderCube( bool cols, float size )
+void Renderer::Dbg::renderCube( const Transform& trf, const Vec4& color )
 {
-	Vec3 maxPos( 0.5 * size );
-	Vec3 minPos( -0.5 * size );
+	sProg->findUniVar( "color" )->setVec4( &color );
+
+	Vec3 maxPos = Vec3( 0.5 ).getTransformed( trf );
+	Vec3 minPos = Vec3( -0.5 ).getTransformed( trf );
 
-	Vec3 vertPositions[] = {
+	Vec3 points [] = {
 		Vec3( maxPos.x, maxPos.y, maxPos.z ),  // right top front
 		Vec3( minPos.x, maxPos.y, maxPos.z ),  // left top front
 		Vec3( minPos.x, minPos.y, maxPos.z ),  // left bottom front
@@ -178,55 +169,12 @@ void Renderer::Dbg::renderCube( bool cols, float size )
 		Vec3( maxPos.x, minPos.y, minPos.z )   // right bottom back
 	};
 
-	Vec3 bakedVertPositions[] = {
-		vertPositions[0], vertPositions[1], vertPositions[2], vertPositions[3], // front face
-		vertPositions[5], vertPositions[4], vertPositions[7], vertPositions[6], // back face
-		vertPositions[4], vertPositions[0], vertPositions[3], vertPositions[7], // right face
-		vertPositions[1], vertPositions[5], vertPositions[6], vertPositions[2], // left face
-		vertPositions[0], vertPositions[4], vertPositions[5], vertPositions[1], // top face
-		vertPositions[3], vertPositions[2], vertPositions[6], vertPositions[7]  // bottom face
-	};
-
-	static Vec3 normals[] = {
-		Vec3( 0.0, 0.0, 1.0 ),  // front face
-		Vec3( 0.0, 0.0, -1.0 ), // back face
-		Vec3( 1.0, 0.0, 0.0 ),  // right face
-		Vec3( -1.0, 0.0, 0.0 ), // left face
-		Vec3( 0.0, 1.0, 0.0 ),  // top face
-		Vec3( 0.0, -1.0, 0.0 )  // bottom face
-	};
+	const ushort indeces [] = { 0, 1, 2, 3, 4, 0, 3, 7, 1, 5, 6, 2, 5, 4, 7, 6, 0, 4, 5, 1, 3, 2, 6, 7 };
 
-	static Vec3 bakedNormals [] = {
-		normals[0], normals[0], normals[0], normals[0],
-		normals[1], normals[1], normals[1], normals[1],
-		normals[2], normals[2], normals[2], normals[2],
-		normals[3], normals[3], normals[3], normals[3],
-		normals[4], normals[4], normals[4], normals[4],
-		normals[5], normals[5], normals[5], normals[5]
-	};
-
-	static Vec3 colors [] = {
-		Vec3( 0.0, 0.0, 1.0 ),
-		Vec3( 0.0, 0.0, 0.5 ),
-		Vec3( 1.0, 0.0, 0.0 ),
-		Vec3( 0.5, 0.0, 1.0 ),
-		Vec3( 0.0, 1.0, 1.0 ),
-		Vec3( 0.0, 0.5, 1.0 )
-	};
-
-	static Vec3 bakedColors [] = {
-		colors[0], colors[0], colors[0], colors[0],
-		colors[1], colors[1], colors[1], colors[1],
-		colors[2], colors[2], colors[2], colors[2],
-		colors[3], colors[3], colors[3], colors[3],
-		colors[4], colors[4], colors[4], colors[4],
-		colors[5], colors[5], colors[5], colors[5]
-	};
-
-	glEnableClientState( GL_VERTEX_ARRAY );
-	glVertexPointer( 3, GL_FLOAT, 0, bakedVertPositions );
-	glDrawArrays( GL_QUADS, 0, 24 );
-	glDisableClientState( GL_VERTEX_ARRAY );
+	glEnableVertexAttribArray( 0 );
+	glVertexAttribPointer( 0, 3, GL_FLOAT, false, 0, &(points[0][0]) );
+	glDrawElements( GL_QUADS, sizeof(indeces)/sizeof(ushort), GL_UNSIGNED_SHORT, indeces );
+	glDisableVertexAttribArray( 0 );
 }
 
 

+ 2 - 2
src/Renderer/Renderer.h

@@ -358,8 +358,8 @@ class Renderer
 			public:
 				Dbg( Renderer& r_ );
 				void renderGrid();
-				void renderSphere( float radius, int complexity, const Vec3& color );
-				void renderCube( bool cols = false, float size = 1.0 );
+				void renderSphere( const Transform& trf, const Vec4& color, int complexity  );
+				void renderCube( const Transform& trf, const Vec4& color );
 
 			private:
 				Fbo fbo;

+ 0 - 3
src/Scene/Camera.cpp

@@ -41,12 +41,9 @@ void Camera::render()
 
 
 	glEnableVertexAttribArray( 0 );
-	glEnableVertexAttribArray( 1 );
 	glVertexAttribPointer( 0, 3, GL_FLOAT, false, 0, points );
-	glVertexAttribPointer( 1, 3, GL_FLOAT, false, 0, colors );
 	glDrawElements( GL_LINES, 16, GL_UNSIGNED_SHORT, indeces );
 	glDisableVertexAttribArray( 0 );
-	glDisableVertexAttribArray( 1 );
 }
 
 

+ 2 - 17
src/Scene/Light.cpp

@@ -40,27 +40,12 @@ void Light::deinit()
 }
 
 
-//======================================================================================================================
-// renderSphere                                                                                                        =
-//======================================================================================================================
-static void renderSphere( const Mat4& tsl, const Vec3& col )
-{
-	glPushMatrix();
-
-	/// @todo move to GL 3.x
-	app->getMainRenderer()->multMatrix( tsl );
-	app->getMainRenderer()->dbg.renderSphere( 1.0/8.0, 8, col );
-
-	glPopMatrix();
-}
-
-
 //======================================================================================================================
 // render                                                                                                              =
 //======================================================================================================================
 void PointLight::render()
 {
-	renderSphere( Mat4(getWorldTransform()), lightProps->getDiffuseColor() );
+	app->getMainRenderer()->dbg.renderSphere( getWorldTransform(), Vec4( lightProps->getDiffuseColor(), 1.0 ), 8 );
 }
 
 
@@ -69,5 +54,5 @@ void PointLight::render()
 //======================================================================================================================
 void SpotLight::render()
 {
-	renderSphere( Mat4(getWorldTransform()), lightProps->getDiffuseColor() );
+	app->getMainRenderer()->dbg.renderSphere( getWorldTransform(), Vec4( lightProps->getDiffuseColor(), 1.0 ), 8 );
 }

+ 1 - 11
src/Scene/ParticleEmitter.cpp

@@ -168,18 +168,8 @@ void ParticleEmitter::update()
 //======================================================================================================================
 void ParticleEmitter::render()
 {
-	glPushMatrix();
-	app->getMainRenderer()->multMatrix( getWorldTransform() );
-
-	app->getMainRenderer()->color3( Vec3(1.0) );
-
-	/*glEnableClientState( GL_VERTEX_ARRAY );
-	glVertexPointer( 3, GL_FLOAT, 0, vertPositions );
-	glDrawElements( GL_LINES, sizeof(vertIndices)/sizeof(uint), GL_UNSIGNED_INT, vertIndices );
-	glDisableClientState( GL_VERTEX_ARRAY );*/
 	glPolygonMode( GL_FRONT, GL_LINE );
-	app->getMainRenderer()->dbg.renderCube();
+	app->getMainRenderer()->dbg.renderCube( getWorldTransform(), Vec4(1.0) );
 	glPolygonMode( GL_FRONT, GL_FILL );
 
-	glPopMatrix();
 }

+ 4 - 16
src/Util/App.cpp

@@ -35,26 +35,20 @@ void App::parseCommandLineArgs( int argc, char* argv[] )
 //======================================================================================================================
 // Constructor                                                                                                         =
 //======================================================================================================================
-App::App():
+App::App( int argc, char* argv[] ):
 	windowW( 1280 ),
 	windowH( 720 ),
 	terminalColoringEnabled( true ),
 	fullScreenFlag( false )
 {
-}
-
+	app = this;
 
-//======================================================================================================================
-// init                                                                                                                =
-//======================================================================================================================
-void App::init( int argc, char* argv[] )
-{
 	parseCommandLineArgs( argc, argv );
 
 	printAppInfo();
 
 	if( isCreated )
-		FATAL( "You cannot init a second App instance" )
+		FATAL( "You cannot init a second App instance" );
 
 	isCreated = true;
 
@@ -62,12 +56,6 @@ void App::init( int argc, char* argv[] )
 	mainRenderer = new MainRenderer;
 	activeCam = NULL;
 
-
-	/*windowW = 1440;
-	windowH = 900;*/
-
-
-
 	timerTick = 1000/40; // in ms. 1000/Hz
 	time = 0;
 }
@@ -194,7 +182,7 @@ void App::printAppInfo()
 {
 	stringstream msg;
 	msg << "App info: debugging ";
-	#if defined( DEBUG )
+	#if defined( DEBUG_ENABLED )
 		msg << "on, ";
 	#else
 		msg << "off, ";

+ 1 - 2
src/Util/App.h

@@ -32,9 +32,8 @@ class App
 	public:
 		uint timerTick;
 
-		App();
+		App( int argc, char* argv[] );
 		~App() {}
-		void init( int argc, char* argv[] );
 		void initWindow();
 		void quitApp( int code );
 		void waitForNextFrame();

+ 11 - 0
src/Util/Common.cpp

@@ -99,3 +99,14 @@ ostream& msgSuffix( ostream& cs )
 	return cs;
 }
 
+
+//======================================================================================================================
+// msgSuffixFatal                                                                                                      =
+//======================================================================================================================
+ostream& msgSuffixFatal( ostream& cs )
+{
+	ostream& cs_ = msgSuffix( cs );
+	::exit(1);
+	return cs;
+}
+

+ 6 - 5
src/Util/Common.h

@@ -51,6 +51,7 @@ enum MsgType
 
 extern ostream& msgPrefix( MsgType msgType, const char* file, int line, const char* func );
 extern ostream& msgSuffix( ostream& cs );
+extern ostream& msgSuffixFatal( ostream& cs );
 
 #ifdef __GNUG__
 	#define FUNCTION __PRETTY_FUNCTION__
@@ -65,13 +66,13 @@ extern ostream& msgSuffix( ostream& cs );
 #define WARNING( x ) msgPrefix( MT_WARNING, __FILE__, __LINE__, FUNCTION ) << x << msgSuffix
 
 /// Show an error and exit application
-#define FATAL( x ) { msgPrefix( MT_FATAL, __FILE__, __LINE__, FUNCTION ) << x << ". Bye!" << msgSuffix; ::exit( 1 ); }
+#define FATAL( x ) msgPrefix( MT_FATAL, __FILE__, __LINE__, FUNCTION ) << x << ". Bye!" << msgSuffixFatal
 
 /// Show an info message
 #define INFO( x ) msgPrefix( MT_INFO, __FILE__, __LINE__, FUNCTION ) << x << msgSuffix
 
 /// Reverse assertion
-#ifdef DEBUG
+#if defined( DEBUG_ENABLED )
 	#define DEBUG_ERR( x ) \
 		if( x ) \
 			msgPrefix( MT_DEBUG_ERR, __FILE__, __LINE__, FUNCTION ) << #x << msgSuffix
@@ -81,7 +82,7 @@ extern ostream& msgSuffix( ostream& cs );
 
 
 /// code that executes on debug
-#ifdef DEBUG
+#ifdef DEBUG_ENABLED
 	#define DEBUG_CODE if( true )
 #else
 	#define DEBUG_CODE if( false )
@@ -101,7 +102,7 @@ extern ostream& msgSuffix( ostream& cs );
  * - Dont use it with semicolon at the end (eg PROPERTY_RW( .... );) because of a doxygen bug
  */
 #define PROPERTY_RW( __Type__, __varName__, __setFunc__, __getFunc__ ) \
-	private: \
+	protected: \
 		typedef __Type__ __Dummy__##__varName__; \
 		__Dummy__##__varName__ __varName__; \
 	public: \
@@ -122,7 +123,7 @@ extern ostream& msgSuffix( ostream& cs );
  * - Dont use it with semicolon at the end (eg PROPERTY_RW( .... );) because of a doxygen bug
  */
 #define PROPERTY_R( __Type__, __varName__, __getFunc__ ) \
-	private: \
+	protected: \
 		typedef __Type__ __Dummy__##__varName__; \
 		__Dummy__##__varName__ __varName__; \
 	public: \

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.