Sfoglia il codice sorgente

Working on the new renderer

Panagiotis Christopoulos Charitos 15 anni fa
parent
commit
7a97558bea

File diff suppressed because it is too large
+ 367 - 352
build/debug/Makefile


+ 2 - 2
docs/Doxyfile

@@ -1278,8 +1278,8 @@ INCLUDE_FILE_PATTERNS  = *.h \
 # undefined via #undef or recursively expanded use the := operator 
 # instead of the = operator.
 
-PREDEFINED             = "PROPERTY_RW(_v0_,_v1_,_v2_,_v3_):=_v0_ _v1_;" \
-                         "PROPERTY_R(_v0_,_v1_,_v2_):=_v0_ _v1_;"
+PREDEFINED             = "PROPERTY_RW(_v0_,_v1_,_v2_,_v3_):=_v3_;/**< Getter for _v1_*/ _v2_;/**< Setter for _v1_*/ _v0_ _v1_;" \
+                         "PROPERTY_R(_v0_,_v1_,_v2_):=_v2_;/**< Getter for _v1_*/ _v0_ _v1_;"
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
 # this tag can be used to specify a list of macro names that should be expanded. 

+ 1 - 0
TODO → docs/TODO

@@ -1,3 +1,4 @@
+
 - Continue working on the new coding style in shaders
 - Changes in the blending objects problem. The BS will become one stage and the PPS will be divided in two steps. The first will apply the SSAO and the EdgeAA in the IS_FAI and the second will do the rest
 - The second Physics demo: Create a box that is geting moved by the user. It has to interact with the other boxes

+ 3 - 3
src/Renderer/Renderer.cpp

