Panagiotis Christopoulos Charitos 15 anni fa
parent
commit
f4ca67b0b3

+ 2 - 1
docs/manual

@@ -319,4 +319,5 @@ ToDo list
 - Re-enable the stencil tex in Ms.cpp and replace all the stencil buffers with
   that (Smo, Bs) to save memory
 - See if the restrictions in FBOs (all FAIs same size) still apply
-
+- See what happens if I write *#pragma anki attribute <randName> 10* where
+  randName does not exist. Do the same for tranform feedback varyings

+ 3 - 3
shaders/HwSkinningTrffbGeneric.glsl

@@ -11,11 +11,11 @@ const int MAX_BONES_PER_MESH = 60;
 uniform mat3 skinningRotations[MAX_BONES_PER_MESH];
 uniform vec3 skinningTranslations[MAX_BONES_PER_MESH];
 
-#pragma anki tranformFeedbackVarying outPosition
+#pragma anki transformFeedbackVarying outPosition
 varying vec3 outPosition;
-#pragma anki tranformFeedbackVarying outNormal
+#pragma anki transformFeedbackVarying outNormal
 varying vec3 outNormal;
-#pragma anki tranformFeedbackVarying outTangent
+#pragma anki transformFeedbackVarying outTangent
 varying vec4 outTangent;
 
 

+ 10 - 4
src/Main.cpp

@@ -291,7 +291,7 @@ void init()
 
 
 //======================================================================================================================
-//                                                                                                                     =
+// mainLoop                                                                                                            =
 //======================================================================================================================
 void mainLoop()
 {
@@ -402,7 +402,7 @@ void mainLoop()
 	INFO("Exiting main loop (" << App::getTicks()-ticks << ")");
 }
 
-
+#include "ShaderPrePreprocessor.h"
 //======================================================================================================================
 // main                                                                                                                =
 //======================================================================================================================
@@ -410,9 +410,15 @@ int main(int argc, char* argv[])
 {
 	new App(argc, argv);
 
-	init();
+	ShaderPrePreprocessor s;
+	s.parseFile("shaders/HwSkinningTrffbGeneric.glsl");
+	for(uint i=0; i<s.getOutput().getTrffbVaryings().size(); i++)
+	{
+		INFO(s.getOutput().getTrffbVaryings()[i].name);
+	}
+	return 0;
 
-	ShaderProg* a = Resource::shaders.load("shaders/HwSkinningTrffbGeneric.glsl");
+	init();
 
 	mainLoop();
 

+ 2 - 1
src/Resources/Helpers/ShaderPrePreprocessor.cpp

@@ -319,7 +319,8 @@ bool ShaderPrePreprocessor::parseFileForPragmas(const string& filename, int dept
 					}
 					else
 					{
-						PARSE_WARN("Ignoring incorrect #pragma anki");
+						PARSE_ERR("#pragma anki followed by incorrect " << token->getInfoStr());
+						return false;
 					}
 				} // end if anki
 				

+ 11 - 12
src/Resources/ShaderProg.cpp

@@ -117,13 +117,13 @@ uint ShaderProg::createAndCompileShader(const char* sourceCode, const char* prep
 	if(!success)
 	{
 		// print info log
-		int info_len = 0;
+		int infoLen = 0;
 		int charsWritten = 0;
 		char* infoLog = NULL;
 
-		glGetShaderiv(glId, GL_INFO_LOG_LENGTH, &info_len);
-		infoLog = (char*)malloc((info_len+1)*sizeof(char));
-		glGetShaderInfoLog(glId, info_len, &charsWritten, infoLog);
+		glGetShaderiv(glId, GL_INFO_LOG_LENGTH, &infoLen);
+		infoLog = (char*)malloc((infoLen+1)*sizeof(char));
+		glGetShaderInfoLog(glId, infoLen, &charsWritten, infoLog);
 		
 		const char* shaderType;
 		switch(type)
@@ -162,15 +162,15 @@ bool ShaderProg::link()
 	if(!success)
 	{
 		int info_len = 0;
-		int chars_written = 0;
-		char* info_log_txt = NULL;
+		int charsWritten = 0;
+		char* infoLogTxt = NULL;
 
 		glGetProgramiv(glId, GL_INFO_LOG_LENGTH, &info_len);
 
-		info_log_txt = (char*)malloc((info_len+1)*sizeof(char));
-		glGetProgramInfoLog(glId, info_len, &chars_written, info_log_txt);
-		SHADER_ERROR("Link log follows:\n" << info_log_txt);
-		free(info_log_txt);
+		infoLogTxt = (char*)malloc((info_len+1)*sizeof(char));
+		glGetProgramInfoLog(glId, info_len, &charsWritten, infoLogTxt);
+		SHADER_ERROR("Link log follows:\n" << infoLogTxt);
+		free(infoLogTxt);
 		return false;
 	}
 
@@ -260,8 +260,7 @@ bool ShaderProg::bindCustomAttribLocs(const ShaderPrePreprocessor& pars) const
 //======================================================================================================================
 bool ShaderProg::load(const char* filename)
 {
-	if(!customLoad(filename, "")) return false;
-	return true;
+	return customLoad(filename, "");
 }
 
 

+ 6 - 6
src/Util/App.h

@@ -12,15 +12,15 @@
  */
 class App
 {
-	PROPERTY_R(uint, windowW, getWindowWidth) ///< @ref PROPERTY_R : The main window width
-	PROPERTY_R(uint, windowH, getWindowHeight) ///< @ref PROPERTY_R : The main window height
-	PROPERTY_R(bool, terminalColoringEnabled, isTerminalColoringEnabled) ///< @ref PROPERTY_R : Terminal coloring for Unix terminals. Default is enabled
+	PROPERTY_R(uint, windowW, getWindowWidth) ///< The main window width
+	PROPERTY_R(uint, windowH, getWindowHeight) ///< The main window height
+	PROPERTY_R(bool, terminalColoringEnabled, isTerminalColoringEnabled) ///< Terminal coloring for Unix terminals. Default on
 	PROPERTY_R(boost::filesystem::path, settingsPath, getSettingsPath)
 	PROPERTY_R(boost::filesystem::path, cachePath, getCachePath)
 
-	PROPERTY_RW(class Scene*, scene, setScene, getScene) ///< @ref PROPERTY_RW : Pointer to the current scene
-	PROPERTY_RW(class MainRenderer*, mainRenderer, setMainRenderer, getMainRenderer) ///< @ref PROPERTY_RW : Pointer to the main renderer
-	PROPERTY_RW(class Camera*, activeCam, setActiveCam, getActiveCam) ///< @ref PROPERTY_RW : Pointer to the current camera
+	PROPERTY_RW(class Scene*, scene, setScene, getScene) ///< Pointer to the current scene
+	PROPERTY_RW(class MainRenderer*, mainRenderer, setMainRenderer, getMainRenderer) ///< Pointer to the main renderer
+	PROPERTY_RW(class Camera*, activeCam, setActiveCam, getActiveCam) ///< Pointer to the current camera
 
 	private:
 		static bool isCreated; ///< A flag to ensure one @ref App instance