Преглед изворни кода

Merge branch 'next' of https://github.com/blackberry/GamePlay into next

Adam Blake пре 13 година
родитељ
комит
77c91b8884
34 измењених фајлова са 296 додато и 289 уклоњено
  1. 3 3
      gameplay-newproject.sh
  2. 4 56
      gameplay/gameplay.xcodeproj/project.pbxproj
  3. 9 9
      gameplay/res/shaders/colored-unlit.frag
  4. 12 12
      gameplay/res/shaders/colored-unlit.vert
  5. 24 21
      gameplay/res/shaders/colored.frag
  6. 10 9
      gameplay/res/shaders/colored.vert
  7. 17 0
      gameplay/res/shaders/font.frag
  8. 19 0
      gameplay/res/shaders/font.vert
  9. 15 0
      gameplay/res/shaders/form.frag
  10. 16 0
      gameplay/res/shaders/form.vert
  11. 0 0
      gameplay/res/shaders/lighting-directional.frag
  12. 0 1
      gameplay/res/shaders/lighting-directional.vert
  13. 0 0
      gameplay/res/shaders/lighting-point.frag
  14. 0 0
      gameplay/res/shaders/lighting-point.vert
  15. 0 0
      gameplay/res/shaders/lighting-spot.frag
  16. 0 0
      gameplay/res/shaders/lighting-spot.vert
  17. 0 0
      gameplay/res/shaders/lighting.frag
  18. 0 0
      gameplay/res/shaders/skinning-none.vert
  19. 0 0
      gameplay/res/shaders/skinning.vert
  20. 16 0
      gameplay/res/shaders/sprite.frag
  21. 19 0
      gameplay/res/shaders/sprite.vert
  22. 16 17
      gameplay/res/shaders/terrain.frag
  23. 3 4
      gameplay/res/shaders/terrain.vert
  24. 27 23
      gameplay/res/shaders/textured-bumped.frag
  25. 9 10
      gameplay/res/shaders/textured-bumped.vert
  26. 2 2
      gameplay/res/shaders/textured-unlit.frag
  27. 6 6
      gameplay/res/shaders/textured-unlit.vert
  28. 21 22
      gameplay/res/shaders/textured.frag
  29. 12 14
      gameplay/res/shaders/textured.vert
  30. 4 29
      gameplay/src/Font.cpp
  31. 4 22
      gameplay/src/Form.cpp
  32. 19 0
      gameplay/src/PlatformiOS.mm
  33. 4 28
      gameplay/src/SpriteBatch.cpp
  34. 5 1
      gameplay/src/TerrainPatch.cpp

+ 3 - 3
gameplay-newproject.sh

@@ -159,7 +159,7 @@ gpPathAbs=`pwd`
 common_path=$projPath
 back=
 while [ "${gpPathAbs#$common_path}" = "${gpPathAbs}" ]; do
-	common_path=$(dirname $common_path)
+	common_path=$(dirname "$common_path")
 	if [ -z "$back" ]; then
 		back=".."
 	else
@@ -280,9 +280,9 @@ aliassedinplace "s*TEMPLATE_TITLE*$title*g" "$projPath/game.config"
 
 # Open the new project folder, use xdg-open on Linux
 if [[ "$unamestr" == "Linux" ]]; then
-	xdg-open $projPath
+	xdg-open "$projPath"
 else
-	open $projPath
+	open "$projPath"
 fi
 
 exit 0

+ 4 - 56
gameplay/gameplay.xcodeproj/project.pbxproj

@@ -82,8 +82,6 @@
 		42789FDF15B0E83700866F5B /* AIStateMachine.h in Headers */ = {isa = PBXBuildFile; fileRef = 42789FCB15B0E83700866F5B /* AIStateMachine.h */; };
 		428390991489D6E800E2B2F5 /* SceneLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 428390971489D6E800E2B2F5 /* SceneLoader.cpp */; };
 		4283909A1489D6E800E2B2F5 /* SceneLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 428390981489D6E800E2B2F5 /* SceneLoader.h */; };
-		42B701F715B08177002BB8C3 /* liblua.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42B701F615B08177002BB8C3 /* liblua.a */; };
-		42B701F915B081B7002BB8C3 /* liblua.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42B701F815B081B6002BB8C3 /* liblua.a */; };
 		42B7FAE315B08049002BB8C3 /* ScreenDisplayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42B7FADD15B08049002BB8C3 /* ScreenDisplayer.cpp */; };
 		42B7FAE415B08049002BB8C3 /* ScreenDisplayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42B7FADD15B08049002BB8C3 /* ScreenDisplayer.cpp */; };
 		42B7FAE515B08049002BB8C3 /* ScriptController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42B7FADE15B08049002BB8C3 /* ScriptController.cpp */; };
@@ -716,12 +714,6 @@
 		42BCD6CD15EFD0F300C0E076 /* lua_VerticalLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42BCD45715EFD0F300C0E076 /* lua_VerticalLayout.cpp */; };
 		42BCD6CE15EFD0F300C0E076 /* lua_VerticalLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 42BCD45815EFD0F300C0E076 /* lua_VerticalLayout.h */; };
 		42BCD6CF15EFD0F300C0E076 /* lua_VerticalLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 42BCD45815EFD0F300C0E076 /* lua_VerticalLayout.h */; };
-		42CCD556146EC1EB00353661 /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42CCD555146EC1EB00353661 /* libpng.a */; };
-		42CD0DAB147D8EA80000361E /* libbullet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42CD0DA6147D8EA80000361E /* libbullet.a */; };
-		42CD0DAC147D8EA80000361E /* libogg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42CD0DA7147D8EA80000361E /* libogg.a */; };
-		42CD0DAD147D8EA80000361E /* libvorbis.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42CD0DA8147D8EA80000361E /* libvorbis.a */; };
-		42CD0DAE147D8EA80000361E /* libvorbisenc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42CD0DA9147D8EA80000361E /* libvorbisenc.a */; };
-		42CD0DAF147D8EA80000361E /* libvorbisfile.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42CD0DAA147D8EA80000361E /* libvorbisfile.a */; };
 		42CD0E46147D8FF60000361E /* Animation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42CD0DB1147D8FF50000361E /* Animation.cpp */; };
 		42CD0E47147D8FF60000361E /* Animation.h in Headers */ = {isa = PBXBuildFile; fileRef = 42CD0DB2147D8FF50000361E /* Animation.h */; };
 		42CD0E48147D8FF60000361E /* AnimationClip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42CD0DB3147D8FF50000361E /* AnimationClip.cpp */; };
