Panagiotis Christopoulos Charitos 13 éve
szülő
commit
7c3c86013e

+ 3 - 0
shaders/MaterialVertexCommon.glsl

@@ -0,0 +1,3 @@
+#pragma anki include "shaders/MaterialVertexVariables.glsl"
+#pragma anki include "shaders/MaterialCommonFunctions.glsl"
+#pragma anki include "shaders/MaterialVertexFunctions.glsl"

+ 0 - 22
shaders/MaterialVertex.glsl → shaders/MaterialVertexFunctions.glsl

@@ -3,28 +3,6 @@
 
 
 #pragma anki include "shaders/Pack.glsl"
 #pragma anki include "shaders/Pack.glsl"
 
 
-/// @name Attributes
-/// @{
-layout(location = 0) in vec3 position;
-layout(location = 3) in vec2 texCoords;
-#if defined(PASS_COLOR)
-layout(location = 1) in vec3 normal;
-layout(location = 2) in vec4 tangent;
-#endif
-/// @}
-
-/// @name Varyings
-/// @{
-out vec2 vTexCoords;
-#if defined(PASS_COLOR)
-out vec3 vNormal;
-out vec3 vTangent;
-out float vTangentW;
-out vec3 vVertPosViewSpace; ///< For env mapping. AKA view vector
-flat out float vSpecularComponent; ///< Calculate it per fragment
-#endif
-/// @}
-
 //==============================================================================
 //==============================================================================
 #define setVaryings1_DEFINED
 #define setVaryings1_DEFINED
 void setVaryings1(in mat4 modelViewProjectionMat)
 void setVaryings1(in mat4 modelViewProjectionMat)

+ 0 - 21
shaders/MaterialVertexInstancingTranslations.glsl

@@ -1,21 +0,0 @@
-/// @file 
-/// Contains variables and functions for instancing of translations
-
-layout(location = 1) uniform instancingBlock
-{
-	vec3 instancingTranslations[];
-};
-
-//==============================================================================
-#define setVaryings_particle_DEFINED
-void setVaryings_particle(in mat4 billboardModelViewProjectionMat)
-{
-#if defined(PASS_DEPTH) && LOD > 0
-	// No tex coords for you
-#else
-	vTexCoords = texCoords;
-#endif
-
-	gl_Position = billboardModelViewProjectionMat 
-		* vec4(position + instancingTranslations[gl_InstanceID], 1.0);
-}

+ 21 - 0
shaders/MaterialVertexVariables.glsl

@@ -0,0 +1,21 @@
+/// @name Attributes
+/// @{
+layout(location = 0) in vec3 position;
+layout(location = 3) in vec2 texCoords;
+#if defined(PASS_COLOR)
+layout(location = 1) in vec3 normal;
+layout(location = 2) in vec4 tangent;
+#endif
+/// @}
+
+/// @name Varyings
+/// @{
+out vec2 vTexCoords;
+#if defined(PASS_COLOR)
+out vec3 vNormal;
+out vec3 vTangent;
+out float vTangentW;
+out vec3 vVertPosViewSpace; ///< For env mapping. AKA view vector
+flat out float vSpecularComponent; ///< Calculate it per fragment
+#endif
+/// @}

+ 1 - 1
src/resource/MaterialShaderProgramCreator.cpp

@@ -147,7 +147,7 @@ void MaterialShaderProgramCreator::parseInputTag(
 	inpvar->type = inputEl.getChildElement("type").getText();
 	inpvar->type = inputEl.getChildElement("type").getText();
 	XmlElement constEl = inputEl.getChildElementOptional("const");
 	XmlElement constEl = inputEl.getChildElementOptional("const");
 	XmlElement valueEl = inputEl.getChildElement("value");
 	XmlElement valueEl = inputEl.getChildElement("value");
-	XmlElement arrSizeEl = inputEl.getChildElement("arraySize");
+	XmlElement arrSizeEl = inputEl.getChildElementOptional("arraySize");
 
 
 	// Is const?
 	// Is const?
 	if(constEl)
 	if(constEl)