2
0
Panagiotis Christopoulos Charitos 15 жил өмнө
parent
commit
6ac0996106

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 325 - 368
build/debug/Makefile


+ 7 - 3
build/genmakefile.py

@@ -1,5 +1,5 @@
 #!/usr/bin/python3.1
-import sys, os, fnmatch, random
+import sys, os, fnmatch, random, re
 from threading import Thread
 
 
@@ -14,6 +14,7 @@ commonFlags = ""
 compilerFlags = ""
 precompiledHeadersFlags = ""
 linkerFlags = ""
+sourceFilesRegExpr = r".*\.[c++|cpp|cc|cxx|C|c]"
 
 
 #======================================================================================================================================
@@ -116,9 +117,12 @@ exec( compile( source, inputCfgFile, "exec" ) )
 
 # find the cpp files
 source_files = []
+regexpr = re.compile( sourceFilesRegExpr )
 for sourceDir in sourcePaths:
 	files = os.listdir( sourceDir )
-	for file_ in fnmatch.filter( files, "*.cpp" ):
+	for file_ in files:
+		if not regexpr.match( file_ ): continue
+		
 		sfile = SourceFile()
 		
 		(fname_wo_ext, ext) = os.path.splitext( file_ )
@@ -128,7 +132,7 @@ for sourceDir in sourcePaths:
 		# search all the source files and resolve conflicts in .o
 		for sfile1 in source_files:
 			if sfile1.objFile == sfile.objFile:
-				print( "There is a conflict with \"" + sfile1.cppFile + "\" and \"" + sfile.cppFile + "\" but dont worry." )
+				print( "There is a naming conflict between \"" + sfile1.cppFile + "\" and \"" + sfile.cppFile + "\" but dont worry." )
 				random.seed()
 				sfile.objFile = str(random.randint(1,99)) + "." + sfile.objFile;
 	

+ 0 - 14
src/Main.cpp

@@ -44,20 +44,6 @@ PointLight* point_lights[10];
 SpotLight* spot_lights[2];
 ParticleEmitter* partEmitter;
 
-class floor_t: public Camera
-{
-	public:
-		void render()
-		{
-			R::Dbg::renderCube( true, 1.0 );
-		}
-
-		void renderDepth()
-		{
-			R::Dbg::renderCube( true, 1.0 );
-		}
-}* floor_;
-
 
 // Physics
 BulletDebuger debugDrawer;

+ 24 - 14
src/NAMING

@@ -1,27 +1,37 @@
-This file contains some of the naming convention we use in AnKi
+This file contains some of the naming shortcuts we use in AnKi
 
-Shader Program     : shaderProg or sProg
-Material           : mtl
-Property           : prop
+
+Array              : arr
 Animation          : anim
 Application        : app
+Buffer             : buff
 Camera             : cam
 Color              : col
 Controller         : ctrl
+Feature            : feat
+Fragment           : frag
+Geometry           : geom
+Location           : loc
+Material           : mtl
+Matrix             : mat
+Number             : num
+Physics            : phy
+Property           : prop
+Quadrilateral      : quad
+Quaternion         : quat
+Resource           : rsrc
+Rotation           : rot
+Shader             : shdr
+Shader Program     : shaderProg or sProg
 Skeletal Animation : sAnim
 Skeleton           : skel
+Text               : txt
+Texture            : tex
 Transformation     : trf
 Translation        : tsl
-Rotation           : rot
-Vector             : vec
-Quaternion         : quat
-Matrix             : mat
+Triangle           : tri
 Utility            : util
-Texture            : tex
-Text               : txt
-Location           : loc
 Variable           : var
-Resource           : rsrc
-Fragment           : frag
+Vector             : vec
 Vertex             : vert
-Triangle           : tri
+

+ 13 - 0
src/Physics/PhyConversions.h

@@ -58,5 +58,18 @@ inline btTransform toBt( const Mat4& m )
 	return r;
 }
 