@@ -910,12 +902,6 @@
 		5B04C57114BFCFE100EB0071 /* SceneLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 428390971489D6E800E2B2F5 /* SceneLoader.cpp */; };
 		5B04C57214BFCFE100EB0071 /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4208DEE614A4079F00D3C511 /* Image.cpp */; };
 		5B04C57314BFCFE100EB0071 /* MeshBatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4201818D14A41B18008C3F56 /* MeshBatch.cpp */; };
-		5B04C57514BFCFE100EB0071 /* libbullet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42CD0DA6147D8EA80000361E /* libbullet.a */; };
-		5B04C57614BFCFE100EB0071 /* libogg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42CD0DA7147D8EA80000361E /* libogg.a */; };
-		5B04C57714BFCFE100EB0071 /* libvorbis.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42CD0DA8147D8EA80000361E /* libvorbis.a */; };
-		5B04C57814BFCFE100EB0071 /* libvorbisenc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42CD0DA9147D8EA80000361E /* libvorbisenc.a */; };
-		5B04C57914BFCFE100EB0071 /* libvorbisfile.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42CD0DAA147D8EA80000361E /* libvorbisfile.a */; };
-		5B04C57A14BFCFE100EB0071 /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42CCD555146EC1EB00353661 /* libpng.a */; };
 		5B04C58114BFCFE100EB0071 /* Animation.h in Headers */ = {isa = PBXBuildFile; fileRef = 42CD0DB2147D8FF50000361E /* Animation.h */; };
 		5B04C58214BFCFE100EB0071 /* AnimationClip.h in Headers */ = {isa = PBXBuildFile; fileRef = 42CD0DB4147D8FF50000361E /* AnimationClip.h */; };
 		5B04C58314BFCFE100EB0071 /* AnimationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 42CD0DB6147D8FF50000361E /* AnimationController.h */; };
@@ -1734,14 +1720,7 @@
 				5B2BC7621512514D00D176CD /* QuartzCore.framework in Frameworks */,
 				5B2BC75F1512514500D176CD /* OpenAL.framework in Frameworks */,
 				5B2BC7601512514500D176CD /* OpenGL.framework in Frameworks */,
-				42CD0DAB147D8EA80000361E /* libbullet.a in Frameworks */,
-				42CD0DAC147D8EA80000361E /* libogg.a in Frameworks */,
-				42CD0DAD147D8EA80000361E /* libvorbis.a in Frameworks */,
-				42CD0DAE147D8EA80000361E /* libvorbisenc.a in Frameworks */,
-				42CD0DAF147D8EA80000361E /* libvorbisfile.a in Frameworks */,
-				42CCD556146EC1EB00353661 /* libpng.a in Frameworks */,
 				4234D99E14686C52003031B3 /* Cocoa.framework in Frameworks */,
-				42B701F715B08177002BB8C3 /* liblua.a in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1756,13 +1735,6 @@
 				5BAF202B152F2AF0003E2AC3 /* OpenGLES.framework in Frameworks */,
 				5BAF202C152F2AF0003E2AC3 /* QuartzCore.framework in Frameworks */,
 				5BAF202D152F2AF0003E2AC3 /* UIKit.framework in Frameworks */,
-				5B04C57514BFCFE100EB0071 /* libbullet.a in Frameworks */,
-				5B04C57614BFCFE100EB0071 /* libogg.a in Frameworks */,
-				5B04C57714BFCFE100EB0071 /* libvorbis.a in Frameworks */,
-				5B04C57814BFCFE100EB0071 /* libvorbisenc.a in Frameworks */,
-				5B04C57914BFCFE100EB0071 /* libvorbisfile.a in Frameworks */,
-				5B04C57A14BFCFE100EB0071 /* libpng.a in Frameworks */,
-				42B701F915B081B7002BB8C3 /* liblua.a in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -3684,13 +3656,7 @@
 					"../external-deps/oggvorbis/include",
 					./gameplay,
 				);
-				LIBRARY_SEARCH_PATHS = (
-					"$(inherited)",
-					"\"$(SRCROOT)/../external-deps/libpng/lib/macosx\"",
-					"\"$(SRCROOT)/../external-deps/bullet/lib/macosx\"",
-					"\"$(SRCROOT)/../external-deps/oggvorbis/lib/macosx\"",
-					"\"$(SRCROOT)/../external-deps/lua/lib/macosx\"",
-				);
+				LIBRARY_SEARCH_PATHS = "$(inherited)";
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
 				ONLY_ACTIVE_ARCH = YES;
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
@@ -3729,13 +3695,7 @@
 					"../external-deps/oggvorbis/include",
 					./gameplay,
 				);
-				LIBRARY_SEARCH_PATHS = (
-					"$(inherited)",
-					"\"$(SRCROOT)/../external-deps/libpng/lib/macosx\"",
-					"\"$(SRCROOT)/../external-deps/bullet/lib/macosx\"",
-					"\"$(SRCROOT)/../external-deps/oggvorbis/lib/macosx\"",
-					"\"$(SRCROOT)/../external-deps/lua/lib/macosx\"",
-				);
+				LIBRARY_SEARCH_PATHS = "$(inherited)";
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				PRODUCT_NAME = gameplay;
@@ -3775,13 +3735,7 @@
 					"../external-deps/bullet/include",
 					"../external-deps/oggvorbis/include",
 				);
-				LIBRARY_SEARCH_PATHS = (
-					"$(inherited)",
-					"\"$(SRCROOT)/../external-deps/libpng/lib/ios/$(CURRENT_ARCH)\"",
-					"\"$(SRCROOT)/../external-deps/bullet/lib/ios/$(CURRENT_ARCH)\"",
-					"\"$(SRCROOT)/../external-deps/oggvorbis/lib/ios/$(CURRENT_ARCH)\"",
-					"\"$(SRCROOT)/../external-deps/lua/lib/ios/$(CURRENT_ARCH)\"",
-				);
+				LIBRARY_SEARCH_PATHS = "$(inherited)";
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_LDFLAGS = "-ObjC";
@@ -3823,13 +3777,7 @@
 					"../external-deps/bullet/include",
 					"../external-deps/oggvorbis/include",
 				);
-				LIBRARY_SEARCH_PATHS = (
-					"$(inherited)",
-					"\"$(SRCROOT)/../external-deps/libpng/lib/ios/$(CURRENT_ARCH)\"",
-					"\"$(SRCROOT)/../external-deps/bullet/lib/ios/$(CURRENT_ARCH)\"",
-					"\"$(SRCROOT)/../external-deps/oggvorbis/lib/ios/$(CURRENT_ARCH)\"",
-					"\"$(SRCROOT)/../external-deps/lua/lib/ios/armv7\"",
-				);
+				LIBRARY_SEARCH_PATHS = "$(inherited)";
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
 				OTHER_LDFLAGS = "-ObjC";
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;

+ 9 - 9
gameplay/res/shaders/colored-unlit.frag

@@ -2,14 +2,6 @@
 precision highp float;
 #endif
 
-// Inputs
-#if defined(VERTEX_COLOR)
-varying vec3 v_color;						// Input Vertex color ( r g b )
-#endif
-#if defined(TEXTURE_LIGHTMAP)
-varying vec2 v_texCoord;
-#endif
-
 // Uniforms
 uniform vec4 u_diffuseColor;               	// Diffuse color
 #if defined(TEXTURE_LIGHTMAP)
@@ -22,7 +14,15 @@ uniform vec4 u_modulateColor;               // Modulation color
 uniform float u_modulateAlpha;              // Modulation alpha
 #endif
 
-// Fragment program
+// Varyings
+#if defined(VERTEX_COLOR)
+varying vec3 v_color;						// Input Vertex color ( r g b )
+#endif
+#if defined(TEXTURE_LIGHTMAP)
+varying vec2 v_texCoord;
+#endif
+
+
 void main()
 {
     // Set base diffuse color

+ 12 - 12
gameplay/res/shaders/colored-unlit.vert

@@ -1,4 +1,4 @@
-// Inputs
+// Attributes
 attribute vec4 a_position;									// Vertex Position							(x, y, z, w)
 #if defined(TEXTURE_LIGHTMAP)
 attribute vec2 a_texCoord;                                  // Texture Coordinate (for lightmapping)
@@ -11,7 +11,13 @@ attribute vec4 a_blendIndices;								// Vertex blend index int u_matrixPalette
 attribute vec3 a_color;										// Vertex Color								(r, g, b)
 #endif
 
-// Outputs
+// Uniforms
+uniform mat4 u_worldViewProjectionMatrix;					// Matrix to transform a position to clip space.
+#if defined(SKINNING)
+uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];		// Array of 4x3 matrices as an array of floats
+#endif
+
+// Varyings
 #if defined(TEXTURE_LIGHTMAP)
 varying vec2 v_texCoord;                                    // Output Texture Coordinate
 #endif
@@ -19,20 +25,14 @@ varying vec2 v_texCoord;                                    // Output Texture Co
 varying vec3 v_color;										// Output Vertex color						(r, g, b)
 #endif
 
-// Uniforms
-uniform mat4 u_worldViewProjectionMatrix;					// Matrix to transform a position to clip space.
-#if defined(SKINNING)
-uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];		// Array of 4x3 matrices as an array of floats
-#endif
-
-// Attribute accessor
+// Skinning
 #if defined(SKINNING)
-#include "lib/attributes-skinning.vert"
+#include "skinning.vert"
 #else
-#include "lib/attributes.vert" 
+#include "skinning-none.vert" 
 #endif
 
-// Vertex Program
+
 void main()
 {
     // Get the vertex position

+ 24 - 21
gameplay/res/shaders/colored.frag

@@ -3,6 +3,25 @@
 precision highp float;
 #endif
 
+// Uniforms
+uniform vec4 u_diffuseColor;               		// Diffuse color
+uniform vec3 u_ambientColor;                    // Ambient color
+uniform vec3 u_lightColor;                      // Light color
+uniform vec3 u_lightDirection;					// Light direction
+#if defined(SPECULAR)
+uniform float u_specularExponent;				// Specular exponent
+#endif
+#if defined(SPOT_LIGHT)
+uniform float u_spotLightInnerAngleCos;			// The bright spot [0.0 - 1.0]
+uniform float u_spotLightOuterAngleCos;			// The soft outer part [0.0 - 1.0]
+#endif
+#if defined(MODULATE_COLOR)
+uniform vec4 u_modulateColor;					// Modulation color
+#endif
+#if defined(MODULATE_ALPHA)
+uniform float u_modulateAlpha;					// Modulation alpha
+#endif
+
 // Inputs
 varying vec3 v_normalVector;					// Normal vector in view space
 #if defined(VERTEX_COLOR)
@@ -22,32 +41,16 @@ varying vec3 v_lightDirection;					// Direction of light in tangent space
 varying vec3 v_cameraDirection;                 // Camera direction
 #endif
 
-// Uniforms
-uniform vec4 u_diffuseColor;               		// Diffuse color
-uniform vec3 u_ambientColor;                    // Ambient color
-uniform vec3 u_lightColor;                      // Light color
-uniform vec3 u_lightDirection;					// Light direction
-#if defined(SPECULAR)
-uniform float u_specularExponent;				// Specular exponent
-#endif
-#if defined(MODULATE_COLOR)
-uniform vec4 u_modulateColor;					// Modulation color
-#endif
-#if defined(MODULATE_ALPHA)
-uniform float u_modulateAlpha;					// Modulation alpha
-#endif
-#include "lib/lighting.frag"
+// Lighting
+#include "lighting.frag"
 #if defined(POINT_LIGHT)
-#include "lib/lighting-point.frag"
+#include "lighting-point.frag"
 #elif defined(SPOT_LIGHT)
-uniform float u_spotLightInnerAngleCos;			// The bright spot [0.0 - 1.0]
-uniform float u_spotLightOuterAngleCos;			// The soft outer part [0.0 - 1.0]
-#include "lib/lighting-spot.frag"
+#include "lighting-spot.frag"
 #else
-#include "lib/lighting-directional.frag"
+#include "lighting-directional.frag"
 #endif
 
-// Fragment program
 void main()
 {
     // Set base diffuse color

+ 10 - 9
gameplay/res/shaders/colored.vert

@@ -1,6 +1,6 @@
 #define LIGHTING
 
-// Inputs
+// Attributes
 attribute vec4 a_position;									// Vertex Position							(x, y, z, w)
 attribute vec3 a_normal;									// Vertex Normal							(x, y, z)
 #if defined(SKINNING)
@@ -31,33 +31,34 @@ uniform float u_spotLightRangeInverse;						// Inverse of light range.
 #else
 #endif
 
-// Outputs
+// Varyings
 varying vec3 v_normalVector;								// Normal vector in view space.
 #if defined(SPECULAR)
 varying vec3 v_cameraDirection;								// Direction the camera is looking at in tangent space.
 #endif
+
 // Lighting
 #if defined(POINT_LIGHT)
 varying vec3 v_vertexToPointLightDirection;					// Direction of point light w.r.t current vertex in tangent space.
 varying float v_pointLightAttenuation;						// Attenuation of point light.
-#include "lib/lighting-point.vert"
+#include "lighting-point.vert"
 #elif defined(SPOT_LIGHT)
 varying vec3 v_vertexToSpotLightDirection;					// Direction of the spot light w.r.t current vertex in tangent space.
 varying float v_spotLightAttenuation;						// Attenuation of spot light.
-#include "lib/lighting-spot.vert"
+#include "lighting-spot.vert"
 #else
 uniform vec3 u_lightDirection;								// Direction of light
-#include "lib/lighting-directional.vert"
+#include "lighting-directional.vert"
 #endif
 
-// Vertex attribute accessors
+// Skinning
 #if defined(SKINNING)
-#include "lib/attributes-skinning.vert"
+#include "skinning.vert"
 #else
-#include "lib/attributes.vert" 
+#include "skinning-none.vert" 
 #endif
 
-// Vertex program
+
 void main()
 {
     // Get the position and normal

+ 17 - 0
gameplay/res/shaders/font.frag

@@ -0,0 +1,17 @@
+#ifdef OPENGL_ES
+precision highp float;
+#endif
+
+// Uniforms
+uniform sampler2D u_texture;
+
+// Varyings
+varying vec2 v_texCoord;
+varying vec4 v_color;
+
+
+void main()
+{
+    gl_FragColor = v_color;
+    gl_FragColor.a = texture2D(u_texture, v_texCoord).a * v_color.a;
+}

+ 19 - 0
gameplay/res/shaders/font.vert

@@ -0,0 +1,19 @@
+// Atttributes
+attribute vec3 a_position;
+attribute vec2 a_texCoord;
+attribute vec4 a_color;
+
+// Uniforms
+uniform mat4 u_projectionMatrix;
+
+// Varyings
+varying vec2 v_texCoord;
+varying vec4 v_color;
+
+
+void main()
+{
+    gl_Position = u_projectionMatrix * vec4(a_position, 1);
+    v_texCoord = a_texCoord;
+    v_color = a_color;
+}

+ 15 - 0
gameplay/res/shaders/form.frag

@@ -0,0 +1,15 @@
+#ifdef OPENGL_ES
+precision highp float;
+#endif
+
+// Uniforms
+uniform sampler2D u_texture;
+
+// Varyings
+varying vec2 v_texCoord;
+
+
+void main()
+{
+    gl_FragColor = texture2D(u_texture, v_texCoord);
+}

+ 16 - 0
gameplay/res/shaders/form.vert

@@ -0,0 +1,16 @@
+// Attributes
+attribute vec3 a_position;
+attribute vec2 a_texCoord;
+
+// Uniforms
+uniform mat4 u_worldViewProjectionMatrix;
+
+// Varyings
+varying vec2 v_texCoord;
+
+
+void main()
+{
+    gl_Position = u_worldViewProjectionMatrix * vec4(a_position, 1);
+    v_texCoord = a_texCoord;
+}

+ 0 - 0
gameplay/res/shaders/lib/lighting-directional.frag → gameplay/res/shaders/lighting-directional.frag


+ 0 - 1
gameplay/res/shaders/lib/lighting-directional.vert → gameplay/res/shaders/lighting-directional.vert

@@ -12,7 +12,6 @@ void applyLight(mat3 tangentSpaceTransformMatrix)
     v_cameraDirection = u_cameraPosition - positionWorldViewSpace.xyz;
 
     #endif
-
 }
 
 #else

+ 0 - 0
gameplay/res/shaders/lib/lighting-point.frag → gameplay/res/shaders/lighting-point.frag


+ 0 - 0
gameplay/res/shaders/lib/lighting-point.vert → gameplay/res/shaders/lighting-point.vert


+ 0 - 0
gameplay/res/shaders/lib/lighting-spot.frag → gameplay/res/shaders/lighting-spot.frag


+ 0 - 0
gameplay/res/shaders/lib/lighting-spot.vert → gameplay/res/shaders/lighting-spot.vert


+ 0 - 0
gameplay/res/shaders/lib/lighting.frag → gameplay/res/shaders/lighting.frag


+ 0 - 0
gameplay/res/shaders/lib/attributes.vert → gameplay/res/shaders/skinning-none.vert


+ 0 - 0
gameplay/res/shaders/lib/attributes-skinning.vert → gameplay/res/shaders/skinning.vert


+ 16 - 0
gameplay/res/shaders/sprite.frag

@@ -0,0 +1,16 @@
+#ifdef OPENGL_ES
+precision highp float;
+#endif
+
+// Uniforms
+uniform sampler2D u_texture;
+
+// Varyings
+varying vec2 v_texCoord;
+varying vec4 v_color;
+
+
+void main()
+{
+    gl_FragColor = v_color * texture2D(u_texture, v_texCoord);
+}

+ 19 - 0
gameplay/res/shaders/sprite.vert

@@ -0,0 +1,19 @@
+// Attributes
+attribute vec3 a_position;
+attribute vec2 a_texCoord;
+attribute vec4 a_color;
+
+// Uniforms
+uniform mat4 u_projectionMatrix;
+
+// Varyings
+varying vec2 v_texCoord;
+varying vec4 v_color;
+
+
+void main()
+{
+    gl_Position = u_projectionMatrix * vec4(a_position, 1);
+    v_texCoord = a_texCoord;
+    v_color = a_color;
+}

+ 16 - 17
gameplay/res/shaders/terrain.frag

@@ -2,34 +2,32 @@
 precision highp float;
 #endif
 
-// Inputs
-#if defined(NORMAL_MAP)
-vec3 v_normalVector;                            // Normal vector variable (from normal map)
-#else
-varying vec3 v_normalVector;					// Normal vector from vertex shader
-#endif
-varying vec2 v_texCoord0;
-
 // Uniforms
 uniform vec3 u_ambientColor;                    // Ambient color
 uniform vec3 u_lightColor;                      // Light color
 uniform vec3 u_lightDirection;					// Light direction
-
 #if defined(DEBUG_PATCHES)
-uniform float u_row;
-uniform float u_column;
+uniform float u_row;                            // Patch row
+uniform float u_column;                         // Patch column
 #endif
-
 #if (LAYER_COUNT > 0)
-uniform sampler2D u_samplers[SAMPLER_COUNT];
+uniform sampler2D u_samplers[SAMPLER_COUNT];    // Surface layer samplers
 #endif
-
 #if defined (NORMAL_MAP)
-uniform sampler2D u_normalMap;
+uniform sampler2D u_normalMap;                  // Normal map
 #endif
 
-#include "lib/lighting.frag"
-#include "lib/lighting-directional.frag"
+// Varyings
+#if defined(NORMAL_MAP)
+vec3 v_normalVector;                            // Normal vector variable (from normal map)
+#else
+varying vec3 v_normalVector;					// Normal vector from vertex shader
+#endif
+varying vec2 v_texCoord0;
+
+// Lighting
+#include "lighting.frag"
+#include "lighting-directional.frag"
 
 #if (LAYER_COUNT > 1)
 void blendLayer(sampler2D textureMap, vec2 textureRepeat, float alphaBlend)
@@ -43,6 +41,7 @@ void blendLayer(sampler2D textureMap, vec2 textureRepeat, float alphaBlend)
 }
 #endif
 
+
 void main()
 {
 #if (LAYER_COUNT > 0)

+ 3 - 4
gameplay/res/shaders/terrain.vert

@@ -1,4 +1,4 @@
-// Inputs
+// Attributes
 attribute vec4 a_position;									// Vertex Position							(x, y, z, w)
 #ifndef NORMAL_MAP
 attribute vec3 a_normal;									// Vertex Normal							(x, y, z)
@@ -21,7 +21,7 @@ uniform mat4 u_normalMatrix;					            // Matrix used for normal vector tr
 #endif
 uniform vec3 u_lightDirection;								// Direction of light
 
-// Outputs
+// Varyings
 #ifndef NORMAL_MAP
 varying vec3 v_normalVector;								// Normal vector out
 #endif
@@ -36,6 +36,7 @@ varying vec2 v_texCoord2;
 varying vec2 v_texCoord3;
 #endif
 
+
 void main()
 {
     // Transform position to clip space.
@@ -45,9 +46,7 @@ void main()
     // Pass normal to fragment shader
     v_normalVector = (u_normalMatrix * vec4(a_normal.x, a_normal.y, a_normal.z, 0)).xyz;
 #endif
-
     v_texCoord0 = a_texCoord0;
-
 #if LAYER_COUNT > 1
     v_texCoord1 = a_texCoord1;
 #endif

+ 27 - 23
gameplay/res/shaders/textured-bumped.frag

@@ -5,7 +5,27 @@
 precision highp float;
 #endif
 
-// Inputs
+// Uniforms
+uniform sampler2D u_diffuseTexture;        		// Diffuse map texture
+uniform sampler2D u_normalmapTexture;       	// Normalmap texture
+uniform vec3 u_ambientColor;                    // Ambient color
+uniform vec3 u_lightColor;                      // Light color
+uniform vec3 u_lightDirection;					// Light direction
+#if defined(SPECULAR)
+uniform float u_specularExponent;				// Specular exponent.
+#endif
+#if defined (SPOT_LIGHT)
+uniform float u_spotLightInnerAngleCos;			// The bright spot [0.0 - 1.0]
+uniform float u_spotLightOuterAngleCos;			// The soft outer part [0.0 - 1.0]
+#endif
+#if defined(MODULATE_COLOR)
+uniform vec4 u_modulateColor;					// Modulation color
+#endif
+#if defined(MODULATE_ALPHA)
+uniform float u_modulateAlpha;					// Modulation alpha
+#endif
+
+// Varyings
 varying vec3 v_normalVector;					// Normal vector in view space
 varying vec2 v_texCoord;						// Texture Coordinate
 #if defined(POINT_LIGHT)
@@ -22,33 +42,17 @@ varying vec3 v_lightDirection;					// Direction of light in tangent space.
 varying vec3 v_cameraDirection;                 // Camera direction
 #endif
 
-// Uniforms
-uniform sampler2D u_diffuseTexture;        		// Diffuse map texture
-uniform sampler2D u_normalmapTexture;       	// Normalmap texture
-uniform vec3 u_ambientColor;                    // Ambient color
-uniform vec3 u_lightColor;                      // Light color
-uniform vec3 u_lightDirection;					// Light direction
-#if defined(SPECULAR)
-uniform float u_specularExponent;				// Specular exponent.
-#endif
-#if defined(MODULATE_COLOR)
-uniform vec4 u_modulateColor;					// Modulation color
-#endif
-#if defined(MODULATE_ALPHA)
-uniform float u_modulateAlpha;					// Modulation alpha
-#endif
-#include "lib/lighting.frag"
+// Lighting
+#include "lighting.frag"
 #if defined(POINT_LIGHT)
-#include "lib/lighting-point.frag"
+#include "lighting-point.frag"
 #elif defined(SPOT_LIGHT)
-uniform float u_spotLightInnerAngleCos;			// The bright spot [0.0 - 1.0]
-uniform float u_spotLightOuterAngleCos;			// The soft outer part [0.0 - 1.0]
-#include "lib/lighting-spot.frag"
+#include "lighting-spot.frag"
 #else
-#include "lib/lighting-directional.frag"
+#include "lighting-directional.frag"
 #endif
 
-// Fragment program
+
 void main()
 {
     // Fetch diffuse color from texture.

+ 9 - 10
gameplay/res/shaders/textured-bumped.vert

@@ -15,12 +15,10 @@ attribute vec4 a_blendIndices;								// Vertex blend index int u_matrixPalette
 // Uniforms
 uniform mat4 u_worldViewProjectionMatrix;					// Matrix to transform a position to clip space
 uniform mat4 u_inverseTransposeWorldViewMatrix;				// Matrix to transform a normal to view space
-
 #if defined(SPECULAR) || defined(SPOT_LIGHT) || defined(POINT_LIGHT)
 uniform mat4 u_worldViewMatrix;								// Matrix to tranform a position to view space
 uniform mat4 u_worldMatrix;								    // Matrix to tranform a position to world space
 #endif
-
 #if defined(SKINNING)
 uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];		// Array of 4x3 matrices
 #endif
@@ -44,35 +42,36 @@ uniform vec3 u_spotLightDirection;							// Direction of light
 uniform vec3 u_lightDirection;								// Direction of light
 #endif
 
-// Outputs
+// Varyings
 varying vec3 v_normalVector;								// Normal vector in view space
 varying vec2 v_texCoord;									// Texture Coordinate
 #if defined(SPECULAR)
 varying vec3 v_cameraDirection;								// Direction the camera is looking at in tangent space
 #endif
+
 // Lighting
 #if defined(POINT_LIGHT)
 varying vec3 v_vertexToPointLightDirection;					// Direction of point light w.r.t current vertex in tangent space
 varying float v_pointLightAttenuation;						// Attenuation of point light
-#include "lib/lighting-point.vert"
+#include "lighting-point.vert"
 #elif defined(SPOT_LIGHT)
 varying vec3 v_vertexToSpotLightDirection;					// Direction of the spot light w.r.t current vertex in tangent space
 varying float v_spotLightAttenuation;						// Attenuation of spot light
 varying vec3 v_spotLightDirection;							// Direction of spot light in tangent space
-#include "lib/lighting-spot.vert"
+#include "lighting-spot.vert"
 #else
 varying vec3 v_lightDirection;								// Direction of light
-#include "lib/lighting-directional.vert"
+#include "lighting-directional.vert"
 #endif
 
-// Vertex Attribute Accessors
+// Skinning
 #if defined(SKINNING)
-#include "lib/attributes-skinning.vert"
+#include "skinning.vert"
 #else
-#include "lib/attributes.vert" 
+#include "skinning-none.vert" 
 #endif
 
-// Vertex program
+
 void main()
 {
     // Get the position, normal, tangents and binormals.

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

@@ -14,13 +14,13 @@ uniform vec4 u_modulateColor;               // Modulation color
 uniform float u_modulateAlpha;              // Modulation alpha
 #endif
 
-// Inputs
+// Varyings
 varying vec2 v_texCoord0;                	// Texture coordinate(u, v)
 #if defined(TEXCOORD1)
 varying vec2 v_texCoord1;                   // Second tex coord for multi-texturing
 #endif
 
-// Fragment Program
+
 void main()
 {
     // Sample the texture for the color

+ 6 - 6
gameplay/res/shaders/textured-unlit.vert

@@ -1,4 +1,4 @@
-// Inputs
+// Attributes
 attribute vec4 a_position;									// Vertex Position							(x, y, z, w)
 attribute vec2 a_texCoord0;									// Vertex Texture Coordinate				(u, v)
 #if defined(TEXCOORD1)
@@ -21,20 +21,20 @@ uniform vec2 u_textureRepeat;								// Texture repeat for tiling
 uniform vec2 u_textureOffset;								// Texture offset
 #endif
 
-// Outputs
+// Varyings
 varying vec2 v_texCoord0;									// Texture Coordinate
 #if defined(TEXCOORD1)
 varying vec2 v_texCoord1;                                   // Second tex coord for multi-texturing
 #endif
 
-// Vertex attribute accessors
+// Skinning 
 #if defined(SKINNING)
-#include "lib/attributes-skinning.vert"
+#include "skinning.vert"
 #else
-#include "lib/attributes.vert" 
+#include "skinning-none.vert" 
 #endif
 
-// Vertex Program
+
 void main()
 {
     // Get the vertex position

+ 21 - 22
gameplay/res/shaders/textured.frag

@@ -4,7 +4,22 @@
 precision highp float;
 #endif
 
-// Inputs
+// Uniforms
+uniform sampler2D u_diffuseTexture;             // Diffuse map texture
+uniform vec3 u_ambientColor;                    // Ambient color
+uniform vec3 u_lightColor;                      // Light color
+uniform vec3 u_lightDirection;					// Light direction
+#if defined(SPECULAR)
+uniform float u_specularExponent;				// Specular exponent
+#endif
+#if defined(MODULATE_COLOR)
+uniform vec4 u_modulateColor;               	// Modulation color
+#endif
+#if defined(MODULATE_ALPHA)
+uniform float u_modulateAlpha;              	// Modulation alpha
+#endif
+
+// Varyings
 varying vec3 v_normalVector;                    // Normal vector in view space
 varying vec2 v_texCoord;                        // Texture coordinate
 #if defined(POINT_LIGHT)
@@ -21,36 +36,20 @@ varying vec3 v_lightDirection;					// Direction of light in tangent space.
 varying vec3 v_cameraDirection;                 // Camera direction
 #endif
 
-// Uniforms
-uniform sampler2D u_diffuseTexture;             // Diffuse map texture
-uniform vec3 u_ambientColor;                    // Ambient color
-uniform vec3 u_lightColor;                      // Light color
-uniform vec3 u_lightDirection;					// Light direction
-
-#if defined(SPECULAR)
-uniform float u_specularExponent;				// Specular exponent
-#endif
-#if defined(MODULATE_COLOR)
-uniform vec4 u_modulateColor;               	// Modulation color
-#endif
-#if defined(MODULATE_ALPHA)
-uniform float u_modulateAlpha;              	// Modulation alpha
-#endif
-#include "lib/lighting.frag"
+// Lighting 
+#include "lighting.frag"
 #if defined(POINT_LIGHT)
-#include "lib/lighting-point.frag"
+#include "lighting-point.frag"
 #elif defined(SPOT_LIGHT)
 uniform float u_spotLightInnerAngleCos;			// The bright spot [0.0 - 1.0]
 uniform float u_spotLightOuterAngleCos;			// The soft outer part [0.0 - 1.0]
 uniform vec3 u_spotLightDirection;              // Direction of a spot light source
-#include "lib/lighting-spot.frag"
+#include "lighting-spot.frag"
 #else
-#include "lib/lighting-directional.frag"
+#include "lighting-directional.frag"
 #endif
 
-uniform vec3 u_cameraPosition;
 
-// Fragment Program
 void main()
 {
     // Sample the diffuse texture for base color

+ 12 - 14
gameplay/res/shaders/textured.vert

@@ -1,6 +1,6 @@
 #define LIGHTING
 
-// Inputs
+// Attributes
 attribute vec4 a_position;									// Vertex position							(x, y, z, w)
 attribute vec3 a_normal;									// Vertex normal							(x, y, z)
 attribute vec2 a_texCoord;									// Vertex texture coordinate				(u, v)
@@ -12,13 +12,9 @@ attribute vec4 a_blendIndices;								// Vertex blend index int u_matrixPalette
 // Uniforms
 uniform mat4 u_worldViewProjectionMatrix;					// Matrix to transform a position to clip space
 uniform mat4 u_inverseTransposeWorldViewMatrix;				// Matrix to transform a normal to view space
-
-//uniform mat4 u_worldViewMatrix;	
-
 #if defined(SPECULAR) || defined(SPOT_LIGHT) || defined(POINT_LIGHT)
 uniform mat4 u_worldViewMatrix;								// Matrix to tranform a position to view space
 #endif
-
 #if defined(SKINNING)
 uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];		// Array of 4x3 matrices
 #endif
@@ -41,7 +37,7 @@ uniform vec3 u_spotLightDirection;                          // Direction of a sp
 #else
 #endif
 
-// Outputs
+// Varyings
 varying vec3 v_normalVector;								// Normal vector in view space
 varying vec2 v_texCoord;									// Texture coordinate
 #if defined(SPECULAR)
@@ -50,26 +46,28 @@ varying vec3 v_cameraDirection;								// Direction the camera is looking at in
 #if defined(POINT_LIGHT)
 varying vec3 v_vertexToPointLightDirection;					// Direction of point light w.r.t current vertex in tangent space
 varying float v_pointLightAttenuation;						// Attenuation of point light
-#include "lib/lighting-point.vert"
+#include "lighting-point.vert"
 #elif defined(SPOT_LIGHT)
 varying vec3 v_vertexToSpotLightDirection;					// Direction of the spot light w.r.t current vertex in tangent space
 varying float v_spotLightAttenuation;						// Attenuation of spot light
-#include "lib/lighting-spot.vert"
+
+// Lighting
+#include "lighting-spot.vert"
 #else
-#include "lib/lighting-directional.vert"
+#include "lighting-directional.vert"
 #endif
 
-// Vertex attribute accessors
+// Skinning
 #if defined(SKINNING)
-#include "lib/attributes-skinning.vert"
+#include "skinning.vert"
 #else
-#include "lib/attributes.vert" 
+#include "skinning-none.vert" 
 #endif
 
-// Vertex Program
+
 void main()
 {
-    // Get the position and normal from attribute accessors
+    // Get the position and normal
     vec4 position = getPosition();
     vec3 normal = getNormal();
 

+ 4 - 29
gameplay/src/Font.cpp

@@ -4,34 +4,9 @@
 #include "FileSystem.h"
 #include "Bundle.h"
 
-// Default font vertex shader
-#define FONT_VSH \
-    "uniform mat4 u_projectionMatrix;\n" \
-    "attribute vec3 a_position;\n" \
-    "attribute vec2 a_texCoord;\n" \
-    "attribute vec4 a_color;\n" \
-    "varying vec2 v_texCoord;\n" \
-    "varying vec4 v_color;\n" \
-    "void main()\n" \
-    "{\n" \
-        "gl_Position = u_projectionMatrix * vec4(a_position, 1);\n" \
-        "v_texCoord = a_texCoord;\n" \
-        "v_color = a_color;\n" \
-    "}\n"
-
-// Default font fragment shader
-#define FONT_FSH \
-    "#ifdef OPENGL_ES\n" \
-    "precision highp float;\n" \
-    "#endif\n" \
-    "varying vec2 v_texCoord;\n" \
-    "varying vec4 v_color;\n" \
-    "uniform sampler2D u_texture;\n" \
-    "void main()\n" \
-    "{\n" \
-        "gl_FragColor = v_color;\n" \
-        "gl_FragColor.a = texture2D(u_texture, v_texCoord).a * v_color.a;\n" \
-    "}"
+// Default font shaders
+#define FONT_VSH "res/shaders/font.vert"
+#define FONT_FSH "res/shaders/font.frag"
 
 namespace gameplay
 {
@@ -124,7 +99,7 @@ Font* Font::create(const char* family, Style style, unsigned int size, Glyph* gl
     // Create the effect for the font's sprite batch.
     if (__fontEffect == NULL)
     {
-        __fontEffect = Effect::createFromSource(FONT_VSH, FONT_FSH);
+        __fontEffect = Effect::createFromFile(FONT_VSH, FONT_FSH);
         if (__fontEffect == NULL)
         {
             GP_ERROR("Failed to create effect for font.");

+ 4 - 22
gameplay/src/Form.cpp

@@ -10,27 +10,9 @@
 #include "CheckBox.h"
 #include "Scene.h"
 
-#define FORM_VSH \
-    "uniform mat4 u_worldViewProjectionMatrix;\n" \
-    "attribute vec3 a_position;\n" \
-    "attribute vec2 a_texCoord;\n" \
-    "varying vec2 v_texCoord;\n" \
-    "void main()\n" \
-    "{\n" \
-        "gl_Position = u_worldViewProjectionMatrix * vec4(a_position, 1);\n" \
-        "v_texCoord = a_texCoord;\n" \
-    "}\n"
-
-#define FORM_FSH \
-    "#ifdef OPENGL_ES\n" \
-    "precision highp float;\n" \
-    "#endif\n" \
-    "varying vec2 v_texCoord;\n" \
-    "uniform sampler2D u_texture;\n" \
-    "void main()\n" \
-    "{\n" \
-        "gl_FragColor = texture2D(u_texture, v_texCoord);\n" \
-    "}\n"
+// Default form shaders
+#define FORM_VSH "res/shaders/form.vert"
+#define FORM_FSH "res/shaders/form.frag"
 
 namespace gameplay
 {
@@ -332,7 +314,7 @@ static Effect* createEffect()
     Effect* effect = NULL;
     if (__formEffect == NULL)
     {
-        __formEffect = Effect::createFromSource(FORM_VSH, FORM_FSH);
+        __formEffect = Effect::createFromFile(FORM_VSH, FORM_FSH);
         if (__formEffect == NULL)
         {
             GP_ERROR("Unable to load form effect.");

+ 19 - 0
gameplay/src/PlatformiOS.mm

@@ -570,8 +570,27 @@ int getUnicode(int key);
 {
     if((evt & Gesture::GESTURE_SWIPE) == Gesture::GESTURE_SWIPE && _swipeRecognizer == NULL)
     {
+        // right swipe (default)
         _swipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeGesture:)];
         [self addGestureRecognizer:_swipeRecognizer];
+
+        // left swipe
+        UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeGesture:)];
+        swipeGesture.direction = UISwipeGestureRecognizerDirectionLeft;
+        [self addGestureRecognizer:swipeGesture];
+        [swipeGesture release];
+        
+        // up swipe
+        UISwipeGestureRecognizer *swipeGesture2 = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeGesture:)];
+        swipeGesture2.direction = UISwipeGestureRecognizerDirectionUp;
+        [self addGestureRecognizer:swipeGesture2];
+        [swipeGesture2 release];
+        
+        // down swipe
+        UISwipeGestureRecognizer *swipeGesture3 = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeGesture:)];
+        swipeGesture3.direction = UISwipeGestureRecognizerDirectionDown;
+        [self addGestureRecognizer:swipeGesture3];
+        [swipeGesture3 release];
     }
     if((evt & Gesture::GESTURE_PINCH) == Gesture::GESTURE_PINCH && _pinchRecognizer == NULL)
     {

+ 4 - 28
gameplay/src/SpriteBatch.cpp

@@ -14,33 +14,9 @@
     vtx.u = vu; vtx.v = vv; \
     vtx.r = vr; vtx.g = vg; vtx.b = vb; vtx.a = va
 
-// Default sprite vertex shader
-#define SPRITE_VSH \
-    "uniform mat4 u_projectionMatrix;\n" \
-    "attribute vec3 a_position;\n" \
-    "attribute vec2 a_texCoord;\n" \
-    "attribute vec4 a_color;\n" \
-    "varying vec2 v_texCoord;\n" \
-    "varying vec4 v_color;\n" \
-    "void main()\n" \
-    "{\n" \
-        "gl_Position = u_projectionMatrix * vec4(a_position, 1);\n" \
-        "v_texCoord = a_texCoord;\n" \
-        "v_color = a_color;\n" \
-    "}\n"
-
-// Default sprite fragment shader
-#define SPRITE_FSH \
-    "#ifdef OPENGL_ES\n" \
-    "precision highp float;\n" \
-    "#endif\n" \
-    "varying vec2 v_texCoord;\n" \
-    "varying vec4 v_color;\n" \
-    "uniform sampler2D u_texture;\n" \
-    "void main()\n" \
-    "{\n" \
-        "gl_FragColor = v_color * texture2D(u_texture, v_texCoord);\n" \
-    "}\n"
+// Default sprite shaders
+#define SPRITE_VSH "res/shaders/sprite.vert"
+#define SPRITE_FSH "res/shaders/sprite.frag"
 
 namespace gameplay
 {
@@ -88,7 +64,7 @@ SpriteBatch* SpriteBatch::create(Texture* texture,  Effect* effect, unsigned int
         // Create our static sprite effect.
         if (__spriteEffect == NULL)
         {
-            __spriteEffect = Effect::createFromSource(SPRITE_VSH, SPRITE_FSH);
+            __spriteEffect = Effect::createFromFile(SPRITE_VSH, SPRITE_FSH);
             if (__spriteEffect == NULL)
             {
                 GP_ERROR("Unable to load sprite effect.");

+ 5 - 1
gameplay/src/TerrainPatch.cpp

@@ -5,6 +5,10 @@
 #include "Scene.h"
 #include "Game.h"
 
+// Default terrain shaders
+#define TERRAIN_VSH "res/shaders/terrain.vert"
+#define TERRAIN_FSH "res/shaders/terrain.frag"
+
 namespace gameplay
 {
 
@@ -470,7 +474,7 @@ bool TerrainPatch::updateMaterial()
             }
         }
 
-        Material* material = Material::create("res/shaders/terrain.vert", "res/shaders/terrain.frag", defines.str().c_str());
+        Material* material = Material::create(TERRAIN_VSH, TERRAIN_FSH, defines.str().c_str());
         if (!material)
             return false;
         material->getStateBlock()->setCullFace(true);