@@ -467,15 +467,15 @@ takeScreenshot
 */
 void takeScreenshot( const char* filename )
 {
-	char* ext = Util::getFileExtension( filename );
+	string ext = Util::getFileExtension( filename );
 	bool ret;
 
 	// exec from this extension
-	if( strcmp( ext, "tga" ) == 0 )
+	if( ext == "tga" )
 	{
 		ret = TakeScreenshotTGA( filename );
 	}
-	else if( strcmp( ext, "jpg" ) == 0 )
+	else if( ext == "jpg" || ext == "jpeg" )
 	{
 		ret = TakeScreenshotJPEG( filename );
 	}

+ 3 - 3
src/Renderer2/MainRenderer.cpp

@@ -181,15 +181,15 @@ bool MainRenderer::takeScreenshotJpeg( const char* filename )
 //=====================================================================================================================================
 void MainRenderer::takeScreenshot( const char* filename )
 {
-	char* ext = Util::getFileExtension( filename );
+	string ext = Util::getFileExtension( filename );
 	bool ret;
 
 	// exec from this extension
-	if( strcmp( ext, "tga" ) == 0 )
+	if( ext == "tga" )
 	{
 		ret = takeScreenshotTga( filename );
 	}
-	else if( strcmp( ext, "jpg" ) == 0 )
+	else if( ext == "jpg" || ext == "jpeg" )
 	{
 		ret = takeScreenshotJpeg( filename );
 	}

+ 9 - 1
src/Renderer2/MainRenderer.h

@@ -6,7 +6,7 @@
 
 
 /**
- * Main renderer
+ * Main onscreen renderer
  */
 class MainRenderer: public Renderer
 {
@@ -27,6 +27,9 @@ class MainRenderer: public Renderer
 	public:
 		MainRenderer(): screenshotJpegQuality( 90 ) {}
 
+		/**
+		 * The same as Renderer::init but with additional initialization. @see Renderer::init
+		 */
 		void init( const RendererInitializer& initializer );
 
 		/**
@@ -34,6 +37,11 @@ class MainRenderer: public Renderer
 		 * @param cam @see Renderer::render
 		 */
 		void render( Camera& cam );
+
+		/**
+		 * Save the color buffer to a tga (lossless & uncompressed & slow) or jpeg (lossy & compressed * fast)
+		 * @param filename The file to save
+		 */
 		void takeScreenshot( const char* filename ); ///< Save the colorbuffer as 24bit uncompressed TGA image
 };
 

+ 9 - 9
src/Renderer2/Renderer.hpp

@@ -14,7 +14,7 @@ class RendererInitializer;
 
 
 /**
- * The renderer class
+ * Offscreen renderer
  *
  * It is a class and not a namespace because we may need external renderers for security cameras for example
  */
@@ -372,14 +372,14 @@ class Renderer
 		static Vec3 unproject( const Vec3& windowCoords, const Mat4& modelViewMat, const Mat4& projectionMat, const int view[4] );
 
 		/**
-		 *
-		 * @param left
-		 * @param right
-		 * @param bottom
-		 * @param top
-		 * @param near
-		 * @param far
-		 * @return
+		 * It returns an orthographic projection matrix
+		 * @param left left vertical clipping plane
+		 * @param right right vertical clipping plane
+		 * @param bottom bottom horizontal clipping plane
+		 * @param top top horizontal clipping plane
+		 * @param near nearer distance of depth clipping plane
+		 * @param far farther distance of depth clipping plane
+		 * @return A 4x4 projection matrix
 		 */
 		static Mat4 ortho( float left, float right, float bottom, float top, float near, float far );
 

+ 3 - 3
src/Resources/Helpers/Image.cpp

@@ -261,10 +261,10 @@ bool Image::loadPNG( const char* filename )
 bool Image::load( const char* filename )
 {
 	// get the extension
-	char* ext = Util::getFileExtension( filename );
+	string ext = Util::getFileExtension( filename );
 
 	// load from this extension
-	if( strcmp( ext, "tga" ) == 0 )
+	if( ext == "tga" )
 	{
 		if( !loadTGA( filename ) )
 		{
@@ -272,7 +272,7 @@ bool Image::load( const char* filename )
 			return false;
 		}
 	}
-	else if( strcmp( ext, "png" ) == 0 )
+	else if( ext == "png" )
 	{
 		if( !loadPNG( filename ) )
 		{

+ 2 - 2
src/Util/Util.cpp

@@ -126,7 +126,7 @@ string getFunctionFromPrettyFunction( const char* prettyFunction )
 //=====================================================================================================================================
 // getFileExtension                                                                                                                   =
 //=====================================================================================================================================
-char* getFileExtension( const char* path )
+string getFileExtension( const char* path )
 {
 	char* str = (char*)path + strlen(path) - 1;
 	for(;;)
@@ -135,7 +135,7 @@ char* getFileExtension( const char* path )
 		str--;
 	}
 
-	if( str == (char*)path + strlen(path) - 1 ) ERROR( "Please puth something after the '.' in path \"" << path << "\". Idiot" );
+	if( str == (char*)path + strlen(path) - 1 ) ERROR( "Please put something after the '.' in path \"" << path << "\". Idiot" );
 	if( str+1 == path ) ERROR( "Path \"" << path << "\" doesnt contain a '.'. What the fuck?" );
 
 	return str+1;

+ 1 - 1
src/Util/Util.h

@@ -15,7 +15,7 @@ extern double randRange( double min, double max ); ///< Pick a random number fro
 
 extern string      readFile( const char* filename ); ///< Open a text file and return its contents into a string
 extern Vec<string> getFileLines( const char* filename ); ///< Open a text file and return its lines into a string vector
-extern char*       getFileExtension( const char* path ); ///< Self explanatory
+extern string      getFileExtension( const char* path ); ///< Self explanatory
 extern char*       cutPath( const char* path ); ///< Given a full path return only the file. Used only to cut the path from __FILE__ and return the actual file name and some other cases
 extern string      getPath( const char* path ); ///< Get a file and get its path
 extern string      getFunctionFromPrettyFunction( const char* pretty_function ); /// The function gets __PRETTY_FUNCTION__ and strips it to get only the function name with its namespace

Some files were not shown because too many files changed in this diff