+inline btQuaternion toBt( const Quat& q )
+{
+	return btQuaternion( q.x, q.y, q.z, q.w );
+}
+
+inline btTransform toBt( const Transform& trf )
+{
+	btTransform r;
+	r.setOrigin( toBt(trf.translation) );
+	r.setRotation( toBt( Quat(trf.rotation) ) );
+	return r;
+}
+
 
 #endif

+ 29 - 0
src/Physics/PhyWorld.cpp

@@ -0,0 +1,29 @@
+#include "PhyWorld.h"
+
+
+//=====================================================================================================================================
+// createNewRigidBody                                                                                                                 =
+//=====================================================================================================================================
+btRigidBody* PhyWorld::createNewRigidBody( float mass, const Transform& startTransform, btCollisionShape* shape, Node* node )
+{
+	DEBUG_ERR( (!shape || shape->getShapeType() != INVALID_SHAPE_PROXYTYPE) )
+
+	//rigidbody is dynamic if and only if mass is non zero, otherwise static
+	bool isDynamic = (mass != 0.0);
+
+	btVector3 localInertia( 0, 0, 0 );
+	if( isDynamic )
+		shape->calculateLocalInertia( mass,localInertia );
+
+
+	MotionState* myMotionState = new MotionState( toBt(startTransform), node );
+
+	btRigidBody::btRigidBodyConstructionInfo cInfo( mass, myMotionState, shape, localInertia );
+
+	btRigidBody* body = new btRigidBody( cInfo );
+	body->setContactProcessingThreshold( defaultContactProcessingThreshold );
+
+	dynamicsWorld->addRigidBody( body );
+	return body;
+}
+

+ 13 - 1
src/Physics/PhyWorld.h

@@ -10,6 +10,7 @@
 class PhyWorld
 {
 	PROPERTY_R( btDiscreteDynamicsWorld*, dynamicsWorld, getDynamicsWorld )
+	PROPERTY_R( float, defaultContactProcessingThreshold, getDefaultContactProcessingThreshold )
 
 	public:
 		btDefaultCollisionConfiguration* collisionConfiguration;
@@ -28,7 +29,8 @@ class PhyWorld
 		};
 
 
-		PhyWorld()
+		PhyWorld() :
+			defaultContactProcessingThreshold( BT_LARGE_FLOAT )
 		{
 			collisionConfiguration = new btDefaultCollisionConfiguration();
 			dispatcher = new	btCollisionDispatcher(collisionConfiguration);
@@ -37,6 +39,16 @@ class PhyWorld
 			dynamicsWorld = new btDiscreteDynamicsWorld( dispatcher, broadphase, sol, collisionConfiguration );
 			dynamicsWorld->setGravity( btVector3(0,-10,0) );
 		}
+
+		/**
+		 * Creates a new rigid body and adds it to the @ref dynamicsWorld. It allocates memory so the caller is responsible for cleaning up
+		 * @param mass The mass of the rigid body. Put zero for static unmovable objects
+		 * @param startTransform The initial position and orientation
+		 * @param shape The collision shape
+		 * @param node The scene node the body moves
+		 * @return A new rigid body
+		 */
+		static btRigidBody* createNewRigidBody( float mass, const Transform& startTransform, btCollisionShape* shape, Node* node );
 };
 
 #endif

+ 4 - 0
src/Renderer/Renderer.cpp

@@ -110,6 +110,10 @@ void init()
 	PRINT( "Renderer initializing..." );
 
 	glewInit();
+
+	// print GL info
+	cout << "OpenGL info: OGL_" << glGetString(GL_VERSION) << " GLSL_" << glGetString(GL_SHADING_LANGUAGE_VERSION) << endl;
+
 	if( !glewIsSupported("GL_VERSION_2_1") )
 		WARNING( "OpenGL ver 2.1 not supported. The application may crash (and burn)" );
 

+ 2 - 2
src/Scene/ParticleEmitter.cpp

@@ -156,10 +156,10 @@ void ParticleEmitter::update()
 			// do the rest
 			++partNum;
 			if( partNum >= particlesPerEmittion ) break;
-		}
+		} // end for all particles
 
 		timeOfPrevEmittion = crntTime;
-	}
+	} // end if can emit
 
 	timeOfPrevUpdate = crntTime;
 }

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно