Explorar el Código

Merge pull request #69 from blackberry-gaming/next

Next
Sean Paul Taylor hace 13 años
padre
commit
64f15b2dd1

+ 3 - 3
README.md

@@ -3,12 +3,12 @@ An open-source, cross-platform 3D native game framework making it easy to learn
 
 
 ## Supported Mobile Platforms
 ## Supported Mobile Platforms
 - BlackBerry PlayBook 2 (using BlackBerry Native SDK 2)
 - BlackBerry PlayBook 2 (using BlackBerry Native SDK 2)
-- Google Android 2.3+ (using Google Android NDK 7)
-- Apple iOS 5 (using Apple XCode 4.3)
+- Google Android 2.3 (using Google Android NDK 7)
+- Apple iOS 5.1 (using Apple XCode 4.3.2)
 
 
 ## Supported Desktop Platforms
 ## Supported Desktop Platforms
 - Microsoft Windows 7 (using Microsoft Visual Studio 2010)
 - Microsoft Windows 7 (using Microsoft Visual Studio 2010)
-- Apple MacOS X (using Apple XCode 4.3)
+- Apple MacOS X (using Apple XCode 4.3.2)
 
 
 ## Roadmap for 'next' branch
 ## Roadmap for 'next' branch
 - Lua Scripting
 - Lua Scripting

+ 10 - 7
gameplay.sln

@@ -25,7 +25,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample03-character", "gamep
 EndProject
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gameplay-encoder", "gameplay-encoder\gameplay-encoder.vcxproj", "{9D69B743-4872-4DD1-8E30-0087C64298D7}"
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gameplay-encoder", "gameplay-encoder\gameplay-encoder.vcxproj", "{9D69B743-4872-4DD1-8E30-0087C64298D7}"
 EndProject
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample04-particles", "gameplay-samples\sample04-particles\sample04-particles.vcxproj", "{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample04-particles", "gameplay-samples\sample04-particles\sample04-particles.vcxproj", "{F47B5740-3C0C-BACE-4C2B-EE23A358D499}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
+	EndProjectSection
 EndProject
 EndProject
 Global
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -70,12 +73,12 @@ Global
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.DebugMem|Win32.Build.0 = Debug|Win32
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.DebugMem|Win32.Build.0 = Debug|Win32
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Release|Win32.ActiveCfg = Release|Win32
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Release|Win32.ActiveCfg = Release|Win32
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Release|Win32.Build.0 = Release|Win32
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Release|Win32.Build.0 = Release|Win32
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|Win32.ActiveCfg = Debug|Win32
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|Win32.Build.0 = Debug|Win32
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|Win32.Build.0 = DebugMem|Win32
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|Win32.ActiveCfg = Release|Win32
-		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|Win32.Build.0 = Release|Win32
+		{F47B5740-3C0C-BACE-4C2B-EE23A358D499}.Debug|Win32.ActiveCfg = Debug|Win32
+		{F47B5740-3C0C-BACE-4C2B-EE23A358D499}.Debug|Win32.Build.0 = Debug|Win32
+		{F47B5740-3C0C-BACE-4C2B-EE23A358D499}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
+		{F47B5740-3C0C-BACE-4C2B-EE23A358D499}.DebugMem|Win32.Build.0 = DebugMem|Win32
+		{F47B5740-3C0C-BACE-4C2B-EE23A358D499}.Release|Win32.ActiveCfg = Release|Win32
+		{F47B5740-3C0C-BACE-4C2B-EE23A358D499}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 		HideSolutionNode = FALSE

+ 9 - 9
gameplay/gameplay.xcodeproj/project.pbxproj

@@ -557,21 +557,21 @@
 		5B2BC75E1512514500D176CD /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
 		5B2BC75E1512514500D176CD /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
 		5B2BC7611512514D00D176CD /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
 		5B2BC7611512514D00D176CD /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
 		5B2BC7631512516B00D176CD /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
 		5B2BC7631512516B00D176CD /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
-		5B2BC768151251EB00D176CD /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
+		5B2BC768151251EB00D176CD /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
 		5B5DB92D14C25B7B007755DB /* libbullet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbullet.a; path = "../external-deps/bullet/lib/ios/i386/libbullet.a"; sourceTree = "<group>"; };
 		5B5DB92D14C25B7B007755DB /* libbullet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbullet.a; path = "../external-deps/bullet/lib/ios/i386/libbullet.a"; sourceTree = "<group>"; };
 		5B5DB92F14C25B94007755DB /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = "../external-deps/libpng/lib/ios/armv7/libpng.a"; sourceTree = "<group>"; };
 		5B5DB92F14C25B94007755DB /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = "../external-deps/libpng/lib/ios/armv7/libpng.a"; sourceTree = "<group>"; };
 		5B5DB93114C25BA5007755DB /* libogg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libogg.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libogg.a"; sourceTree = "<group>"; };
 		5B5DB93114C25BA5007755DB /* libogg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libogg.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libogg.a"; sourceTree = "<group>"; };
 		5B5DB93214C25BA5007755DB /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbis.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbis.a"; sourceTree = "<group>"; };
 		5B5DB93214C25BA5007755DB /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbis.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbis.a"; sourceTree = "<group>"; };
 		5B5DB93314C25BA5007755DB /* libvorbisenc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisenc.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbisenc.a"; sourceTree = "<group>"; };
 		5B5DB93314C25BA5007755DB /* libvorbisenc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisenc.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbisenc.a"; sourceTree = "<group>"; };
 		5B5DB93414C25BA5007755DB /* libvorbisfile.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisfile.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbisfile.a"; sourceTree = "<group>"; };
 		5B5DB93414C25BA5007755DB /* libvorbisfile.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisfile.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbisfile.a"; sourceTree = "<group>"; };
-		5BAF201E152F2A6D003E2AC3 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
-		5BAF2020152F2AF0003E2AC3 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };
-		5BAF2021152F2AF0003E2AC3 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
-		5BAF2022152F2AF0003E2AC3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
-		5BAF2023152F2AF0003E2AC3 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; };
-		5BAF2024152F2AF0003E2AC3 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
-		5BAF2025152F2AF0003E2AC3 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };
-		5BAF2026152F2AF0003E2AC3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF201E152F2A6D003E2AC3 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
+		5BAF2020152F2AF0003E2AC3 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF2021152F2AF0003E2AC3 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF2022152F2AF0003E2AC3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF2023152F2AF0003E2AC3 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF2024152F2AF0003E2AC3 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF2025152F2AF0003E2AC3 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF2026152F2AF0003E2AC3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
 		5BB0823814C6FEB10019975F /* gameplay-main-android.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "gameplay-main-android.cpp"; path = "src/gameplay-main-android.cpp"; sourceTree = SOURCE_ROOT; };
 		5BB0823814C6FEB10019975F /* gameplay-main-android.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "gameplay-main-android.cpp"; path = "src/gameplay-main-android.cpp"; sourceTree = SOURCE_ROOT; };
 		5BB0823914C6FEB10019975F /* PlatformAndroid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PlatformAndroid.cpp; path = src/PlatformAndroid.cpp; sourceTree = SOURCE_ROOT; };
 		5BB0823914C6FEB10019975F /* PlatformAndroid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PlatformAndroid.cpp; path = src/PlatformAndroid.cpp; sourceTree = SOURCE_ROOT; };
 		5BB0823C14C6FEC40019975F /* Mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mouse.h; path = src/Mouse.h; sourceTree = SOURCE_ROOT; };
 		5BB0823C14C6FEC40019975F /* Mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mouse.h; path = src/Mouse.h; sourceTree = SOURCE_ROOT; };

+ 7 - 0
gameplay/res/shaders/bumped-specular.fsh

@@ -8,6 +8,9 @@ uniform vec3 u_ambientColor;                // Ambient color.
 uniform float u_specularExponent;           // Specular exponent or shininess property.
 uniform float u_specularExponent;           // Specular exponent or shininess property.
 uniform sampler2D u_diffuseTexture;         // Diffuse texture.
 uniform sampler2D u_diffuseTexture;         // Diffuse texture.
 uniform sampler2D u_normalMapTexture;       // Normal map texture.
 uniform sampler2D u_normalMapTexture;       // Normal map texture.
+#if defined(GLOBAL_ALPHA)
+uniform float u_globalAlpha;                    // Global alpha value
+#endif
 
 
 // Inputs
 // Inputs
 varying vec2 v_texCoord;                    // Texture Coordinate.
 varying vec2 v_texCoord;                    // Texture Coordinate.
@@ -114,4 +117,8 @@ void main()
     // Light the pixel
     // Light the pixel
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.rgb = _ambientColor + _diffuseColor + _specularColor;
     gl_FragColor.rgb = _ambientColor + _diffuseColor + _specularColor;
+
+#if defined(GLOBAL_ALPHA)
+    gl_FragColor.a *= u_globalAlpha;
+#endif
 }
 }

+ 7 - 0
gameplay/res/shaders/bumped.fsh

@@ -7,6 +7,9 @@ uniform vec3 u_lightColor;                   // Light color.
 uniform vec3 u_ambientColor;                 // Ambient color.
 uniform vec3 u_ambientColor;                 // Ambient color.
 uniform sampler2D u_diffuseTexture;          // Diffuse texture.
 uniform sampler2D u_diffuseTexture;          // Diffuse texture.
 uniform sampler2D u_normalMapTexture;        // Normal map texture.
 uniform sampler2D u_normalMapTexture;        // Normal map texture.
+#if defined(GLOBAL_ALPHA)
+uniform float u_globalAlpha;                    // Global alpha value
+#endif
 
 
 // Inputs
 // Inputs
 varying vec2 v_texCoord;                     // Texture Coordinate.
 varying vec2 v_texCoord;                     // Texture Coordinate.
@@ -103,4 +106,8 @@ void main()
     // Light the pixel
     // Light the pixel
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.rgb = _ambientColor + _diffuseColor;
     gl_FragColor.rgb = _ambientColor + _diffuseColor;
+
+#if defined(GLOBAL_ALPHA)
+    gl_FragColor.a *= u_globalAlpha;
+#endif
 }
 }

+ 7 - 0
gameplay/res/shaders/colored-specular.fsh

@@ -9,6 +9,9 @@ uniform float u_specularExponent;               // Specular exponent or shinines
 #if !defined(VERTEX_COLOR)
 #if !defined(VERTEX_COLOR)
 uniform vec4 u_diffuseColor;                    // Diffuse color
 uniform vec4 u_diffuseColor;                    // Diffuse color
 #endif
 #endif
+#if defined(GLOBAL_ALPHA)
+uniform float u_globalAlpha;                    // Global alpha value
+#endif
 
 
 // Inputs
 // Inputs
 varying vec3 v_normalVector;                    // NormalVector in view space
 varying vec3 v_normalVector;                    // NormalVector in view space
@@ -122,4 +125,8 @@ void main()
     // Light the pixel
     // Light the pixel
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.rgb = _ambientColor + _diffuseColor + _specularColor;
     gl_FragColor.rgb = _ambientColor + _diffuseColor + _specularColor;
+
+#if defined(GLOBAL_ALPHA)
+    gl_FragColor.a *= u_globalAlpha;
+#endif
 }
 }

+ 7 - 0
gameplay/res/shaders/colored.fsh

@@ -6,6 +6,9 @@ precision highp float;
 uniform vec3 u_lightColor;                      // Light color
 uniform vec3 u_lightColor;                      // Light color
 uniform vec3 u_ambientColor;                    // Ambient color
 uniform vec3 u_ambientColor;                    // Ambient color
 uniform vec4 u_diffuseColor;                    // Diffuse color
 uniform vec4 u_diffuseColor;                    // Diffuse color
+#if defined(GLOBAL_ALPHA)
+uniform float u_globalAlpha;                    // Global alpha value
+#endif
 
 
 // Inputs
 // Inputs
 varying vec3 v_normalVector;                    // NormalVector in view space.
 varying vec3 v_normalVector;                    // NormalVector in view space.
@@ -101,4 +104,8 @@ void main()
     // Light the pixel
     // Light the pixel
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.rgb = _ambientColor + _diffuseColor;
     gl_FragColor.rgb = _ambientColor + _diffuseColor;
+
+#if defined(GLOBAL_ALPHA)
+    gl_FragColor.a *= u_globalAlpha;
+#endif
 }
 }

+ 7 - 0
gameplay/res/shaders/diffuse-specular.fsh

@@ -7,6 +7,9 @@ uniform vec3 u_lightColor;                      // Light color
 uniform vec3 u_ambientColor;                    // Ambient color
 uniform vec3 u_ambientColor;                    // Ambient color
 uniform float u_specularExponent;               // Specular exponent or shininess property.
 uniform float u_specularExponent;               // Specular exponent or shininess property.
 uniform sampler2D u_diffuseTexture;             // Diffuse texture.
 uniform sampler2D u_diffuseTexture;             // Diffuse texture.
+#if defined(GLOBAL_ALPHA)
+uniform float u_globalAlpha;                    // Global alpha value
+#endif
 
 
 // Inputs
 // Inputs
 varying vec3 v_normalVector;                    // NormalVector in view space.
 varying vec3 v_normalVector;                    // NormalVector in view space.
@@ -114,4 +117,8 @@ void main()
     // Light the pixel
     // Light the pixel
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.rgb = _ambientColor + _diffuseColor + _specularColor;
     gl_FragColor.rgb = _ambientColor + _diffuseColor + _specularColor;
+
+#if defined(GLOBAL_ALPHA)
+    gl_FragColor.a *= u_globalAlpha;
+#endif
 }
 }

+ 7 - 0
gameplay/res/shaders/diffuse.fsh

@@ -6,6 +6,9 @@ precision highp float;
 uniform vec3 u_lightColor;                      // Light color
 uniform vec3 u_lightColor;                      // Light color
 uniform vec3 u_ambientColor;                    // Ambient color
 uniform vec3 u_ambientColor;                    // Ambient color
 uniform sampler2D u_diffuseTexture;             // Diffuse texture.
 uniform sampler2D u_diffuseTexture;             // Diffuse texture.
+#if defined(GLOBAL_ALPHA)
+uniform float u_globalAlpha;                    // Global alpha value
+#endif
 
 
 // Inputs
 // Inputs
 varying vec3 v_normalVector;                    // NormalVector in view space.
 varying vec3 v_normalVector;                    // NormalVector in view space.
@@ -101,4 +104,8 @@ void main()
     // Light the pixel
     // Light the pixel
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.rgb = _ambientColor + _diffuseColor;
     gl_FragColor.rgb = _ambientColor + _diffuseColor;
+
+#if defined(GLOBAL_ALPHA)
+    gl_FragColor.a *= u_globalAlpha;
+#endif
 }
 }

+ 7 - 0
gameplay/res/shaders/parallax-specular.fsh

@@ -10,6 +10,9 @@ uniform sampler2D u_diffuseTexture;             // Diffuse texture.
 uniform sampler2D u_bumpMapTexture;             // Height map texture
 uniform sampler2D u_bumpMapTexture;             // Height map texture
 uniform sampler2D u_normalMapTexture;           // Normal map texture.
 uniform sampler2D u_normalMapTexture;           // Normal map texture.
 uniform float u_parallaxHeight;                 // Parallax height
 uniform float u_parallaxHeight;                 // Parallax height
+#if defined(GLOBAL_ALPHA)
+uniform float u_globalAlpha;                    // Global alpha value
+#endif
 
 
 // Inputs
 // Inputs
 varying vec2 v_texCoord;                        // Texture Coordinate.
 varying vec2 v_texCoord;                        // Texture Coordinate.
@@ -165,4 +168,8 @@ void main()
     // Light the pixel
     // Light the pixel
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.rgb = _ambientColor + _diffuseColor + _specularColor;
     gl_FragColor.rgb = _ambientColor + _diffuseColor + _specularColor;
+
+#if defined(GLOBAL_ALPHA)
+    gl_FragColor.a *= u_globalAlpha;
+#endif
 }
 }

+ 7 - 0
gameplay/res/shaders/parallax.fsh

@@ -9,6 +9,9 @@ uniform sampler2D u_diffuseTexture;             // Diffuse texture.
 uniform sampler2D u_bumpMapTexture;             // Height map texture
 uniform sampler2D u_bumpMapTexture;             // Height map texture
 uniform sampler2D u_normalMapTexture;           // Normal map texture.
 uniform sampler2D u_normalMapTexture;           // Normal map texture.
 uniform float u_parallaxHeight;                 // Parallax height
 uniform float u_parallaxHeight;                 // Parallax height
+#if defined(GLOBAL_ALPHA)
+uniform float u_globalAlpha;                    // Global alpha value
+#endif
 
 
 // Inputs
 // Inputs
 varying vec2 v_texCoord;                        // Texture Coordinate.
 varying vec2 v_texCoord;                        // Texture Coordinate.
@@ -157,4 +160,8 @@ void main()
     // Light the pixel
     // Light the pixel
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.rgb = _ambientColor + _diffuseColor;
     gl_FragColor.rgb = _ambientColor + _diffuseColor;
+
+#if defined(GLOBAL_ALPHA)
+    gl_FragColor.a *= u_globalAlpha;
+#endif
 }
 }

+ 7 - 0
gameplay/res/shaders/solid.fsh

@@ -4,8 +4,15 @@ precision highp float;
 
 
 // Uniforms
 // Uniforms
 uniform vec4 u_diffuseColor;        // Diffuse color
 uniform vec4 u_diffuseColor;        // Diffuse color
+#if defined(GLOBAL_ALPHA)
+uniform float u_globalAlpha;        // Global alpha value
+#endif
 
 
 void main()
 void main()
 {
 {
     gl_FragColor = u_diffuseColor;
     gl_FragColor = u_diffuseColor;
+
+#if defined(GLOBAL_ALPHA)
+    gl_FragColor.a *= u_globalAlpha;
+#endif
 }
 }

+ 7 - 0
gameplay/res/shaders/textured.fsh

@@ -5,6 +5,9 @@ precision highp float;
 // Uniforms
 // Uniforms
 uniform sampler2D u_diffuseTexture;     // Diffuse texture
 uniform sampler2D u_diffuseTexture;     // Diffuse texture
 uniform vec4 u_diffuseColor;            // Diffuse color/tint
 uniform vec4 u_diffuseColor;            // Diffuse color/tint
+#if defined(GLOBAL_ALPHA)
+uniform float u_globalAlpha;            // Global alpha value
+#endif
 
 
 // Inputs
 // Inputs
 varying vec2 v_texCoord;                // Texture coordinate (u, v).
 varying vec2 v_texCoord;                // Texture coordinate (u, v).
@@ -12,4 +15,8 @@ varying vec2 v_texCoord;                // Texture coordinate (u, v).
 void main()
 void main()
 {
 {
     gl_FragColor = texture2D(u_diffuseTexture, v_texCoord) * u_diffuseColor;
     gl_FragColor = texture2D(u_diffuseTexture, v_texCoord) * u_diffuseColor;
+
+#if defined(GLOBAL_ALPHA)
+    gl_FragColor.a *= u_globalAlpha;
+#endif
 }
 }

+ 2 - 2
gameplay/src/Animation.cpp

@@ -71,8 +71,8 @@ Animation::Channel::Channel(Animation* animation, AnimationTarget* target, int p
 
 
 Animation::Channel::Channel(const Channel& copy, Animation* animation, AnimationTarget* target)
 Animation::Channel::Channel(const Channel& copy, Animation* animation, AnimationTarget* target)
     : _animation(animation), _target(target), _propertyId(copy._propertyId), _curve(copy._curve), _duration(copy._duration)
     : _animation(animation), _target(target), _propertyId(copy._propertyId), _curve(copy._curve), _duration(copy._duration)
-{
-    _curve->addRef();
+{
+    _curve->addRef();
     _target->addChannel(this);
     _target->addChannel(this);
 }
 }
 
 

+ 58 - 58
gameplay/src/DebugNew.cpp

@@ -200,64 +200,64 @@ void debugFree(void* p)
 
 
 #ifdef WIN32
 #ifdef WIN32
 void printStackTrace(MemoryAllocationRecord* rec)
 void printStackTrace(MemoryAllocationRecord* rec)
-{
-    const unsigned int bufferSize = 512;
-
-    // Resolve the program counter to the corresponding function names.
-    unsigned int pc;
-    for (int i = 0; i < MAX_STACK_FRAMES; i++)
-    {
-        // Check to see if we are at the end of the stack trace.
-        pc = rec->pc[i];
-        if (pc == 0)
-            break;
-
-        // Get the function name.
-        unsigned char buffer[sizeof(IMAGEHLP_SYMBOL64) + bufferSize];
-        IMAGEHLP_SYMBOL64* symbol = (IMAGEHLP_SYMBOL64*)buffer;
-        DWORD64 displacement;
-        memset(symbol, 0, sizeof(IMAGEHLP_SYMBOL64) + bufferSize);
-        symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
-        symbol->MaxNameLength = bufferSize;
-        if (!SymGetSymFromAddr64(GetCurrentProcess(), pc, &displacement, symbol))
-        {
-            gameplay::printError("[memory] STACK TRACE: <unknown location>");
-        }
-        else
-        {
-            symbol->Name[bufferSize - 1] = '\0';
-
-            // Check if we need to go further up the stack.
-            if (strncmp(symbol->Name, "operator new", 12) == 0)
-            {
-                // In operator new or new[], keep going...
-            }
-            else
-            {
-                // Get the file and line number.
-                if (pc != 0)
-                {
-                    IMAGEHLP_LINE64 line;
-                    DWORD displacement;
-                    memset(&line, 0, sizeof(line));
-                    line.SizeOfStruct = sizeof(line);
-                    if (!SymGetLineFromAddr64(GetCurrentProcess(), pc, &displacement, &line))
-                    {
-                        gameplay::printError("[memory] STACK TRACE: %s - <unknown file>:<unknown line number>", symbol->Name);
-                    }
-                    else
-                    {
-                        const char* file = strrchr(line.FileName, '\\');
-                        if(!file) 
-                            file = line.FileName;
-                        else
-                            file++;
-                        
-                        gameplay::printError("[memory] STACK TRACE: %s - %s:%d", symbol->Name, file, line.LineNumber);
-                    }
-                }
-            }
-        }
+{
+    const unsigned int bufferSize = 512;
+
+    // Resolve the program counter to the corresponding function names.
+    unsigned int pc;
+    for (int i = 0; i < MAX_STACK_FRAMES; i++)
+    {
+        // Check to see if we are at the end of the stack trace.
+        pc = rec->pc[i];
+        if (pc == 0)
+            break;
+
+        // Get the function name.
+        unsigned char buffer[sizeof(IMAGEHLP_SYMBOL64) + bufferSize];
+        IMAGEHLP_SYMBOL64* symbol = (IMAGEHLP_SYMBOL64*)buffer;
+        DWORD64 displacement;
+        memset(symbol, 0, sizeof(IMAGEHLP_SYMBOL64) + bufferSize);
+        symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
+        symbol->MaxNameLength = bufferSize;
+        if (!SymGetSymFromAddr64(GetCurrentProcess(), pc, &displacement, symbol))
+        {
+            gameplay::printError("[memory] STACK TRACE: <unknown location>");
+        }
+        else
+        {
+            symbol->Name[bufferSize - 1] = '\0';
+
+            // Check if we need to go further up the stack.
+            if (strncmp(symbol->Name, "operator new", 12) == 0)
+            {
+                // In operator new or new[], keep going...
+            }
+            else
+            {
+                // Get the file and line number.
+                if (pc != 0)
+                {
+                    IMAGEHLP_LINE64 line;
+                    DWORD displacement;
+                    memset(&line, 0, sizeof(line));
+                    line.SizeOfStruct = sizeof(line);
+                    if (!SymGetLineFromAddr64(GetCurrentProcess(), pc, &displacement, &line))
+                    {
+                        gameplay::printError("[memory] STACK TRACE: %s - <unknown file>:<unknown line number>", symbol->Name);
+                    }
+                    else
+                    {
+                        const char* file = strrchr(line.FileName, '\\');
+                        if(!file) 
+                            file = line.FileName;
+                        else
+                            file++;
+                        
+                        gameplay::printError("[memory] STACK TRACE: %s - %s:%d", symbol->Name, file, line.LineNumber);
+                    }
+                }
+            }
+        }
     }
     }
 }
 }
 #endif
 #endif

+ 0 - 1
gameplay/src/PlatformMacOSX.mm

@@ -6,7 +6,6 @@
 #include "Game.h"
 #include "Game.h"
 #include "Form.h"
 #include "Form.h"
 #include <unistd.h>
 #include <unistd.h>
-
 #import <Cocoa/Cocoa.h>
 #import <Cocoa/Cocoa.h>
 #import <QuartzCore/CVDisplayLink.h>
 #import <QuartzCore/CVDisplayLink.h>
 #import <OpenGL/OpenGL.h>
 #import <OpenGL/OpenGL.h>

+ 25 - 12
gameplay/src/PlatformiOS.mm

@@ -4,9 +4,8 @@
 #include "Platform.h"
 #include "Platform.h"
 #include "FileSystem.h"
 #include "FileSystem.h"
 #include "Game.h"
 #include "Game.h"
-
+#include "Form.h"
 #include <unistd.h>
 #include <unistd.h>
-
 #import <UIKit/UIKit.h>
 #import <UIKit/UIKit.h>
 #import <QuartzCore/QuartzCore.h>
 #import <QuartzCore/QuartzCore.h>
 #import <CoreMotion/CoreMotion.h>
 #import <CoreMotion/CoreMotion.h>
@@ -307,15 +306,15 @@ int getKey(unichar keyCode);
     if([text length] == 0) return;
     if([text length] == 0) return;
     assert([text length] == 1);
     assert([text length] == 1);
     unichar c = [text characterAtIndex:0];
     unichar c = [text characterAtIndex:0];
-    int gpk = getKey(c);
-    Game::getInstance()->keyEvent(Keyboard::KEY_PRESS, gpk);    
-    Game::getInstance()->keyEvent(Keyboard::KEY_RELEASE, gpk);    
+    int key = getKey(c);
+    Platform::keyEventInternal(Keyboard::KEY_PRESS, key);    
+    Platform::keyEventInternal(Keyboard::KEY_RELEASE, key);    
 }
 }
 
 
 - (void)deleteBackward 
 - (void)deleteBackward 
 {
 {
-    Game::getInstance()->keyEvent(Keyboard::KEY_PRESS, Keyboard::KEY_BACKSPACE);    
-    Game::getInstance()->keyEvent(Keyboard::KEY_RELEASE, Keyboard::KEY_BACKSPACE);    
+    Platform::keyEventInternal(Keyboard::KEY_PRESS, Keyboard::KEY_BACKSPACE);    
+    Platform::keyEventInternal(Keyboard::KEY_RELEASE, Keyboard::KEY_BACKSPACE);    
 }
 }
 
 
 - (BOOL)hasText 
 - (BOOL)hasText 
@@ -333,7 +332,7 @@ int getKey(unichar keyCode);
         {
         {
             uniqueTouch = [t hash];
             uniqueTouch = [t hash];
         }
         }
-        Game::getInstance()->touchEvent(Touch::TOUCH_PRESS, touchLoc.x, touchLoc.y, uniqueTouch);
+        Platform::touchEventInternal(Touch::TOUCH_PRESS, touchLoc.x, touchLoc.y, uniqueTouch);
     }
     }
 }
 }
 
 
@@ -345,7 +344,7 @@ int getKey(unichar keyCode);
         CGPoint touchLoc = [t locationInView:self];
         CGPoint touchLoc = [t locationInView:self];
         if(self.multipleTouchEnabled == YES) 
         if(self.multipleTouchEnabled == YES) 
             uniqueTouch = [t hash];
             uniqueTouch = [t hash];
-        Game::getInstance()->touchEvent(Touch::TOUCH_RELEASE, touchLoc.x, touchLoc.y, uniqueTouch);
+        Platform::touchEventInternal(Touch::TOUCH_RELEASE, touchLoc.x, touchLoc.y, uniqueTouch);
     }
     }
 }
 }
 
 
@@ -363,7 +362,7 @@ int getKey(unichar keyCode);
         CGPoint touchLoc = [t locationInView:self];
         CGPoint touchLoc = [t locationInView:self];
         if(self.multipleTouchEnabled == YES) 
         if(self.multipleTouchEnabled == YES) 
             uniqueTouch = [t hash];
             uniqueTouch = [t hash];
-        Game::getInstance()->touchEvent(Touch::TOUCH_MOVE, touchLoc.x, touchLoc.y, uniqueTouch);
+        Platform::touchEventInternal(Touch::TOUCH_MOVE, touchLoc.x, touchLoc.y, uniqueTouch);
     }
     }
 }
 }
 
 
@@ -394,8 +393,7 @@ int getKey(unichar keyCode);
 
 
 - (void)didReceiveMemoryWarning
 - (void)didReceiveMemoryWarning
 {
 {
-    [super didReceiveMemoryWarning];    
-    // Release any cached data, images, etc that aren't in use.
+    [super didReceiveMemoryWarning];
 }
 }
 
 
 #pragma mark - View lifecycle
 #pragma mark - View lifecycle
@@ -862,6 +860,21 @@ void Platform::displayKeyboard(bool display)
         }
         }
     }
     }
 }
 }
+    
+void Platform::touchEventInternal(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
+{
+    if (!Form::touchEventInternal(evt, x, y, contactIndex))
+    {
+        Game::getInstance()->touchEvent(evt, x, y, contactIndex);
+    }
+}
+
+void Platform::keyEventInternal(Keyboard::KeyEvent evt, int key)
+{
+    gameplay::Game::getInstance()->keyEvent(evt, key);
+    Form::keyEventInternal(evt, key);
+}
+    
 
 
 void Platform::sleep(long ms)
 void Platform::sleep(long ms)
 {
 {