Browse Source

Fixes to shader library for lightmaps to be supported on colored-unlit shaders.
Renamed bumped.vert/.frag to textured-bumped.vert/.frag

setaylor 13 years ago
parent
commit
b7aceede71

+ 2 - 2
gameplay/gameplay.vcxproj

@@ -206,8 +206,6 @@
     <None Include="res\logo_powered_black.png" />
     <None Include="res\logo_powered_white.png" />
     <None Include="res\logo_white.png" />
-    <None Include="res\shaders\bumped.frag" />
-    <None Include="res\shaders\bumped.vert" />
     <None Include="res\shaders\colored-unlit.frag" />
     <None Include="res\shaders\colored-unlit.vert" />
     <None Include="res\shaders\colored.frag" />
@@ -221,6 +219,8 @@
     <None Include="res\shaders\lib\lighting-spot.frag" />
     <None Include="res\shaders\lib\lighting-spot.vert" />
     <None Include="res\shaders\lib\lighting.frag" />
+    <None Include="res\shaders\textured-bumped.frag" />
+    <None Include="res\shaders\textured-bumped.vert" />
     <None Include="res\shaders\textured-unlit.frag" />
     <None Include="res\shaders\textured-unlit.vert" />
     <None Include="res\shaders\textured.frag" />

+ 6 - 6
gameplay/gameplay.vcxproj.filters

@@ -637,12 +637,6 @@
     <None Include="res\shaders\colored-unlit.frag">
       <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\bumped.vert">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\bumped.frag">
-      <Filter>res\shaders</Filter>
-    </None>
     <None Include="res\shaders\lib\lighting.frag">
       <Filter>res\shaders\lib</Filter>
     </None>
@@ -670,6 +664,12 @@
     <None Include="res\shaders\lib\attributes-skinning.vert">
       <Filter>res\shaders\lib</Filter>
     </None>
+    <None Include="res\shaders\textured-bumped.frag">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\textured-bumped.vert">
+      <Filter>res\shaders</Filter>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <None Include="src\PhysicsFixedConstraint.inl">

+ 8 - 3
gameplay/res/shaders/colored-unlit.frag

@@ -7,9 +7,11 @@ precision highp float;
 varying vec3 v_color;						// Input Vertex color ( r g b )
 #endif
 
-uniform vec4 u_diffuseColor;               	// Diffuse color
-
 // Uniforms
+uniform vec4 u_diffuseColor;               	// Diffuse color
+#if defined(TEXTURE_LIGHTMAP)
+uniform sampler2D u_lightmapTexture;     	// Lightmap texture
+#endif
 #if defined(MODULATE_COLOR)
 uniform vec4 u_modulateColor;               // Modulation color
 #endif
@@ -26,7 +28,10 @@ void main()
 	#else
 	gl_FragColor = u_diffuseColor;
     #endif
-	
+	#if defined(TEXTURE_LIGHTMAP)
+	vec4 lightColor = texture2D(u_lightmapTexture, v_texCoord);
+	gl_FragColor.a *= lightColor.a;
+	#endif
 	// Global color modulation
 	#if defined(MODULATE_COLOR)
 	gl_FragColor *= u_modulateColor;

+ 0 - 0
gameplay/res/shaders/bumped.frag → gameplay/res/shaders/textured-bumped.frag


+ 0 - 0
gameplay/res/shaders/bumped.vert → gameplay/res/shaders/textured-bumped.vert


+ 3 - 3
gameplay/res/shaders/textured-unlit.frag

@@ -4,7 +4,7 @@ precision highp float;
 
 // Uniforms
 uniform sampler2D u_diffuseTexture;     	// Diffuse texture
-#if defined(TEXTURE_LIGHT)
+#if defined(TEXTURE_LIGHTMAP)
 uniform sampler2D u_lightmapTexture;     	// Lightmap texture
 #endif
 #if defined(MODULATE_COLOR)
@@ -22,8 +22,8 @@ void main()
 {
     // Sample the texture for the color
     gl_FragColor = texture2D(u_diffuseTexture, v_texCoord);
-	#if defined(TEXTURE_LIGHT)
-	vec4 lightColor = texture2D(u_lightTexture, v_texCoord);
+	#if defined(TEXTURE_LIGHTMAP)
+	vec4 lightColor = texture2D(u_lightmapTexture, v_texCoord);
 	gl_FragColor.a *= lightColor.a;
 	#endif
 	// Global color modulation