Browse Source

Merge pull request #254 from blackberry/next

gameplay v1.4.0
Sean Paul Taylor 13 years ago
parent
commit
6f05fa0263
100 changed files with 11576 additions and 2652 deletions
  1. 99 67
      .gitignore
  2. 28 2
      CHANGES.md
  3. 3 5
      README.md
  4. 25 17
      gameplay-encoder/README.md
  5. 23 0
      gameplay-encoder/gameplay-encoder.sln
  6. 2 5
      gameplay-encoder/gameplay-encoder.vcxproj
  7. 2 2
      gameplay-encoder/gameplay-encoder.vcxproj.user
  8. 5 0
      gameplay-encoder/src/Animations.cpp
  9. 1 0
      gameplay-encoder/src/Animations.h
  10. 12 0
      gameplay-encoder/src/Base.cpp
  11. 10 0
      gameplay-encoder/src/Base.h
  12. 43 9
      gameplay-encoder/src/DAESceneEncoder.cpp
  13. 2 0
      gameplay-encoder/src/DAESceneEncoder.h
  14. 130 0
      gameplay-encoder/src/DAEUtil.cpp
  15. 67 1
      gameplay-encoder/src/DAEUtil.h
  16. 7 10
      gameplay-encoder/src/EncoderArguments.cpp
  17. 1 1
      gameplay-encoder/src/EncoderArguments.h
  18. 75 1
      gameplay-encoder/src/FBXSceneEncoder.cpp
  19. 6 1
      gameplay-encoder/src/FBXSceneEncoder.h
  20. 19 0
      gameplay-encoder/src/FileIO.cpp
  21. 8 0
      gameplay-encoder/src/FileIO.h
  22. 2 1
      gameplay-encoder/src/GPBDecoder.cpp
  23. 122 10
      gameplay-encoder/src/GPBFile.cpp
  24. 24 0
      gameplay-encoder/src/GPBFile.h
  25. 7 3
      gameplay-encoder/src/Mesh.cpp
  26. 6 1
      gameplay-encoder/src/MeshSkin.cpp
  27. 3 1
      gameplay-encoder/src/MeshSkin.h
  28. 1 1
      gameplay-encoder/src/Quaternion.h
  29. 8 14
      gameplay-encoder/src/TTFFontEncoder.cpp
  30. 12 2
      gameplay-encoder/src/TTFFontEncoder.h
  31. 2 2
      gameplay-encoder/src/Vector2.h
  32. 2 2
      gameplay-encoder/src/Vector3.h
  33. 2 2
      gameplay-encoder/src/Vector4.h
  34. 28 12
      gameplay-encoder/src/main.cpp
  35. 26 0
      gameplay-luagen/README.md
  36. 15 0
      gameplay-luagen/gameplay-api/xml/combine.xslt
  37. 832 0
      gameplay-luagen/gameplay-api/xml/compound.xsd
  38. 3 0
      gameplay-luagen/gameplay-api/xml/index.xml
  39. 66 0
      gameplay-luagen/gameplay-api/xml/index.xsd
  40. 1794 0
      gameplay-luagen/gameplay-luagen.doxyfile
  41. 20 0
      gameplay-luagen/gameplay-luagen.sln
  42. 136 0
      gameplay-luagen/gameplay-luagen.vcxproj
  43. 48 0
      gameplay-luagen/gameplay-luagen.vcxproj.filters
  44. 13 0
      gameplay-luagen/gameplay-luagen.vcxproj.user
  45. 258 0
      gameplay-luagen/gameplay-luagen.xcodeproj/project.pbxproj
  46. 113 0
      gameplay-luagen/gameplay-luagen.xcodeproj/xcshareddata/xcschemes/gameplay-luagen.xcscheme
  47. 2 0
      gameplay-luagen/generate-doxygen-xml.bat
  48. 86 0
      gameplay-luagen/src/Base.h
  49. 296 0
      gameplay-luagen/src/ClassBinding.cpp
  50. 51 0
      gameplay-luagen/src/ClassBinding.h
  51. 302 0
      gameplay-luagen/src/DebugNew.cpp
  52. 50 0
      gameplay-luagen/src/DebugNew.h
  53. 16 0
      gameplay-luagen/src/EnumBinding.h
  54. 988 0
      gameplay-luagen/src/FunctionBinding.cpp
  55. 165 0
      gameplay-luagen/src/FunctionBinding.h
  56. 1965 0
      gameplay-luagen/src/Generator.cpp
  57. 207 0
      gameplay-luagen/src/Generator.h
  58. 16 0
      gameplay-luagen/src/TypedefBinding.h
  59. 42 0
      gameplay-luagen/src/main.cpp
  60. 5 1
      gameplay-newproject.sh
  61. 10 2
      gameplay-template/android/jni/template.Android.mk
  62. 2 2
      gameplay-template/android/template.build.xml
  63. 11 11
      gameplay-template/gameplay-template.vcxproj
  64. 2 2
      gameplay-template/gameplay-template.vcxproj.filters
  65. 3 3
      gameplay-template/gameplay-template.vcxproj.user
  66. 4 0
      gameplay-template/gameplay-template.xcodeproj/project.pbxproj
  67. 2 2
      gameplay-template/res/box.material
  68. 35 0
      gameplay-template/res/colored.frag
  69. 0 111
      gameplay-template/res/colored.fsh
  70. 24 0
      gameplay-template/res/colored.vert
  71. 0 183
      gameplay-template/res/colored.vsh
  72. 17 2
      gameplay-template/src/TemplateGame.cpp
  73. 7 2
      gameplay-template/src/TemplateGame.h
  74. 50 8
      gameplay-template/template.cproject
  75. 98 63
      gameplay.doxyfile
  76. 11 8
      gameplay.sln
  77. 3 3
      gameplay.xcworkspace/contents.xcworkspacedata
  78. 38 4
      gameplay/.cproject
  79. 255 2
      gameplay/android/jni/Android.mk
  80. 355 27
      gameplay/gameplay.vcxproj
  81. 999 69
      gameplay/gameplay.vcxproj.filters
  82. 996 5
      gameplay/gameplay.xcodeproj/project.pbxproj
  83. 0 124
      gameplay/res/shaders/bumped-specular.fsh
  84. 0 248
      gameplay/res/shaders/bumped-specular.vsh
  85. 0 113
      gameplay/res/shaders/bumped.fsh
  86. 0 236
      gameplay/res/shaders/bumped.vsh
  87. 0 132
      gameplay/res/shaders/colored-specular.fsh
  88. 0 203
      gameplay/res/shaders/colored-specular.vsh
  89. 42 0
      gameplay/res/shaders/colored-unlit.frag
  90. 39 0
      gameplay/res/shaders/colored-unlit.vert
  91. 70 0
      gameplay/res/shaders/colored.frag
  92. 0 111
      gameplay/res/shaders/colored.fsh
  93. 81 0
      gameplay/res/shaders/colored.vert
  94. 0 183
      gameplay/res/shaders/colored.vsh
  95. 0 124
      gameplay/res/shaders/diffuse-specular.fsh
  96. 0 194
      gameplay/res/shaders/diffuse-specular.vsh
  97. 0 111
      gameplay/res/shaders/diffuse.fsh
  98. 0 191
      gameplay/res/shaders/diffuse.vsh
  99. 93 0
      gameplay/res/shaders/lib/attributes-skinning.vert
  100. 27 0
      gameplay/res/shaders/lib/attributes.vert

+ 99 - 67
.gitignore

@@ -16,8 +16,8 @@ Thumbs.db
 /Device-Debug
 /Device-Coverage
 /Device-Profile
-/Device-Release
-/gameplay.xcworkspace/xcuserdata
+/Device-Release
+
 /gameplay/Debug
 /gameplay/DebugMem
 /gameplay/Release
@@ -27,12 +27,27 @@ Thumbs.db
 /gameplay/Device-Debug
 /gameplay/Device-Coverage
 /gameplay/Device-Profile
-/gameplay/Device-Release
-/gameplay/gameplay.xcodeproj/xcuserdata
+/gameplay/Device-Release
+/gameplay.xcworkspace/xcuserdata
+/gameplay/gameplay.xcodeproj/xcuserdata
+/gameplay/android/NUL
+/gameplay/android/proguard.cfg
+/gameplay/android/local.properties
+/gameplay/android/project.properties
+/gameplay/android/obj
+
+/gameplay-api/xml
+
 /gameplay-encoder/Debug
 /gameplay-encoder/Release
-/gameplay-encoder/gameplay-encoder.xcodeproj/xcuserdata
-/gameplay-internal
+/gameplay-encoder/gameplay-encoder.xcodeproj/xcuserdata
+
+/gameplay-luagen/Release
+/gameplay-luagen/Debug
+/gameplay-luagen/doxygen_entrydb_680.tmp
+/gameplay-luagen/doxygen_objdb_680.tmp
+/gameplay-luagen/xml
+
 /gameplay-samples/sample00-mesh/Debug
 /gameplay-samples/sample00-mesh/DebugMem
 /gameplay-samples/sample00-mesh/Release
@@ -45,7 +60,18 @@ Thumbs.db
 /gameplay-samples/sample00-mesh/Device-Release
 /gameplay-samples/sample00-mesh/res/shaders
 /gameplay-samples/sample00-mesh/res/logo_powered_white.png
-/gameplay-samples/sample00-mesh/sample00-mesh.xcodeproj/xcuserdata
+/gameplay-samples/sample00-mesh/sample00-mesh.xcodeproj/xcuserdata
+/gameplay-samples/sample00-mesh/android/src
+/gameplay-samples/sample00-mesh/android/assets
+/gameplay-samples/sample00-mesh/android/bin
+/gameplay-samples/sample00-mesh/android/gen
+/gameplay-samples/sample00-mesh/android/libs
+/gameplay-samples/sample00-mesh/android/obj
+/gameplay-samples/sample00-mesh/android/NUL
+/gameplay-samples/sample00-mesh/android/local.properties
+/gameplay-samples/sample00-mesh/android/proguard.cfg
+/gameplay-samples/sample00-mesh/android/project.properties
+
 /gameplay-samples/sample01-longboard/Debug
 /gameplay-samples/sample01-longboard/DebugMem
 /gameplay-samples/sample01-longboard/Release
@@ -58,7 +84,19 @@ Thumbs.db
 /gameplay-samples/sample01-longboard/Device-Release
 /gameplay-samples/sample01-longboard/res/shaders
 /gameplay-samples/sample01-longboard/res/logo_powered_white.png
-/gameplay-samples/sample01-longboard/sample01-longboard.xcodeproj/xcuserdata
+/gameplay-samples/sample01-longboard/sample01-longboard.xcodeproj/xcuserdata
+/gameplay-samples/sample01-longboard/NUL
+/gameplay-samples/sample01-longboard/android/NUL
+/gameplay-samples/sample01-longboard/android/src
+/gameplay-samples/sample01-longboard/android/assets
+/gameplay-samples/sample01-longboard/android/bin
+/gameplay-samples/sample01-longboard/android/gen
+/gameplay-samples/sample01-longboard/android/libs
+/gameplay-samples/sample01-longboard/android/obj
+/gameplay-samples/sample01-longboard/android/proguard.cfg
+/gameplay-samples/sample01-longboard/android/project.properties
+/gameplay-samples/sample01-longboard/android/local.properties
+
 /gameplay-samples/sample02-spaceship/Debug
 /gameplay-samples/sample02-spaceship/DebugMem
 /gameplay-samples/sample02-spaceship/Release
@@ -71,7 +109,18 @@ Thumbs.db
 /gameplay-samples/sample02-spaceship/Device-Release
 /gameplay-samples/sample02-spaceship/res/shaders
 /gameplay-samples/sample02-spaceship/res/logo_powered_white.png
-/gameplay-samples/sample02-spaceship/sample02-spaceship.xcodeproj/xcuserdata
+/gameplay-samples/sample02-spaceship/sample02-spaceship.xcodeproj/xcuserdata
+/gameplay-samples/sample02-spaceship/android/NUL
+/gameplay-samples/sample02-spaceship/android/project.properties
+/gameplay-samples/sample02-spaceship/android/assets
+/gameplay-samples/sample02-spaceship/android/bin
+/gameplay-samples/sample02-spaceship/android/gen
+/gameplay-samples/sample02-spaceship/android/libs
+/gameplay-samples/sample02-spaceship/android/obj
+/gameplay-samples/sample02-spaceship/android/src
+/gameplay-samples/sample02-spaceship/android/proguard.cfg
+/gameplay-samples/sample02-spaceship/android/local.properties
+
 /gameplay-samples/sample03-character/Debug
 /gameplay-samples/sample03-character/DebugMem
 /gameplay-samples/sample03-character/Release
@@ -84,7 +133,19 @@ Thumbs.db
 /gameplay-samples/sample03-character/Device-Release
 /gameplay-samples/sample03-character/res/shaders
 /gameplay-samples/sample03-character/res/logo_powered_white.png
-/gameplay-samples/sample03-character/sample03-character.xcodeproj/xcuserdata
+/gameplay-samples/sample03-character/sample03-character.xcodeproj/xcuserdata
+/gameplay-samples/sample03-character/android/project.properties
+/gameplay-samples/sample03-character/android/proguard.cfg
+/gameplay-samples/sample03-character/android/local.properties
+/gameplay-samples/sample03-character/android/src
+/gameplay-samples/sample03-character/android/assets
+/gameplay-samples/sample03-character/android/bin
+/gameplay-samples/sample03-character/android/gen
+/gameplay-samples/sample03-character/android/libs
+/gameplay-samples/sample03-character/android/obj
+/gameplay-samples/sample03-character/android/NUL
+/gameplay-samples/sample03-character/res/gamepad.xcf
+
 /gameplay-samples/sample04-particles/Debug
 /gameplay-samples/sample04-particles/DebugMem
 /gameplay-samples/sample04-particles/Release
@@ -98,65 +159,9 @@ Thumbs.db
 /gameplay-samples/sample04-particles/res/shaders
 /gameplay-samples/sample04-particles/res/logo_powered_white.png
 /gameplay-samples/sample04-particles/sample04-particles.xcodeproj/xcuserdata
-
-/gameplay-android/obj
-/gameplay-android/NUL
-/gameplay/android/NUL
-/gameplay/android/proguard.cfg
-/gameplay/android/local.properties
-/gameplay/android/project.properties
-/gameplay/android/obj
-/gameplay-samples/sample00-mesh/android/src
-/gameplay-samples/sample00-mesh/android/assets
-/gameplay-samples/sample00-mesh/android/bin
-/gameplay-samples/sample00-mesh/android/gen
-/gameplay-samples/sample00-mesh/android/libs
-/gameplay-samples/sample00-mesh/android/obj
-/gameplay-android/local.properties
-/gameplay-android/proguard.cfg
-/gameplay-android/project.properties
-/gameplay-samples/sample00-mesh/android/NUL
-/gameplay-samples/sample00-mesh/android/local.properties
-/gameplay-samples/sample00-mesh/android/proguard.cfg
-/gameplay-samples/sample00-mesh/android/project.properties
-/gameplay-samples/sample01-longboard/android/NUL
-/gameplay-samples/sample01-longboard/android/src
-/gameplay-samples/sample01-longboard/android/assets
-/gameplay-samples/sample01-longboard/android/bin
-/gameplay-samples/sample01-longboard/android/gen
-/gameplay-samples/sample01-longboard/android/libs
-/gameplay-samples/sample01-longboard/android/obj
-/gameplay-samples/sample01-longboard/android/project.properties
-/gameplay-samples/sample01-longboard/android/local.properties
-/gameplay-samples/sample02-spaceship/android/project.properties
-/gameplay-samples/sample02-spaceship/android/assets
-/gameplay-samples/sample02-spaceship/android/bin
-/gameplay-samples/sample02-spaceship/android/gen
-/gameplay-samples/sample02-spaceship/android/libs
-/gameplay-samples/sample02-spaceship/android/obj
-/gameplay-samples/sample02-spaceship/android/src
-/gameplay-samples/sample02-spaceship/android/proguard.cfg
-/gameplay-samples/sample02-spaceship/android/local.properties
-/gameplay-samples/sample03-character/android/project.properties
-/gameplay-samples/sample03-character/android/proguard.cfg
-/gameplay-samples/sample03-character/android/local.properties
-/gameplay-samples/sample01-longboard/android/proguard.cfg
-/gameplay-samples/sample02-spaceship/android/NUL
-/gameplay-samples/sample01-longboard/android/proguard.cfg
-/gameplay-samples/sample03-character/android/src
-/gameplay-samples/sample03-character/android/assets
-/gameplay-samples/sample03-character/android/bin
-/gameplay-samples/sample03-character/android/gen
-/gameplay-samples/sample03-character/android/libs
-/gameplay-samples/sample03-character/android/obj
-/gameplay-samples/sample03-character/android/NUL
-/gameplay-samples/sample01-longboard/NUL
-
-
 /gameplay-samples/sample04-particles/Device-Debug
 /gameplay-samples/sample04-particles/Debug
 /gameplay-samples/sample04-particles/DebugMem
-/gameplay-samples/sample03-character/res/gamepad.xcf
 /gameplay-samples/sample04-particles/android/src
 /gameplay-samples/sample04-particles/android/assets
 /gameplay-samples/sample04-particles/android/bin
@@ -165,4 +170,31 @@ Thumbs.db
 /gameplay-samples/sample04-particles/android/obj
 /gameplay-samples/sample04-particles/android/proguard.cfg
 /gameplay-samples/sample04-particles/android/local.properties
-/gameplay-samples/sample04-particles/android/project.properties
+/gameplay-samples/sample04-particles/android/project.properties
+
+/gameplay-samples/sample05-lua/Debug
+/gameplay-samples/sample05-lua/DebugMem
+/gameplay-samples/sample05-lua/Release
+/gameplay-samples/sample05-lua/Simulator
+/gameplay-samples/sample05-lua/Simulator-Coverage
+/gameplay-samples/sample05-lua/Simulator-Profile
+/gameplay-samples/sample05-lua/Device-Debug
+/gameplay-samples/sample05-lua/Device-Coverage
+/gameplay-samples/sample05-lua/Device-Profile
+/gameplay-samples/sample05-lua/Device-Release
+/gameplay-samples/sample05-lua/res/shaders
+/gameplay-samples/sample05-lua/res/logo_powered_white.png
+/gameplay-samples/sample05-lua/sample05-lua.xcodeproj/xcuserdata
+/gameplay-samples/sample05-lua/android/src
+/gameplay-samples/sample05-lua/android/assets
+/gameplay-samples/sample05-lua/android/bin
+/gameplay-samples/sample05-lua/android/gen
+/gameplay-samples/sample05-lua/android/libs
+/gameplay-samples/sample05-lua/android/obj
+/gameplay-samples/sample05-lua/android/NUL
+/gameplay-samples/sample05-lua/android/local.properties
+/gameplay-samples/sample05-lua/android/proguard.cfg
+/gameplay-samples/sample05-lua/android/project.properties
+
+/gameplay-internal
+/gameplay\android/proguard-project.txt

+ 28 - 2
CHANGES.md

@@ -1,3 +1,29 @@
+## v1.4.0
+
+- Lua script bindings for all gameplay interfaces.
+- Lua script binding generator tool (gameplay-luagen) for generating gameplay Lua bindings from doxygen xml output.
+- AIController, AIAgent, AIStateMachine, AIState and AIMessage clases for scripted AI support.
+- Sample for sample05-lua to demonstrate basic Lua with AI scripting.
+- Gamepad class with virtual gamepad support.
+- Pre-built versions gameplay-encoder added to bin folder with TTF, DAE and FBX support built-in.
+- Improved modular shaders with support for #include in shaders. (breaks compat. for shaders)
+- LightMap support into colored-unlit.frag and textured-unlit.frag shaders.
+- Adds cloning and wireframing features to sample03-character.
+- Adds kick the ball on the sample03-character to demonstrate 2 buttons and more physics.
+- Fixes missing mouse events on UI controls.
+- Fixes to gameplay-encoder to prompt user for font size if not specified.
+- Fixes to add "-g" as short form argument for grouping animations.
+- Fixes node cloning.
+- Fixes to gameplay-encoder for output file path when encoding fonts.
+- Fixes to FrameBuffer, RenderTarget and DepthStencilTarget.
+- Fixes user switching in MacOSX to other applications with Apple-Tab.
+- Fixes measureText with empty string to be proper size.
+- Fixed for aliased text by applying linear filtering by default on Fonts.
+- Fixes RenderState::StateBlock::bindNoRestore() issue where blend function was not restored to the proper defaults.
+- Fixes some inconsistencies in Game event method names for menuEvent. (breaks compat. in Game)
+- Fixes some inconsistencies with AnimationClip::getID() to be same as Node::getId() and other classes. (breaks compat. in AnimationClip)
+- Fixes to gameplay-encoder and PhysicsRigidBody for heightmaps which adds height precision into generated heightmap png's.
+
 ## v1.3.0
 
 - Portrait mode games on mobile platforms.
@@ -5,7 +31,7 @@
 - User Interface support for scrolling with scrollbars on Container.
 - PVRTC, ATC and DXT texture compression support.
 - Performance improvements in user interface forms and text.
-- Performance improvements in animations on transforms.
+- Performance improvements in animations on transforms.
 - Performance improvements using NEON math for BlackBerry and iOS.
 - Fixes for improvements in error handling throughout all systems.
 - Fixes supporting built-in Maya COLLADA exporter via DAE_FBX export.
@@ -25,7 +51,7 @@
 - Bluetooth keyboard/mouse support on BlackBerry platform.
 - Developer guide.
 - Sample/turorial for sample03-character.
-- Sample for sample04-particles.
+- Sample for sample04-particles to demonstrate particle emitters.
 - Fixes for loading properties from URL.
 - Fixes on Win32/MacOSX for when mouse pointer leaves the window and returns.
 - Fixes to accelerometer for Android.

+ 3 - 5
README.md

@@ -1,4 +1,4 @@
-## gameplay v1.3.0
+## gameplay v1.4.0
 An open-source, cross-platform 3D native C++ game framework making it easy to learn and write mobile and desktop games. 
 
 ## Supported Mobile Platforms
@@ -11,12 +11,10 @@ An open-source, cross-platform 3D native C++ game framework making it easy to le
 - Apple MacOS X (using Apple XCode 4.3.2)
 
 ## Roadmap for 'next' branch
-- Lua script bindings
-- Gamepad support
+- Linux support
 - Vehicle physics
-- Terrain
-- Lightmaps
 - Shadows
+- AI pathfinding
 
 ## Licence
 The project is open sourced under the Apache 2.0 license.

+ 25 - 17
gameplay-encoder/README.md

@@ -1,36 +1,44 @@
 ## gameplay-encoder
 Command-line tool for encoding games assets like true-type fonts and 3D scene files
 into a simple binary-based bundle file format for the gameplay 3D game framework runtime. 
+The 'bin' folder contains pre-built versions of the gameplay-encoder executables for both 
+Windows 7 and MacOS X with support built-in support for:
 
-## TrueType Font Support
-TrueType Fonts conversion is enabled/built-in by default into gameplay-encoder via freetype 2 library.
+## TrueType Font
+TrueType Fonts represent a standard in defining outline fonts and has become the 
+most common format for fonts. The gameplay-encoder reads these fonts and binary encodes 
+them into a texture mapped base representation using a texture atlas and 8-bit alpha
+representation.
 
-## COLLADA Scene Support
-COLLADA is enabled/built-in by default into gameplay-encoder via COLLADA-DOM library.
-Most major 3D DCC tools support the export of COLLADA 1.4.
-We also recommend you download and use OpenCOLADA (http://opencollada.org/)
-for Autodesk Maya and 3DS Max.
+## COLLADA Scene
+COLLADA is a royalty-free XML schema that enables digital asset exchange 
+within the interactive 3D industry. Most major 3D DCC tools support export to COLLADA 1.4.
 
-## FBX Scene Support
-FBX support can easily be enabled in gameplay-encoder but requires an 
-additional installation of Autodesk FBX SDK. (http://www.autodesk.com/fbx).
-You must then rebuild gameplay-encoder with the follow platform/tooling instructions:
+## FBX Scene
+Autodesk® FBX® asset exchange technology facilitates higher-fidelity data exchange 
+between several Autodesk content creation packages
+Autodesk® Maya®, Autodesk® 3ds Max®, Autodesk® MotionBuilder®, Autodesk® Mudbox®, and Autodesk® Softimage®
+For more information goto "http://www.autodesk.com/fbx".
+
+## Building gameplay-encoder
+The gameplay-encoder comes pre-built for both Windows 7 and MacOS X in the 'bin' folder.
+However, to build the gameplay-ecoder yourself just open either the 
+Visual Studio 2010 project "gameplay-encoder.vccproj" on Windows 7 or
+XCode project "gameplay-encoder.xcodeproj" on MacOSX.
 
-### Building FBX Support on Windows 7 using Visual Studio 2010
+### Building with FBX Support on Windows 7 using Visual Studio 2010
 - Download and install the FBX SDK for Window VS2010. (http://www.autodesk.com/fbx)
-- Edit the project properties of "gameplay-encoder"
+- Edit the project properties of "gameplay-encoder" for Debug
 - Add Preprocessor Definition "USE_FBX" (C++/Preprocessor)
 - Add the FBX SDK include directory to Additional Include Directories (C++/General)
   * Example: C:/Program Files/Autodesk/FBX/FbxSdk/2013.1/include
 - Add the FBX lib directory to the Additional Library Directories (Linker/General)
   * Example: C:/Program Files/Autodesk/FBX/FbxSdk/2013.1/lib/vs2010/x86
-- Add "fbxsdk-2013.1-mdd.lib" and "wininet.lib" to the Additional Dependencies (Linker/Input)
+- Add "fbxsdk-2013.1-mdd.lib"(Release) and "wininet.lib" to the Additional Dependencies (Linker/Input)
   * Example: fbxsdk-2013.1-mdd.lib;wininet.lib
-- Add a post build event to copy the DLL (Build Events/Post-Build Event)
-  * Example: copy /Y "C:\Program Files\Autodesk\FBX\FbxSdk\2013.1\lib\vs2010\x86\fbxsdk-2013.1d.dll" "$(TargetDir)"
 - Build gameplay-encoder
 
-### Building FBX Support on Mac OS X using XCode 4.3.2+
+### Building with FBX Support on Mac OS X using XCode 4.3.2+
 - Download and install the FBX SDK for Mac OS X (http://www.autodesk.com/fbx)
 - Edit the project properties of target "gameplay-encoder".
 - Add Preprocessor Macro "USE_FBX" to both Debug/Release sections. (Build Settings)

+ 23 - 0
gameplay-encoder/gameplay-encoder.sln

@@ -0,0 +1,23 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gameplay-encoder", "gameplay-encoder.vcxproj", "{9D69B743-4872-4DD1-8E30-0087C64298D7}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		DebugMem|Win32 = DebugMem|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Debug|Win32.ActiveCfg = Debug|Win32
+		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Debug|Win32.Build.0 = Debug|Win32
+		{9D69B743-4872-4DD1-8E30-0087C64298D7}.DebugMem|Win32.ActiveCfg = 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.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 2 - 5
gameplay-encoder/gameplay-encoder.vcxproj

@@ -161,9 +161,7 @@
       <IgnoreSpecificDefaultLibraries>MSVCRT</IgnoreSpecificDefaultLibraries>
     </Link>
     <PostBuildEvent>
-      <Command>copy /Y "$(ProjectDir)..\external-deps\collada-dom\lib\win32\*.dll" "$(TargetDir)"
-copy /Y "$(ProjectDir)..\external-deps\zlib\lib\win32\*.dll" "$(TargetDir)"
-</Command>
+      <Command>copy /Y "$(ProjectDir)..\bin\win32\*.dll" "$(TargetDir)"</Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -188,8 +186,7 @@ copy /Y "$(ProjectDir)..\external-deps\zlib\lib\win32\*.dll" "$(TargetDir)"
       </IgnoreSpecificDefaultLibraries>
     </Link>
     <PostBuildEvent>
-      <Command>copy /Y "$(ProjectDir)..\external-deps\collada-dom\lib\win32\*.dll" "$(TargetDir)"
-copy /Y "$(ProjectDir)..\external-deps\zlib\lib\win32\*.dll" "$(TargetDir)"
+      <Command>copy /Y "$(ProjectDir)..\bin\win32\*.dll" "$(TargetDir)"
 </Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>

+ 2 - 2
gameplay-encoder/gameplay-encoder.vcxproj.user

@@ -4,10 +4,10 @@
     <LocalDebuggerCommandArguments>
     </LocalDebuggerCommandArguments>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
-    <LocalDebuggerEnvironment>PATH=%PATH%;../external-deps/zlib/lib/win32;../external-deps/libpng/lib/win32</LocalDebuggerEnvironment>
+    <LocalDebuggerEnvironment>PATH=%PATH%;../bin/win32;</LocalDebuggerEnvironment>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <LocalDebuggerEnvironment>PATH=%PATH%;../external-deps/zlib/lib/win32;../external-deps/libpng/lib/win32</LocalDebuggerEnvironment>
+    <LocalDebuggerEnvironment>PATH=%PATH%;../bin/win32;</LocalDebuggerEnvironment>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
   </PropertyGroup>
 </Project>

+ 5 - 0
gameplay-encoder/src/Animations.cpp

@@ -62,4 +62,9 @@ Animation* Animations::getAnimation(unsigned int index) const
     return _animations[index];
 }
 
+void Animations::removeAnimation(unsigned int index)
+{
+    _animations.erase(_animations.begin() + index);
+}
+
 }

+ 1 - 0
gameplay-encoder/src/Animations.h

@@ -32,6 +32,7 @@ public:
     void add(Animation* animation);
     unsigned int getAnimationCount() const;
     Animation* getAnimation(unsigned int index) const;
+    void removeAnimation(unsigned int index);
 
 private:
 

+ 12 - 0
gameplay-encoder/src/Base.cpp

@@ -11,4 +11,16 @@ void fillArray(float values[], float value, size_t length)
     }
 }
 
+std::string getBaseName(const std::string& filepath)
+{
+    size_t index1 = filepath.find_last_of('\\');
+    size_t index2 = filepath.find_last_of('/');
+    size_t index = (index1 != -1 && index1 > index2 ? index1 : index2);
+    size_t length = filepath.length();
+    std::string filename = filepath.substr(index + 1, length);
+    length = filename.length();
+    std::string output = filename.substr(0, (length-4));
+    return output;
+}
+
 }

+ 10 - 0
gameplay-encoder/src/Base.h

@@ -76,6 +76,16 @@ enum VertexUsage
 
 void fillArray(float values[], float value, size_t length);
 
+/**
+ * Returns the base name of the given path.
+ * Example: "c:/foo/bar/model.dae" returns "model.dae"
+ * 
+ * @param filepath File path.
+ * 
+ * @return Base file name.
+ */
+std::string getBaseName(const std::string& filepath);
+
 #define ISZERO(x) (fabs(x) < 0.000001f)
 
 // Object deletion macro

+ 43 - 9
gameplay-encoder/src/DAESceneEncoder.cpp

@@ -36,19 +36,52 @@ unsigned int getMaxOffset(domInputLocalOffset_Array& inputArray)
 
 void DAESceneEncoder::optimizeCOLLADA(const EncoderArguments& arguments, domCOLLADA* dom)
 {
-    DAEOptimizer optimizer(dom);
     const std::vector<std::string>& groupAnimatioNodeIds = arguments.getGroupAnimationNodeId();
     const std::vector<std::string>& groupAnimatioIds = arguments.getGroupAnimationAnimationId();
     assert(groupAnimatioNodeIds.size() == groupAnimatioIds.size());
-    size_t size = groupAnimatioNodeIds.size();
-    if (size > 0)
+    if (!groupAnimatioNodeIds.empty())
     {
-        begin();
-        for (size_t i = 0; i < size; ++i)
+        size_t size = groupAnimatioNodeIds.size();
+        if (size > 0)
+        {
+            DAEOptimizer optimizer(dom);
+            begin();
+            for (size_t i = 0; i < size; ++i)
+            {
+                optimizer.combineAnimations(groupAnimatioNodeIds[i], groupAnimatioIds[i]);
+            }
+            end("groupAnimation");
+        }
+    }
+    else
+    {
+        // Determine if there are any mesh skins that are animated that have more than 1 animation targeting its joints.
+        // (candidates for grouping)
+        std::vector<std::string> nodeIds;
+        if (findGroupAnimationNodes(dom, nodeIds))
         {
-            optimizer.combineAnimations(groupAnimatioNodeIds[i], groupAnimatioIds[i]);
+            // Ask the user if they want to group animations automatically.
+            if (promptUserGroupAnimations())
+            {
+                printf("Grouping animations...\n");
+
+                DAEOptimizer optimizer(dom);
+                begin();
+                char buffer[20];
+                size_t size = nodeIds.size();
+                for (size_t i = 0; i < size; ++i)
+                {
+                    // In COLLADA, ids must be unique but they don't have to be unique in GPB.
+                    // Save the animation id as "animations___#" and then rename it once the GPB objects are created
+                    // but before the GPB is written to file.
+                    sprintf(buffer, "animations___%lu", i);
+                    std::string animationId(buffer);
+                    _tempGroupAnimationIds.push_back(animationId);
+                    optimizer.combineAnimations(nodeIds[i], animationId);
+                }
+                end("groupAnimation");
+            }
         }
-        end("groupAnimation");
     }
     if (arguments.DAEOutputEnabled())
     {
@@ -306,6 +339,7 @@ void DAESceneEncoder::write(const std::string& filepath, const EncoderArguments&
     end("loadAnimations");
 
     _gamePlayFile.adjust();
+    _gamePlayFile.renameAnimations(_tempGroupAnimationIds, "animations");
 
     // Write the output file
     std::string outputFilePath = arguments.getOutputFilePath();
@@ -626,7 +660,7 @@ bool DAESceneEncoder::loadTarget(const domChannelRef& channelRef, AnimationChann
             }
             else if (type == domMatrix::ID())
             {
-                // If the animation is targetting a matrix then convert it into
+                // If the animation is targeting a matrix then convert it into
                 // a scale, rotate, translate animation by decomposing the matrix.
                 targetProperty = Transform::ANIMATE_SCALE_ROTATE_TRANSLATE;
 
@@ -1333,7 +1367,7 @@ Model* DAESceneEncoder::loadSkin(const domSkin* skinElement)
             std::vector<std::string> list;
             getJointNames(source, list);
 
-            // Go through the joint list and conver them from sid to id because the sid information is
+            // Go through the joint list and convert them from sid to id because the sid information is
             // lost when converting to the gameplay binary format.
             for (std::vector<std::string>::iterator i = list.begin(); i != list.end(); i++)
             {

+ 2 - 0
gameplay-encoder/src/DAESceneEncoder.h

@@ -204,6 +204,8 @@ private:
     float* _vertexBlendWeights;
     unsigned int* _vertexBlendIndices;
 
+    std::vector<std::string> _tempGroupAnimationIds;
+
     clock_t _begin;
 };
 

+ 130 - 0
gameplay-encoder/src/DAEUtil.cpp

@@ -1,3 +1,4 @@
+#include <set>
 #include "Base.h"
 #include "DAEUtil.h"
 #include "StringUtil.h"
@@ -421,4 +422,133 @@ domVisual_scene* getVisualScene(const domCOLLADA::domSceneRef& domScene)
     return NULL;
 }
 
+domNode* getParent(domNodeRef node)
+{
+    daeElement* parent = node->getParent();
+    if (parent && parent->getElementType() == COLLADA_TYPE::NODE)
+    {
+        domNodeRef parentNode = daeSafeCast<domNode>(parent);
+        return parentNode.cast();
+    }
+    return NULL;
+}
+
+domAnimation* getAnimation(domChannelRef channel)
+{
+    daeElement* parent = channel->getParent();
+    if (parent && parent->getElementType() == COLLADA_TYPE::ANIMATION)
+    {
+        domAnimationRef parentNode = daeSafeCast<domAnimation>(parent);
+        return parentNode.cast();
+    }
+    return NULL;
+}
+
+domNode* getCommonNodeAncestor(std::list<domNodeRef>& nodes)
+{
+    if (nodes.empty())
+        return NULL;
+    if (nodes.size() == 1)
+        return nodes.begin()->cast();
+
+    std::list<domNode*> ancestors;
+    size_t minAncestorCount = INT_MAX;
+    for (std::list<domNodeRef>::iterator it = nodes.begin(); it != nodes.end(); ++it)
+    {
+        domNodeRef& node = *it;
+        getNodeAncestors(node, ancestors);
+        ancestors.push_back(node.cast());
+        minAncestorCount = std::min(minAncestorCount, ancestors.size());
+    }
+    ancestors.resize(minAncestorCount);
+
+    return ancestors.back();
+}
+
+void getNodeAncestors(domNodeRef& node, std::list<domNode*>& ancestors)
+{
+    ancestors.clear();
+    domNode* parent = getParent(node);
+    while (parent != NULL)
+    {
+        ancestors.push_front(parent);
+        parent = getParent(parent);
+    }
+}
+
+bool findGroupAnimationNodes(domCOLLADA* dom, std::vector<std::string>& nodesToGroup)
+{
+    bool groupPossible = false;
+    const domLibrary_controllers_Array& controllersArrays = dom->getLibrary_controllers_array();
+    size_t controllersArraysCount = controllersArrays.getCount();
+    for (size_t i = 0; i < controllersArraysCount; ++i)
+    {
+        const domLibrary_controllersRef& libraryController = controllersArrays.get(i);
+        const domController_Array& controllerArray = libraryController->getController_array();
+        size_t controllerCount = controllerArray.getCount();
+        for (size_t j = 0; j < controllerCount; ++j)
+        {
+            const domControllerRef& controllerRef = controllerArray.get(j);
+            const domSkinRef& skinRef = controllerRef->getSkin();
+            if (skinRef.cast() != NULL)
+            {
+                domSkin::domJointsRef joints = skinRef->getJoints();
+                domInputLocal_Array& jointInputs = joints->getInput_array();
+                for (unsigned int i = 0; i < jointInputs.getCount(); ++i)
+                {
+                    domInputLocalRef input = jointInputs.get(i);
+                    std::string inputSemantic = std::string(input->getSemantic());
+                    domURIFragmentType* sourceURI = &input->getSource();
+                    sourceURI->resolveElement();
+                    const domSourceRef source = (domSource*)(daeElement*)sourceURI->getElement();
+                    if (equals(inputSemantic, "JOINT"))
+                    {
+                        std::list<domChannelRef> channels;
+                        std::list<domNodeRef> nodes;
+                        findChannelsTargetingJoints(source, channels, nodes);
+                        // If the channels don't share the same animation then they can be grouped.
+                        if (!sameAnimation(channels))
+                        {
+                            groupPossible = true;
+                            domNode* parentMost = getCommonNodeAncestor(nodes);
+                            nodesToGroup.push_back(parentMost->getId());
+                        }
+                    }
+                }
+            }
+        }
+    }
+    return groupPossible;
+}
+
+bool sameAnimation(std::list<domChannelRef>& channels)
+{
+    std::list<domChannelRef>::iterator it = channels.begin();
+    domAnimation* temp = getAnimation(*it);
+    ++it;
+    for (; it != channels.end(); ++it)
+    {
+        if (getAnimation(*it) != temp)
+            return false;
+    }
+    return true;
+}
+
+void findChannelsTargetingJoints(const domSourceRef& source, std::list<domChannelRef>& channels, std::list<domNodeRef>& nodes)
+{
+    std::vector<std::string> jointNames;
+    getJointNames(source, jointNames);
+    for (std::vector<std::string>::iterator i = jointNames.begin(); i != jointNames.end(); i++)
+    {
+        daeSIDResolver resolver(source->getDocument()->getDomRoot(), i->c_str());
+        daeElement* element = resolver.getElement();
+        if (element && element->getElementType() == COLLADA_TYPE::NODE)
+        {
+            domNodeRef node = daeSafeCast<domNode>(element);
+            nodes.push_back(node);
+            getAnimationChannels(node, channels);
+        }
+    }
+}
+
 }

+ 67 - 1
gameplay-encoder/src/DAEUtil.h

@@ -126,12 +126,78 @@ bool isEmptyAnimation(domAnimationRef& animation);
 /**
  * Gets the visual scene from the given COLLADA dom scene.
  * 
- * @param COLLADA dom scene.
+ * @param domScene The dom scene.
  * 
  * @return The visual scene or NULL if not found.
  */
 domVisual_scene* getVisualScene(const domCOLLADA::domSceneRef& domScene);
 
+/**
+ * Returns the parent node of the given node or NULL if there is no parent.
+ * 
+ * @param node The node to get the parent for.
+ * 
+ * @return The parent node or NULL if the node does not have a parent node.
+ */
+domNode* getParent(domNodeRef node);
+
+/**
+ * Returns the animation for the given channel.
+ * 
+ * @param channel The animation channel to get the animation for.
+ * 
+ * @return The animation of the channel or NULL if the channel does not belong to an animation.
+ */
+domAnimation* getAnimation(domChannelRef channel);
+
+/**
+ * Gets the common node ancestor for the given list of nodes.
+ * This function assumes that the nodes share a common ancestor.
+ * 
+ * @param nodes The list of nodes.
+ * 
+ * @return The common node ancestor or NULL if the list of was empty.
+ */
+domNode* getCommonNodeAncestor(std::list<domNodeRef>& nodes);
+
+/**
+ * Gets the list of node ancestors for the given node.
+ * 
+ * @param node The node to get the ancestors for.
+ * @param ancestors The output list of ancestors. 
+ *                  The first element is the root node and the last element is the direct parent of the node.
+ */
+void getNodeAncestors(domNodeRef& node, std::list<domNode*>& ancestors);
+
+/**
+ * Finds the nodes that can be automatically grouped because there is a mesh skin that has joints 
+ * that are being targetted by animations that are not grouped.
+ * 
+ * @param dom The COLLADA dom.
+ * @param nodesToGroup The list of node IDs that can have their animations automatically grouped under.
+ * 
+ * @return True if there are mesh skins that can have their animations grouped, false otherwise.
+ */
+bool findGroupAnimationNodes(domCOLLADA* dom, std::vector<std::string>& nodesToGroup);
+
+/**
+ * Returns true if the list of animation channels share the same animation.
+ * 
+ * @param channels The list of channels.
+ * 
+ * @return True if the channels share the same animation, false otherwis.
+ */ 
+bool sameAnimation(std::list<domChannelRef>& channels);
+
+/**
+ * Finds the animation channels that target the given joints and the list of nodes that are targetted by those channels.
+ * 
+ * @param source The source element to get the list of joints from.
+ * @param channels The output list of channels.
+ * @param nodes The output list of nodes.
+ */
+void findChannelsTargetingJoints(const domSourceRef& source, std::list<domChannelRef>& channels, std::list<domNodeRef>& nodes);
+
 }
 
 #endif

+ 7 - 10
gameplay-encoder/src/EncoderArguments.cpp

@@ -179,16 +179,13 @@ void EncoderArguments::printUsage() const
     fprintf(stderr,"COLLADA and FBX file options:\n");
     fprintf(stderr,"  -i <id>\t\tFilter by node ID.\n");
     fprintf(stderr,"  -t\t\t\tWrite text/xml.\n");
-    fprintf(stderr,"  -groupAnimations <node id> <animation id>\n" \
-        "\t\t\tGroup all animation channels targetting the nodes into a new animation.\n");
-    fprintf(stderr,"  -heightmaps \"<node ids>\"\n" \
+    fprintf(stderr,"  -g <node id> <animation id>\n" \
+        "\t\t\tGroup all animation channels targeting the nodes into a new animation.\n");
+    fprintf(stderr,"  -h \"<node ids>\"\n" \
         "\t\t\tList of nodes to generate heightmaps for.\n" \
         "\t\t\tNode id list should be in quotes with a space between each id.\n" \
         "\t\t\tHeightmaps will be saved in files named <nodeid>.png.\n");
     fprintf(stderr,"\n");
-    fprintf(stderr,"COLLADA file options:\n");
-    fprintf(stderr,"  -dae <filepath>\tOutput optimized DAE.\n");
-    fprintf(stderr,"\n");
     fprintf(stderr,"TTF file options:\n");
     fprintf(stderr,"  -s <size of font>\tSize of the font.\n");
     fprintf(stderr,"  -p\t\t\tOutput font preview.\n");
@@ -284,12 +281,12 @@ void EncoderArguments::readOption(const std::vector<std::string>& options, size_
         }
         break;
     case 'g':
-        if (str.compare("-groupAnimations") == 0)
+        if (str.compare("-groupAnimations") == 0 || str.compare("-g") == 0)
         {
             // read two strings, make sure not to go out of bounds
             if ((*index + 2) >= options.size())
             {
-                fprintf(stderr, "Error: -groupAnimations requires 2 arguments.\n");
+                fprintf(stderr, "Error: -g requires 2 arguments.\n");
                 _parseError = true;
                 return;
             }
@@ -316,7 +313,7 @@ void EncoderArguments::readOption(const std::vector<std::string>& options, size_
         break;
     case 'h':
         {
-            if (str.compare("-heightmaps") == 0)
+            if (str.compare("-heightmaps") == 0 || str.compare("-h") == 0)
             {
                 (*index)++;
                 if (*index < options.size())
@@ -450,7 +447,7 @@ void unittestsEncoderArguments()
     exePath.append("/gameplay-encoder.exe");
     const char* exe = exePath.c_str();
     {
-        const char* argv[] = {exe, "-groupAnimations", "root", "movements", "C:\\Git\\gaming\\GamePlay\\gameplay-encoder\\res\\seymour.dae"};
+        const char* argv[] = {exe, "-g", "root", "movements", "C:\\Git\\gaming\\GamePlay\\gameplay-encoder\\res\\seymour.dae"};
         EncoderArguments args(sizeof(argv) / sizeof(char*), (const char**)argv);
         assert(equals(args.getAnimationId("root"), ("movements")));
         assert(equals(args.getGroupAnimationNodeId()[0], ("root")));

+ 1 - 1
gameplay-encoder/src/EncoderArguments.h

@@ -76,7 +76,7 @@ public:
     const std::vector<std::string>& getHeightmapNodeIds() const;
 
     /**
-     * Returns true if an error occured while parsing the command line arguments.
+     * Returns true if an error occurred while parsing the command line arguments.
      */
     bool parseErrorOccured() const;
 

+ 75 - 1
gameplay-encoder/src/FBXSceneEncoder.cpp

@@ -154,13 +154,24 @@ void addScaleChannel(Animation* animation, FbxNode* fbxNode, float startTime, fl
 
 void addTranslateChannel(Animation* animation, FbxNode* fbxNode, float startTime, float stopTime);
 
+/**
+ * Determines if it is possible to automatically group animations for mesh skins.
+ * 
+ * @param fbxScene The FBX scene to search.
+ * 
+ * @return True if there is at least one mesh skin that has animations that can be grouped.
+ */
+bool isGroupAnimationPossible(FbxScene* fbxScene);
+bool isGroupAnimationPossible(FbxNode* fbxNode);
+bool isGroupAnimationPossible(FbxMesh* fbxMesh);
+
 
 ////////////////////////////////////
 // Member Functions
 ////////////////////////////////////
 
 FBXSceneEncoder::FBXSceneEncoder()
-    : _groupAnimation(NULL)
+    : _groupAnimation(NULL), _autoGroupAnimations(false)
 {
 }
 
@@ -187,6 +198,16 @@ void FBXSceneEncoder::write(const std::string& filepath, const EncoderArguments&
     print("Loading FBX file.");
     importer->Import(fbxScene);
     importer->Destroy();
+
+    // Determine if animations should be grouped.
+    if (arguments.getGroupAnimationAnimationId().empty() && isGroupAnimationPossible(fbxScene))
+    {
+        if (promptUserGroupAnimations())
+        {
+            _autoGroupAnimations = true;
+        }
+    }
+
     print("Loading Scene.");
     loadScene(fbxScene);
     print("Loading animations.");
@@ -195,6 +216,10 @@ void FBXSceneEncoder::write(const std::string& filepath, const EncoderArguments&
 
     print("Optimizing GamePlay Binary.");
     _gamePlayFile.adjust();
+    if (_autoGroupAnimations)
+    {
+        _gamePlayFile.groupMeshSkinAnimations();
+    }
     
     std::string outputFilePath = arguments.getOutputFilePath();
 
@@ -1473,4 +1498,53 @@ void copyMatrix(const FbxMatrix& fbxMatrix, Matrix& matrix)
     }
 }
 
+bool isGroupAnimationPossible(FbxScene* fbxScene)
+{
+    FbxNode* rootNode = fbxScene->GetRootNode();
+    if (rootNode)
+    {
+        if (isGroupAnimationPossible(rootNode))
+            return true;
+    }
+    return false;
+}
+
+bool isGroupAnimationPossible(FbxNode* fbxNode)
+{
+    if (fbxNode)
+    {
+        FbxMesh* fbxMesh = fbxNode->GetMesh();
+        if (isGroupAnimationPossible(fbxMesh))
+            return true;
+        const int childCount = fbxNode->GetChildCount();
+        for (int i = 0; i < childCount; ++i)
+        {
+            if (isGroupAnimationPossible(fbxNode->GetChild(i)))
+                return true;
+        }
+    }
+    return false;
+}
+
+bool isGroupAnimationPossible(FbxMesh* fbxMesh)
+{
+    if (fbxMesh)
+    {
+        const int deformerCount = fbxMesh->GetDeformerCount();
+        for (int i = 0; i < deformerCount; ++i)
+        {
+            FbxDeformer* deformer = fbxMesh->GetDeformer(i);
+            if (deformer->GetDeformerType() == FbxDeformer::eSkin)
+            {
+                FbxSkin* fbxSkin = static_cast<FbxSkin*>(deformer);
+                if (fbxSkin)
+                {
+                    return true;
+                }
+            }
+        }
+    }
+    return false;
+}
+
 #endif

+ 6 - 1
gameplay-encoder/src/FBXSceneEncoder.h

@@ -215,9 +215,14 @@ private:
     std::map<FbxUInt64, Mesh*> _meshes;
 
     /**
-     * The animation that channels should be added to it the user is using the -groupAnimation command line argument. May be NULL.
+     * The animation that channels should be added to if the user is using the -groupAnimation command line argument. May be NULL.
      */
     Animation* _groupAnimation;
+
+    /**
+     * Indicates if the animations for mesh skins should be grouped before writing out the GPB file.
+     */
+    bool _autoGroupAnimations;
 };
 
 #endif

+ 19 - 0
gameplay-encoder/src/FileIO.cpp

@@ -184,4 +184,23 @@ void writeVectorText(const Vector4& v, FILE* file)
     fprintf(file, "%f %f %f %f\n", v.x, v.y, v.z, v.w);
 }
 
+bool promptUserGroupAnimations()
+{
+    char buffer[80];
+    for (;;)
+    {
+        printf("Do you want to group animations? (y/n)\n");
+        std::cin.getline(buffer, 80);
+        
+        if (buffer[0] == 'y' || buffer[0] == 'Y' || buffer[0] == '\0')
+        {
+            return true;
+        }
+        else if (buffer[0] == 'n' || buffer[0] == 'N')
+        {
+            return false;
+        }
+    }
+}
+
 }

+ 8 - 0
gameplay-encoder/src/FileIO.h

@@ -136,6 +136,14 @@ void writeVectorBinary(const Vector4& v, FILE* file);
 
 void writeVectorText(const Vector4& v, FILE* file);
 
+/**
+ * Prompts the user if they want to group animations automatically.
+ * If the user enters an invalid response, the question is asked again.
+ * 
+ * @return True if the user wants to group animations, false otherwise.
+ */
+bool promptUserGroupAnimations();
+
 }
 
 #endif

+ 2 - 1
gameplay-encoder/src/GPBDecoder.cpp

@@ -40,9 +40,10 @@ void GPBDecoder::readBinary(const std::string& filepath)
 bool GPBDecoder::validateHeading()
 {
     const size_t HEADING_SIZE = 9;
-    const char identifier[] = { '«', 'G', 'P', 'B', '»', '\r', '\n', '\x1A', '\n' };
+    const char identifier[] = "\xABGPB\xBB\r\n\x1A\n";
 
     char heading[HEADING_SIZE];
+    fread(heading, sizeof(unsigned char), HEADING_SIZE, _file);
     for (size_t i = 0; i < HEADING_SIZE; ++i)
     {
         if (heading[i] != identifier[i])

+ 122 - 10
gameplay-encoder/src/GPBFile.cpp

@@ -1,6 +1,7 @@
 #include "Base.h"
 #include "GPBFile.h"
 #include "Transform.h"
+#include "StringUtil.h"
 
 #define EPSILON 1.2e-7f;
 
@@ -14,6 +15,26 @@ static GPBFile* __instance = NULL;
  */
 static bool isAlmostOne(float value);
 
+/**
+ * Gets the common node ancestor for the given list of nodes.
+ * This function assumes that the nodes share a common ancestor.
+ * 
+ * @param nodes The list of nodes.
+ * 
+ * @return The common node ancestor or NULL if the list of was empty.
+ */
+static Node* getCommonNodeAncestor(const std::vector<Node*>& nodes);
+
+/**
+ * Gets the list of node ancestors for the given node.
+ * 
+ * @param node The node to get the ancestors for.
+ * @param ancestors The output list of ancestors. 
+ *                  The first element is the root node and the last element is the direct parent of the node.
+ */
+static void getNodeAncestors(Node* node, std::list<Node*>& ancestors);
+
+
 GPBFile::GPBFile(void)
     : _file(NULL), _animationsAdded(false)
 {
@@ -300,10 +321,49 @@ void GPBFile::adjust()
     //
     // merge animations if possible
     //   Search for animations that have the same target and key times and see if they can be merged.
-    //   Blender will output a simple translation animation to 3 separate animations with the same key times but targetting X, Y and Z.
+    //   Blender will output a simple translation animation to 3 separate animations with the same key times but targeting X, Y and Z.
     //   This can be merged into one animation. Same for scale animations.
 }
 
+void GPBFile::groupMeshSkinAnimations()
+{
+    for (std::list<Node*>::iterator it = _nodes.begin(); it != _nodes.end(); ++it)
+    {
+        if (Model* model = (*it)->getModel())
+        {
+            if (MeshSkin* skin = model->getSkin())
+            {
+                const std::vector<Node*>& joints = skin->getJoints();
+                Node* commonAncestor = getCommonNodeAncestor(joints);
+                if (commonAncestor)
+                {
+                    // group the animation channels that target this common ancestor and its child nodes
+                    Animation* animation = new Animation();
+                    animation->setId("animations");
+
+                    moveAnimationChannels(commonAncestor, animation);
+                    _animations.add(animation);
+                }
+            }
+        }
+    }
+}
+
+void GPBFile::renameAnimations(std::vector<std::string>& animationIds, const char* newId)
+{
+    const unsigned int animationCount = _animations.getAnimationCount();
+    for (unsigned int animationIndex = 0; animationIndex < animationCount; ++animationIndex)
+    {
+        Animation* animation = _animations.getAnimation(animationIndex);
+        assert(animation);
+        std::vector<std::string>::const_iterator it = find(animationIds.begin(), animationIds.end(), animation->getId());
+        if (it != animationIds.end())
+        {
+            animation->setId(newId);
+        }
+    }
+}
+
 void GPBFile::computeBounds(Node* node)
 {
     assert(node);
@@ -313,14 +373,6 @@ void GPBFile::computeBounds(Node* node)
         {
             mesh->computeBounds();
         }
-        if (MeshSkin* skin = model->getSkin())
-        {
-            skin->computeBounds();
-        }
-    }
-    for (Node* child = node->getFirstChild(); child != NULL; child = child->getNextSibling())
-    {
-        computeBounds(child);
     }
 }
 
@@ -427,9 +479,69 @@ void GPBFile::decomposeTransformAnimationChannel(Animation* animation, const Ani
     animation->add(translateChannel);
 }
 
-static bool isAlmostOne(float value)
+void GPBFile::moveAnimationChannels(Node* node, Animation* dstAnimation)
+{
+    // Loop through the animations and channels backwards because they will be removed when found.
+    int animationCount = _animations.getAnimationCount();
+    for (int i = animationCount - 1; i >= 0; --i)
+    {
+        Animation* animation = _animations.getAnimation(i);
+        int channelCount = animation->getAnimationChannelCount();
+        for (int j = channelCount - 1; j >= 0; --j)
+        {
+            AnimationChannel* channel = animation->getAnimationChannel(j);
+            if (equals(channel->getTargetId(), node->getId()))
+            {
+                animation->remove(channel);
+                dstAnimation->add(channel);
+            }
+        }
+        if (animation->getAnimationChannelCount() == 0)
+        {
+            _animations.removeAnimation(i);
+        }
+    }
+    for (Node* child = node->getFirstChild(); child != NULL; child = child->getNextSibling())
+    {
+        moveAnimationChannels(child, dstAnimation);
+    }
+}
+
+bool isAlmostOne(float value)
 {
     return std::fabs(value - 1.0f) < EPSILON;
 }
 
+Node* getCommonNodeAncestor(const std::vector<Node*>& nodes)
+{
+    if (nodes.empty())
+        return NULL;
+    if (nodes.size() == 1)
+        return nodes.front();
+
+    std::list<Node*> ancestors;
+    size_t minAncestorCount = INT_MAX;
+    for (std::vector<Node*>::const_iterator it = nodes.begin(); it != nodes.end(); ++it)
+    {
+        Node* node = *it;
+        getNodeAncestors(node, ancestors);
+        ancestors.push_back(node);
+        minAncestorCount = std::min(minAncestorCount, ancestors.size());
+    }
+    ancestors.resize(minAncestorCount);
+
+    return ancestors.back();
+}
+
+void getNodeAncestors(Node* node, std::list<Node*>& ancestors)
+{
+    ancestors.clear();
+    Node* parent = node->getParent();
+    while (parent != NULL)
+    {
+        ancestors.push_front(parent);
+        parent = parent->getParent();
+    }
+}
+
 }

+ 24 - 0
gameplay-encoder/src/GPBFile.h

@@ -102,6 +102,19 @@ public:
      */
     void adjust();
 
+    /**
+     * Groups the animations of all mesh skins to be under one animation per mesh skin.
+     */
+    void groupMeshSkinAnimations();
+
+    /**
+     * Renames the animations in the list of animation ids to the new animation id.
+     * 
+     * @param animationIds The list of animations to rename.
+     * @param newId The new animation id.
+     */
+    void renameAnimations(std::vector<std::string>& animationIds, const char* newId);
+
 private:
     /**
      * Computes the bounds of all meshes in the node hierarchy.
@@ -117,6 +130,14 @@ private:
      */
     void decomposeTransformAnimationChannel(Animation* animation, const AnimationChannel* channel);
 
+    /**
+     * Moves the animation channels that target the given node and its children to be under the given animation.
+     * 
+     * @param node The node to recursively search from.
+     * @param animation The animation to move the channels to.
+     */
+    void moveAnimationChannels(Node* node, Animation* animation);
+
 private:
 
     FILE* _file;
@@ -124,6 +145,9 @@ private:
     std::list<Camera*> _cameras;
     std::list<Light*> _lights;
     std::list<Mesh*> _geometry;
+    /**
+     * The flat list of all nodes.
+     */
     std::list<Node*> _nodes;
     Animations _animations;
     bool _animationsAdded;

+ 7 - 3
gameplay-encoder/src/Mesh.cpp

@@ -225,10 +225,14 @@ void Mesh::generateHeightmap(const char* filename)
             // Write height value normalized between 0-255 (between min and max height)
             float h = heights[y*width + x];
             float nh = (h - minHeight) / maxHeight;
-            png_byte b = (png_byte)(nh * 255.0f);
-            
+            int bits = (int)(nh * 16777215.0f); // 2^24-1
+
             int pos = x*3;
-            row[pos] = row[pos+1] = row[pos+2] = b;
+            row[pos+2] = (png_byte)(bits & 0xff);
+            bits >>= 8;
+            row[pos+1] = (png_byte)(bits & 0xff);
+            bits >>= 8;
+            row[pos] = (png_byte)(bits & 0xff);
         }
         png_write_row(png_ptr, row);
     }

+ 6 - 1
gameplay-encoder/src/MeshSkin.cpp

@@ -109,6 +109,11 @@ const std::vector<std::string>& MeshSkin::getJointNames()
     return _jointNames;
 }
 
+const std::vector<Node*>& MeshSkin::getJoints() const
+{
+    return _joints;
+}
+
 void MeshSkin::setJoints(const std::vector<Node*>& list)
 {
     _joints = list;
@@ -340,7 +345,7 @@ void MeshSkin::computeBounds()
     DEBUGPRINT("\n");
 
     // Compute a total combined bounding volume for the MeshSkin that contains all possible
-    // vertex positions for all animations targetting the skin. This rough approximation allows
+    // vertex positions for all animations targeting the skin. This rough approximation allows
     // us to store a volume that can be used for rough intersection tests (such as for visibility
     // determination) efficiently at runtime.
 

+ 3 - 1
gameplay-encoder/src/MeshSkin.h

@@ -38,9 +38,11 @@ public:
 
     void setVertexInfluenceCount(unsigned int count);
 
+    const std::vector<std::string>& getJointNames();
+
     void setJointNames(const std::vector<std::string>& list);
 
-    const std::vector<std::string>& getJointNames();
+    const std::vector<Node*>& getJoints() const;
 
     void setJoints(const std::vector<Node*>& list);
 

+ 1 - 1
gameplay-encoder/src/Quaternion.h

@@ -14,7 +14,7 @@ class Matrix;
  *
  * Quaternions are typically used as a replacement for euler angles and rotation matrices as a way to achieve smooth interpolation and avoid gimbal lock.
  *
- * Note that this quaternion class does not automatically keep the quaternion normalized. Therefore, care must be taken to normalize the quaternion when neccessary, by calling the normalize method.
+ * Note that this quaternion class does not automatically keep the quaternion normalized. Therefore, care must be taken to normalize the quaternion when necessary, by calling the normalize method.
  * The package provides three methods for doing quaternion interpolation: lerp, slerp, and squad.
  *
  * lerp (linear interpolation): the interpolation curve gives a straight line in quaternion space. It is simple and fast to compute. The only problem is that it does not provide constant angular velocity. Note that a constant velocity is not necessarily a requirement for a curve;

+ 8 - 14
gameplay-encoder/src/TTFFontEncoder.cpp

@@ -1,6 +1,7 @@
 #include "Base.h"
 #include "TTFFontEncoder.h"
 #include "GPBFile.h"
+#include "StringUtil.h"
 
 namespace gameplay
 {
@@ -33,7 +34,7 @@ static void writeString(FILE* fp, const char* str)
     }
 }
 
-int writeFont(const char* filename, unsigned int fontSize, const char* id, bool fontpreview = false)
+int writeFont(const char* inFilePath, const char* outFilePath, unsigned int fontSize, const char* id, bool fontpreview = false)
 {
     Glyph glyphArray[END_INDEX - START_INDEX];
     
@@ -48,7 +49,7 @@ int writeFont(const char* filename, unsigned int fontSize, const char* id, bool
     
     // Initialize font face.
     FT_Face face;
-    error = FT_New_Face(library, filename, 0, &face);
+    error = FT_New_Face(library, inFilePath, 0, &face);
     if (error)
     {
         fprintf(stderr, "FT_New_Face error: %d \n", error);
@@ -249,15 +250,9 @@ int writeFont(const char* filename, unsigned int fontSize, const char* id, bool
         penX += advance; // Move X to next glyph position
         i++;
     }
-    
-    unsigned int idlen = strlen(id);
 
-    // Write it to the id.gpb file.
-    char* fileName = (char*)malloc(idlen + 4);
-    strcpy(fileName, id);
-    strcat(fileName, ".gpb");
 
-    FILE *gpbFp = fopen(fileName, "wb");
+    FILE *gpbFp = fopen(outFilePath, "wb");
     
     // File header and version.
     char fileHeader[9]     = {'«', 'G', 'P', 'B', '»', '\r', '\n', '\x1A', '\n'};
@@ -303,15 +298,14 @@ int writeFont(const char* filename, unsigned int fontSize, const char* id, bool
     // Close file.
     fclose(gpbFp);
 
-    printf("%s.gpb created successfully! \n", id);
+    printf("%s.gpb created successfully. \n", getBaseName(outFilePath).c_str());
 
     if (fontpreview)
     {
         // Write out font map to an image.
-        strcpy(fileName, id);
-        strcat(fileName, ".pgm");
-
-        FILE *imageFp = fopen(fileName, "wb");
+        std::string pgmFilePath = getFilenameNoExt(outFilePath);
+        pgmFilePath.append(".pgm");
+        FILE *imageFp = fopen(pgmFilePath.c_str(), "wb");
         fprintf(imageFp, "P5 %d %d 255\n", imageWidth, imageHeight);
         fwrite((const char *)imageBuffer, sizeof(unsigned char), imageWidth * imageHeight, imageFp);
         fclose(imageFp);

+ 12 - 2
gameplay-encoder/src/TTFFontEncoder.h

@@ -3,7 +3,6 @@
 
 #define START_INDEX     32
 #define END_INDEX       127
-
 #define GLYPH_PADDING   4
 
 namespace gameplay
@@ -18,6 +17,17 @@ public:
     float uvCoords[4];
 };
 
-int writeFont(const char* filename, unsigned int fontSize, const char* id, bool fontpreview);
+/**
+ * Writes the font gpb file.
+ * 
+ * @param inFilePath Input file path to the tiff file.
+ * @param outFilePath Output file path to write the gpb to.
+ * @param fontSize Size of the font.
+ * @param id ID string of the font in the ref table.
+ * @param fontpreview True if the pgm font preview file should be written. (For debugging)
+ * 
+ * @return 0 if successful, -1 if error.
+ */
+int writeFont(const char* inFilePath, const char* outFilePath, unsigned int fontSize, const char* id, bool fontpreview);
 
 }

+ 2 - 2
gameplay-encoder/src/Vector2.h

@@ -163,7 +163,7 @@ public:
     /**
      * Returns the squared distance between this vector and v.
      *
-     * When it is not neccessary to get the exact distance between
+     * When it is not necessary to get the exact distance between
      * two vectors (for example, when simply comparing the
      * distance between different vectors), it is advised to use
      * this method instead of distance.
@@ -207,7 +207,7 @@ public:
     /**
      * Returns the squared length of this vector.
      *
-     * When it is not neccessary to get the exact length of a
+     * When it is not necessary to get the exact length of a
      * vector (for example, when simply comparing the lengths of
      * different vectors), it is advised to use this method
      * instead of length.

+ 2 - 2
gameplay-encoder/src/Vector3.h

@@ -210,7 +210,7 @@ public:
     /**
      * Returns the squared distance between this vector and v.
      *
-     * When it is not neccessary to get the exact distance between
+     * When it is not necessary to get the exact distance between
      * two vectors (for example, when simply comparing the
      * distance between different vectors), it is advised to use
      * this method instead of distance.
@@ -254,7 +254,7 @@ public:
     /**
      * Returns the squared length of this vector.
      *
-     * When it is not neccessary to get the exact length of a
+     * When it is not necessary to get the exact length of a
      * vector (for example, when simply comparing the lengths of
      * different vectors), it is advised to use this method
      * instead of length.

+ 2 - 2
gameplay-encoder/src/Vector4.h

@@ -201,7 +201,7 @@ public:
     /**
      * Returns the squared distance between this vector and v.
      *
-     * When it is not neccessary to get the exact distance between
+     * When it is not necessary to get the exact distance between
      * two vectors (for example, when simply comparing the
      * distance between different vectors), it is advised to use
      * this method instead of distance.
@@ -245,7 +245,7 @@ public:
     /**
      * Returns the squared length of this vector.
      *
-     * When it is not neccessary to get the exact length of a
+     * When it is not necessary to get the exact length of a
      * vector (for example, when simply comparing the lengths of
      * different vectors), it is advised to use this method
      * instead of length.

+ 28 - 12
gameplay-encoder/src/main.cpp

@@ -7,16 +7,28 @@
 
 using namespace gameplay;
 
-static std::string getFileName(const std::string& filepath)
+/**
+ * Prompts the user for a font size until a valid font size is entered.
+ * 
+ * @return A valid font size.
+ */
+static unsigned int promptUserFontSize()
 {
-    size_t index1 = filepath.find_last_of('\\');
-    size_t index2 = filepath.find_last_of('/');
-    size_t index = (index1 != -1 && index1 > index2 ? index1 : index2);
-    size_t length = filepath.length();
-    std::string filename = filepath.substr(index + 1, length);
-    length = filename.length();
-    std::string output = filename.substr(0, (length-4));
-    return output;
+    static const int lowerBound = 8;
+    static const int upperBound = 500;
+    unsigned int fontSize = 0;
+    char buffer[80];
+    do
+    {
+        printf("Enter font size (between %d and %d):\n", lowerBound, upperBound);
+        std::cin.getline(buffer, 80);
+        int i = atoi(buffer);
+        if (i >= lowerBound && i <= upperBound)
+        {
+            fontSize = (unsigned int)i;
+        }
+    } while (fontSize == 0);
+    return fontSize;
 }
 
 /**
@@ -74,9 +86,13 @@ int main(int argc, const char** argv)
         }
     case EncoderArguments::FILEFORMAT_TTF:
         {
-            std::string realpath(arguments.getFilePath());
-            std::string id = getFileName(realpath);
-            writeFont(realpath.c_str(), arguments.getFontSize(), id.c_str(), arguments.fontPreviewEnabled());
+            unsigned int fontSize = arguments.getFontSize();
+            if (fontSize == 0)
+            {
+                fontSize = promptUserFontSize();
+            }
+            std::string id = getBaseName(arguments.getFilePath());
+            writeFont(arguments.getFilePath().c_str(), arguments.getOutputFilePath().c_str(), fontSize, id.c_str(), arguments.fontPreviewEnabled());
             break;
         }
     case EncoderArguments::FILEFORMAT_GPB:

+ 26 - 0
gameplay-luagen/README.md

@@ -0,0 +1,26 @@
+## Usage
+To generate the Lua script bindings for gameplay, run the generate-doxygen-xml.bat (or .sh) script. Then, on Windows, open the gameplay-luagen Visual Studio solution and build and run the gameplay-luagen project. On Mac, open the gameplay-luagen XCode workspace and build and run the gameplay-luagen project.
+
+There are also prebuilt binaries in the gameplay/bin folder.
+
+
+## Unsupported Features
+- operators
+- templates
+- variable arguments
+- Lua doesn't support as many types as C++ so if there are functions that overload on parameters with types that overlap in Lua, the overloading won't work properly (i.e. char, short, int, long, float, double and all corresponding unsigned variants overlap in Lua).
+
+
+### To Do List
+- Look into updating bindValue() to support binding to any Lua script function.
+- Add a global function that implements casting for use from Lua scripts (i.e. to downcast from a Control to a Button).
+- Currently ignored: there is one memory leak in gameplay-luagen that is very difficult to fix (it appears to be a locale related leak-something leaks the first time an ofstream is created-doesn't matter the ofstream).
+
+
+## Disclaimer
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+OTHER DEALINGS IN THE SOFTWARE.

+ 15 - 0
gameplay-luagen/gameplay-api/xml/combine.xslt

@@ -0,0 +1,15 @@
+<!-- XSLT script to combine the generated output into a single file. 
+     If you have xsltproc you could use:
+     xsltproc combine.xslt index.xml >all.xml
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <xsl:output method="xml" version="1.0" indent="no" standalone="yes" />
+  <xsl:template match="/">
+    <doxygen version="{doxygenindex/@version}">
+      <!-- Load all doxgen generated xml files -->
+      <xsl:for-each select="doxygenindex/compound">
+        <xsl:copy-of select="document( concat( @refid, '.xml' ) )/doxygen/*" />
+      </xsl:for-each>
+    </doxygen>
+  </xsl:template>
+</xsl:stylesheet>

+ 832 - 0
gameplay-luagen/gameplay-api/xml/compound.xsd

@@ -0,0 +1,832 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <xsd:element name="doxygen" type="DoxygenType"/>
+
+  <!-- Complex types -->
+
+  <xsd:complexType name="DoxygenType">
+    <xsd:sequence maxOccurs="unbounded">
+      <xsd:element name="compounddef" type="compounddefType" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="version" type="DoxVersionNumber" use="required" />
+  </xsd:complexType>
+
+  <xsd:complexType name="compounddefType">
+    <xsd:sequence>
+      <xsd:element name="compoundname" type="xsd:string"/>
+      <xsd:element name="title" type="xsd:string" minOccurs="0" />
+      <xsd:element name="basecompoundref" type="compoundRefType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="derivedcompoundref" type="compoundRefType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="includes" type="incType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="includedby" type="incType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="incdepgraph" type="graphType" minOccurs="0" />
+      <xsd:element name="invincdepgraph" type="graphType" minOccurs="0" />
+      <xsd:element name="innerdir" type="refType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="innerfile" type="refType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="innerclass" type="refType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="innernamespace" type="refType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="innerpage" type="refType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="innergroup" type="refType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="templateparamlist" type="templateparamlistType" minOccurs="0" />
+      <xsd:element name="sectiondef" type="sectiondefType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+      <xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
+      <xsd:element name="inheritancegraph" type="graphType" minOccurs="0" />
+      <xsd:element name="collaborationgraph" type="graphType" minOccurs="0" />
+      <xsd:element name="programlisting" type="listingType" minOccurs="0" />
+      <xsd:element name="location" type="locationType" minOccurs="0" />
+      <xsd:element name="listofallmembers" type="listofallmembersType" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+    <xsd:attribute name="kind" type="DoxCompoundKind" />
+    <xsd:attribute name="prot" type="DoxProtectionKind" />
+  </xsd:complexType>
+
+  <xsd:complexType name="listofallmembersType">
+    <xsd:sequence>
+      <xsd:element name="member" type="memberRefType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="memberRefType">
+    <xsd:sequence>
+      <xsd:element name="scope" />
+      <xsd:element name="name" />
+    </xsd:sequence>
+    <xsd:attribute name="refid" type="xsd:string" />
+    <xsd:attribute name="prot" type="DoxProtectionKind" />
+    <xsd:attribute name="virt" type="DoxVirtualKind" />
+    <xsd:attribute name="ambiguityscope" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="compoundRefType">
+    <xsd:simpleContent>
+      <xsd:extension base="xsd:string">
+        <xsd:attribute name="refid" type="xsd:string" use="optional" />
+        <xsd:attribute name="prot" type="DoxProtectionKind" />
+        <xsd:attribute name="virt" type="DoxVirtualKind" />
+      </xsd:extension>
+    </xsd:simpleContent>
+  </xsd:complexType>
+
+  <xsd:complexType name="reimplementType">
+    <xsd:simpleContent>
+      <xsd:extension base="xsd:string">
+        <xsd:attribute name="refid" type="xsd:string" />
+      </xsd:extension>
+    </xsd:simpleContent>
+  </xsd:complexType>
+
+  <xsd:complexType name="incType">
+    <xsd:simpleContent>
+      <xsd:extension base="xsd:string">
+        <xsd:attribute name="refid" type="xsd:string" />
+        <xsd:attribute name="local" type="DoxBool" />
+      </xsd:extension>
+    </xsd:simpleContent>
+  </xsd:complexType>
+
+  <xsd:complexType name="refType">
+    <xsd:simpleContent>
+      <xsd:extension base="xsd:string">
+        <xsd:attribute name="refid" type="xsd:string" />
+        <xsd:attribute name="prot" type="DoxProtectionKind" use="optional"/>
+      </xsd:extension>
+    </xsd:simpleContent>
+  </xsd:complexType>
+
+  <xsd:complexType name="refTextType">
+    <xsd:simpleContent>
+      <xsd:extension base="xsd:string">
+       <xsd:attribute name="refid" type="xsd:string" />
+       <xsd:attribute name="kindref" type="DoxRefKind" />
+       <xsd:attribute name="external" type="xsd:string" use="optional"/>
+       <xsd:attribute name="tooltip" type="xsd:string" use="optional"/>
+      </xsd:extension>
+    </xsd:simpleContent>
+  </xsd:complexType>
+
+  <xsd:complexType name="sectiondefType">
+    <xsd:sequence>
+      <xsd:element name="header" type="xsd:string" minOccurs="0" />
+      <xsd:element name="description" type="descriptionType" minOccurs="0" />
+      <xsd:element name="memberdef" type="memberdefType" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="kind" type="DoxSectionKind" />
+  </xsd:complexType>
+
+  <xsd:complexType name="memberdefType">
+    <xsd:sequence>
+      <xsd:element name="templateparamlist" type="templateparamlistType" minOccurs="0" />
+      <xsd:element name="type" type="linkedTextType" minOccurs="0" />
+      <xsd:element name="definition" minOccurs="0" />
+      <xsd:element name="argsstring" minOccurs="0" />
+      <xsd:element name="name" />
+      <xsd:element name="read" minOccurs="0" />
+      <xsd:element name="write" minOccurs="0" />
+      <xsd:element name="bitfield" minOccurs="0" />
+      <xsd:element name="reimplements" type="reimplementType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="reimplementedby" type="reimplementType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="param" type="paramType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="enumvalue" type="enumvalueType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="initializer" type="linkedTextType" minOccurs="0" />
+      <xsd:element name="exceptions" type="linkedTextType" minOccurs="0" />
+      <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+      <xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
+      <xsd:element name="inbodydescription" type="descriptionType" minOccurs="0" />
+      <xsd:element name="location" type="locationType" />
+      <xsd:element name="references" type="referenceType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="referencedby" type="referenceType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="kind" type="DoxMemberKind" />
+    <xsd:attribute name="id" type="xsd:string" />
+    <xsd:attribute name="prot" type="DoxProtectionKind" />
+    <xsd:attribute name="static" type="DoxBool" />
+    <xsd:attribute name="const" type="DoxBool" />
+    <xsd:attribute name="explicit" type="DoxBool" />
+    <xsd:attribute name="inline" type="DoxBool" />
+    <xsd:attribute name="virt" type="DoxVirtualKind" />
+    <xsd:attribute name="volatile" type="DoxBool" />
+    <xsd:attribute name="mutable" type="DoxBool" />
+    <!-- Qt property -->
+    <xsd:attribute name="readable" type="DoxBool" use="optional"/>
+    <xsd:attribute name="writable" type="DoxBool" use="optional"/>
+    <!-- C++/CLI variable -->
+    <xsd:attribute name="initonly" type="DoxBool" use="optional"/>
+    <!-- C++/CLI and C# property -->
+    <xsd:attribute name="settable" type="DoxBool" use="optional"/>
+    <xsd:attribute name="gettable" type="DoxBool" use="optional"/>
+    <!-- C++/CLI function -->
+    <xsd:attribute name="final" type="DoxBool" use="optional"/>
+    <xsd:attribute name="sealed" type="DoxBool" use="optional"/>
+    <xsd:attribute name="new" type="DoxBool" use="optional"/>
+    <!-- C++/CLI event -->
+    <xsd:attribute name="add" type="DoxBool" use="optional"/>
+    <xsd:attribute name="remove" type="DoxBool" use="optional"/>
+    <xsd:attribute name="raise" type="DoxBool" use="optional"/>
+    <!-- Objective-C 2.0 protocol method -->
+    <xsd:attribute name="optional" type="DoxBool" use="optional"/>
+    <xsd:attribute name="required" type="DoxBool" use="optional"/>
+    <!-- Objective-C 2.0 property accessor -->
+    <xsd:attribute name="accessor" type="DoxAccessor" use="optional"/>
+  </xsd:complexType>
+
+  <xsd:complexType name="descriptionType" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="title" type="xsd:string" minOccurs="0"/>	    
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="internal" type="docInternalType" minOccurs="0" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="enumvalueType" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="name" />
+      <xsd:element name="initializer" type="linkedTextType" minOccurs="0" />
+      <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+      <xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+    <xsd:attribute name="prot" type="DoxProtectionKind" />
+  </xsd:complexType>
+
+  <xsd:complexType name="templateparamlistType">
+    <xsd:sequence>
+      <xsd:element name="param" type="paramType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="paramType">
+    <xsd:sequence>
+      <xsd:element name="type" type="linkedTextType" minOccurs="0" />
+      <xsd:element name="declname" minOccurs="0" />
+      <xsd:element name="defname" minOccurs="0" />
+      <xsd:element name="array" minOccurs="0" />
+      <xsd:element name="defval" type="linkedTextType" minOccurs="0" />
+      <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="linkedTextType" mixed="true">
+    <xsd:sequence>
+    <xsd:element name="ref" type="refTextType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="graphType">
+    <xsd:sequence>
+      <xsd:element name="node" type="nodeType" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="nodeType">
+    <xsd:sequence>
+      <xsd:element name="label" />
+      <xsd:element name="link" type="linkType" minOccurs="0" />
+      <xsd:element name="childnode" type="childnodeType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="childnodeType">
+    <xsd:sequence>
+      <xsd:element name="edgelabel" minOccurs="0" maxOccurs="unbounded"/>
+    </xsd:sequence>
+    <xsd:attribute name="refid" type="xsd:string" />
+    <xsd:attribute name="relation" type="DoxGraphRelation" />
+  </xsd:complexType>
+
+  <xsd:complexType name="linkType">
+    <xsd:attribute name="refid" type="xsd:string" />
+    <xsd:attribute name="external" type="xsd:string" use="optional"/>
+  </xsd:complexType>
+
+  <xsd:complexType name="listingType">
+    <xsd:sequence>
+      <xsd:element name="codeline" type="codelineType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="codelineType">
+    <xsd:sequence>
+      <xsd:element name="highlight" type="highlightType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="lineno" type="xsd:integer" />
+    <xsd:attribute name="refid" type="xsd:string" />
+    <xsd:attribute name="refkind" type="DoxRefKind" />
+    <xsd:attribute name="external" type="DoxBool" />
+  </xsd:complexType>
+
+  <xsd:complexType name="highlightType" mixed="true">
+    <xsd:choice minOccurs="0" maxOccurs="unbounded">
+      <xsd:element name="sp" />
+      <xsd:element name="ref" type="refTextType" />
+    </xsd:choice>
+    <xsd:attribute name="class" type="DoxHighlightClass" />
+  </xsd:complexType>
+
+  <xsd:complexType name="referenceType" mixed="true">
+    <xsd:attribute name="refid" type="xsd:string" />
+    <xsd:attribute name="compoundref" type="xsd:string" use="optional" />
+    <xsd:attribute name="startline" type="xsd:integer" />
+    <xsd:attribute name="endline" type="xsd:integer" />
+  </xsd:complexType>
+
+  <xsd:complexType name="locationType">
+    <xsd:attribute name="file" type="xsd:string" />
+    <xsd:attribute name="line" type="xsd:integer" />
+    <xsd:attribute name="bodyfile" type="xsd:string" />
+    <xsd:attribute name="bodystart" type="xsd:integer" />
+    <xsd:attribute name="bodyend" type="xsd:integer" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docSect1Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="title" type="xsd:string" />	    
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect2" type="docSect2Type" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="internal" type="docInternalS1Type" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docSect2Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="title" type="xsd:string" />	    
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect3" type="docSect3Type" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="internal" type="docInternalS2Type" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docSect3Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="title" type="xsd:string" />	    
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect4" type="docSect4Type" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="internal" type="docInternalS3Type" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docSect4Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="title" type="xsd:string" />	    
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="internal" type="docInternalS4Type" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docInternalType" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="para"  type="docParaType"  minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docInternalS1Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="para"  type="docParaType"  minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect2" type="docSect2Type" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docInternalS2Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="para"  type="docParaType"  minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect3" type="docSect3Type" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docInternalS3Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="para"  type="docParaType"  minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect3" type="docSect4Type" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docInternalS4Type" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="para"  type="docParaType"  minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+ 
+  <xsd:group name="docTitleCmdGroup">
+    <xsd:choice>
+      <xsd:element name="ulink" type="docURLLink" />
+      <xsd:element name="bold" type="docMarkupType" />
+      <xsd:element name="emphasis" type="docMarkupType" />
+      <xsd:element name="computeroutput" type="docMarkupType" />
+      <xsd:element name="subscript" type="docMarkupType" />
+      <xsd:element name="superscript" type="docMarkupType" />
+      <xsd:element name="center" type="docMarkupType" />
+      <xsd:element name="small" type="docMarkupType" />
+      <xsd:element name="htmlonly" type="xsd:string" />
+      <xsd:element name="manonly" type="xsd:string" />
+      <xsd:element name="xmlonly" type="xsd:string" />
+      <xsd:element name="rtfonly" type="xsd:string" />
+      <xsd:element name="latexonly" type="xsd:string" />
+      <xsd:element name="dot" type="xsd:string" />
+      <xsd:element name="anchor" type="docAnchorType" />
+      <xsd:element name="formula" type="docFormulaType" />
+      <xsd:element name="ref" type="docRefTextType" />
+      <xsd:element name="copy" type="docEmptyType" />
+      <xsd:element name="trademark" type="docEmptyType" />
+      <xsd:element name="registered" type="docEmptyType" />
+      <xsd:element name="lsquo" type="docEmptyType" />
+      <xsd:element name="rsquo" type="docEmptyType" />
+      <xsd:element name="ldquo" type="docEmptyType" />
+      <xsd:element name="rdquo" type="docEmptyType" />
+      <xsd:element name="ndash" type="docEmptyType" />
+      <xsd:element name="mdash" type="docEmptyType" />
+      <xsd:element name="umlaut" type="docCharType" />
+      <xsd:element name="acute" type="docCharType" />
+      <xsd:element name="grave" type="docCharType" />
+      <xsd:element name="circ" type="docCharType" />
+      <xsd:element name="slash" type="docCharType" />
+      <xsd:element name="tilde" type="docCharType" />
+      <xsd:element name="cedil" type="docCharType" />
+      <xsd:element name="ring" type="docCharType" />
+      <xsd:element name="szlig" type="docEmptyType" />
+      <xsd:element name="nonbreakablespace" type="docEmptyType" />
+    </xsd:choice>
+  </xsd:group>
+
+  <xsd:complexType name="docTitleType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+  </xsd:complexType>
+
+  <xsd:group name="docCmdGroup">
+    <xsd:choice>
+      <xsd:group ref="docTitleCmdGroup"/>
+      <xsd:element name="linebreak" type="docEmptyType" />
+      <xsd:element name="hruler" type="docEmptyType" />
+      <xsd:element name="preformatted" type="docMarkupType" />
+      <xsd:element name="programlisting" type="listingType" />
+      <xsd:element name="verbatim" type="xsd:string" />
+      <xsd:element name="indexentry" type="docIndexEntryType" />
+      <xsd:element name="orderedlist" type="docListType" />
+      <xsd:element name="itemizedlist" type="docListType" />
+      <xsd:element name="simplesect" type="docSimpleSectType" />
+      <xsd:element name="title" type="docTitleType" />
+      <xsd:element name="variablelist" type="docVariableListType" />
+      <xsd:element name="table" type="docTableType" />
+      <xsd:element name="heading" type="docHeadingType" />
+      <xsd:element name="image" type="docImageType" />
+      <xsd:element name="dotfile" type="docDotFileType" />
+      <xsd:element name="toclist" type="docTocListType" />
+      <xsd:element name="language" type="docLanguageType" />
+      <xsd:element name="parameterlist" type="docParamListType" />
+      <xsd:element name="xrefsect" type="docXRefSectType" />
+      <xsd:element name="copydoc" type="docCopyType" />
+      <xsd:element name="blockquote" type="docBlockQuoteType" />
+    </xsd:choice>
+  </xsd:group>
+
+  <xsd:complexType name="docParaType" mixed="true">
+    <xsd:group ref="docCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docMarkupType" mixed="true">
+    <xsd:group ref="docCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docURLLink" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+    <xsd:attribute name="url" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docAnchorType" mixed="true">
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docFormulaType" mixed="true">
+    <xsd:attribute name="id" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docIndexEntryType">
+    <xsd:sequence>
+      <xsd:element name="primaryie" type="xsd:string" />
+      <xsd:element name="secondaryie" type="xsd:string" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docListType">
+    <xsd:sequence>
+      <xsd:element name="listitem" type="docListItemType" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docListItemType">
+    <xsd:sequence>
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docSimpleSectType">
+    <xsd:sequence>
+      <xsd:element name="title" type="docTitleType" minOccurs="0" />
+      <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+        <xsd:element name="para" type="docParaType" minOccurs="1" maxOccurs="unbounded" />
+        <xsd:element name="simplesectsep" type="docEmptyType" minOccurs="0"/>
+      </xsd:sequence>
+    </xsd:sequence>
+    <xsd:attribute name="kind" type="DoxSimpleSectKind" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docVarListEntryType">
+    <xsd:sequence>
+      <xsd:element name="term" type="docTitleType" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:group name="docVariableListGroup">
+    <xsd:sequence>
+      <xsd:element name="varlistentry" type="docVarListEntryType" />
+      <xsd:element name="listitem" type="docListItemType" />
+    </xsd:sequence>
+  </xsd:group>
+
+  <xsd:complexType name="docVariableListType">
+    <xsd:sequence>
+      <xsd:group ref="docVariableListGroup" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docRefTextType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+    <xsd:attribute name="refid" type="xsd:string" />
+    <xsd:attribute name="kindref" type="DoxRefKind" />
+    <xsd:attribute name="external" type="xsd:string" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docTableType">
+    <xsd:sequence>
+      <xsd:element name="row" type="docRowType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="caption" type="docCaptionType" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="rows" type="xsd:integer" />
+    <xsd:attribute name="cols" type="xsd:integer" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docRowType">
+    <xsd:sequence>
+      <xsd:element name="entry" type="docEntryType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docEntryType">
+    <xsd:sequence>
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="thead" type="DoxBool" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docCaptionType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docHeadingType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+    <xsd:attribute name="level" type="xsd:integer" /> <!-- todo: range 1-6 -->
+  </xsd:complexType>
+
+  <xsd:complexType name="docImageType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+    <xsd:attribute name="type" type="DoxImageKind" /> 
+    <xsd:attribute name="name" type="xsd:string" /> 
+    <xsd:attribute name="width" type="xsd:string" /> 
+    <xsd:attribute name="height" type="xsd:string" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docDotFileType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+    <xsd:attribute name="name" type="xsd:string" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docTocItemType" mixed="true">
+    <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+    <xsd:attribute name="id" type="xsd:string" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docTocListType">
+    <xsd:sequence>
+      <xsd:element name="tocitem" type="docTocItemType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docLanguageType">
+    <xsd:sequence>
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="langid" type="xsd:string" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docParamListType">
+    <xsd:sequence>
+      <xsd:element name="parameteritem" type="docParamListItem" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+    <xsd:attribute name="kind" type="DoxParamListKind" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docParamListItem">
+    <xsd:sequence>
+      <xsd:element name="parameternamelist" type="docParamNameList" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="parameterdescription" type="descriptionType" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docParamNameList">
+    <xsd:sequence>
+      <xsd:element name="parametertype" type="docParamType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="parametername" type="docParamName" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docParamType" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="ref" type="refTextType" minOccurs="0" maxOccurs="1" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docParamName" mixed="true">
+    <xsd:sequence>
+      <xsd:element name="ref" type="refTextType" minOccurs="0" maxOccurs="1" />
+    </xsd:sequence>
+    <xsd:attribute name="direction" type="DoxParamDir" use="optional" />
+  </xsd:complexType>
+
+  <xsd:complexType name="docXRefSectType">
+    <xsd:sequence>
+      <xsd:element name="xreftitle" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="xrefdescription" type="descriptionType" />
+    </xsd:sequence>
+    <xsd:attribute name="id" type="xsd:string" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docCopyType">
+    <xsd:sequence>
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
+      <xsd:element name="internal" type="docInternalType" minOccurs="0" />
+    </xsd:sequence>
+    <xsd:attribute name="link" type="xsd:string" /> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docBlockQuoteType">
+    <xsd:sequence>
+      <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="docCharType">
+    <xsd:attribute name="char" type="DoxCharRange"/> 
+  </xsd:complexType>
+
+  <xsd:complexType name="docEmptyType"/>
+
+  <!-- Simple types -->
+
+  <xsd:simpleType name="DoxBool">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="yes" />
+      <xsd:enumeration value="no" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxGraphRelation">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="include" />
+      <xsd:enumeration value="usage" />
+      <xsd:enumeration value="template-instance" />
+      <xsd:enumeration value="public-inheritance" />
+      <xsd:enumeration value="protected-inheritance" />
+      <xsd:enumeration value="private-inheritance" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxRefKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="compound" />
+      <xsd:enumeration value="member" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxMemberKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="define" />
+      <xsd:enumeration value="property" />
+      <xsd:enumeration value="event" />
+      <xsd:enumeration value="variable" />
+      <xsd:enumeration value="typedef" />
+      <xsd:enumeration value="enum" />
+      <xsd:enumeration value="function" />
+      <xsd:enumeration value="signal" />
+      <xsd:enumeration value="prototype" />
+      <xsd:enumeration value="friend" />
+      <xsd:enumeration value="dcop" />
+      <xsd:enumeration value="slot" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxProtectionKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="public" />
+      <xsd:enumeration value="protected" />
+      <xsd:enumeration value="private" />
+      <xsd:enumeration value="package" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxVirtualKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="non-virtual" />
+      <xsd:enumeration value="virtual" />
+      <xsd:enumeration value="pure-virtual" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxCompoundKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="class" />
+      <xsd:enumeration value="struct" />
+      <xsd:enumeration value="union" />
+      <xsd:enumeration value="interface" />
+      <xsd:enumeration value="protocol" />
+      <xsd:enumeration value="category" />
+      <xsd:enumeration value="exception" />
+      <xsd:enumeration value="file" />
+      <xsd:enumeration value="namespace" />
+      <xsd:enumeration value="group" />
+      <xsd:enumeration value="page" />
+      <xsd:enumeration value="example" />
+      <xsd:enumeration value="dir" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxSectionKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="user-defined" />
+      <xsd:enumeration value="public-type" />
+      <xsd:enumeration value="public-func" />
+      <xsd:enumeration value="public-attrib" />
+      <xsd:enumeration value="public-slot" />
+      <xsd:enumeration value="signal" />
+      <xsd:enumeration value="dcop-func" />
+      <xsd:enumeration value="property" />
+      <xsd:enumeration value="event" />
+      <xsd:enumeration value="public-static-func" />
+      <xsd:enumeration value="public-static-attrib" />
+      <xsd:enumeration value="protected-type" />
+      <xsd:enumeration value="protected-func" />
+      <xsd:enumeration value="protected-attrib" />
+      <xsd:enumeration value="protected-slot" />
+      <xsd:enumeration value="protected-static-func" />
+      <xsd:enumeration value="protected-static-attrib" />
+      <xsd:enumeration value="package-type" />
+      <xsd:enumeration value="package-func" />
+      <xsd:enumeration value="package-attrib" />
+      <xsd:enumeration value="package-static-func" />
+      <xsd:enumeration value="package-static-attrib" />
+      <xsd:enumeration value="private-type" />
+      <xsd:enumeration value="private-func" />
+      <xsd:enumeration value="private-attrib" />
+      <xsd:enumeration value="private-slot" />
+      <xsd:enumeration value="private-static-func" />
+      <xsd:enumeration value="private-static-attrib" />
+      <xsd:enumeration value="friend" />
+      <xsd:enumeration value="related" />
+      <xsd:enumeration value="define" />
+      <xsd:enumeration value="prototype" />
+      <xsd:enumeration value="typedef" />
+      <xsd:enumeration value="enum" />
+      <xsd:enumeration value="func" />
+      <xsd:enumeration value="var" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxHighlightClass">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="comment" />
+      <xsd:enumeration value="normal" />
+      <xsd:enumeration value="preprocessor" />
+      <xsd:enumeration value="keyword" />
+      <xsd:enumeration value="keywordtype" />
+      <xsd:enumeration value="keywordflow" />
+      <xsd:enumeration value="stringliteral" />
+      <xsd:enumeration value="charliteral" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxSimpleSectKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="see" />
+      <xsd:enumeration value="return" />
+      <xsd:enumeration value="author" />
+      <xsd:enumeration value="authors" />
+      <xsd:enumeration value="version" />
+      <xsd:enumeration value="since" />
+      <xsd:enumeration value="date" />
+      <xsd:enumeration value="note" />
+      <xsd:enumeration value="warning" />
+      <xsd:enumeration value="pre" />
+      <xsd:enumeration value="post" />
+      <xsd:enumeration value="copyright" />
+      <xsd:enumeration value="invariant" />
+      <xsd:enumeration value="remark" />
+      <xsd:enumeration value="attention" />
+      <xsd:enumeration value="par" />
+      <xsd:enumeration value="rcs" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxVersionNumber">
+    <xsd:restriction base="xsd:string">
+      <xsd:pattern value="\d+\.\d+.*" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxImageKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="html" />
+      <xsd:enumeration value="latex" />
+      <xsd:enumeration value="rtf" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxParamListKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="param" />
+      <xsd:enumeration value="retval" />
+      <xsd:enumeration value="exception" />
+      <xsd:enumeration value="templateparam" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxCharRange">
+    <xsd:restriction base="xsd:string">
+      <xsd:pattern value="[aeiouncAEIOUNC]" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxParamDir">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="in"/>
+      <xsd:enumeration value="out"/>
+      <xsd:enumeration value="inout"/>
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="DoxAccessor">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="retain"/>
+      <xsd:enumeration value="copy"/>
+      <xsd:enumeration value="assign"/>
+    </xsd:restriction>
+  </xsd:simpleType>
+
+</xsd:schema>
+

+ 3 - 0
gameplay-luagen/gameplay-api/xml/index.xml

@@ -0,0 +1,3 @@
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+<doxygenindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="index.xsd" version="1.8.1">
+</doxygenindex>

+ 66 - 0
gameplay-luagen/gameplay-api/xml/index.xsd

@@ -0,0 +1,66 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <xsd:element name="doxygenindex" type="DoxygenType"/>
+
+  <xsd:complexType name="DoxygenType">
+    <xsd:sequence>
+      <xsd:element name="compound" type="CompoundType" minOccurs="0" maxOccurs="unbounded"/>
+    </xsd:sequence>
+    <xsd:attribute name="version" type="xsd:string" use="required"/>
+  </xsd:complexType>
+
+  <xsd:complexType name="CompoundType">
+    <xsd:sequence>
+      <xsd:element name="name" type="xsd:string"/>
+      <xsd:element name="member" type="MemberType" minOccurs="0" maxOccurs="unbounded"/>
+    </xsd:sequence>
+    <xsd:attribute name="refid" type="xsd:string" use="required"/>
+    <xsd:attribute name="kind" type="CompoundKind" use="required"/>
+  </xsd:complexType>
+
+  <xsd:complexType name="MemberType">
+    <xsd:sequence>
+      <xsd:element name="name" type="xsd:string"/>
+    </xsd:sequence>
+    <xsd:attribute name="refid" type="xsd:string" use="required"/>
+    <xsd:attribute name="kind" type="MemberKind" use="required"/>
+  </xsd:complexType>
+  
+  <xsd:simpleType name="CompoundKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="class"/>
+      <xsd:enumeration value="struct"/>
+      <xsd:enumeration value="union"/>
+      <xsd:enumeration value="interface"/>
+      <xsd:enumeration value="protocol"/>
+      <xsd:enumeration value="category"/>
+      <xsd:enumeration value="exception"/>
+      <xsd:enumeration value="file"/>
+      <xsd:enumeration value="namespace"/>
+      <xsd:enumeration value="group"/>
+      <xsd:enumeration value="page"/>
+      <xsd:enumeration value="example"/>
+      <xsd:enumeration value="dir"/>
+    </xsd:restriction>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="MemberKind">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="define"/>
+      <xsd:enumeration value="property"/>
+      <xsd:enumeration value="event"/>
+      <xsd:enumeration value="variable"/>
+      <xsd:enumeration value="typedef"/>
+      <xsd:enumeration value="enum"/>
+      <xsd:enumeration value="enumvalue"/>
+      <xsd:enumeration value="function"/>
+      <xsd:enumeration value="signal"/>
+      <xsd:enumeration value="prototype"/>
+      <xsd:enumeration value="friend"/>
+      <xsd:enumeration value="dcop"/>
+      <xsd:enumeration value="slot"/>
+    </xsd:restriction>
+  </xsd:simpleType>
+
+</xsd:schema>
+

+ 1794 - 0
gameplay-luagen/gameplay-luagen.doxyfile

@@ -0,0 +1,1794 @@
+# Doxyfile 1.8.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file 
+# that follow. The default is UTF-8 which is also the encoding used for all 
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the 
+# iconv built into libc) for the transcoding. See 
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or sequence of words) that should 
+# identify the project. Note that if you do not use Doxywizard you need 
+# to put quotes around the project name if it contains spaces.
+
+PROJECT_NAME           = gameplay
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 1.4.0
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description 
+# for a project that appears at the top of each page and should give viewer 
+# a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          = 
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is 
+# included in the documentation. The maximum height of the logo should not 
+# exceed 55 pixels and the maximum width should not exceed 200 pixels. 
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO           = 
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = .
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, 
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English 
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, 
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, 
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = 
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful if your file system 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like regular Qt-style comments 
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
+# interpret the first line (until the first dot) of a Qt-style 
+# comment as the brief description. If set to NO, the comments 
+# will behave just like regular Qt-style comments (thus requiring 
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = "script{1} = \xmlonly <xmlonly>\1</xmlonly> \endxmlonly"
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only). 
+# A mapping has the form "name=value". For example adding 
+# "class=itcl::class" will allow you to use the command class in the 
+# itcl::class meaning.
+
+TCL_SUBST              = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Java. For instance, namespaces will be presented as packages, qualified 
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 
+# sources only. Doxygen will then generate output that is more tailored for 
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 
+# sources. Doxygen will then generate output that is tailored for 
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it 
+# parses. With this tag you can assign which parser to use for a given extension. 
+# Doxygen has a built-in mapping, but you can override or extend it using this 
+# tag. The format is ext=language, where ext is a file extension, and language 
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, 
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make 
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C 
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions 
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING      = 
+
+# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all 
+# comments according to the Markdown format, which allows for more readable 
+# documentation. See http://daringfireball.net/projects/markdown/ for details. 
+# The output of markdown processing is further processed by doxygen, so you 
+# can mix doxygen, HTML, and XML commands with Markdown formatting. 
+# Disable only in case of backward compatibilities issues.
+
+MARKDOWN_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 
+# to include (a tag file for) the STL sources as input, then you should 
+# set this tag to YES in order to let doxygen match functions declarations and 
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
+# func(std::string) {}). This also makes the inheritance and collaboration 
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to 
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 
+# Doxygen will parse them like normal C++ but will assume all classes use public 
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter 
+# and setter methods for a property. Setting this option to YES (the default) 
+# will make doxygen replace the get and set methods by a property in the 
+# documentation. This will only work if the methods are indeed getting or 
+# setting a simple type. If this is not the case, or you want to show the 
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and 
+# unions are shown inside the group in which they are included (e.g. using 
+# @ingroup) instead of on a separate page (for HTML and Man pages) or 
+# section (for LaTeX and RTF).
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and 
+# unions with only public data fields will be shown inline in the documentation 
+# of the scope in which they are defined (i.e. file, namespace, or group 
+# documentation), provided this scope is documented. If set to NO (the default), 
+# structs, classes, and unions are shown on a separate page (for HTML and Man 
+# pages) or section (for LaTeX and RTF).
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 
+# is documented as struct, union, or enum with the name of the typedef. So 
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
+# with name TypeT. When disabled the typedef will appear as a member of a file, 
+# namespace, or class. And the struct will be named TypeS. This can typically 
+# be useful for C code in case the coding convention dictates that all compound 
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to 
+# determine which symbols to keep in memory and which to flush to disk. 
+# When the cache is full, less often used symbols will be written to disk. 
+# For small to medium size projects (<1000 input files) the default value is 
+# probably good enough. For larger projects a too small cache size can cause 
+# doxygen to be busy swapping symbols to and from disk most of the time 
+# causing a significant performance penalty. 
+# If the system has enough physical memory increasing the cache will improve the 
+# performance by keeping more symbols in memory. Note that the value works on 
+# a logarithmic scale so increasing the size by one will roughly double the 
+# memory usage. The cache size is given by this formula: 
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, 
+# corresponding to a cache size of 2^16 = 65536 symbols.
+
+SYMBOL_CACHE_SIZE      = 0
+
+# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be 
+# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given 
+# their name and scope. Since this can be an expensive process and often the 
+# same symbol appear multiple times in the code, doxygen keeps a cache of 
+# pre-resolved symbols. If the cache is too small doxygen will become slower. 
+# If the cache is too large, memory is wasted. The cache size is given by this 
+# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, 
+# corresponding to a cache size of 2^16 = 65536 symbols.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = NO
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be 
+# extracted and appear in the documentation as a namespace called 
+# 'anonymous_namespace{file}', where file will be replaced with the base 
+# name of the file that contains the anonymous namespace. By default 
+# anonymous namespaces are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = YES
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen 
+# will list include files with double quotes in the documentation 
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen 
+# will sort the (brief and detailed) documentation of class members so that 
+# constructors and destructors are listed first. If set to NO (the default) 
+# the constructors will appear in the respective orders defined by 
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. 
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO 
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the 
+# hierarchy of group names into alphabetical order. If set to NO (the default) 
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. 
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to 
+# do proper type resolution of all parameters of a function it will reject a 
+# match between the prototype and the implementation of a member function even 
+# if there is only one candidate or it is obvious which candidate to choose 
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen 
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or macro consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and macros in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. 
+# This will remove the Files entry from the Quick Index and from the 
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = NO
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the 
+# Namespaces page.  This will remove the Namespaces entry from the Quick Index 
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = NO
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from 
+# the version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the program writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed 
+# by doxygen. The layout file controls the global structure of the generated 
+# output files in an output format independent way. The create the layout file 
+# that represents doxygen's defaults, run doxygen with the -l option. 
+# You can optionally specify a file name after the option, if omitted 
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE            = 
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files 
+# containing the references data. This must be a list of .bib files. The 
+# .bib extension is automatically appended if omitted. Using this command 
+# requires the bibtex tool to be installed. See also 
+# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style 
+# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this 
+# feature you need bibtex and perl available in the search path.
+
+CITE_BIB_FILES         = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = ../gameplay/src
+
+# This tag can be used to specify the character encoding of the source files 
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
+# also the default input encoding. Doxygen uses libiconv (or the iconv built 
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for 
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh 
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py 
+# *.f90 *.f *.for *.vhd *.vhdl
+
+FILE_PATTERNS          = *.h \
+                         *.cpp
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag. 
+# Note that relative paths are relative to the directory from which doxygen is 
+# run.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or 
+# directories that are symbolic links (a Unix file system feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = 
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
+# (namespaces, classes, functions, etc.) that should be excluded from the 
+# output. The symbol name can be a fully qualified name, a word, or if the 
+# wildcard * is used, a substring. Examples: ANamespace, AClass, 
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty or if 
+# non of the patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file 
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) 
+# and it is also possible to disable source filtering for a specific pattern 
+# using *.ext= (so without naming a filter). This option only has effect when 
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS = 
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) 
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from 
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will 
+# link to the source code.  Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = NO
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header. Note that when using a custom header you are responsible  
+# for the proper inclusion of any scripts and style sheets that doxygen 
+# needs, which is dependent on the configuration options used. 
+# It is advised to generate a default header using "doxygen -w html 
+# header.html footer.html stylesheet.css YourConfigFile" and then modify 
+# that header. Note that the header is subject to change so you typically 
+# have to redo this when upgrading to a newer version of doxygen or when 
+# changing the value of configuration settings such as GENERATE_TREEVIEW!
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# style sheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or 
+# other source files which should be copied to the HTML output directory. Note 
+# that these files will be copied to the base HTML output directory. Use the 
+# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these 
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that 
+# the files will be copied as-is; there are no commands or markers available.
+
+HTML_EXTRA_FILES       = 
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. 
+# Doxygen will adjust the colors in the style sheet and background images 
+# according to this color. Hue is specified as an angle on a colorwheel, 
+# see http://en.wikipedia.org/wiki/Hue for more information. 
+# For instance the value 0 represents red, 60 is yellow, 120 is green, 
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. 
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of 
+# the colors in the HTML output. For a value of 0 the output will use 
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to 
+# the luminance component of the colors in the HTML output. Values below 
+# 100 gradually make the output lighter, whereas values above 100 make 
+# the output darker. The value divided by 100 is the actual gamma applied, 
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, 
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML 
+# page will contain the date and time when the page was generated. Setting 
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
+# documentation will contain sections that can be hidden and shown after the 
+# page has loaded.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of 
+# entries shown in the various tree structured indices initially; the user 
+# can expand and collapse entries dynamically later on. Doxygen will expand 
+# the tree to such a level that at most the specified number of entries are 
+# visible (unless a fully collapsed tree already exceeds this amount). 
+# So setting the number of entries 1 will produce a full collapsed tree by 
+# default. 0 is a special value representing an infinite number of entries 
+# and will result in a full expanded tree by default.
+
+HTML_INDEX_NUM_ENTRIES = 113
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files 
+# will be generated that can be used as input for Apple's Xcode 3 
+# integrated development environment, introduced with OSX 10.5 (Leopard). 
+# To create a documentation set, doxygen will generate a Makefile in the 
+# HTML output directory. Running make will produce the docset in that 
+# directory and running "make install" will install the docset in 
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find 
+# it at startup. 
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html 
+# for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the 
+# feed. A documentation feed provides an umbrella under which multiple 
+# documentation sets from a single provider (such as a company or product suite) 
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 
+# should uniquely identify the documentation set bundle. This should be a 
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify 
+# the documentation publisher. This should be a reverse domain-name style 
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING 
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file 
+# content.
+
+CHM_INDEX_ENCODING     = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and 
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated 
+# that can be used as input for Qt's qhelpgenerator to generate a 
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can 
+# be used to specify the file name of the resulting .qch file. 
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               = 
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating 
+# Qt Help Project output. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to 
+# add. For more information please see 
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   = 
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the 
+# custom filter to add. For more information please see 
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters"> 
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  = 
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this 
+# project's 
+# filter section matches. 
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes"> 
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  = 
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can 
+# be used to specify the location of Qt's qhelpgenerator. 
+# If non-empty doxygen will try to run qhelpgenerator on the generated 
+# .qhp file.
+
+QHG_LOCATION           = 
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files  
+# will be generated, which together with the HTML files, form an Eclipse help 
+# plugin. To install this plugin and make it available under the help contents 
+# menu in Eclipse, the contents of the directory containing the HTML and XML 
+# files needs to be copied into the plugins directory of eclipse. The name of 
+# the directory within the plugins directory should be the same as 
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before 
+# the help appears.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin 
+# the directory name containing the HTML and XML files should also have 
+# this name.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) 
+# at top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it. Since the tabs have the same information as the 
+# navigation tree you can set this option to NO if you already set 
+# GENERATE_TREEVIEW to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index 
+# structure should be generated to display hierarchical information. 
+# If the tag value is set to YES, a side panel will be generated 
+# containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). 
+# Windows users are probably better off using the HTML help feature. 
+# Since the tree basically has the same information as the tab index you 
+# could consider to set DISABLE_INDEX to NO when enabling this option.
+
+GENERATE_TREEVIEW      = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values 
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML 
+# documentation. Note that a value of 0 will completely suppress the enum 
+# values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open 
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of Latex formulas included 
+# as images in the HTML documentation. The default is 10. Note that 
+# when you change the font size after a successful doxygen run you need 
+# to manually remove any form_*.png images from the HTML output directory 
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images 
+# generated for formulas are transparent PNGs. Transparent PNGs are 
+# not supported properly for IE 6.0, but are supported on all modern browsers. 
+# Note that when changing this option you need to delete any form_*.png files 
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax 
+# (see http://www.mathjax.org) which uses client side Javascript for the 
+# rendering instead of using prerendered bitmaps. Use this if you do not 
+# have LaTeX installed or if you want to formulas look prettier in the HTML 
+# output. When enabled you may also need to install MathJax separately and 
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you need to specify the location relative to the 
+# HTML output directory using the MATHJAX_RELPATH option. The destination 
+# directory should contain the MathJax.js script. For instance, if the mathjax 
+# directory is located at the same level as the HTML output directory, then 
+# MATHJAX_RELPATH should be ../mathjax. The default value points to 
+# the MathJax Content Delivery Network so you can quickly see the result without 
+# installing MathJax.  However, it is strongly recommended to install a local 
+# copy of MathJax from http://www.mathjax.org before deployment.
+
+MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension 
+# names that should be enabled during MathJax rendering.
+
+MATHJAX_EXTENSIONS     = 
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box 
+# for the HTML output. The underlying search engine uses javascript 
+# and DHTML and should work on any modern browser. Note that when using 
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets 
+# (GENERATE_DOCSET) there is already a search function so this one should 
+# typically be disabled. For large projects the javascript based search engine 
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be 
+# implemented using a PHP enabled web server instead of at the web client 
+# using Javascript. Doxygen will generate the search PHP script and index 
+# file to put on the web server. The advantage of the server 
+# based approach is that it scales better to large projects and allows 
+# full text search. The disadvantages are that it is more difficult to setup 
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name. 
+# Note that when enabling USE_PDFLATEX this option is only used for 
+# generating bitmaps for formulas in the HTML output, but not in the 
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for 
+# the generated latex document. The footer should contain everything after 
+# the last chapter. If it is left blank doxygen will generate a 
+# standard footer. Notice: only use this tag if you know what you are doing!
+
+LATEX_FOOTER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include 
+# source code with syntax highlighting in the LaTeX output. 
+# Note that which sources are shown also depends on other settings 
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the 
+# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See 
+# http://en.wikipedia.org/wiki/BibTeX for more info.
+
+LATEX_BIB_STYLE        = plain
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load style sheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = YES
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = NO
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# pointed to by INCLUDE_PATH will be searched when a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition that 
+# overrules the definition found in the source code.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all references to function-like macros 
+# that are alone on a line, have an all uppercase name, and do not end with a 
+# semicolon, because these will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. For each 
+# tag file the location of the external documentation should be added. The 
+# format of a tag file without this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths 
+# or URLs. Note that each tag file must have a unique name (where the name does 
+# NOT include the path). If a tag file is not located in the directory in which 
+# doxygen is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option also works with HAVE_DOT disabled, but it is recommended to 
+# install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc 
+# command. Doxygen will then run the mscgen tool (see 
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the 
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where 
+# the mscgen tool resides. If left empty the tool is assumed to be found in the 
+# default search path.
+
+MSCGEN_PATH            = 
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is 
+# allowed to run in parallel. When set to 0 (the default) doxygen will 
+# base this on the number of processors available in the system. You can set it 
+# explicitly to a value larger than 0 to get control over the balance 
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS        = 0
+
+# By default doxygen will use the Helvetica font for all dot files that 
+# doxygen generates. When you want a differently looking font you can specify 
+# the font name using DOT_FONTNAME. You need to make sure dot is able to find 
+# the font, which can be done by putting it in a standard location or by setting 
+# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the 
+# directory containing the font.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. 
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the Helvetica font. 
+# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to 
+# set the path where dot can find it.
+
+DOT_FONTPATH           = 
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside 
+# the class node. If there are many fields or methods and many nodes the 
+# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS 
+# threshold limits the number of items for each type to make the size more 
+# managable. Set this to 0 for no limit. Note that the threshold may be 
+# exceeded by 50% before the limit is enforced.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then 
+# doxygen will generate a call dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable call graphs 
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then 
+# doxygen will generate a caller dependency graph for every global function 
+# or class method. Note that enabling this option will significantly increase 
+# the time of a run. So in most cases it will be better to enable caller 
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include 
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are svg, png, jpg, or gif. 
+# If left blank png will be used. If you choose svg you need to set 
+# HTML_FILE_EXTENSION to xhtml in order to make the SVG files 
+# visible in IE 9+ (other browsers do not have this requirement).
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to 
+# enable generation of interactive SVG images that allow zooming and panning. 
+# Note that this requires a modern browser other than Internet Explorer. 
+# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you 
+# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files 
+# visible. Older versions of IE do not have SVG support.
+
+INTERACTIVE_SVG        = NO
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that 
+# contain msc files that are included in the documentation (see the 
+# \mscfile command).
+
+MSCFILE_DIRS           = 
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
+# nodes that will be shown in the graph. If the number of nodes in a graph 
+# becomes larger than this value, doxygen will truncate the graph, which is 
+# visualized by representing a node as a red box. Note that doxygen if the 
+# number of direct children of the root node in a graph is already larger than 
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that the size of a graph can be further restricted by 
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, because dot on Windows does not 
+# seem to support this out of the box. Warning: Depending on the platform used, 
+# enabling this option may lead to badly anti-aliased labels on the edges of 
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES

+ 20 - 0
gameplay-luagen/gameplay-luagen.sln

@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gameplay-luagen", "gameplay-luagen.vcxproj", "{CA137C5D-FDE1-4095-926A-59E8472504BF}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{CA137C5D-FDE1-4095-926A-59E8472504BF}.Debug|Win32.ActiveCfg = Debug|Win32
+		{CA137C5D-FDE1-4095-926A-59E8472504BF}.Debug|Win32.Build.0 = Debug|Win32
+		{CA137C5D-FDE1-4095-926A-59E8472504BF}.Release|Win32.ActiveCfg = Release|Win32
+		{CA137C5D-FDE1-4095-926A-59E8472504BF}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 136 - 0
gameplay-luagen/gameplay-luagen.vcxproj

@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="src\ClassBinding.cpp" />
+    <ClCompile Include="src\DebugNew.cpp" />
+    <ClCompile Include="src\FunctionBinding.cpp" />
+    <ClCompile Include="src\Generator.cpp" />
+    <ClCompile Include="src\main.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="src\Base.h" />
+    <ClInclude Include="src\ClassBinding.h" />
+    <ClInclude Include="src\DebugNew.h" />
+    <ClInclude Include="src\EnumBinding.h" />
+    <ClInclude Include="src\FunctionBinding.h" />
+    <ClInclude Include="src\Generator.h" />
+    <ClInclude Include="src\TypedefBinding.h" />
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{CA137C5D-FDE1-4095-926A-59E8472504BF}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>gameplayluagen</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+    <CustomBuildBeforeTargets>
+    </CustomBuildBeforeTargets>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+    <CustomBuildBeforeTargets>
+    </CustomBuildBeforeTargets>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>GP_ERRORS_AS_WARNINGS;_ITERATOR_DEBUG_LEVEL=0;WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>..\external-deps\tinyxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalLibraryDirectories>..\external-deps\tinyxml2\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>tinyxml2.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <PreBuildEvent>
+      <Command>
+      </Command>
+    </PreBuildEvent>
+    <CustomBuildStep>
+      <Command>
+      </Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Message>
+      </Message>
+    </CustomBuildStep>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>..\external-deps\tinyxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalLibraryDirectories>..\external-deps\tinyxml2\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>tinyxml2.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <PreBuildEvent>
+      <Command>
+      </Command>
+    </PreBuildEvent>
+    <CustomBuildStep>
+      <Command>
+      </Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Message>
+      </Message>
+    </CustomBuildStep>
+    <PostBuildEvent>
+      <Command>copy $(TargetPath) $(ProjectDir)..\bin\win32\$(TargetFileName)</Command>
+    </PostBuildEvent>
+    <PostBuildEvent>
+      <Message>Copying executable to bin/win32 folder ...</Message>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 48 - 0
gameplay-luagen/gameplay-luagen.vcxproj.filters

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="src">
+      <UniqueIdentifier>{ff86fc9c-4adf-479c-bcfc-fef8919ed4c1}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="src\ClassBinding.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\DebugNew.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\FunctionBinding.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Generator.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\main.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="src\Base.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\ClassBinding.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\DebugNew.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\EnumBinding.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\FunctionBinding.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Generator.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\TypedefBinding.h">
+      <Filter>src</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 13 - 0
gameplay-luagen/gameplay-luagen.vcxproj.user

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LocalDebuggerCommandArguments>"$(ProjectDir)xml/" "$(ProjectDir)../gameplay/src/lua/" gameplay</LocalDebuggerCommandArguments>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+    <LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LocalDebuggerCommandArguments>"$(ProjectDir)xml/" "$(ProjectDir)../gameplay/src/lua/" gameplay</LocalDebuggerCommandArguments>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+    <LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand>
+  </PropertyGroup>
+</Project>

+ 258 - 0
gameplay-luagen/gameplay-luagen.xcodeproj/project.pbxproj

@@ -0,0 +1,258 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		42B7F6FD15B06EFE002BB8C3 /* ClassBinding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42B7F6F215B06EFE002BB8C3 /* ClassBinding.cpp */; };
+		42B7F6FE15B06EFE002BB8C3 /* DebugNew.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42B7F6F415B06EFE002BB8C3 /* DebugNew.cpp */; };
+		42B7F6FF15B06EFE002BB8C3 /* FunctionBinding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42B7F6F715B06EFE002BB8C3 /* FunctionBinding.cpp */; };
+		42B7F70015B06EFE002BB8C3 /* Generator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42B7F6F915B06EFE002BB8C3 /* Generator.cpp */; };
+		42B7F70115B06EFE002BB8C3 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42B7F6FB15B06EFE002BB8C3 /* main.cpp */; };
+		42B7F71215B06F67002BB8C3 /* libtinyxml2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42B7F71115B06F67002BB8C3 /* libtinyxml2.a */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		42B7F6DE15B06E85002BB8C3 /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = /usr/share/man/man1/;
+			dstSubfolderSpec = 0;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 1;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		42B7F6E015B06E85002BB8C3 /* gameplay-luagen */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "gameplay-luagen"; sourceTree = BUILT_PRODUCTS_DIR; };
+		42B7F6F115B06EFE002BB8C3 /* Base.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Base.h; path = src/Base.h; sourceTree = SOURCE_ROOT; };
+		42B7F6F215B06EFE002BB8C3 /* ClassBinding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClassBinding.cpp; path = src/ClassBinding.cpp; sourceTree = SOURCE_ROOT; };
+		42B7F6F315B06EFE002BB8C3 /* ClassBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClassBinding.h; path = src/ClassBinding.h; sourceTree = SOURCE_ROOT; };
+		42B7F6F415B06EFE002BB8C3 /* DebugNew.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DebugNew.cpp; path = src/DebugNew.cpp; sourceTree = SOURCE_ROOT; };
+		42B7F6F515B06EFE002BB8C3 /* DebugNew.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DebugNew.h; path = src/DebugNew.h; sourceTree = SOURCE_ROOT; };
+		42B7F6F615B06EFE002BB8C3 /* EnumBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EnumBinding.h; path = src/EnumBinding.h; sourceTree = SOURCE_ROOT; };
+		42B7F6F715B06EFE002BB8C3 /* FunctionBinding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FunctionBinding.cpp; path = src/FunctionBinding.cpp; sourceTree = SOURCE_ROOT; };
+		42B7F6F815B06EFE002BB8C3 /* FunctionBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FunctionBinding.h; path = src/FunctionBinding.h; sourceTree = SOURCE_ROOT; };
+		42B7F6F915B06EFE002BB8C3 /* Generator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Generator.cpp; path = src/Generator.cpp; sourceTree = SOURCE_ROOT; };
+		42B7F6FA15B06EFE002BB8C3 /* Generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Generator.h; path = src/Generator.h; sourceTree = SOURCE_ROOT; };
+		42B7F6FB15B06EFE002BB8C3 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = src/main.cpp; sourceTree = SOURCE_ROOT; };
+		42B7F6FC15B06EFE002BB8C3 /* TypedefBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TypedefBinding.h; path = src/TypedefBinding.h; sourceTree = SOURCE_ROOT; };
+		42B7F71115B06F67002BB8C3 /* libtinyxml2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libtinyxml2.a; path = "../external-deps/tinyxml2/lib/macosx/libtinyxml2.a"; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		42B7F6DD15B06E85002BB8C3 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				42B7F71215B06F67002BB8C3 /* libtinyxml2.a in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		42B7F6D515B06E85002BB8C3 = {
+			isa = PBXGroup;
+			children = (
+				42B7F6E315B06E85002BB8C3 /* src */,
+				42B7F70B15B06F3A002BB8C3 /* Libraries */,
+				42B7F6E115B06E85002BB8C3 /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		42B7F6E115B06E85002BB8C3 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				42B7F6E015B06E85002BB8C3 /* gameplay-luagen */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		42B7F6E315B06E85002BB8C3 /* src */ = {
+			isa = PBXGroup;
+			children = (
+				42B7F6F115B06EFE002BB8C3 /* Base.h */,
+				42B7F6F215B06EFE002BB8C3 /* ClassBinding.cpp */,
+				42B7F6F315B06EFE002BB8C3 /* ClassBinding.h */,
+				42B7F6F415B06EFE002BB8C3 /* DebugNew.cpp */,
+				42B7F6F515B06EFE002BB8C3 /* DebugNew.h */,
+				42B7F6F615B06EFE002BB8C3 /* EnumBinding.h */,
+				42B7F6F715B06EFE002BB8C3 /* FunctionBinding.cpp */,
+				42B7F6F815B06EFE002BB8C3 /* FunctionBinding.h */,
+				42B7F6F915B06EFE002BB8C3 /* Generator.cpp */,
+				42B7F6FA15B06EFE002BB8C3 /* Generator.h */,
+				42B7F6FB15B06EFE002BB8C3 /* main.cpp */,
+				42B7F6FC15B06EFE002BB8C3 /* TypedefBinding.h */,
+			);
+			name = src;
+			path = "gameplay-luagen";
+			sourceTree = "<group>";
+		};
+		42B7F70B15B06F3A002BB8C3 /* Libraries */ = {
+			isa = PBXGroup;
+			children = (
+				42B7F71115B06F67002BB8C3 /* libtinyxml2.a */,
+			);
+			name = Libraries;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		42B7F6DF15B06E85002BB8C3 /* gameplay-luagen */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 42B7F6EA15B06E85002BB8C3 /* Build configuration list for PBXNativeTarget "gameplay-luagen" */;
+			buildPhases = (
+				42B7F6DC15B06E85002BB8C3 /* Sources */,
+				42B7F6DD15B06E85002BB8C3 /* Frameworks */,
+				42B7F6DE15B06E85002BB8C3 /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "gameplay-luagen";
+			productName = "gameplay-luagen";
+			productReference = 42B7F6E015B06E85002BB8C3 /* gameplay-luagen */;
+			productType = "com.apple.product-type.tool";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		42B7F6D715B06E85002BB8C3 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0430;
+			};
+			buildConfigurationList = 42B7F6DA15B06E85002BB8C3 /* Build configuration list for PBXProject "gameplay-luagen" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = 42B7F6D515B06E85002BB8C3;
+			productRefGroup = 42B7F6E115B06E85002BB8C3 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				42B7F6DF15B06E85002BB8C3 /* gameplay-luagen */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+		42B7F6DC15B06E85002BB8C3 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				42B7F6FD15B06EFE002BB8C3 /* ClassBinding.cpp in Sources */,
+				42B7F6FE15B06EFE002BB8C3 /* DebugNew.cpp in Sources */,
+				42B7F6FF15B06EFE002BB8C3 /* FunctionBinding.cpp in Sources */,
+				42B7F70015B06EFE002BB8C3 /* Generator.cpp in Sources */,
+				42B7F70115B06EFE002BB8C3 /* main.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+		42B7F6E815B06E85002BB8C3 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				COPY_PHASE_STRIP = NO;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				ONLY_ACTIVE_ARCH = YES;
+				SDKROOT = macosx;
+			};
+			name = Debug;
+		};
+		42B7F6E915B06E85002BB8C3 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				SDKROOT = macosx;
+			};
+			name = Release;
+		};
+		42B7F6EB15B06E85002BB8C3 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				HEADER_SEARCH_PATHS = "../external-deps/tinyxml2/include";
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SRCROOT)/../external-deps/tinyxml2/lib/macosx\"",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		42B7F6EC15B06E85002BB8C3 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				HEADER_SEARCH_PATHS = "../external-deps/tinyxml2/include";
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SRCROOT)/../external-deps/tinyxml2/lib/macosx\"",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		42B7F6DA15B06E85002BB8C3 /* Build configuration list for PBXProject "gameplay-luagen" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				42B7F6E815B06E85002BB8C3 /* Debug */,
+				42B7F6E915B06E85002BB8C3 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		42B7F6EA15B06E85002BB8C3 /* Build configuration list for PBXNativeTarget "gameplay-luagen" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				42B7F6EB15B06E85002BB8C3 /* Debug */,
+				42B7F6EC15B06E85002BB8C3 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 42B7F6D715B06E85002BB8C3 /* Project object */;
+}

+ 113 - 0
gameplay-luagen/gameplay-luagen.xcodeproj/xcshareddata/xcschemes/gameplay-luagen.xcscheme

@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   version = "1.7">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "42B7F6DF15B06E85002BB8C3"
+               BuildableName = "gameplay-luagen"
+               BlueprintName = "gameplay-luagen"
+               ReferencedContainer = "container:gameplay-luagen.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      buildConfiguration = "Debug">
+      <Testables>
+      </Testables>
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "42B7F6DF15B06E85002BB8C3"
+            BuildableName = "gameplay-luagen"
+            BlueprintName = "gameplay-luagen"
+            ReferencedContainer = "container:gameplay-luagen.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+   </TestAction>
+   <LaunchAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Debug"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      allowLocationSimulation = "YES">
+      <PreActions>
+         <ExecutionAction
+            ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
+            <ActionContent
+               title = "Run Script"
+               scriptText = "rm ${SRCROOT}/../gameplay/src/lua/*&#10;">
+               <EnvironmentBuildable>
+                  <BuildableReference
+                     BuildableIdentifier = "primary"
+                     BlueprintIdentifier = "42B7F6DF15B06E85002BB8C3"
+                     BuildableName = "gameplay-luagen"
+                     BlueprintName = "gameplay-luagen"
+                     ReferencedContainer = "container:gameplay-luagen.xcodeproj">
+                  </BuildableReference>
+               </EnvironmentBuildable>
+            </ActionContent>
+         </ExecutionAction>
+      </PreActions>
+      <BuildableProductRunnable>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "42B7F6DF15B06E85002BB8C3"
+            BuildableName = "gameplay-luagen"
+            BlueprintName = "gameplay-luagen"
+            ReferencedContainer = "container:gameplay-luagen.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+      <CommandLineArguments>
+         <CommandLineArgument
+            argument = "$(PROJECT_DIR)/xml"
+            isEnabled = "YES">
+         </CommandLineArgument>
+         <CommandLineArgument
+            argument = "$(PROJECT_DIR)/../gameplay/src/lua/"
+            isEnabled = "YES">
+         </CommandLineArgument>
+      </CommandLineArguments>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Release"
+      debugDocumentVersioning = "YES">
+      <BuildableProductRunnable>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "42B7F6DF15B06E85002BB8C3"
+            BuildableName = "gameplay-luagen"
+            BlueprintName = "gameplay-luagen"
+            ReferencedContainer = "container:gameplay-luagen.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

+ 2 - 0
gameplay-luagen/generate-doxygen-xml.bat

@@ -0,0 +1,2 @@
+del /Q .\xml\*
+doxygen gameplay-luagen.doxyfile

+ 86 - 0
gameplay-luagen/src/Base.h

@@ -0,0 +1,86 @@
+#include <algorithm>
+#include <cassert>
+#include <fstream>
+#include <iostream>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+#include <sys/types.h>
+#include <sys/stat.h>
+using namespace std;
+
+#define LUA_GLOBAL_FILENAME "lua_Global"
+#define LUA_ALL_BINDINGS_FILENAME "lua_all_bindings"
+#define LUA_OBJECT "ScriptUtil::LuaObject"
+#define SCOPE_REPLACEMENT ""
+#define SCOPE_REPLACEMENT_SIZE strlen(SCOPE_REPLACEMENT)
+#define REF_CLASS_NAME "Ref"
+
+#ifdef WIN32
+#include <windows.h>
+#pragma warning(disable : 4996)
+#pragma warning(disable : 4244)
+#pragma warning(disable : 4345)
+#else
+#include <dirent.h>
+#endif
+
+// Object deletion macro
+#define SAFE_DELETE(x) \
+    { \
+        delete x; \
+        x = NULL; \
+    }
+
+// Array deletion macro
+#define SAFE_DELETE_ARRAY(x) \
+    { \
+        delete[] x; \
+        x = NULL; \
+    }
+
+extern void printError(const char* format, ...);
+
+// Current function macro.
+#ifdef WIN32
+#define __current__func__ __FUNCTION__
+#else
+#define __current__func__ __func__
+#endif
+
+// Assert macros.
+#ifdef _DEBUG
+#define GP_ASSERT(expression) do { \
+    if (!(expression)) \
+    { \
+        printError("%s -- Assertion '" #expression "' failed.\n", __current__func__); \
+        assert(expression); \
+    } } while (0)
+#else
+#define GP_ASSERT(expression)
+#endif
+
+// Error macro.
+#ifdef GP_ERRORS_AS_WARNINGS
+#define GP_ERROR GP_WARN
+#else
+#define GP_ERROR(...) do \
+    { \
+        printError("%s -- ", __current__func__); \
+        printError(__VA_ARGS__); \
+        printError("\n"); \
+        assert(0); \
+        std::exit(-1); \
+    } while (0)
+#endif
+
+// Warning macro.
+#define GP_WARN(...) do \
+    { \
+        printError("%s -- ", __current__func__); \
+        printError(__VA_ARGS__); \
+        printError("\n"); \
+    } while (0)
+
+#include "DebugNew.h"

+ 296 - 0
gameplay-luagen/src/ClassBinding.cpp

@@ -0,0 +1,296 @@
+#include "ClassBinding.h"
+#include "Generator.h"
+
+static void generateInstanceGetter(ostream& o, const string& classname, const string& uniquename)
+{
+    o << "static " << classname << "* getInstance(lua_State* state)\n";
+    o << "{\n";
+    o << "    void* userdata = luaL_checkudata(state, 1, \"" << uniquename << "\");\n";
+    o << "    luaL_argcheck(state, userdata != NULL, 1, \"\'" << uniquename << "\' expected.\");\n";
+    o << "    return (" << classname << "*)((" << LUA_OBJECT << "*)userdata)->instance;\n";
+    o << "}\n\n";
+}
+
+ClassBinding::ClassBinding(string classname, string refId) : classname(classname),
+    refId(refId), inaccessibleConstructor(false), inaccessibleDestructor(false)
+{
+    // Get the class's name and namespace.
+    this->classname = Generator::getInstance()->getClassNameAndNamespace(classname, &ns);
+
+    // Calculate the unique name for the class.
+    uniquename = Generator::getUniqueName(this->classname);
+}
+
+void ClassBinding::write(string dir, const set<string>& includes, string* bindingNS)
+{
+    // Calculate the constructor string.
+    size_t index = uniquename.rfind(SCOPE_REPLACEMENT);
+    string constructorString = "";
+    string* constructorUniqueName = NULL;
+    if (index != uniquename.npos && index != uniquename.length())
+        constructorString += uniquename.substr(index + SCOPE_REPLACEMENT_SIZE);
+    else
+        constructorString += uniquename;
+
+    // Generate a constructor function if there isn't one
+    // and the class doesn't have an inaccessible constructor.
+    FunctionBinding b(classname, uniquename);
+    b.name = constructorString;
+    b.returnParam = FunctionBinding::Param(FunctionBinding::Param::TYPE_CONSTRUCTOR, FunctionBinding::Param::KIND_POINTER, refId);
+    b.type = FunctionBinding::MEMBER_FUNCTION;
+    b.own = true;
+
+    map<string, vector<FunctionBinding> >::iterator iter = bindings.find(b.getFunctionName());
+    if (iter == bindings.end())
+    {
+        if (!inaccessibleConstructor)
+        {
+            bindings[b.getFunctionName()].push_back(b);
+            constructorUniqueName = new string(b.getFunctionName());
+        }
+    }
+    else
+    {
+        constructorUniqueName = new string(iter->second[0].getFunctionName());
+    }
+
+    // Calculate the destructor string.
+    index = uniquename.rfind(SCOPE_REPLACEMENT);
+    string destructorString = "~";
+    string* destructorUniqueName = NULL;
+    if (index != uniquename.npos && index != uniquename.length())
+        destructorString += uniquename.substr(index + SCOPE_REPLACEMENT_SIZE);
+    else
+        destructorString += uniquename;
+
+    // Generate a destructor function if there isn't one
+    // and the class doesn't have an inaccessible destructor
+    // or the class is derived from Ref.
+    b = FunctionBinding(classname, uniquename);
+    b.name = destructorString;
+    b.returnParam = FunctionBinding::Param(FunctionBinding::Param::TYPE_DESTRUCTOR);
+    b.type = FunctionBinding::MEMBER_FUNCTION;
+
+    iter = bindings.find(b.getFunctionName());
+    if (iter == bindings.end())
+    {
+        if (!inaccessibleDestructor || Generator::getInstance()->isRef(classname))
+        {
+            bindings[b.getFunctionName()].push_back(b);
+            destructorUniqueName = new string(b.getFunctionName());
+        }
+    }
+    else
+    {
+        destructorUniqueName = new string(iter->second[0].getFunctionName());
+    }
+
+    // Write out the header.
+    {
+        string path = dir + string("lua_") + uniquename + string(".h");
+        ofstream o(path.c_str());
+        if (!o)
+        {
+            GP_ERROR("Failed to open file '%s' for generating Lua bindings.", path.c_str());
+            return;
+        }
+
+        string includeGuard = string("lua_") + uniquename + string("_H_");
+        transform(includeGuard.begin(), includeGuard.end(), includeGuard.begin(), ::toupper);
+        o << "#ifndef " << includeGuard << "\n";
+        o << "#define " << includeGuard << "\n\n";
+
+        if (bindingNS)
+        {
+            o << "namespace " << *bindingNS << "\n";
+            o << "{\n\n";
+        }
+
+        o << "// Lua bindings for " << classname << ".\n";
+            
+        // Write out the binding functions declarations.
+        iter = bindings.begin();
+        for (; iter != bindings.end(); iter++)
+        {
+            o << "int " << iter->second[0].getFunctionName() << "(lua_State* state);\n";
+        }
+        o << "\n";
+
+        // Write out the signature of the function used to register the class with Lua.
+        o << "void luaRegister_" << uniquename << "();\n\n";
+
+        if (bindingNS)
+            o << "}\n\n";
+        o << "#endif\n";
+        o.close();
+    }
+
+    // Write out the implementation.
+    {
+        string path = dir + string("lua_") + uniquename + string(".cpp");
+        ofstream o(path.c_str());
+        if (!o)
+        {
+            GP_ERROR("Failed to open file '%s' for generating Lua bindings.", path.c_str());
+            return;
+        }
+        
+        o << "#include \"Base.h\"\n";
+        o << "#include \"ScriptController.h\"\n";
+        o << "#include \"lua_" << uniquename << ".h\"\n";
+
+        // Ensure we include the original class header, even 
+        // if the list of includes doesn't have it.
+        if (includes.find(include) == includes.end())
+            o << "#include \"" << include << "\"\n";
+
+        for (set<string>::iterator includeIter = includes.begin(); includeIter != includes.end(); includeIter++)
+        {
+            o << "#include \"" << *includeIter << "\"\n";
+        }
+        o << "\n";
+        
+
+        // If the original class is part of a namespace and we aren't generating into that namespace,
+        // include its member with a 'using' statement.
+        if (ns.length() > 0 && (!bindingNS || (*bindingNS != ns)))
+        {
+            o << "using " << ns << ";\n\n";
+        }
+
+        if (bindingNS)
+        {
+            o << "namespace " << *bindingNS << "\n";
+            o << "{\n\n";
+        }
+
+        // Write out the function used to register the class with Lua.
+        o << "void luaRegister_" << uniquename << "()\n";
+        o << "{\n";
+        
+        // Get the member functions ready to bind.
+        iter = bindings.begin();
+        bool hasMembers = false;
+        for (; iter != bindings.end(); iter++)
+        {
+            for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+            {
+                if (iter->second[i].type == FunctionBinding::MEMBER_FUNCTION ||
+                    iter->second[i].type == FunctionBinding::MEMBER_CONSTANT ||
+                    iter->second[i].type == FunctionBinding::MEMBER_VARIABLE)
+                {
+                    hasMembers = true;
+                    break;
+                }
+            }
+
+            if (hasMembers)
+                break;
+        }
+        if (hasMembers)
+        {
+            o << "    const luaL_Reg lua_members[] = \n";
+            o << "    {\n";
+            iter = bindings.begin();
+            for (; iter != bindings.end(); iter++)
+            {
+                for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+                {
+                    if ((iter->second[i].type == FunctionBinding::MEMBER_FUNCTION ||
+                        iter->second[i].type == FunctionBinding::MEMBER_CONSTANT ||
+                        iter->second[i].type == FunctionBinding::MEMBER_VARIABLE) &&
+                        iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR &&
+                        iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_DESTRUCTOR)
+                    {
+                        o << "        {\"" << iter->second[i].name << "\", " << iter->second[i].getFunctionName() << "},\n";
+                        break;
+                    }
+                }
+            }
+            o << "        {NULL, NULL}\n";
+            o << "    };\n";
+        }
+        else
+        {
+            o << "    const luaL_Reg* lua_members = NULL;\n";
+        }
+
+        // Get the static functions ready to bind.
+        iter = bindings.begin();
+        bool hasStatics = false;
+        for (; iter != bindings.end(); iter++)
+        {
+            for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+            {
+                if (iter->second[i].type == FunctionBinding::STATIC_FUNCTION ||
+                    iter->second[i].type == FunctionBinding::STATIC_CONSTANT ||
+                    iter->second[i].type == FunctionBinding::STATIC_VARIABLE)
+                {
+                    hasStatics = true;
+                    break;
+                }
+            }
+
+            if (hasStatics)
+                break;
+        }
+        if (hasStatics)
+        {
+            o << "    const luaL_Reg lua_statics[] = \n";
+            o << "    {\n";
+            iter = bindings.begin();
+            for (; iter != bindings.end(); iter++)
+            {
+                for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+                {
+                    if (iter->second[i].type == FunctionBinding::STATIC_FUNCTION ||
+                    iter->second[i].type == FunctionBinding::STATIC_CONSTANT ||
+                    iter->second[i].type == FunctionBinding::STATIC_VARIABLE)
+                    {
+                        o << "        {\"" << iter->second[i].name << "\", " << iter->second[i].getFunctionName() << "},\n";
+                        break;
+                    }
+                }
+            }
+            o << "        {NULL, NULL}\n";
+            o << "    };\n";
+        }
+        else
+        {
+            o << "    const luaL_Reg* lua_statics = NULL;\n";
+        }
+
+        // Output the scope path for the class (used for inner classes).
+        vector<string> scopePath = Generator::getScopePath(classname, ns);
+        o << "    std::vector<std::string> scopePath;\n";
+        for (vector<string>::iterator scopeIter = scopePath.begin(); scopeIter != scopePath.end(); scopeIter++)
+        {
+            o << "    scopePath.push_back(\"" << *scopeIter << "\");\n";
+        }
+
+        // Register the class (its member and static functions and constructor and destructor).
+        o << "\n    ScriptUtil::registerClass(\"" << uniquename << "\", lua_members, ";
+        o << ((constructorUniqueName) ? *constructorUniqueName : "NULL") << ", ";
+        o << ((destructorUniqueName) ? *destructorUniqueName : "NULL") << ", ";
+        o << "lua_statics, scopePath);\n";
+        o << "}\n\n";
+
+        // Write out the function used to get the instance for
+        // calling member functions and variables.
+        generateInstanceGetter(o, classname, uniquename);
+
+        // Write out the binding functions.
+        iter = bindings.begin();
+        for (; iter != bindings.end(); iter++)
+        {
+            FunctionBinding::write(o, iter->second);
+        }
+
+        if (bindingNS)
+            o << "}\n";
+        o.close();
+    }
+
+    SAFE_DELETE(constructorUniqueName);
+    SAFE_DELETE(destructorUniqueName);
+}

+ 51 - 0
gameplay-luagen/src/ClassBinding.h

@@ -0,0 +1,51 @@
+#ifndef CLASSBINDING_H_
+#define CLASSBINDING_H_
+
+#include "Base.h"
+#include "FunctionBinding.h"
+
+/**
+ * Represents the script binding for a class.
+ */
+struct ClassBinding
+{
+    /**
+     * Constructor.
+     * 
+     * @param classname The name of the class.
+     * @param refId The reference ID for the class (generated by Doxygen).
+     */
+    ClassBinding(string classname = "", string refId = "");
+
+    /**
+     * Writes out the generated Lua bindings in C++ to the given directory.
+     * 
+     * @param dir The directory to write the bindings files (.h and .cpp) to.
+     * @param includes The includes for the class.
+     * @param bindingNS The namespace to generate the Lua bindings within.
+     */
+    void write(string dir, const set<string>& includes, string* bindingNS = NULL);
+
+    /** Holds all the public function bindings of the class. */
+    map<string, vector<FunctionBinding> > bindings;
+    /** Holds bindings for hidden functions of the class (protected/private). */
+    map<string, vector<FunctionBinding> > hidden;
+    /** Holds the name(s) of the derived class(es). */
+    vector<string> derived;
+    /** Holds the name of the class. */
+    string classname;
+    /** Holds the class's unique name (used only in the script bindings). */
+    string uniquename;
+    /** Holds the class's (Doxygen-generated) reference id. */
+    string refId;
+    /** Holds the needed include for the original class declaration. */
+    string include;
+    /** Holds whether the class has an inaccessible (protected/private) constructor (or has a pure-virtual method). */
+    bool inaccessibleConstructor;
+    /** Holds whether the class has an inaccessible (protected/private) destructor. */
+    bool inaccessibleDestructor;
+    /** Holds the class' namespace (if it has one). */
+    string ns;
+};
+
+#endif

+ 302 - 0
gameplay-luagen/src/DebugNew.cpp

@@ -0,0 +1,302 @@
+#include <new>
+#include <exception>
+#include <cstdio>
+#include <cstdarg>
+
+#ifdef WIN32
+#include <windows.h>
+#include <dbghelp.h>
+#pragma comment(lib,"dbghelp.lib")
+
+#define MAX_STACK_FRAMES 16
+bool __trackStackTrace = false;
+#endif
+
+struct MemoryAllocationRecord
+{
+    unsigned long address;          // address returned to the caller after allocation
+    unsigned int size;              // size of the allocation request
+    const char* file;               // source file of allocation request
+    int line;                       // source line of the allocation request
+    MemoryAllocationRecord* next;
+    MemoryAllocationRecord* prev;
+#ifdef WIN32
+    bool trackStackTrace;
+    unsigned int pc[MAX_STACK_FRAMES];
+#endif
+};
+
+MemoryAllocationRecord* __memoryAllocations = 0;
+int __memoryAllocationCount = 0;
+
+void* debugAlloc(std::size_t size, const char* file, int line);
+void debugFree(void* p);
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+void* operator new (std::size_t size, const char* file, int line)
+{
+    return debugAlloc(size, file, line);
+}
+
+void* operator new[] (std::size_t size, const char* file, int line)
+{
+    return operator new (size, file, line);
+}
+
+void* operator new (std::size_t size) throw(std::bad_alloc)
+{
+    return operator new (size, "", 0);
+}
+
+void* operator new[] (std::size_t size) throw(std::bad_alloc)
+{
+    return operator new (size, "", 0);
+}
+
+void* operator new (std::size_t size, const std::nothrow_t&) throw()
+{
+    return operator new (size, "", 0);
+}
+
+void* operator new[] (std::size_t size, const std::nothrow_t&) throw()
+{
+    return operator new (size, "", 0);
+}
+
+void operator delete (void* p) throw()
+{
+    debugFree(p);
+}
+
+void operator delete[] (void* p) throw()
+{
+    operator delete (p);
+}
+
+void operator delete (void* p, const char* file, int line) throw()
+{
+    operator delete (p);
+}
+
+void operator delete[] (void* p, const char* file, int line) throw()
+{
+    operator delete (p);
+}
+
+#ifdef _MSC_VER
+#pragma warning( default : 4290 )
+#endif
+
+// Include Base.h (needed for logging macros) AFTER new operator impls
+#include "Base.h"
+
+void* debugAlloc(std::size_t size, const char* file, int line)
+{
+    // Allocate memory + size for a MemoryAlloctionRecord
+    unsigned char* mem = (unsigned char*)malloc(size + sizeof(MemoryAllocationRecord));
+
+    MemoryAllocationRecord* rec = (MemoryAllocationRecord*)mem;
+
+    // Move memory pointer past record
+    mem += sizeof(MemoryAllocationRecord);
+
+    rec->address = (unsigned long)mem;
+    rec->size = size;
+    rec->file = file;
+    rec->line = line;
+    rec->next = __memoryAllocations;
+    rec->prev = 0;
+
+    // Capture the stack frame (up to MAX_STACK_FRAMES) if we 
+    // are running on Windows and the user has enabled it.
+#if defined(WIN32)
+    rec->trackStackTrace = __trackStackTrace;
+    if (rec->trackStackTrace)
+    {
+        static bool initialized = false;
+        if (!initialized)
+        {
+            if (!SymInitialize(GetCurrentProcess(), NULL, true))
+                printError("Stack trace tracking will not work.\n");
+            initialized = true;
+        }
+    
+        // Get the current context (state of EBP, EIP, ESP registers).
+        static CONTEXT context;
+        RtlCaptureContext(&context);
+    
+        static STACKFRAME64 stackFrame;
+        memset(&stackFrame, 0, sizeof(STACKFRAME64));
+
+        // Initialize the stack frame based on the machine architecture.
+#ifdef _M_IX86
+        static const DWORD machineType = IMAGE_FILE_MACHINE_I386;
+        stackFrame.AddrPC.Offset = context.Eip;
+        stackFrame.AddrPC.Mode = AddrModeFlat;
+        stackFrame.AddrFrame.Offset = context.Ebp;
+        stackFrame.AddrFrame.Mode = AddrModeFlat;
+        stackFrame.AddrStack.Offset = context.Esp;
+        stackFrame.AddrStack.Mode = AddrModeFlat;
+#else
+#error "Machine architecture not supported!"
+#endif
+
+        // Walk up the stack and store the program counters.
+        memset(rec->pc, 0, sizeof(rec->pc));
+        for (int i = 0; i < MAX_STACK_FRAMES; i++)
+        {
+            rec->pc[i] = stackFrame.AddrPC.Offset;
+            if (!StackWalk64(machineType, GetCurrentProcess(), GetCurrentThread(), &stackFrame,
+                &context, NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL))
+            {
+                break;
+            }
+        }
+    }
+#endif
+
+    if (__memoryAllocations)
+        __memoryAllocations->prev = rec;
+    __memoryAllocations = rec;
+    ++__memoryAllocationCount;
+
+    return mem;
+}
+
+void debugFree(void* p)
+{
+    if (p == 0)
+        return;
+
+    // Backup passed in pointer to access memory allocation record
+    void* mem = ((unsigned char*)p) - sizeof(MemoryAllocationRecord);
+
+    MemoryAllocationRecord* rec = (MemoryAllocationRecord*)mem;
+
+    // Sanity check: ensure that address in record matches passed in address
+    if (rec->address != (unsigned long)p)
+    {
+        printError("[memory] CORRUPTION: Attempting to free memory address with invalid memory allocation record.\n");
+        return;
+    }
+
+    // Link this item out
+    if (__memoryAllocations == rec)
+        __memoryAllocations = rec->next;
+    if (rec->prev)
+        rec->prev->next = rec->next;
+    if (rec->next)
+        rec->next->prev = rec->prev;
+    --__memoryAllocationCount;
+
+    // Free the address from the original alloc location (before mem allocation record)
+    free(mem);
+}
+
+#ifdef WIN32
+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))
+        {
+            printError("[memory] STACK TRACE: <unknown location>\n");
+        }
+        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))
+                    {
+                        printError("[memory] STACK TRACE: %s - <unknown file>:<unknown line number>\n", symbol->Name);
+                    }
+                    else
+                    {
+                        const char* file = strrchr(line.FileName, '\\');
+                        if(!file) 
+                            file = line.FileName;
+                        else
+                            file++;
+                        
+                        printError("[memory] STACK TRACE: %s - %s:%d\n", symbol->Name, file, line.LineNumber);
+                    }
+                }
+            }
+        }
+    }
+}
+#endif
+
+extern void printMemoryLeaks()
+{
+    // Dump general heap memory leaks
+    if (__memoryAllocationCount == 0)
+    {
+        printError("[memory] All HEAP allocations successfully cleaned up (no leaks detected).\n");
+    }
+    else
+    {
+        printError("[memory] WARNING: %d HEAP allocations still active in memory.\n", __memoryAllocationCount);
+        MemoryAllocationRecord* rec = __memoryAllocations;
+        while (rec)
+        {
+#ifdef WIN32
+            if (rec->trackStackTrace)
+            {
+                printError("[memory] LEAK: HEAP allocation leak at address %#x of size %d:\n", rec->address, rec->size);
+                printStackTrace(rec);
+            }
+            else
+                printError("[memory] LEAK: HEAP allocation leak at address %#x of size %d from line %d in file '%s'.\n", rec->address, rec->size, rec->line, rec->file);
+#else
+                printError("[memory] LEAK: HEAP allocation leak at address %#x of size %d from line %d in file '%s'.\n", rec->address, rec->size, rec->line, rec->file);
+#endif
+            rec = rec->next;
+        }
+    }
+}
+
+#if defined(WIN32)
+void setTrackStackTrace(bool trackStackTrace)
+{
+    __trackStackTrace = trackStackTrace;
+}
+
+void toggleTrackStackTrace()
+{
+    __trackStackTrace = !__trackStackTrace;
+}
+#endif

+ 50 - 0
gameplay-luagen/src/DebugNew.h

@@ -0,0 +1,50 @@
+#ifndef DEBUGNEW_H_
+#define DEBUGNEW_H_
+
+#include <new>
+#include <exception>
+
+#define TRACK_MEMORY() \
+    static struct MemoryTrackerClass { ~MemoryTrackerClass() { printMemoryLeaks(); system("pause"); } } m
+
+// Prints all heap and reference leaks to stderr.
+extern void printMemoryLeaks();
+
+// global new/delete operator overloads
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 ) // C++ exception specification ignored.
+#endif
+void* operator new (std::size_t size, const char* file, int line);
+void* operator new[] (std::size_t size, const char* file, int line);
+void* operator new (std::size_t size) throw(std::bad_alloc);
+void* operator new[] (std::size_t size) throw(std::bad_alloc);
+void* operator new (std::size_t size, const std::nothrow_t&) throw();
+void* operator new[] (std::size_t size, const std::nothrow_t&) throw();
+void operator delete (void* p) throw();
+void operator delete[] (void* p) throw();
+void operator delete (void* p, const char* file, int line) throw();
+void operator delete[] (void* p, const char* file, int line) throw();
+#ifdef _MSC_VER
+#pragma warning( default : 4290 )
+#endif
+
+// Re-define new to use versions with file and line number
+#define DEBUG_NEW new (__FILE__, __LINE__)
+#define new DEBUG_NEW
+
+#endif
+
+#if defined(WIN32)
+
+/**
+ * Sets whether stack traces are tracked on memory allocations or not.
+ * 
+ * @param trackStackTrace Whether to track the stack trace on memory allocations.
+ */
+void setTrackStackTrace(bool trackStackTrace);
+
+/**
+ * Toggles stack trace tracking on memory allocations.
+ */
+void toggleTrackStackTrace();
+#endif

+ 16 - 0
gameplay-luagen/src/EnumBinding.h

@@ -0,0 +1,16 @@
+#ifndef ENUMBINDING_H
+#define ENUMBINDING_H
+
+#include "Base.h"
+
+/**
+ * Represents a script binding for an enumeration.
+ */
+struct EnumBinding
+{
+    vector<string> values;
+    vector<string> scopePath;
+    string include;
+};
+
+#endif

+ 988 - 0
gameplay-luagen/src/FunctionBinding.cpp

@@ -0,0 +1,988 @@
+#include "FunctionBinding.h"
+#include "Generator.h"
+
+
+// Helper functions.
+static inline void outputLuaTypeCheckInstance(ostream& o);
+static inline void outputLuaTypeCheck(ostream& o, int index, const FunctionBinding::Param& p = 
+    FunctionBinding::Param(FunctionBinding::Param::TYPE_OBJECT, FunctionBinding::Param::KIND_POINTER));
+static inline void indent(ostream& o, int indentLevel);
+static inline void outputBindingInvocation(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel);
+static inline void outputGetParam(ostream& o, const FunctionBinding::Param& p, int i, int indentLevel, bool offsetIndex = false);
+static inline void outputMatchedBinding(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel);
+static inline void outputReturnValue(ostream& o, const FunctionBinding& b, int indentLevel);
+
+
+FunctionBinding::Param::Param(FunctionBinding::Param::Type type, Kind kind, const string& info) : 
+    type(type), kind(kind), info(info), hasDefaultValue(false)
+{
+}
+
+bool FunctionBinding::Param::operator==(const Param& p) const
+{
+    return this->type == p.type && this->kind == p.kind && this->info == p.info;
+}
+
+bool FunctionBinding::Param::operator!=(const Param& p) const
+{
+    return !(*this == p);
+}
+
+FunctionBinding::FunctionBinding(string classname, string uniquename) : classname(classname), uniquename(uniquename), name(""), own(false)
+{
+}
+
+string FunctionBinding::getFunctionName() const
+{
+    if (functionName.length() == 0)
+    {
+        functionName = "lua_";
+        functionName += uniquename;
+    
+        if (type == STATIC_FUNCTION ||
+            type == STATIC_CONSTANT ||
+            type == STATIC_VARIABLE)
+            functionName += "_static";
+        functionName += "_";
+
+        if (returnParam.type == Param::TYPE_CONSTRUCTOR)
+            functionName += "_init";
+        else if (returnParam.type == Param::TYPE_DESTRUCTOR)
+            functionName += "_gc";
+        else
+        {
+            size_t i = name.rfind("::");
+            if (i != name.npos)
+                functionName += name.substr(i + 2);
+            else
+                functionName += name;
+        }
+    }
+
+    return functionName;
+}
+
+unsigned int FunctionBinding::getMinParamCount() const
+{
+    for (unsigned int i = 0; i < paramTypes.size(); i++)
+    {
+        if (paramTypes[i].hasDefaultValue)
+            return i;
+    }
+    return paramTypes.size();
+}
+
+void FunctionBinding::write(ostream& o, const vector<FunctionBinding>& bindings)
+{
+    GP_ASSERT(bindings.size() > 0);
+
+    // Print the function signature.
+    o << "int " << bindings[0].getFunctionName() << "(lua_State* state)\n";
+    o << "{\n";
+
+    if (bindings.size() == 1 && bindings[0].type == FunctionBinding::MEMBER_VARIABLE)
+    {
+        // Validate the parameter count.
+        o << "    // Validate the number of parameters.\n";
+        o << "    if (lua_gettop(state) > 2)\n";
+        o << "    {\n";
+        o << "        lua_pushstring(state, \"Invalid number of parameters (expected 1 or 2).\");\n";
+        o << "        lua_error(state);\n";
+        o << "    }\n\n";
+        
+        // Get or set the member variable depending on the number of parameters.
+        o << "    " << bindings[0].classname << "* instance = getInstance(state);\n";
+        o << "    if (lua_gettop(state) == 2)\n";
+        o << "    {\n";
+        outputGetParam(o, bindings[0].returnParam, 1, 2);
+
+        if (bindings[0].returnParam.kind == FunctionBinding::Param::KIND_POINTER &&
+            bindings[0].returnParam.type != FunctionBinding::Param::TYPE_OBJECT &&
+            bindings[0].returnParam.info.size() > 0)
+        {
+            o << "        memcpy(instance->" << bindings[0].name << ", param2, sizeof(";
+            o << FunctionBinding::Param(bindings[0].returnParam.type) << ") * " << bindings[0].returnParam.info << ");\n";
+        }
+        else
+        {
+            o << "        instance->" << bindings[0].name << " = ";
+            if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT &&
+                bindings[0].returnParam.kind != FunctionBinding::Param::KIND_POINTER)
+            {
+                o << "*";
+            }
+            o << "param2;\n";
+        }
+
+        o << "        return 0;\n";
+        o << "    }\n";
+        o << "    else\n";
+        o << "    {\n";
+        
+        // Pass the return value back to Lua.
+        if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            switch (bindings[0].returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "        void* returnPtr = (void*)instance->" << bindings[0].name << ";\n";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "        void* returnPtr = (void*)new " << bindings[0].returnParam << "(instance->" << bindings[0].name << ");\n";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "        void* returnPtr = (void*)&(instance->" << bindings[0].name << ");\n";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", bindings[0].returnParam.kind);
+                break;
+            }
+        }
+        else
+        {
+            o << "        " << bindings[0].returnParam << " result = instance->" << bindings[0].name << ";\n";
+        }
+        outputReturnValue(o, bindings[0], 2);
+        o << "    }\n";
+        o << "}\n\n";
+    }
+    else if (bindings.size() == 1 && 
+        (bindings[0].type == FunctionBinding::STATIC_VARIABLE ||
+        bindings[0].type == FunctionBinding::GLOBAL_VARIABLE))
+    {
+        // Validate the parameter count.
+        o << "    // Validate the number of parameters.\n";
+        o << "    if (lua_gettop(state) > 1)\n";
+        o << "    {\n";
+        o << "        lua_pushstring(state, \"Invalid number of parameters (expected 0 or 1).\");\n";
+        o << "        lua_error(state);\n";
+        o << "    }\n\n";
+        
+        // Get or set the static variable depending on the number of parameters.
+        o << "    if (lua_gettop(state) == 1)\n";
+        o << "    {\n";
+        outputGetParam(o, bindings[0].returnParam, 0, 2);
+
+        if (bindings[0].returnParam.kind == FunctionBinding::Param::KIND_POINTER &&
+            bindings[0].returnParam.type != FunctionBinding::Param::TYPE_OBJECT &&
+            bindings[0].returnParam.info.size() > 0)
+        {
+            o << "        memcpy(";
+            if (bindings[0].classname.size() > 0)
+                o << bindings[0].classname << "::";
+            o << bindings[0].name << ", param1, sizeof(";
+            o << FunctionBinding::Param(bindings[0].returnParam.type) << ") * " << bindings[0].returnParam.info << ");\n";
+        }
+        else
+        {
+            o << "        ";
+            if (bindings[0].classname.size() > 0)
+                o << bindings[0].classname << "::";
+            o << bindings[0].name << " = ";
+            if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT &&
+                bindings[0].returnParam.kind != FunctionBinding::Param::KIND_POINTER)
+            {
+                o << "*";
+            }
+            o << "param1;\n";
+        }
+        o << "        return 0;\n";
+        o << "    }\n";
+        o << "    else\n";
+        o << "    {\n";
+        
+        // Pass the return value back to Lua.
+        if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            switch (bindings[0].returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "        void* returnPtr = (void*)";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ";\n";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "        void* returnPtr = (void*)new " << bindings[0].returnParam << "(";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ");\n";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "        void* returnPtr = (void*)&(";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ");\n";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", bindings[0].returnParam.kind);
+                break;
+            }
+        }
+        else
+        {
+            o << "        " << bindings[0].returnParam << " result = ";
+            if (bindings[0].classname.size() > 0)
+                o << bindings[0].classname << "::";
+            o << bindings[0].name << ";\n";
+        }
+        outputReturnValue(o, bindings[0], 2);
+        o << "    }\n";
+        o << "}\n\n";
+    }
+    else if (bindings.size() == 1 && bindings[0].type == FunctionBinding::MEMBER_CONSTANT)
+    {
+        // Validate the parameter count.
+        o << "    // Validate the number of parameters.\n";
+        o << "    if (lua_gettop(state) > 1)\n";
+        o << "    {\n";
+        o << "        lua_pushstring(state, \"Invalid number of parameters (expected 1).\");\n";
+        o << "        lua_error(state);\n";
+        o << "    }\n\n";
+        
+        // Pass the return value back to Lua.
+        o << "    " << bindings[0].classname << "* instance = getInstance(state);\n";
+        if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            switch (bindings[0].returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "    void* returnPtr = (void*)instance->" << bindings[0].name << ";\n";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "    void* returnPtr = (void*)new " << bindings[0].returnParam << "(instance->" << bindings[0].name << ");\n";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "    void* returnPtr = (void*)&(instance->" << bindings[0].name << ");\n";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", bindings[0].returnParam.kind);
+                break;
+            }
+        }
+        else
+        {
+            o << "    " << bindings[0].returnParam << " result = instance->" << bindings[0].name << ";\n";
+        }
+        outputReturnValue(o, bindings[0], 1);
+        o << "}\n\n";
+    }
+    else if (bindings.size() == 1 && 
+        (bindings[0].type == FunctionBinding::STATIC_CONSTANT ||
+        bindings[0].type == FunctionBinding::GLOBAL_CONSTANT))
+    {
+        // Validate the parameter count.
+        o << "    // Validate the number of parameters.\n";
+        o << "    if (lua_gettop(state) > 0)\n";
+        o << "    {\n";
+        o << "        lua_pushstring(state, \"Invalid number of parameters (expected 0).\");\n";
+        o << "        lua_error(state);\n";
+        o << "    }\n\n";
+        
+        // Pass the return value back to Lua.
+        if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            switch (bindings[0].returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "    void* returnPtr = (void*)";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ";\n";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "    void* returnPtr = (void*)new " << bindings[0].returnParam << "(";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ");\n";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "    void* returnPtr = (void*)&(";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ");\n";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", bindings[0].returnParam.kind);
+                break;
+            }
+        }
+        else
+        {
+            o << "    " << bindings[0].returnParam << " result = ";
+            if (bindings[0].classname.size() > 0)
+                o << bindings[0].classname << "::";
+            o << bindings[0].name << ";\n";
+        }
+        outputReturnValue(o, bindings[0], 1);
+        o << "}\n\n";
+    }
+    else
+    {
+        // Get all valid parameter counts.
+        unsigned int paramCountOffset;
+        map<unsigned int, vector<const FunctionBinding*> > paramCounts;
+        for (unsigned int i = 0, count = bindings.size(); i < count; i++)
+        {
+            unsigned int minParamCount = bindings[i].getMinParamCount();
+            paramCountOffset = (bindings[i].type == FunctionBinding::MEMBER_FUNCTION && bindings[i].returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR) ? 1 : 0;
+            paramCounts[minParamCount + paramCountOffset].push_back(&bindings[i]);
+
+            if (minParamCount < bindings[i].paramTypes.size())
+            {
+                for (unsigned int c = minParamCount + 1; c <= bindings[i].paramTypes.size(); c++)
+                {
+                    paramCounts[c + paramCountOffset].push_back(&bindings[i]);
+                }
+            }
+        }
+        
+        // Get the parameter count.
+        o << "    // Get the number of parameters.\n";
+        o << "    int paramCount = lua_gettop(state);\n\n";
+        
+        // Retrieve all the parameters and attempt to match them to a valid binding,
+        // notifying the user if the number of parameters is invalid.
+        o << "    // Attempt to match the parameters to a valid binding.\n";
+        o << "    switch (paramCount)\n";
+        o << "    {\n";
+        map<unsigned int, vector<const FunctionBinding*> >::iterator iter;
+        unsigned int checkCount = 0;
+        for (iter = paramCounts.begin(); iter != paramCounts.end(); iter++)
+        {
+            o << "        case " << iter->first << ":\n";
+            o << "        {\n";
+
+            for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+            {
+                // Only indent if there are parameters.
+                if (iter->first > 0)
+                    indent(o, 3);
+
+                if (i > 0)
+                {                    
+                    o << "else ";
+                }
+                outputMatchedBinding(o, *(iter->second[i]), iter->first, 3);
+            }
+
+            // Only print an else clause with error report if there are parameters.
+            if (iter->first > 0)
+            {
+                indent(o, 3);
+                o << "else\n";
+                indent(o, 3);
+                o << "{\n";
+                indent(o, 4);
+                o << "lua_pushstring(state, \"" << bindings[0].getFunctionName();
+                o << " - Failed to match the given parameters to a valid function signature.\");\n";
+                indent(o, 4);
+                o << "lua_error(state);\n";
+                indent(o, 3);
+                o << "}\n";
+            }
+            
+            o << "            break;\n";
+            o << "        }\n";
+        }
+        
+        o << "        default:\n";
+        o << "        {\n";
+        o << "            lua_pushstring(state, \"Invalid number of parameters (expected "; 
+        for (iter = paramCounts.begin(), checkCount = 1; iter != paramCounts.end(); iter++)
+        {
+            if (checkCount == paramCounts.size() && paramCounts.size() > 1)
+                o << " or ";
+            o << iter->first;
+            checkCount++;
+
+            if (checkCount < paramCounts.size())
+                o << ", ";
+        }
+        o << ").\");\n";
+        o << "            lua_error(state);\n";
+        o << "            break;\n";
+        o << "        }\n";
+        o << "    }\n";
+        o << "    return 0;\n";
+        o << "}\n\n";
+    }
+}
+
+bool FunctionBinding::signaturesMatch(const FunctionBinding& b1, const FunctionBinding& b2)
+{
+    if (b1.type == b2.type)
+    {
+        bool namesMatch = b1.name == b2.name;
+
+        // Ignore class qualifiers on member function bindings (to support inherited overloaded bindings).
+        if (b1.type == FunctionBinding::MEMBER_CONSTANT ||
+            b1.type == FunctionBinding::MEMBER_FUNCTION ||
+            b1.type == FunctionBinding::MEMBER_VARIABLE)
+        {
+            string b1name = b1.name;
+            string b2name = b2.name;
+            size_t i = b1name.rfind("::");
+            if (i != b1name.npos)
+                b1name = b1name.substr(i + 2);
+            i = b2name.rfind("::");
+            if (i != b2name.npos)
+                b2name = b2name.substr(i + 2);
+    
+            namesMatch = b1name == b2name;
+        }
+
+        // Check the binding's name, parameter types and return value type.
+        if (namesMatch)
+        {
+            if (b1.paramTypes.size() != b2.paramTypes.size())
+                return false;
+
+            for (unsigned int i = 0, count = b1.paramTypes.size(); i < count; i++)
+            {
+                if (b1.paramTypes[i] != b2.paramTypes[i])
+                    return false;
+            }
+
+            return true;
+        }
+    }
+    return false;
+}
+
+ostream& operator<<(ostream& o, const FunctionBinding::Param& param)
+{
+    switch (param.type)
+    {
+    case FunctionBinding::Param::TYPE_VOID:
+        o << "void";
+        break;
+    case FunctionBinding::Param::TYPE_BOOL:
+        o << "bool";
+        break;
+    case FunctionBinding::Param::TYPE_CHAR:
+        o << "char";
+        break;
+    case FunctionBinding::Param::TYPE_SHORT:
+        o << "short";
+        break;
+    case FunctionBinding::Param::TYPE_INT:
+        o << "int";
+        break;
+    case FunctionBinding::Param::TYPE_LONG:
+        o << "long";
+        break;
+    case FunctionBinding::Param::TYPE_UCHAR:
+        o << "unsigned char";
+        break;
+    case FunctionBinding::Param::TYPE_USHORT:
+        o << "unsigned short";
+        break;
+    case FunctionBinding::Param::TYPE_UINT:
+        o << "unsigned int";
+        break;
+    case FunctionBinding::Param::TYPE_ULONG:
+        o << "unsigned long";
+        break;
+    case FunctionBinding::Param::TYPE_FLOAT:
+        o << "float";
+        break;
+    case FunctionBinding::Param::TYPE_DOUBLE:
+        o << "double";
+        break;
+    case FunctionBinding::Param::TYPE_ENUM:
+        o << Generator::getInstance()->getIdentifier(param.info);
+        break;
+    case FunctionBinding::Param::TYPE_STRING:
+        if (param.info == "string")
+            o << "std::string";
+        else
+            o << "const char";
+        break;
+    case FunctionBinding::Param::TYPE_OBJECT:
+    case FunctionBinding::Param::TYPE_CONSTRUCTOR:
+        o << Generator::getInstance()->getIdentifier(param.info);
+        break;
+    case FunctionBinding::Param::TYPE_UNRECOGNIZED:
+        o << param.info;
+        break;
+    case FunctionBinding::Param::TYPE_DESTRUCTOR:
+    default:
+        break;
+    }
+
+    if (param.kind == FunctionBinding::Param::KIND_POINTER)
+        o << "*";
+
+    return o;
+}
+
+// ---------------------------------------------
+// Helper functions
+
+static inline void outputLuaTypeCheckInstance(ostream& o)
+{
+    o << "(lua_type(state, 1) == LUA_TUSERDATA)";
+}
+
+static inline void outputLuaTypeCheck(ostream& o, int index, const FunctionBinding::Param& p)
+{
+    switch (p.type)
+    {
+    case FunctionBinding::Param::TYPE_BOOL:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER) 
+        {
+            o << "(lua_type(state, " << index << ") == LUA_TTABLE || ";
+            o << "lua_type(state, " << index << ") == LUA_TLIGHTUSERDATA)";
+        }
+        else
+        {
+            o << "lua_type(state, " << index << ") == LUA_TBOOLEAN";
+        }
+        break;
+    case FunctionBinding::Param::TYPE_CHAR:
+    case FunctionBinding::Param::TYPE_SHORT:
+    case FunctionBinding::Param::TYPE_INT:
+    case FunctionBinding::Param::TYPE_LONG:
+    case FunctionBinding::Param::TYPE_UCHAR:
+    case FunctionBinding::Param::TYPE_USHORT:
+    case FunctionBinding::Param::TYPE_UINT:
+    case FunctionBinding::Param::TYPE_ULONG:
+    case FunctionBinding::Param::TYPE_FLOAT:
+    case FunctionBinding::Param::TYPE_DOUBLE:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER) 
+        {
+            o << "(lua_type(state, " << index << ") == LUA_TTABLE || ";
+            o << "lua_type(state, " << index << ") == LUA_TLIGHTUSERDATA)";
+        }
+        else
+        {
+            o << "lua_type(state, " << index << ") == LUA_TNUMBER";
+        }
+        break;
+    case FunctionBinding::Param::TYPE_STRING:
+    case FunctionBinding::Param::TYPE_ENUM:
+        o << "(lua_type(state, " << index << ") == LUA_TSTRING || ";
+        o << "lua_type(state, " << index << ") == LUA_TNIL)";
+        break;
+    case FunctionBinding::Param::TYPE_OBJECT:
+        o << "(lua_type(state, " << index << ") == LUA_TUSERDATA || ";
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "lua_type(state, " << index << ") == LUA_TTABLE || ";
+        o << "lua_type(state, " << index << ") == LUA_TNIL)";
+        break;
+    case FunctionBinding::Param::TYPE_CONSTRUCTOR:
+    case FunctionBinding::Param::TYPE_DESTRUCTOR:
+    case FunctionBinding::Param::TYPE_VOID:
+    case FunctionBinding::Param::TYPE_VARARGS:
+    default:
+        o << "lua_type(state, " << index << ") == LUA_TNONE";
+    }
+}
+
+static inline void indent(ostream& o, int indentLevel)
+{
+    for (int k = 0; k < indentLevel; k++)
+        o << "    ";
+}
+
+static inline void outputBindingInvocation(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel)
+{
+    bool isNormalMember = (b.type == FunctionBinding::MEMBER_FUNCTION && b.returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR);
+
+    // Get the passed in parameters.
+    for (unsigned int i = 0, count = paramCount - (isNormalMember ? 1 : 0); i < count; i++)
+    {
+        outputGetParam(o, b.paramTypes[i], i, indentLevel, isNormalMember);
+    }
+
+    // Get the instance for member functions.
+    if ((b.type == FunctionBinding::MEMBER_FUNCTION) &&
+        b.returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR &&
+        b.returnParam.type != FunctionBinding::Param::TYPE_DESTRUCTOR)
+    {
+        indent(o, indentLevel);
+        o << b.classname << "* instance = getInstance(state);\n";
+    }
+
+    if (b.returnParam.type == FunctionBinding::Param::TYPE_DESTRUCTOR)
+    {
+        indent(o, indentLevel);
+        o << "void* userdata = luaL_checkudata(state, 1, \"" << Generator::getUniqueName(b.classname) << "\");\n";
+        indent(o, indentLevel);
+        o << "luaL_argcheck(state, userdata != NULL, 1, \"\'" << Generator::getUniqueName(b.classname) << "\' expected.\");\n";
+        indent(o, indentLevel);
+        o << LUA_OBJECT << "* object = (" << LUA_OBJECT << "*)userdata;\n";
+        indent(o, indentLevel);
+        o << "if (object->owns)\n";
+        indent(o, indentLevel);
+        o << "{\n";
+        indent(o, indentLevel + 1);
+        o << b.classname << "* instance = (" << b.classname << "*)object->instance;\n";
+        if (Generator::getInstance()->isRef(b.classname))
+        {
+            indent(o, indentLevel + 1);
+            o << "SAFE_RELEASE(instance);\n";
+        }
+        else
+        {
+            indent(o, indentLevel + 1);
+            o << "SAFE_DELETE(instance);\n";
+        }
+        indent(o, indentLevel);
+        o << "}\n";
+    }
+    else
+    {
+        // Create a variable to hold the return type (if appropriate).
+        if (!(b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR || 
+            b.returnParam.type == FunctionBinding::Param::TYPE_VOID || 
+            b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT))
+        {
+            indent(o, indentLevel);
+            o << b.returnParam << " result = ";
+        }
+
+        // For functions that return objects, create the appropriate user data in Lua.
+        if (b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR || b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            indent(o, indentLevel);
+            switch (b.returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "void* returnPtr = (void*)";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "void* returnPtr = (void*)new " << b.returnParam << "(";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "void* returnPtr = (void*)&(";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", b.returnParam.kind);
+                break;
+            }
+        }
+
+        if (b.type == FunctionBinding::STATIC_FUNCTION)
+        {
+            if (b.returnParam.type == FunctionBinding::Param::TYPE_VOID)
+                indent(o, indentLevel);
+            o << b.classname << "::" << b.name << "(";
+        }
+        else if (b.type == FunctionBinding::GLOBAL_FUNCTION)
+        {
+            if (b.returnParam.type == FunctionBinding::Param::TYPE_VOID)
+                indent(o, indentLevel);
+            o << b.name << "(";
+        }
+        else if (b.type == FunctionBinding::MEMBER_FUNCTION)
+        {
+            if (b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+            {
+                o << "new " << Generator::getInstance()->getIdentifier(b.returnParam.info) << "(";
+            }
+            else
+            {
+                if (b.returnParam.type == FunctionBinding::Param::TYPE_VOID)
+                    indent(o, indentLevel);
+                o << "instance->" << b.name << "(";
+            }
+        }
+
+        // Pass the arguments.
+        for (unsigned int i = 0, count = paramCount - ((isNormalMember) ? 1 : 0); i < count; i++)
+        {
+            if (b.paramTypes[i].type == FunctionBinding::Param::TYPE_OBJECT && b.paramTypes[i].kind != FunctionBinding::Param::KIND_POINTER)
+                o << "*";
+            o << "param" << i + 1;
+
+            if (i != count - 1)
+                o << ", ";
+        }
+
+        // Output the matching parenthesis for the case where a non-pointer object is being returned.
+        if (b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT && b.returnParam.kind != FunctionBinding::Param::KIND_POINTER)
+            o << ")";
+
+        o << ");\n";
+    }
+
+    outputReturnValue(o, b, indentLevel);
+}
+
+static inline void outputGetParam(ostream& o, const FunctionBinding::Param& p, int i, int indentLevel, bool offsetIndex)
+{
+    indent(o, indentLevel);
+    o << "// Get parameter " << i + 1 << " off the stack.\n";
+
+    switch (p.type)
+    {
+    case FunctionBinding::Param::TYPE_UNRECOGNIZED:
+        indent(o, indentLevel);
+        o << "GP_WARN(\"Attempting to get parameter " << i + 1 << " with unrecognized type " << p.info << " as an unsigned integer.\");\n";
+    case FunctionBinding::Param::TYPE_BOOL:
+    case FunctionBinding::Param::TYPE_CHAR:
+    case FunctionBinding::Param::TYPE_SHORT:
+    case FunctionBinding::Param::TYPE_INT:
+    case FunctionBinding::Param::TYPE_LONG:
+    case FunctionBinding::Param::TYPE_UCHAR:
+    case FunctionBinding::Param::TYPE_USHORT:
+    case FunctionBinding::Param::TYPE_UINT:
+    case FunctionBinding::Param::TYPE_ULONG:
+    case FunctionBinding::Param::TYPE_FLOAT:
+    case FunctionBinding::Param::TYPE_DOUBLE:
+    case FunctionBinding::Param::TYPE_STRING:
+    case FunctionBinding::Param::TYPE_ENUM:
+        indent(o, indentLevel);
+        o << p << " param" << i + 1 << " = ";
+        break;
+    default:
+        // Ignore these cases.
+        break;
+    }
+
+    int paramIndex = (offsetIndex) ? i + 2 : i + 1;
+    switch (p.type)
+    {
+    case FunctionBinding::Param::TYPE_BOOL:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getBoolPointer(" << paramIndex << ");\n";
+        else
+            o << "ScriptUtil::luaCheckBool(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_CHAR:
+        o << "(char)luaL_checkint(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_SHORT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getShortPointer(" << paramIndex << ");\n";
+        else
+            o << "(short)luaL_checkint(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_INT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getIntPointer(" << paramIndex << ");\n";
+        else
+            o << "(int)luaL_checkint(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_LONG:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getLongPointer(" << paramIndex << ");\n";
+        else
+            o << "(long)luaL_checklong(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_UCHAR:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getUnsignedCharPointer(" << paramIndex << ");\n";
+        else
+            o << "(unsigned char)luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_USHORT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getUnsignedShortPointer(" << paramIndex << ");\n";
+        else
+            o << "(unsigned short)luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_UINT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getUnsignedIntPointer(" << paramIndex << ");\n";
+        else
+            o << "(unsigned int)luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_ULONG:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getUnsignedLongPointer(" << paramIndex << ");\n";
+        else
+            o << "(unsigned long)luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_FLOAT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getFloatPointer(" << paramIndex << ");\n";
+        else
+            o << "(float)luaL_checknumber(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_DOUBLE:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptUtil::getDoublePointer(" << paramIndex << ");\n";
+        else
+            o << "(double)luaL_checknumber(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_STRING:
+        o << "ScriptUtil::getString(" << paramIndex << ", " << ((p.info == "string") ? "true" : "false") << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_ENUM:
+        o << "(" << p << ")lua_enumFromString_" << Generator::getInstance()->getUniqueNameFromRef(p.info) << "(luaL_checkstring(state, " << paramIndex << "));\n";
+        break;
+    case FunctionBinding::Param::TYPE_UNRECOGNIZED:
+        // Attempt to retrieve the unrecognized type as an unsigned integer.
+        o << "(" << p.info << ")luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_OBJECT:
+        indent(o, indentLevel);
+        o << p;
+        if (p.kind != FunctionBinding::Param::KIND_POINTER)
+            o << "*";
+        o << " param" << i + 1 << " = ";
+        o << "ScriptUtil::getObjectPointer<";
+        o << Generator::getInstance()->getIdentifier(p.info) << ">(" << paramIndex;
+        o << ", \"" << Generator::getInstance()->getUniqueNameFromRef(p.info) << "\", ";
+        o << ((p.kind != FunctionBinding::Param::KIND_POINTER) ? "true" : "false") << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_CONSTRUCTOR:
+    case FunctionBinding::Param::TYPE_DESTRUCTOR:
+    case FunctionBinding::Param::TYPE_VOID:
+    default:
+        // Ignore these cases.
+        break;
+    }
+
+    o << "\n";
+}
+
+static inline void outputMatchedBinding(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel)
+{
+    bool isNormalMember = (b.type == FunctionBinding::MEMBER_FUNCTION && b.returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR);
+
+    // If the current invocation of the function takes zero parameters, then invoke the binding.
+    if (paramCount == 0)
+    {
+        outputBindingInvocation(o, b, paramCount, indentLevel);
+    }
+    else
+    {
+        // NOTE: The way this currently works may cause some issues since Lua
+        // has a smaller set of types than C++. There may be cases where functions
+        // that take types with less precision (i.e. int vs. float) are called
+        // when the user in fact wanted to call the version with more precision.
+        // (this will only happen for overloaded functions).
+
+        o << "if (";
+        for (unsigned int i = 0, count = paramCount; i < count; i++)
+        {
+            if (isNormalMember && i == 0)
+                outputLuaTypeCheckInstance(o);
+            else
+                outputLuaTypeCheck(o, i + 1, b.paramTypes[(isNormalMember ? i - 1 : i)]);
+
+            if (i == count - 1)
+                o << ")\n";
+            else
+            {
+                o << " &&\n";
+                indent(o, indentLevel + 1);
+            }
+        }
+        indent(o, indentLevel);
+        o << "{\n";
+            
+        outputBindingInvocation(o, b, paramCount, indentLevel + 1);
+
+        indent(o, indentLevel);
+        o << "}\n";
+    }
+}
+
+static inline void outputReturnValue(ostream& o, const FunctionBinding& b, int indentLevel)
+{
+    // Pass the return value back to Lua.
+    if (!(b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR || 
+        b.returnParam.type == FunctionBinding::Param::TYPE_DESTRUCTOR ||
+        b.returnParam.type == FunctionBinding::Param::TYPE_VOID || 
+        b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT))
+    {
+        o << "\n";
+        indent(o, indentLevel);
+        o << "// Push the return value onto the stack.\n";
+
+        // If the return type is a basic type pointer, return it as light user data.
+        if (b.returnParam.type != FunctionBinding::Param::TYPE_ENUM &&
+            b.returnParam.type != FunctionBinding::Param::TYPE_STRING &&
+            b.returnParam.kind == FunctionBinding::Param::KIND_POINTER)
+        {
+            indent(o, indentLevel);
+            o << "lua_pushlightuserdata(state, result);\n";
+            indent(o, indentLevel);
+            o << "return 1;\n";
+            return;
+        }
+    }
+
+    indent(o, indentLevel);
+    switch (b.returnParam.type)
+    {
+    case FunctionBinding::Param::TYPE_BOOL:
+        o << "lua_pushboolean(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_CHAR:
+    case FunctionBinding::Param::TYPE_SHORT:
+    case FunctionBinding::Param::TYPE_INT:
+    case FunctionBinding::Param::TYPE_LONG:
+        o << "lua_pushinteger(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_UNRECOGNIZED:
+        o << "GP_WARN(\"Attempting to return value with unrecognized type " << b.returnParam.info << " as an unsigned integer.\");\n";
+        indent(o, indentLevel);
+    case FunctionBinding::Param::TYPE_UCHAR:
+    case FunctionBinding::Param::TYPE_USHORT:
+    case FunctionBinding::Param::TYPE_UINT:
+    case FunctionBinding::Param::TYPE_ULONG:
+        o << "lua_pushunsigned(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_FLOAT:
+    case FunctionBinding::Param::TYPE_DOUBLE:
+        o << "lua_pushnumber(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_ENUM:
+        o << "lua_pushstring(state, lua_stringFromEnum_" << Generator::getInstance()->getUniqueNameFromRef(b.returnParam.info) << "(result));\n";
+        break;
+    case FunctionBinding::Param::TYPE_STRING:
+        if (b.returnParam.info == "string")
+            o << "lua_pushstring(state, result.c_str());\n";
+        else
+            o << "lua_pushstring(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_OBJECT:
+    case FunctionBinding::Param::TYPE_CONSTRUCTOR:
+        o << "if (returnPtr)\n";
+        indent(o, indentLevel);
+        o << "{\n";
+        indent(o, indentLevel + 1);
+        o << LUA_OBJECT << "* object = (" << LUA_OBJECT << "*)lua_newuserdata(state, sizeof(" << LUA_OBJECT << "));\n";
+        indent(o, indentLevel + 1);
+        o << "object->instance = returnPtr;\n";
+        indent(o, indentLevel + 1);
+        o << "object->owns = ";
+        if (b.own || (b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT && b.returnParam.kind == FunctionBinding::Param::KIND_VALUE))
+            o << "true";
+        else
+            o << "false";
+        o << ";\n";
+        indent(o, indentLevel + 1);
+        o << "luaL_getmetatable(state, \"" << Generator::getInstance()->getUniqueNameFromRef(b.returnParam.info) << "\");\n";
+        indent(o, indentLevel + 1);
+        o << "lua_setmetatable(state, -2);\n";
+        indent(o, indentLevel);
+        o << "}\n";
+        indent(o, indentLevel);
+        o << "else\n";
+        indent(o, indentLevel);
+        o << "{\n";
+        indent(o, indentLevel + 1);
+        o << "lua_pushnil(state);\n";
+        indent(o, indentLevel);
+        o << "}\n";
+        break;
+    case FunctionBinding::Param::TYPE_DESTRUCTOR:
+    case FunctionBinding::Param::TYPE_VOID:
+    default:
+        o << "\n";
+        indent(o, indentLevel);
+        o << "return 0;\n";
+        return;
+    }
+
+    o << "\n";
+    indent(o, indentLevel);
+    o << "return 1;\n";
+}

+ 165 - 0
gameplay-luagen/src/FunctionBinding.h

@@ -0,0 +1,165 @@
+#ifndef FUNCTIONBINDING_H_
+#define FUNCTIONBINDING_H_
+
+#include "Base.h"
+
+/**
+ * Represents a binding from a function or variable to a function within the script runtime.
+ */
+struct FunctionBinding
+{
+    /**
+     * Represents the type of the binding.
+     */
+    enum Type
+    {
+        GLOBAL_FUNCTION,
+        GLOBAL_VARIABLE,
+        GLOBAL_CONSTANT,
+        STATIC_FUNCTION,
+        STATIC_VARIABLE,
+        STATIC_CONSTANT,
+        MEMBER_FUNCTION,
+        MEMBER_VARIABLE,
+        MEMBER_CONSTANT
+    };
+
+    /**
+     * Represents either a parameter or a return value.
+     */
+    struct Param
+    {
+        /**
+         * Represents the type of parameter or return value.
+         */
+        enum Type
+        {
+            TYPE_CONSTRUCTOR,
+            TYPE_DESTRUCTOR,
+            TYPE_VOID,
+            TYPE_BOOL,
+            TYPE_CHAR,
+            TYPE_SHORT,
+            TYPE_INT,
+            TYPE_LONG,
+            TYPE_UCHAR,
+            TYPE_USHORT,
+            TYPE_UINT,
+            TYPE_ULONG,
+            TYPE_FLOAT,
+            TYPE_DOUBLE,
+            TYPE_STRING,
+            TYPE_OBJECT,
+            TYPE_ENUM,
+            TYPE_UNRECOGNIZED,
+            TYPE_VARARGS
+        };
+
+        /** 
+         * Represents the kind or nature of the parameter/return value.
+         */
+        enum Kind
+        {
+            KIND_VALUE,
+            KIND_REFERENCE,
+            KIND_POINTER
+        };
+
+        /**
+         * Constructor.
+         * 
+         * @param type The type of the parameter.
+         * @param kind The kind of the parameter.
+         * @param info The extra info of the parameter (optional).
+         */
+        Param(Type type = TYPE_VOID, Kind kind = KIND_VALUE, const string& info = "");
+
+        /**
+         * Equality operator.
+         * 
+         * @param p The param to compare to.
+         * @return True if the parameters are equal; false otherwise.
+         */
+        bool operator==(const Param& p) const;
+
+        /**
+         * Inequality operator.
+         * 
+         * @param p The param to compare to.
+         * @return True if the parameters are not equal; false otherwise.
+         */
+        bool operator!=(const Param& p) const;
+
+        /** The type of the parameter. */
+        Type type;
+        /** The kind of the parameter. */
+        Kind kind;
+        /** Extra info (either the class name for a pointer 
+        type or whether a string type is a std::string or a C-string). */
+        string info;
+        /** Whether the parameter has a default value. */
+        bool hasDefaultValue;
+    };
+
+    /**
+     * Constructor.
+     *
+     * @param classname The name of the class that owns this binding.
+     * @param uniquename The class's unique name (used only in the script bindings).
+     */
+    FunctionBinding(string classname = "", string uniquename = "");
+
+    /**
+     * Retrieves the C++ function name for the script binding.
+     * 
+     * @return The C++ function name for the script binding.
+     */
+    string getFunctionName() const;
+
+    /**
+     * Gets the minimum number of parameters needed to call 
+     * the function that the binding corresponds to.
+     * 
+     * @return The minimum number of parameters.
+     */
+    unsigned int getMinParamCount() const;
+
+    /**
+     * Writes out the script binding for the given set of binding objects
+     * (the given set corresponds to all overloaded versions of a function).
+     * 
+     * @param o The output stream to write to.
+     * @param bindings The set of binding objects.
+     */
+    static void write(ostream& o, const vector<FunctionBinding>& bindings);
+
+    /**
+     * Retrieves whether the given two bindings have matching signatures.
+     * 
+     * @param b1 The first binding.
+     * @param b2 The second binding.
+     * @return True if the signatures match; false otherwise.
+     */
+    static bool signaturesMatch(const FunctionBinding& b1, const FunctionBinding& b2);
+
+    /** The binding's type. */
+    Type type;
+    /** The binding's return value. */
+    Param returnParam;
+    /** The binding's parameters. */
+    vector<Param> paramTypes;
+    /** The name of the class that owns this binding. */
+    string classname;
+    /** Holds the class's unique name (used only in the script bindings). */
+    string uniquename;
+    /** The name of the binding (function or variable name). */
+    string name;
+    /** Holds the unique name of the C++ function that implements the Lua binding. */
+    mutable string functionName;
+    /** Holds whether the binding's return value is a object that is owned by whomever calls the function. */
+    bool own;
+};
+
+ostream& operator<<(ostream& o, const FunctionBinding::Param& param);
+
+#endif

+ 1965 - 0
gameplay-luagen/src/Generator.cpp

@@ -0,0 +1,1965 @@
+#include "Generator.h"
+
+Generator* Generator::__instance = NULL;
+
+// Warning flags.
+static bool __printTemplateWarning = false;
+static bool __printVarargWarning = false;
+static bool __printOperatorWarning = false;
+
+// Utility functions (local to this file).
+static string trim(const string& str);
+static string stripTypeQualifiers(const string& typeStr, FunctionBinding::Param::Kind& kind);
+static inline bool isWantedFileNormal(const string& s);
+static inline bool isNamespaceFile(const string& s);
+static inline bool isGeneratedBindingFile(const string& s);
+static bool getFileList(string directory, vector<string>& files, bool (*isWantedFile)(const string& s));
+static bool isReservedKeyword(string name);
+
+Generator* Generator::getInstance()
+{
+    if (!__instance)
+        __instance = new Generator();
+
+    return __instance;
+}
+
+void Generator::releaseInstance()
+{
+    SAFE_DELETE(__instance);
+}
+
+string Generator::getUniqueName(string name)
+{
+    // Calculate the unique name for the given identifier (class, struct, enum, etc).
+    string uniquename = name;
+    size_t i = uniquename.find("::");
+    while (i != uniquename.npos)
+    {
+        uniquename.replace(i, 2, SCOPE_REPLACEMENT);
+        i = uniquename.find("::");
+    }
+
+    return uniquename;
+}
+
+string Generator::getUniqueNameFromRef(string refId)
+{
+    return getUniqueName(getIdentifier(refId));
+}
+
+vector<string> Generator::getScopePath(string classname, string ns)
+{
+    size_t i = classname.find("::");
+    vector<string> scopePath;
+    while (i != classname.npos)
+    {
+        string scope = classname.substr(0, i);
+        if (scope != ns)
+            scopePath.push_back(scope);
+        classname = classname.substr(i + 2);
+        i = classname.find("::");
+    }
+
+    return scopePath;
+}
+
+string Generator::getIdentifier(string refId)
+{
+    if (_refIds.find(refId) != _refIds.end())
+        return _refIds[refId];
+    return refId;
+}
+
+string Generator::getClassNameAndNamespace(string classname, string* ns)
+{
+    size_t index = classname.find("::");
+    if (index != classname.npos)
+    {
+        string classNS = classname.substr(0, index);
+        if (_namespaces.find(classNS) != _namespaces.end())
+        {
+            if (ns)
+                *ns = classNS;
+
+            string tmp = classname.substr(index + 2);
+            if (_namespaces[classNS].find(tmp) != _namespaces[classNS].end())
+                return classname.substr(index + 2);
+            else
+            {
+                size_t tmpIndex = tmp.find("::");
+                if (tmpIndex != tmp.npos)
+                {
+                    tmp = tmp.substr(0, tmpIndex);
+                    if (_namespaces[classNS].find(tmp) != _namespaces[classNS].end())
+                    {
+                        _namespaces[classNS].insert(classname.substr(index + 2));
+                        return classname.substr(index + 2);
+                    }
+                }
+            }
+        }
+    }
+
+    return classname;
+}
+
+void Generator::setIdentifier(string refId, string id)
+{
+    _refIds[refId] = id;
+}
+
+bool Generator::isDerived(const ClassBinding& c, string classname)
+{
+    for (unsigned int i = 0; i < c.derived.size(); i++)
+    {
+        // If the derived class is not in the ref ID table, then it
+        // is a hidden (protected, private, etc.) class, so don't consider it.
+        if (_refIds.find(c.derived[i]) != _refIds.end())
+        {
+            const string& derivedClassName = getIdentifier(c.derived[i]);
+            if (derivedClassName == classname || 
+                (_classes.find(derivedClassName) != _classes.end() &&
+                isDerived(_classes[derivedClassName], classname)))
+            {
+                return true;
+            }
+        }
+    }
+    return false;
+}
+
+bool Generator::isRef(string classname)
+{
+    // Check if the class is derived from Ref.
+    for (unsigned int i = 0; i < _topLevelBaseClasses.size(); i++)
+    {
+        if (_topLevelBaseClasses[i] == REF_CLASS_NAME)
+        {
+            return isDerived(_classes[_topLevelBaseClasses[i]], classname);
+        }
+    }
+    return classname == REF_CLASS_NAME;
+}
+
+string Generator::getCompoundName(XMLElement* node)
+{
+    // Get the name of the namespace, class, struct, or file that we are processing.
+    XMLElement* nameElement = node->FirstChildElement("compoundname");
+    if (!nameElement)
+    {
+        GP_ERROR("Missing 'compoundname' child node of 'compounddef' node for XML document '%s'.", _file);
+        return "";
+    }
+    const char* text = nameElement->GetText();
+    if (!text)
+    {
+        GP_ERROR("The 'compoundname' node is empty for XML document '%s'.", _file);
+        return "";
+    }
+
+    return string(text);
+}
+
+void Generator::run(string inDir, string outDir, string* bindingNS)
+{
+    // Set the output directory.
+    _outDir = outDir;
+
+    // Get a list of all .cpp and .h files in the output directory so
+    // we can delete them before generating new bindings.
+    vector<string> oldBindingsFiles;
+    getFileList(outDir, oldBindingsFiles, isGeneratedBindingFile);
+
+    // Delete the old bindings.
+    for (unsigned int i = 0; i < oldBindingsFiles.size(); i++)
+    {
+        remove(oldBindingsFiles[i].c_str());
+    }
+
+
+    // Get a list of the Doxygen XML files that specify a namespace.
+    // Note: we must do this before adding the normal files so that
+    // when we process the files sequentially, we process the namespaces
+    // before the normal files (so that namespaces can be removed
+    // properly from class/struct names, etc.)
+    vector<string> files;
+    getFileList(inDir, files, isNamespaceFile);
+
+    // Add all of the normal Doxygen XML files we want to use to generate Lua bindings.
+    if (!getFileList(inDir, files, isWantedFileNormal) || files.empty())
+    {
+        GP_ERROR("Failed to get a valid list of files to generate bindings from using directory '%s'.", inDir.c_str());
+        return;
+    }
+
+    // Go through each file and build the data needed to generate the bindings.
+    for (vector<string>::iterator iter = files.begin(); iter != files.end(); iter++)
+    {
+        tinyxml2::XMLDocument doc;
+        _file = iter->c_str();
+        doc.LoadFile(iter->c_str());
+
+        int ret = doc.ErrorID();
+        if (ret != 0)
+        {
+            GP_ERROR("Failed to load XML document '%s' properly with error ID %d.", iter->c_str(), ret);
+            continue;
+        }
+
+        XMLElement* rootNode = doc.FirstChildElement("doxygen");
+        if (!rootNode)
+        {
+            GP_ERROR("Missing root 'doxygen' node for XML document '%s'.", iter->c_str());
+            continue;
+        }
+        XMLElement* node = rootNode->FirstChildElement("compounddef");
+        if (!node)
+        {
+            GP_ERROR("Missing 'compounddef' node for XML document '%s'.", iter->c_str());
+            continue;
+        }
+
+        const char* kind = node->Attribute("kind");
+        if (kind && strcmp(kind, "namespace") == 0)
+        {
+            string name = getCompoundName(node);
+            cout << "Parsing namespace " << name << "...\n";
+            getNamespace(node, name);
+        }
+        else if ( (kind && (strcmp(kind, "class") == 0 || strcmp(kind, "struct") == 0) ) && strcmp(node->Attribute("prot"), "public") == 0)
+        {
+            string name = getCompoundName(node);
+            cout << "Parsing class/struct " << name << "...\n";
+            getClass(node, name);
+        }
+        else if (kind && strcmp(kind, "file") == 0)
+        {
+            string name = getCompoundName(node);
+            cout << "Parsing file " << name << "...\n";
+            if (name.find(".h") != name.npos)
+            {
+                getFunctions(node);
+                getEnums(node, name);
+            }
+            else if (name.find(".cpp") != name.npos)
+            {
+                getIncludes(node, name);
+            }
+        }
+    }
+
+    // Resolve all inheritance.
+    resolveInheritance();
+
+    // Resolve all unrecognized parameter and return value types.
+    resolveTypes();
+
+    // Resolve all inherited include files.
+    resolveInheritedIncludes();
+
+    // Generate the script bindings.
+    generateBindings(bindingNS);
+
+    // Print out all warnings (unsupported types, function name-Lua keyword clashes, etc.)
+    if (__warnings.size() > 0)
+    {
+        cout << "\nWarnings:\n";
+        for (set<string>::iterator iter = __warnings.begin(); iter!= __warnings.end(); iter++)
+        {
+            GP_WARN("%s", iter->c_str());
+        }
+    }
+
+    // Print warnings for the use of unsupported C++ features.
+    if (__printTemplateWarning)
+        GP_WARN("Detected the use of template parameters; this feature of C++ is not supported.");
+    if (__printVarargWarning)
+        GP_WARN("Detected the use of variable argument lists; this feature of C++ is not supported.");
+    if (__printOperatorWarning)
+        GP_WARN("Detected the use of operator overloading; this feature of C++ is not supported.");
+}
+
+Generator::Generator()
+{
+}
+
+Generator::~Generator()
+{
+}
+
+void Generator::getFunctions(XMLElement* fileNode, string ns)
+{
+    // Process all public, non-static functions and variables that are defined in this file.
+    XMLElement* node = NULL;
+    const char* kind = NULL;
+    const char* isStatic = NULL;
+    for (node = fileNode->FirstChildElement("sectiondef"); node != NULL; node = node->NextSiblingElement("sectiondef"))
+    {
+        kind = node->Attribute("kind");
+        if (kind && strcmp(kind, "func") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                isStatic = e->Attribute("static");
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore" &&
+                    (!isStatic || strcmp(isStatic, "yes") != 0))
+                {
+                    FunctionBinding b;
+                    b.type = FunctionBinding::GLOBAL_FUNCTION;
+                    b.name = getName(e);
+
+                    if (!isReservedKeyword(b.name))
+                    {
+                        // Ignore operators.
+                        if (b.name.find("operator") != 0)
+                        {
+                            b.returnParam = getParam(e);
+
+                            getParams(e, b);
+                            getCreateFlag(e, b);
+                            _functions[b.getFunctionName()].push_back(b);
+
+                            // Add the function to the set of namespace members if it is part of a namespace.
+                            if (ns.size() > 0)
+                                _namespaces[ns].insert(b.name);
+                        }
+                        else
+                        {
+                            __printOperatorWarning = true;
+                        }
+                    }
+                    else
+                    {
+                        __warnings.insert(string("Function name '") + b.name + string("' is a reserved Lua keyword; binding '") + b.getFunctionName() + string("' was not generated."));
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        else if (kind && strcmp(kind, "var") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                isStatic = e->Attribute("static");
+                if (getScriptFlag(e) != "ignore" &&
+                    (!isStatic || strcmp(isStatic, "yes") != 0))
+                {
+                    FunctionBinding b;
+                    if (getIsConstType(e))
+                        b.type = FunctionBinding::GLOBAL_CONSTANT;
+                    else
+                        b.type = FunctionBinding::GLOBAL_VARIABLE;
+
+                    b.name = getName(e);
+                    if (!isReservedKeyword(b.name))
+                    {
+                        b.returnParam = getParam(e, true);
+                        _functions[b.getFunctionName()].push_back(b);
+                        
+                        // Add the variable to the set of namespace members if it is part of a namespace.
+                        if (ns.size() > 0)
+                            _namespaces[ns].insert(b.name);
+                    }
+                    else
+                    {
+                        __warnings.insert(string("Function name '") + b.name + string("' is a reserved Lua keyword; binding '") + b.getFunctionName() + string("' was not generated."));
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+    }
+}
+
+void Generator::getNamespace(XMLElement* nsNode, const string& name)
+{
+    // Skip the 'std' namespace.
+    if (name == "std")
+        return;
+
+    // Create the set of all classes that are a part of this namespace.
+    XMLElement* e = nsNode->FirstChildElement("innerclass");
+    while (e)
+    {
+        string classname = e->GetText();
+        size_t i = classname.find("::");
+        if (i != classname.npos)
+            classname = classname.substr(i + 2);
+        _namespaces[name].insert(classname);
+        e = e->NextSiblingElement("innerclass");
+    }
+
+    // Parse all functions that are directly in this namespace.
+    getFunctions(nsNode, name);
+
+    // Parse all enums that are directly in this namespace.
+    getEnums(nsNode, name);
+
+    // Parse all typedefs.
+    getTypedefs(nsNode, name);
+}
+
+void Generator::getClass(XMLElement* classNode, const string& name)
+{
+    // Get the ref id for the class.
+    string refId = classNode->Attribute("id");
+
+    // Create the class binding object that we will store the function bindings in (name -> binding).
+    ClassBinding classBinding(name, refId);
+
+    // Store the mapping between the ref id and the class's fully qualified name.
+    Generator::getInstance()->setIdentifier(refId, classBinding.classname);
+
+    // Check if we should ignore this class.
+    if (getScriptFlag(classNode) == "ignore")
+        return;
+
+    // Get the include header for the original class declaration.
+    XMLElement* includeElement = classNode->FirstChildElement("includes");
+    if (includeElement)
+    {
+        const char* text = includeElement->GetText();
+        if (!text)
+        {
+            GP_ERROR("The 'includes' node is empty (a class must have an include file) for XML document '%s'.", _file);
+            return;
+        }
+        classBinding.include = text;
+    }
+    else
+    {
+        // See if we are an inner class. If so, attempt to get the include from the root parent class.
+        size_t index = classBinding.classname.find("::");
+        if (index != classBinding.classname.npos)
+        {
+            string parentClassName = classBinding.classname.substr(0, index);
+            if (_classes.find(parentClassName) != _classes.end())
+                classBinding.include = _classes[parentClassName].include;
+        }
+    }
+
+    // Track whether the class has any pure virtual functions.
+    bool hasPureVirtual = false;
+
+    // Process all public members that are defined in this class.
+    XMLElement* node = NULL;
+    const char* kind = NULL;
+    for (node = classNode->FirstChildElement("sectiondef"); node != NULL; node = node->NextSiblingElement("sectiondef"))
+    {
+        kind = node->Attribute("kind");
+        if (!kind)
+        {
+            GP_ERROR("Section definition is missing required 'kind' attribute in XML document  '%s'.", _file);
+            return;
+        }
+
+        // Process public static functions.
+        if (strcmp(kind, "public-static-func") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore")
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    b.type = FunctionBinding::STATIC_FUNCTION;
+
+                    b.name = getName(e);
+                    if (!isReservedKeyword(b.name))
+                    {
+                        b.returnParam = getParam(e, false, b.classname);
+                        
+                        getParams(e, b);
+                        getCreateFlag(e, b);
+                        classBinding.bindings[b.getFunctionName()].push_back(b);
+                    }
+                    else
+                    {
+                        __warnings.insert(string("Function name '") + b.name + string("' is a reserved Lua keyword; binding '") + b.getFunctionName() + string("' was not generated."));
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        // Process public member functions.
+        else if (strcmp(kind, "public-func") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore")
+                {
+                    if (strcmp(e->Attribute("virt"), "pure-virtual") == 0)
+                        hasPureVirtual = true;
+
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    b.type = FunctionBinding::MEMBER_FUNCTION;
+
+                    b.name = getName(e);
+
+                    if (!isReservedKeyword(b.name))
+                    {
+                        // Ignore operators.
+                        if (b.name.find("operator") != 0)
+                        {
+                            b.returnParam = getParam(e, false, b.classname);
+                            if (b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+                            {
+                                b.returnParam.info = refId;
+                                b.own = true;
+                            }
+
+                            getParams(e, b);
+                            getCreateFlag(e, b);
+                            classBinding.bindings[b.getFunctionName()].push_back(b);
+                        }
+                        else
+                        {
+                            __printOperatorWarning = true;
+                        }
+                    }
+                    else
+                    {
+                        __warnings.insert(string("Function name '") + b.name + string("' is a reserved Lua keyword; binding '") + b.getFunctionName() + string("' was not generated."));
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        // Process public static variables.
+        else if (strcmp(kind, "public-static-attrib") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (getScriptFlag(e) != "ignore")
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    if (getIsConstType(e))
+                        b.type = FunctionBinding::STATIC_CONSTANT;
+                    else
+                        b.type = FunctionBinding::STATIC_VARIABLE;
+
+                    b.name = getName(e);
+                    if (!isReservedKeyword(b.name))
+                    {
+                        b.returnParam = getParam(e, true, b.classname);
+                        classBinding.bindings[b.getFunctionName()].push_back(b);
+                    }
+                    else
+                    {
+                        __warnings.insert(string("Function name '") + b.name + string("' is a reserved Lua keyword; binding '") + b.getFunctionName() + string("' was not generated."));
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        // Process public member variables.
+        else if (strcmp(kind, "public-attrib") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore")
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    if (getIsConstType(e))
+                        b.type = FunctionBinding::MEMBER_CONSTANT;
+                    else
+                        b.type = FunctionBinding::MEMBER_VARIABLE;
+
+                    b.name = getName(e);
+                    if (!isReservedKeyword(b.name))
+                    {
+                        b.returnParam = getParam(e, true, b.classname);
+                        classBinding.bindings[b.getFunctionName()].push_back(b);
+                    }
+                    else
+                    {
+                        __warnings.insert(string("Function name '") + b.name + string("' is a reserved Lua keyword; binding '") + b.getFunctionName() + string("' was not generated."));
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        else if (strcmp(kind, "protected-func") == 0 ||
+                 strcmp(kind, "private-func") == 0)
+        {
+            // Check for inaccessible constructor/destructor
+            // and create a list of all other inaccessible functions
+            // (we do this so that classes that override a public function
+            // and change its scope to protected or private work properly
+            // from Lua-i.e. no binding is generated for such functions).
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (strcmp(e->Attribute("virt"), "pure-virtual") == 0)
+                    hasPureVirtual = true;
+
+                FunctionBinding::Param t = getParam(e);
+                if (t.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+                {
+                    classBinding.inaccessibleConstructor = true;
+                }
+                else if (t.type == FunctionBinding::Param::TYPE_DESTRUCTOR)
+                {
+                    classBinding.inaccessibleDestructor = true;
+                }
+                else
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    b.type = FunctionBinding::MEMBER_FUNCTION;
+
+                    b.name = getName(e);
+                
+                    if (!isReservedKeyword(b.name))
+                    {
+                        // Ignore operators.
+                        if (b.name.find("operator") != 0)
+                        {
+                            b.returnParam = getParam(e, false, b.classname);
+                            if (b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+                            {
+                                b.returnParam.info = refId;
+                                b.own = true;
+                            }
+
+                            getParams(e, b);
+                            getCreateFlag(e, b);
+                            classBinding.hidden[b.getFunctionName()].push_back(b);
+                        }
+                        else
+                        {
+                            __printOperatorWarning = true;
+                        }
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        else if (strcmp(kind, "protected-static-func") == 0 ||
+                 strcmp(kind, "private-static-func") == 0)
+        {
+            // Create a list of all other inaccessible functions
+            // (we do this so that classes that override a public function
+            // and change its scope to protected or private work properly
+            // from Lua-i.e. no binding is generated for such functions).
+
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore")
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    b.type = FunctionBinding::STATIC_FUNCTION;
+
+                    b.name = getName(e);
+                    if (!isReservedKeyword(b.name))
+                    {
+                        b.returnParam = getParam(e, false, b.classname);
+                        
+                        getParams(e, b);
+                        getCreateFlag(e, b);
+                        classBinding.hidden[b.getFunctionName()].push_back(b);
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        // Process public enums and typedefs.
+        else if (strcmp(kind, "public-type") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (getScriptFlag(e) != "ignore")
+                {
+                    if (strcmp(e->Attribute("kind"), "enum") == 0)
+                    {
+                        getEnum(e, classBinding.classname, classBinding.ns, classBinding.include);
+                    }
+                    else if (strcmp(e->Attribute("kind"), "typedef") == 0)
+                    {
+                        getTypedef(e, classBinding.classname, classBinding.ns);
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        else
+        {
+            // Ignore other section definitions.
+        }
+    }
+
+    // If the class has a pure-virtual method, we mark the constructor as inaccessible
+    // and remove any constructor bindings that are in the list.
+    if (hasPureVirtual)
+    {
+        classBinding.inaccessibleConstructor = true;
+        map<string, vector<FunctionBinding> >::iterator iter = classBinding.bindings.begin();
+        for (; iter != classBinding.bindings.end(); iter++)
+        {
+            if (iter->second[0].returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+            {
+                classBinding.bindings.erase(iter);
+                break;
+            }
+        }
+    }
+
+    // Store the class's derived class(es)' ref id(s) if it has any.
+    node = classNode->FirstChildElement("derivedcompoundref");
+    while (node)
+    {
+        classBinding.derived.push_back(node->Attribute("refid"));
+        node = node->NextSiblingElement("derivedcompoundref");
+    }
+
+    // If the class has no base classes and it has derived classes, add it to the list of top-level classes.
+    if (!classNode->FirstChildElement("basecompoundref") && classBinding.derived.size() > 0)
+        _topLevelBaseClasses.push_back(classBinding.classname);
+
+    // Insert the class binding into the global table.
+    _classes[classBinding.classname] = classBinding;
+}
+
+void Generator::getEnums(XMLElement* fileNode, string ns)
+{
+    XMLElement* node = NULL;
+    const char* kind = NULL;
+    for (node = fileNode->FirstChildElement("sectiondef"); node != NULL; node = node->NextSiblingElement("sectiondef"))
+    {
+        kind = node->Attribute("kind");
+        if (!kind)
+        {
+            GP_ERROR("Section definition is missing required 'kind' attribute in XML document  '%s'.", _file);
+            return;
+        }
+
+        // Process the enums.
+        if (strcmp(kind, "enum") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (getScriptFlag(e) != "ignore" && strcmp(e->Attribute("kind"), "enum") == 0)
+                {
+                    getEnum(e, "", ns);
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+    }
+}
+
+void Generator::getEnum(XMLElement* e, string classname, string ns, string include)
+{
+    // Get the enumeration's name.
+    string enumname = classname;
+    if (enumname.size() > 0)
+        enumname += string("::");
+    enumname += getName(e);
+
+    // Get the ref id for the enum.
+    string refId = e->Attribute("id");
+
+    // Store the ref id to name mapping.
+    Generator::getInstance()->setIdentifier(refId, enumname);
+    
+    // Add the enum to the enum list if it's not there 
+    // (we implicitly create it when we set its scope path).
+    if (_enums.find(enumname) == _enums.end())
+        _enums[enumname].scopePath = Generator::getScopePath(enumname, ns);
+
+    // Set the include file for the enum.
+    if (include.size() > 0)
+        _enums[enumname].include = include;
+    else
+    {
+        XMLElement* location = e->FirstChildElement("location");
+        if (location)
+            _enums[enumname].include = location->Attribute("file");
+    }
+
+    for (e = e->FirstChildElement("enumvalue"); e; e = e->NextSiblingElement("enumvalue"))
+    {
+        _enums[enumname].values.push_back(getName(e));
+    }
+
+    // Add the enum to the set of namespace members if it is part of a namespace.
+    if (ns.size() > 0)
+        _namespaces[ns].insert(enumname);
+}
+
+void Generator::getTypedefs(XMLElement* fileNode, string ns)
+{
+    XMLElement* node = NULL;
+    const char* kind = NULL;
+    for (node = fileNode->FirstChildElement("sectiondef"); node != NULL; node = node->NextSiblingElement("sectiondef"))
+    {
+        kind = node->Attribute("kind");
+        if (!kind)
+        {
+            GP_ERROR("Section definition is missing required 'kind' attribute in XML document  '%s'.", _file);
+            return;
+        }
+
+        // Process the enums.
+        if (strcmp(kind, "typedef") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (getScriptFlag(e) != "ignore" && strcmp(e->Attribute("kind"), "typedef") == 0)
+                {
+                    getTypedef(e, "", ns);
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+    }
+}
+
+void Generator::getTypedef(XMLElement* e, string classname, string ns)
+{
+    TypedefBinding t;
+
+    // Get the typedef's name.
+    string tname = classname;
+    if (tname.size() > 0)
+        tname += string("::");
+    tname += getName(e);
+
+    // Get the typedef's id and store the mapping from ref id to name.
+    string refId = e->Attribute("id");
+    setIdentifier(refId, tname);
+
+    FunctionBinding::Param p = getParam(e);
+    if (p.info.size() > 0)
+        t.refId = p.info;
+
+    _typedefs[tname] = t;
+
+    // Add the typedef to the set of namespace members if it is part of a namespace.
+    if (ns.size() > 0)
+        _namespaces[ns].insert(tname);
+}
+
+static inline bool getScriptFlagHelper(XMLElement* e, string& flag)
+{
+    XMLElement* x = e->FirstChildElement("xmlonly");
+    if (x)
+    {
+        flag = x->GetText();
+        return true;
+    }
+
+    x = e->FirstChild() ? e->FirstChild()->ToElement() : NULL;
+    while (x)
+    {
+        if (getScriptFlagHelper(x, flag))
+            return true;
+
+        x = x->NextSibling() ? x->NextSibling()->ToElement() : NULL;
+    }
+    return false;
+}
+
+string Generator::getScriptFlag(XMLElement* e)
+{
+    string flag;
+
+    XMLElement* n = e->FirstChildElement("detaileddescription");
+    if (n)
+        getScriptFlagHelper(n, flag);
+    
+    return flag;
+}
+
+void Generator::getCreateFlag(XMLElement* e, FunctionBinding& b)
+{
+    if (getScriptFlag(e) == "create")
+        b.own = true;
+}
+
+string Generator::getName(XMLElement* e)
+{
+    // Get the name for the binding.
+    XMLElement* nameElement = e->FirstChildElement("name");
+    if (!nameElement)
+    {
+        GP_ERROR("Missing 'name' child node in XML document '%s'.", _file);
+        return string();
+    }
+    return nameElement->GetText();
+}
+
+bool Generator::getIsConstType(XMLElement* e)
+{
+    XMLElement* typeElement = e->FirstChildElement("type");
+    if (!typeElement)
+    {
+        GP_ERROR("Missing 'type' node in XML document '%s'.", _file);
+        return false;
+    }
+
+    XMLNode* textNode = typeElement->FirstChild();
+    if (textNode)
+    {
+        XMLText* text = textNode->ToText();
+        if (text)
+        {
+            string type = text->Value();
+            return type.find("const") != type.npos;
+        }
+    }
+    return false;
+}
+
+FunctionBinding::Param Generator::getParam(XMLElement* e, bool isVariable, string classname)
+{
+    // Get the type for the current element (either the return type or a parameter type).
+    XMLElement* typeElement = e->FirstChildElement("type");
+    if (!typeElement)
+    {
+        GP_ERROR("Missing 'type' node in XML document '%s'.", _file);
+    }
+
+    FunctionBinding::Param p;
+    XMLNode* textNode = typeElement->FirstChild();
+    if (!textNode)
+    {
+        // Get the name of the current element to see if it is a destructor.
+        string name = getName(e);
+        if (name.find("~") == 0)
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_DESTRUCTOR);
+        }
+        else
+        {
+            // Assume it's a constructor.
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_CONSTRUCTOR, FunctionBinding::Param::KIND_POINTER, name);
+        }
+    }
+    else
+    {
+        // Get the type string without const or reference qualifiers (and trim whitespace).
+        string refId = "";
+        string typeStr = "";
+        FunctionBinding::Param::Kind kind;
+        {
+            // Attempt to process the type as reference (i.e. class, struct, enum, typedef, etc.) type.
+            XMLNode* node = textNode;
+            while (node)
+            {
+                if (strcmp(node->Value(), "ref") == 0)
+                {
+                    refId = node->ToElement()->Attribute("refid");
+                    typeStr += node->ToElement()->GetText();
+                }
+                else if (node->ToText())
+                {
+                    typeStr += node->ToText()->Value();
+                }
+
+                node = node->NextSibling();
+            }
+
+            typeStr = stripTypeQualifiers(typeStr, kind);
+        }
+
+        if (typeStr == "void")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_VOID, kind);
+        }
+        else if (typeStr == "bool")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_BOOL, kind);
+        }
+        else if (typeStr == "char" && kind != FunctionBinding::Param::KIND_POINTER)
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_CHAR, kind);
+        }
+        else if (typeStr == "short")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_SHORT, kind);
+        }
+        else if (typeStr == "int")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_INT, kind);
+        }
+        else if (typeStr == "long")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_LONG, kind);
+        }
+        else if (typeStr == "unsigned char")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_UCHAR, kind);
+        }
+        else if (typeStr == "unsigned short")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_USHORT, kind);
+        }
+        else if (typeStr == "unsigned int")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_UINT, kind);
+        }
+        else if (typeStr == "unsigned long")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_ULONG, kind);
+        }
+        else if (typeStr == "float")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_FLOAT, kind);
+        }
+        else if (typeStr == "double")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_DOUBLE, kind);
+        }
+        else if (typeStr == "string" || typeStr == "std::string")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_STRING, kind, "string");
+        }
+        else if (typeStr == "char" && kind == FunctionBinding::Param::KIND_POINTER)
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_STRING, kind, "char*");
+        }
+        else if (_enums.find(typeStr) != _enums.end() ||
+            (classname.size() > 0 && _enums.find(classname + string("::") + typeStr) != _enums.end()))
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_ENUM, kind, refId);
+        }
+        else if (typeStr == "...")
+        {
+            __printVarargWarning = true;
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_VARARGS);
+        }
+        else
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_UNRECOGNIZED, kind, (refId.size() > 0) ? refId : typeStr);
+        }
+
+        // Check if the type is a pointer declared with square brackets (i.e. float x[4]).
+        XMLElement* arrayElement = NULL;
+        if ((arrayElement = e->FirstChildElement("array")) != NULL ||
+            (isVariable && (arrayElement = e->FirstChildElement("argsstring")) != NULL))
+        {
+            const char* text = arrayElement->GetText();
+            string arrayString = (text ? text : "");
+            string::size_type i = arrayString.find("[");
+            string::size_type k = arrayString.find("]");
+            if (i != arrayString.npos && k != arrayString.npos)
+            {
+                p.kind = FunctionBinding::Param::KIND_POINTER;
+                if (i != k - 1)
+                    p.info = arrayString.substr(i + 1, k - (i + 1));
+            }
+        }
+    }
+
+    // Get the default value for the parameter if it has one.
+    XMLElement* defaultValueElement = e->FirstChildElement("defval");
+    if (defaultValueElement)
+    {
+        p.hasDefaultValue = true;
+    }
+
+    return p;
+}
+
+void Generator::getParams(XMLElement* e, FunctionBinding& b)
+{
+    XMLElement* param = e->FirstChildElement("param");
+    while (param)
+    {
+        FunctionBinding::Param p = getParam(param, false, b.classname);
+        if (p.type != FunctionBinding::Param::TYPE_VARARGS)
+            b.paramTypes.push_back(p);
+        param = param->NextSiblingElement("param");
+    }
+}
+
+void Generator::resolveMembers(const ClassBinding& c)
+{
+    vector<ClassBinding*> derived;
+
+    // Go through the derived classes' bindings and update them.
+    ClassBinding* cb = NULL;
+    map<string, vector<FunctionBinding> >::const_iterator iter;
+    for (unsigned int i = 0; i < c.derived.size(); i++)
+    {
+        // If the class is not in the map of classes, then
+        // it was marked to be ignored, so skip over it.
+        string derivedClassName = getIdentifier(c.derived[i]);
+        if (_classes.find(derivedClassName) == _classes.end())
+            continue;
+
+        cb = &_classes[derivedClassName];
+
+        // Go through this class' bindings and add them to the current
+        // derived class if they are not already there (excluding constructors and destructors).
+        for (iter = c.bindings.begin(); iter != c.bindings.end(); iter++)
+        {
+            FunctionBinding b(cb->classname, cb->uniquename);
+            b.type = iter->second[0].type;
+            b.name = iter->second[0].name;
+
+            map<string, vector<FunctionBinding> >::iterator findIter = cb->bindings.find(b.getFunctionName());
+            map<string, vector<FunctionBinding> >::iterator hiddenIter = cb->hidden.find(b.getFunctionName());
+            if (findIter == cb->bindings.end() && hiddenIter == cb->hidden.end())
+            {
+                for (unsigned int i = 0, iCount = iter->second.size(); i < iCount; i++)
+                {
+                    if (iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR &&
+                        iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_DESTRUCTOR)
+                    {
+                        // Copy the binding, but set its function name to 
+                        // empty so that it is regenerated correctly.
+                        b = iter->second[i];
+                        b.functionName = "";
+                        b.classname = cb->classname;
+                        b.uniquename = cb->uniquename;
+
+                        cb->bindings[b.getFunctionName()].push_back(b);
+                    }
+                }
+            }
+            else
+            {
+                bool addBinding;
+                for (unsigned int i = 0, iCount = iter->second.size(); i < iCount; i++)
+                {
+                    string name = iter->second[i].name;
+
+                    addBinding = true;
+                    if (findIter != cb->bindings.end())
+                    {
+                        for (unsigned int j = 0, jCount = findIter->second.size(); j < jCount; j++)
+                        {
+                            if (FunctionBinding::signaturesMatch(iter->second[i], findIter->second[j]))
+                            {
+                                addBinding = false;
+                                break;
+                            }
+                        }
+
+                        // To call the base function, we have to qualify the call since
+                        // the derived class has a function with the same name and different parameters.
+                        if (addBinding)
+                            name = iter->second[i].classname + string("::") + iter->second[i].name;
+                    }
+                    if (hiddenIter != cb->hidden.end())
+                    {
+                        for (unsigned int j = 0, jCount = hiddenIter->second.size(); j < jCount; j++)
+                        {
+                            if (FunctionBinding::signaturesMatch(iter->second[i], hiddenIter->second[j]))
+                            {
+                                addBinding = false;
+                                break;
+                            }
+                        }
+                    }
+
+                    if (addBinding)
+                    {
+                        FunctionBinding b = iter->second[i];
+                        b.name = name;
+                        b.functionName = findIter->first;
+                        b.classname = cb->classname;
+                        b.uniquename = getUniqueName(cb->classname);
+
+                        if (findIter != cb->bindings.end())
+                            findIter->second.push_back(b);
+                        else
+                            cb->bindings[b.getFunctionName()].push_back(b);
+                    }
+                }
+            }
+        }
+
+        derived.push_back(cb);
+    }
+
+    // Go through the derived classes' bindings and resolve the members for their derived classes.
+    for (unsigned int i = 0; i < derived.size(); i++)
+    {
+        resolveMembers(*derived[i]);
+    }
+}
+
+void Generator::resolveInheritance()
+{
+    // Go through the class inheritance tree and update each class's bindings list 
+    // to include the bindings from the base class that haven't been overridden.
+    for (unsigned int i = 0; i < _topLevelBaseClasses.size(); i++)
+    {
+        resolveMembers(_classes[_topLevelBaseClasses[i]]);
+    }
+}
+
+void Generator::resolveIncludes(const ClassBinding& c)
+{
+    vector<ClassBinding*> derived;
+
+    // Go through the derived classes' bindings and update them.
+    ClassBinding* cb = NULL;
+    map<string, vector<FunctionBinding> >::const_iterator iter;
+    for (unsigned int i = 0; i < c.derived.size(); i++)
+    {
+        // If the class is not in the map of classes, then
+        // it was marked to be ignored, so skip over it.
+        string derivedClassName = getIdentifier(c.derived[i]);
+        if (_classes.find(derivedClassName) == _classes.end())
+            continue;
+
+        cb = &_classes[derivedClassName];
+
+        // Add all include files (uniquely) from the base class to the derived class.
+        map<string, set<string> >::iterator baseIncludes = _includes.find(c.include);
+        if (baseIncludes != _includes.end() && baseIncludes->second.size() > 0)
+        {
+            set<string>::iterator iter = baseIncludes->second.begin();
+            set<string>& derivedIncludes = _includes[cb->include];
+            for (; iter != baseIncludes->second.end(); iter++)
+            {
+                derivedIncludes.insert(*iter);
+            }
+        }
+        
+        derived.push_back(cb);
+    }
+
+    // Go through the derived classes' bindings and resolve the members for their derived classes.
+    for (unsigned int i = 0; i < derived.size(); i++)
+    {
+        resolveIncludes(*derived[i]);
+    }
+}
+
+void Generator::resolveInheritedIncludes()
+{
+    // Go through the class inheritance tree and update each class's 
+    // list of includes to include the includes from the base class
+    for (unsigned int i = 0; i < _topLevelBaseClasses.size(); i++)
+    {
+        resolveIncludes(_classes[_topLevelBaseClasses[i]]);
+    }
+}
+
+void Generator::resolveType(FunctionBinding::Param* param, string functionName, string header)
+{
+    string name = getIdentifier(param->info);
+
+    if (param->type == FunctionBinding::Param::TYPE_UNRECOGNIZED)
+    {
+        map<string, TypedefBinding>::iterator typedefIter = _typedefs.find(name);
+        if (typedefIter != _typedefs.end() && typedefIter->second.refId.size() > 0)
+        {
+            param->type = FunctionBinding::Param::TYPE_OBJECT;
+            param->info = typedefIter->second.refId;
+        }
+        else
+        {
+            map<string, ClassBinding>::iterator classIter = _classes.find(name);
+            if (classIter != _classes.end())
+            {
+                param->type = FunctionBinding::Param::TYPE_OBJECT;
+            }
+            else
+            {
+                map<string, EnumBinding>::iterator enumIter = _enums.find(name);
+                if (enumIter != _enums.end())
+                {
+                    param->type = FunctionBinding::Param::TYPE_ENUM;
+                }
+                else
+                {
+                    __warnings.insert(string("Unrecognized C++ type: ") + functionName + string(" -- ") + (name.size() > 0 ? name : param->info));
+                }
+            }
+        }
+    }
+
+    // Ensure that the header for the Lua enum conversion 
+    // functions is included in the file containing the
+    // generated binding that this param/return value is part of.
+    if (param->type == FunctionBinding::Param::TYPE_ENUM)
+    {
+        string enumHeader = string("lua_") + getUniqueName(name) + string(".h");
+        if (_includes.find(header) != _includes.end())
+        {
+            set<string>& includes = _includes[header];
+            if (includes.find(enumHeader) == includes.end())
+                includes.insert(enumHeader);
+        }
+        else
+        {
+            _includes[header].insert(enumHeader);
+        }
+    }
+}
+
+void Generator::resolveTypes()
+{
+    // Go through all member functions and attempt to resolve unrecognized types.
+    for (map<string, ClassBinding>::iterator iter = _classes.begin(); iter != _classes.end(); iter++)
+    {
+        map<string, vector<FunctionBinding> >::iterator functionNameIter = iter->second.bindings.begin();
+        for (; functionNameIter != iter->second.bindings.end(); functionNameIter++)
+        {
+            vector<FunctionBinding>::iterator functionIter = functionNameIter->second.begin();
+            for (; functionIter != functionNameIter->second.end(); functionIter++)
+            {
+                resolveType(&functionIter->returnParam, iter->first + string("::") + functionIter->name, iter->second.include);
+
+                vector<FunctionBinding::Param>::iterator paramIter = functionIter->paramTypes.begin();
+                for (; paramIter != functionIter->paramTypes.end(); paramIter++)
+                {
+                    resolveType(&(*paramIter), iter->first + string("::") + functionIter->name, iter->second.include);
+                }
+            }
+        }
+    }
+
+    // Go through all non-member functions and attempt to resolve unrecognized types.
+    string globalHeader = string("lua_") + string(LUA_GLOBAL_FILENAME) + string(".h");
+    for (map<string, vector<FunctionBinding> >::iterator iter = _functions.begin(); iter != _functions.end(); iter++)
+    {
+        vector<FunctionBinding>::iterator functionIter = iter->second.begin();
+        for (; functionIter != iter->second.end(); functionIter++)
+        {
+            resolveType(&functionIter->returnParam, functionIter->name, globalHeader);
+
+            vector<FunctionBinding::Param>::iterator paramIter = functionIter->paramTypes.begin();
+            for (; paramIter != functionIter->paramTypes.end(); paramIter++)
+            {
+                resolveType(&(*paramIter), functionIter->name, globalHeader);
+            }
+        }
+    }
+}
+
+void Generator::generateBindings(string* bindingNS)
+{
+    bool generatingGameplay = false;
+    if (bindingNS && (*bindingNS == "gameplay"))
+        generatingGameplay = true;
+
+    string luaAllHStr = _outDir + string(LUA_ALL_BINDINGS_FILENAME) + string(".h");
+    ofstream luaAllH(luaAllHStr.c_str());
+    string includeGuard = string(LUA_ALL_BINDINGS_FILENAME) + string("_H_");
+    transform(includeGuard.begin(), includeGuard.end(), includeGuard.begin(), ::toupper);
+    luaAllH << "#ifndef " << includeGuard << "\n";
+    luaAllH << "#define " << includeGuard << "\n\n";
+    
+    string luaAllCppStr = _outDir + string(LUA_ALL_BINDINGS_FILENAME) + string(".cpp");
+    ofstream luaAllCpp(luaAllCppStr.c_str());
+    luaAllCpp << "#include \"Base.h\"\n";
+    luaAllCpp << "#include \"" << string(LUA_ALL_BINDINGS_FILENAME) << ".h\"\n\n";
+    if (bindingNS)
+    {
+        luaAllCpp << "namespace " << *bindingNS << "\n";
+        luaAllCpp << "{\n\n";
+    }
+    luaAllCpp << "void lua_RegisterAllBindings()\n";
+    luaAllCpp << "{\n";
+
+    // Write out all the class bindings.
+    if (_classes.size() > 0)
+    {
+        map<string, ClassBinding>::iterator iter = _classes.begin();
+        for (; iter != _classes.end(); iter++)
+        {
+            if (generatingGameplay || (!generatingGameplay && _namespaces["gameplay"].find(iter->second.classname) == _namespaces["gameplay"].end()))
+            {
+                cout << "Generating bindings for '" << iter->first << "'...\n";
+                iter->second.write(_outDir, _includes[iter->second.include], bindingNS);
+
+                luaAllH << "#include \"lua_" << iter->second.uniquename << ".h\"\n";
+                luaAllCpp << "    luaRegister_" << iter->second.uniquename << "();\n";
+            }
+        }
+    }
+
+    // Go through all the classes and if they have any derived classes, add them to the list of base classes.
+    vector<string> baseClasses;
+    for (map<string, ClassBinding>::iterator iter = _classes.begin(); iter != _classes.end(); iter++)
+    {
+        if (iter->second.derived.size() > 0)
+            baseClasses.push_back(iter->first);
+    }
+
+    // Write out all the enum files.
+    if (_enums.size() > 0)
+    {
+        // Write out the enum conversion function declarations.
+        for (map<string, EnumBinding>::iterator iter = _enums.begin(); iter != _enums.end(); iter++)
+        {
+            if (generatingGameplay || (!generatingGameplay &&  _namespaces["gameplay"].find(iter->first) == _namespaces["gameplay"].end()))
+            {
+                cout << "Generating bindings for '" << iter->first << "'...\n";
+
+                // Header.
+                string enumHStr = _outDir + string("lua_") + getUniqueName(iter->first) + string(".h");
+                ofstream enumH(enumHStr.c_str());
+                includeGuard = string("lua_") + getUniqueName(iter->first) + string("_H_");
+                transform(includeGuard.begin(), includeGuard.end(), includeGuard.begin(), ::toupper);
+                enumH << "#ifndef " << includeGuard << "\n";
+                enumH << "#define " << includeGuard << "\n\n";
+                enumH << "#include \"" << iter->second.include << "\"\n\n";
+
+                if (bindingNS)
+                {
+                    enumH << "namespace " << *bindingNS << "\n";
+                    enumH << "{\n\n";
+                }
+
+                enumH << "// Lua bindings for enum conversion functions for " << iter->first << ".\n";
+                enumH << iter->first << " lua_enumFromString_" << getUniqueName(iter->first) << "(const char* s);\n";
+                enumH << "const char* lua_stringFromEnum_" << getUniqueName(iter->first) << "(" << iter->first << " e);\n\n";
+
+                if (bindingNS)
+                {
+                    enumH << "}\n\n";
+                }
+
+                enumH << "#endif\n";
+                enumH.close();
+
+                // Implementation.
+                string enumCppStr = _outDir + string("lua_") + getUniqueName(iter->first) + string(".cpp"); 
+                ofstream enumCpp(enumCppStr.c_str());
+                enumCpp << "#include \"Base.h\"\n";
+                enumCpp << "#include \"lua_" << getUniqueName(iter->first) << ".h\"\n\n";
+
+                if (bindingNS)
+                {
+                    enumCpp << "namespace " << *bindingNS << "\n";
+                    enumCpp << "{\n\n";
+                }
+
+                enumCpp << "static const char* enumStringEmpty = \"\";\n\n";
+
+                // Build the scope string if applicable.
+                string scope;
+                if (iter->second.scopePath.size() > 0)
+                {
+                    for (unsigned int i = 0; i < iter->second.scopePath.size(); i++)
+                    {
+                        scope += iter->second.scopePath[i] + string("::");
+                    }
+                }
+
+                // Write out the string constants that correspond to the enumeration values.
+                for (unsigned int i = 0; i < iter->second.values.size(); i++)
+                {
+                    enumCpp << "static const char* luaEnumString_" << getUniqueName(iter->first) << "_";
+                    enumCpp << iter->second.values[i] << " = \"" << iter->second.values[i] << "\";\n";
+                }
+                enumCpp << "\n";
+
+                enumCpp << iter->first << " lua_enumFromString_" << getUniqueName(iter->first) << "(const char* s)\n";
+                enumCpp << "{\n";
+                
+                for (unsigned int i = 0; i < iter->second.values.size(); i++)
+                {
+                    enumCpp << "    ";
+                        
+                    enumCpp << "if (strcmp(s, luaEnumString_" << getUniqueName(iter->first) << "_" << iter->second.values[i] << ") == 0)\n";
+                    enumCpp << "        return ";
+                    if (scope.size() > 0)
+                        enumCpp << scope;
+                    enumCpp << iter->second.values[i] << ";\n";
+
+                    if (i == iter->second.values.size() - 1)
+                    {
+                        enumCpp << "    GP_ERROR(\"Invalid enumeration value '%s' for enumeration " << iter->first << ".\", s);\n";
+                        enumCpp << "    return ";
+                        if (scope.size() > 0)
+                            enumCpp << scope;
+                        enumCpp << iter->second.values[0] << ";\n";
+                    }
+                }
+
+                enumCpp << "}\n\n";
+
+                enumCpp << "const char* lua_stringFromEnum_" << getUniqueName(iter->first) << "(" << iter->first << " e)\n";
+                enumCpp << "{\n";
+
+                // Write out the enum-to-string conversion code.
+                for (unsigned int i = 0; i < iter->second.values.size(); i++)
+                {
+                    enumCpp << "    ";
+                        
+                    enumCpp << "if (e == ";
+                    if (scope.size() > 0)
+                        enumCpp << scope;
+                    enumCpp << iter->second.values[i] << ")\n";
+                    enumCpp << "        return luaEnumString_" << getUniqueName(iter->first) << "_" << iter->second.values[i] << ";\n";
+
+                    if (i == iter->second.values.size() - 1)
+                    {
+                        enumCpp << "    GP_ERROR(\"Invalid enumeration value '%d' for enumeration " << iter->first << ".\", e);\n";
+                        enumCpp << "    return enumStringEmpty;\n";
+                    }
+                }
+
+                enumCpp << "}\n\n";
+
+                if (bindingNS)
+                {
+                    enumCpp << "}\n\n";
+                }
+                enumCpp.close();
+            }
+        }
+    }
+
+    // Write out the global bindings file.
+    cout << "Generating global bindings...\n";
+    if (baseClasses.size() > 0 || _functions.size() > 0 || _enums.size() > 0)
+    {
+        // Calculate if there are global function bindings to write out.
+        bool generateGlobalFunctionBindings = false;
+        if (_functions.size() > 0)
+        {
+            for (map<string, vector<FunctionBinding> >::iterator iter = _functions.begin(); iter != _functions.end(); iter++)
+            {
+                if (generatingGameplay || (!generatingGameplay &&  _namespaces["gameplay"].find(iter->second[0].name) == _namespaces["gameplay"].end()))
+                {
+                    generateGlobalFunctionBindings = true;
+                    break;
+                }
+            }
+        }
+
+        // Calculate if there are enum bindings to write out.
+        bool generateEnumBindings = false;
+        if (_enums.size() > 0)
+        {
+            for (map<string, EnumBinding>::iterator iter = _enums.begin(); iter != _enums.end(); iter++)
+            {
+                if (generatingGameplay || (!generatingGameplay &&  _namespaces["gameplay"].find(iter->first) == _namespaces["gameplay"].end()))
+                {
+                    generateEnumBindings = true;
+                    break;
+                }
+            }
+        }
+
+        // Write out the header file.
+        {
+            string path = _outDir + string(LUA_GLOBAL_FILENAME) + string(".h");
+            ofstream global(path.c_str());
+            includeGuard = string(LUA_GLOBAL_FILENAME) + string("_H_");
+            transform(includeGuard.begin(), includeGuard.end(), includeGuard.begin(), ::toupper);
+            global << "#ifndef " << includeGuard << "\n";
+            global << "#define " << includeGuard << "\n\n";
+
+            // Write out the needed includes for the global enumeration function.
+            for (map<string, EnumBinding>::iterator iter = _enums.begin(); iter != _enums.end(); iter++)
+            {
+                if (generatingGameplay || (!generatingGameplay &&  _namespaces["gameplay"].find(iter->first) == _namespaces["gameplay"].end()))
+                    global << "#include \"lua_" << getUniqueName(iter->first) << ".h\"\n";
+            }
+            global << "\n";
+            luaAllH << "#include \"" << string(LUA_GLOBAL_FILENAME) << ".h\"\n";
+            luaAllCpp << "    luaRegister_" << LUA_GLOBAL_FILENAME << "();\n";
+
+            if (bindingNS)
+            {
+                global << "namespace " << *bindingNS << "\n";
+                global << "{\n\n";
+            }
+
+            if (generateGlobalFunctionBindings)
+            {
+                global << "// Lua bindings for global functions.\n";
+
+                // Write out the binding function declarations.
+                for (map<string, vector<FunctionBinding> >::iterator iter = _functions.begin(); iter != _functions.end(); iter++)
+                {
+                    if (generatingGameplay || (!generatingGameplay &&  _namespaces["gameplay"].find(iter->second[0].name) == _namespaces["gameplay"].end()))
+                        global << "int " << iter->second[0].getFunctionName() << "(lua_State* state);\n";
+                }
+                global << "\n";
+            }
+
+            if (generateEnumBindings)
+            {
+                global << "// Global enum to string conversion function (used to pass enums to Lua from C++).\n";
+                global << "const char* lua_stringFromEnumGlobal(std::string& enumname, unsigned int value);\n\n";
+            }
+            
+            // Write out the signature of the function used to register the global functions with Lua.
+            global << "void luaRegister_" << LUA_GLOBAL_FILENAME << "();\n\n";
+
+            if (bindingNS)
+                global << "}\n\n";
+            global << "#endif\n";
+            global.close();
+        }
+
+        // Write out the implementation.
+        {
+            string path = _outDir + string(LUA_GLOBAL_FILENAME) + string(".cpp");
+            ofstream global(path.c_str());            
+            global << "#include \"ScriptController.h\"\n";
+            global << "#include \"" << LUA_GLOBAL_FILENAME << ".h\"\n";
+            map<string, set<string> >::iterator iter = _includes.find(string(LUA_GLOBAL_FILENAME) + string(".h"));
+            if (iter != _includes.end())
+            {
+                set<string>::iterator includeIter = iter->second.begin();
+                for (; includeIter != iter->second.end(); includeIter++)
+                {
+                    global << "#include \"" << *includeIter << "\"\n";
+                }
+            }
+            global << "\n";
+
+            if (bindingNS)
+            {
+                global << "namespace " << *bindingNS << "\n";
+                global << "{\n\n";
+            }
+
+            // Write out the function used to register all global bindings with Lua.
+            global << "void luaRegister_" << LUA_GLOBAL_FILENAME << "()\n";
+            global << "{\n";
+        
+            if (generateGlobalFunctionBindings)
+            {
+                // Bind the non-member functions.
+                for (map<string, vector<FunctionBinding> >::iterator iter = _functions.begin(); iter != _functions.end(); iter++)
+                {
+                    if (generatingGameplay || (!generatingGameplay &&  _namespaces["gameplay"].find(iter->second[0].name) == _namespaces["gameplay"].end()))
+                        global << "    ScriptUtil::registerFunction(\"" << iter->second[0].name << "\", " << iter->second[0].getFunctionName() << ");\n";
+                }
+            }
+
+            // Generate the hierarchy map.
+            if (baseClasses.size() > 0)
+            {
+                for (unsigned int i = 0, count = baseClasses.size(); i < count; i++)
+                {
+                    set<string> derived;
+                    getAllDerived(derived, baseClasses[i]);
+                    for (set<string>::iterator iter = derived.begin(); iter != derived.end(); iter++)
+                    {
+                        if (generatingGameplay || (!generatingGameplay &&  _namespaces["gameplay"].find(*iter) == _namespaces["gameplay"].end()))
+                            global << "    ScriptUtil::setGlobalHierarchyPair(\"" << baseClasses[i] << "\", \"" << *iter << "\");\n";
+                    }
+                }
+            }
+
+            // Register all enums.
+            if (generateEnumBindings)
+            {
+                global << "    ScriptUtil::addStringFromEnumConversionFunction(&";
+                if (bindingNS)
+                    global << *bindingNS << "::";
+                global << "lua_stringFromEnumGlobal);\n";
+
+                for (map<string, EnumBinding>::iterator iter = _enums.begin(); iter != _enums.end(); iter++)
+                {
+                    if (generatingGameplay || (!generatingGameplay &&  _namespaces["gameplay"].find(iter->first) == _namespaces["gameplay"].end()))
+                    {
+                        global << "\n    // Register enumeration " << iter->first << ".\n";
+                        global << "    {\n";
+
+                        global << "        std::vector<std::string> scopePath;\n";
+                        for (unsigned int i = 0; i < iter->second.scopePath.size(); i++)
+                        {
+                            global << "        scopePath.push_back(\"" << iter->second.scopePath[i] << "\");\n";
+                        }
+
+                        vector<string>::iterator enumIter = iter->second.values.begin();
+                        for (; enumIter != iter->second.values.end(); enumIter++)
+                        {
+                            global << "        ScriptUtil::registerConstantString(\"" << *enumIter << "\", \"" << *enumIter << "\", scopePath);\n";
+                        }
+
+                        global << "    }\n";
+                    }
+                }
+            }
+            global << "}\n\n";
+            
+            // Write out the binding functions.
+            if (generateGlobalFunctionBindings)
+            {
+                for (map<string, vector<FunctionBinding> >::iterator iter = _functions.begin(); iter != _functions.end(); iter++)
+                {
+                    if (generatingGameplay || (!generatingGameplay &&  _namespaces["gameplay"].find(iter->second[0].name) == _namespaces["gameplay"].end()))
+                        FunctionBinding::write(global, iter->second);
+                }
+            }
+
+            // Write out the global enum conversion function (used to pass enums from C++ to Lua).
+            if (generateEnumBindings)
+            {
+                global << "static const char* enumStringEmpty = \"\";\n\n";
+                global << "const char* lua_stringFromEnumGlobal(std::string& enumname, unsigned int value)\n";
+                global << "{\n";
+                for (map<string, EnumBinding>::iterator iter = _enums.begin(); iter != _enums.end(); iter++)
+                {
+                    if (generatingGameplay || (!generatingGameplay &&  _namespaces["gameplay"].find(iter->first) == _namespaces["gameplay"].end()))
+                    {
+                        global << "    if (enumname == \"";
+                        global << iter->first << "\")\n";
+                        global << "        return lua_stringFromEnum_" << getUniqueName(iter->first) << "((" << iter->first << ")value);\n";
+                    }
+                }
+                global << "\n";
+                global << "    GP_ERROR(\"Unrecognized enumeration type '%s'.\", enumname.c_str());\n";
+                global << "    return enumStringEmpty;\n";
+                global << "}\n\n";
+            }
+
+            if (bindingNS)
+                global << "}\n";
+            global.close();
+        }
+    }
+
+    luaAllCpp << "}\n\n";
+    if (bindingNS)
+        luaAllCpp << "}\n\n";
+    luaAllCpp.close();
+
+    if (bindingNS)
+    {
+        luaAllH << "\nnamespace " << *bindingNS << "\n";
+        luaAllH << "{\n\n";
+    }
+    luaAllH << "void lua_RegisterAllBindings();\n\n";
+    if (bindingNS)
+        luaAllH<< "}\n\n";
+    luaAllH << "#endif\n";
+    luaAllH.close();
+}
+
+void Generator::getAllDerived(set<string>& derived, string classname)
+{
+    for (unsigned int i = 0, count = _classes[classname].derived.size(); i < count; i++)
+    {
+        // If the derived class is not in the ref ID table, then it
+        // is a hidden (protected, private, etc.) class, so don't include it.
+        if (_refIds.find(_classes[classname].derived[i]) != _refIds.end())
+        {
+            string derivedClassName = getIdentifier(_classes[classname].derived[i]);
+            derived.insert(derivedClassName);
+            getAllDerived(derived, derivedClassName);
+        }
+    }
+}
+
+void Generator::getIncludes(XMLElement* e, string filename)
+{
+    filename.replace(filename.find(".cpp"), 4, ".h");
+    for (e = e->FirstChildElement("includes"); e; e = e->NextSiblingElement("includes"))
+    {
+        if (e->Attribute("refid"))
+            _includes[filename].insert(e->GetText());
+    }
+}
+
+// ----------------------------------------------------------------------------
+// Utility functions
+
+static string trim(const string& str)
+{
+    string s = str;
+    while (isspace(s[0]))
+    {
+        s.erase(s.begin());
+    }
+    while (isspace(s[s.size() - 1]))
+    {
+        s.erase(s.begin() + s.size() - 1);
+    }
+    return s;
+}
+
+static string stripTypeQualifiers(const string& typeStr, FunctionBinding::Param::Kind& kind)
+{
+    string type = typeStr;
+    kind = FunctionBinding::Param::KIND_VALUE;
+
+    // Check if the type is a reference.
+    string::size_type i = type.find("&");
+    if (i != type.npos)
+    {
+        kind = FunctionBinding::Param::KIND_REFERENCE;
+        type.erase(type.begin() + i);
+    }
+
+    // Check if the type is a pointer.
+    i = type.find("*");
+    if (i != type.npos)
+    {
+        kind = FunctionBinding::Param::KIND_POINTER;
+        type.erase(type.begin() + i);
+    }
+
+    // Ignore const qualifiers.
+    i = type.find("const ");
+    if (i != type.npos)
+    {
+        type.erase(type.begin() + i, type.begin() + i + 6);
+    }
+
+    return trim(type);
+}
+
+static inline bool isWantedFileNormal(const string& s)
+{
+    if (s.find(".xml") == s.size() - 4)
+    {
+        if (s.find("class") == 0 || s.find("struct") == 0 || 
+            (s.find("_") == 0 && (s.find("h.xml") != s.npos || s.find("cpp.xml") != s.npos)))
+            return true;
+    }
+    return false;
+}
+
+static inline bool isNamespaceFile(const string& s)
+{
+    if (s.find(".xml") == s.size() - 4)
+    {
+        if (s.find("namespace") == 0)
+            return true;
+    }
+    return false;
+}
+
+static inline bool isGeneratedBindingFile(const string& s)
+{
+    return ( (s.find(".cpp") == s.size() - 4) || (s.find(".h") == s.size() - 2) );
+}
+
+static bool getFileList(string directory, vector<string>& files, bool (*isWantedFile)(const string& s))
+{
+#ifdef WIN32
+    string path = directory + string("/*");
+
+    // Convert char to wchar.
+    basic_string<TCHAR> wPath;
+    wPath.assign(path.begin(), path.end());
+
+    WIN32_FIND_DATA FindFileData;
+    HANDLE hFind = FindFirstFile(wPath.c_str(), &FindFileData);
+    if (hFind == INVALID_HANDLE_VALUE) 
+    {
+        return false;
+    }
+    do
+    {
+        // Add to the list if this is not a directory and it passes the test function.
+        if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
+        {
+            // Convert wchar to char.
+            basic_string<TCHAR> wfilename(FindFileData.cFileName);
+            string filename;
+            filename.assign(wfilename.begin(), wfilename.end());
+
+            if (isWantedFile(filename))
+            {
+                filename = string(directory) + string("/") + filename;
+                files.push_back(filename);
+            }
+        }
+    } while (FindNextFile(hFind, &FindFileData) != 0);
+
+    FindClose(hFind);
+    return true;
+#else
+    string path = directory + string("/.");
+    struct dirent* dp;
+    DIR* dir = opendir(path.c_str());
+    if (!dir)
+    {
+        return false;
+    }
+    while ((dp = readdir(dir)) != NULL)
+    {
+        string filepath(path);
+        filepath.append("/");
+        filepath.append(dp->d_name);
+
+        struct stat buf;
+        if (!stat(filepath.c_str(), &buf))
+        {
+            // Add to the list if this is not a directory and it passes the test function.
+            if (!S_ISDIR(buf.st_mode))
+            {
+                string filename = dp->d_name;
+                if (isWantedFile(filename))
+                {
+                    filename = string(directory) + string("/") + filename;
+                    files.push_back(filename);
+                }
+            }
+        }
+    }
+    closedir(dir);
+    return true;
+#endif
+}
+
+bool isReservedKeyword(string name)
+{
+    static set<string> keywords;
+    if (keywords.size() == 0)
+    {
+        keywords.insert("and");
+        keywords.insert("break");
+        keywords.insert("do");
+        keywords.insert("else");
+        keywords.insert("elseif");
+        keywords.insert("end");
+        keywords.insert("false");
+        keywords.insert("for");
+        keywords.insert("function");
+        keywords.insert("if");
+        keywords.insert("in");
+        keywords.insert("local");
+        keywords.insert("nil");
+        keywords.insert("not");
+        keywords.insert("or");
+        keywords.insert("repeat");
+        keywords.insert("return");
+        keywords.insert("then");
+        keywords.insert("true");
+        keywords.insert("until");
+        keywords.insert("while");
+    };
+
+    return keywords.find(name) != keywords.end();
+}
+
+// ----------------------------------------------------------------------------

+ 207 - 0
gameplay-luagen/src/Generator.h

@@ -0,0 +1,207 @@
+#ifndef GENERATOR_H_
+#define GENERATOR_H_
+
+#include "Base.h"
+#include "ClassBinding.h"
+#include "EnumBinding.h"
+#include "FunctionBinding.h"
+#include "Generator.h"
+#include "TypedefBinding.h"
+
+#include <tinyxml2.h>
+using namespace tinyxml2;
+
+/**
+ * Generates script bindings.
+ */
+class Generator
+{
+public:
+
+    /**
+     * Retrieves the global instance of the generator.
+     * 
+     * @return The global instance of the generator.
+     */
+    static Generator* getInstance();
+
+    /**
+     * Releases the global instance of the generator.
+     */
+    static void releaseInstance();
+
+    /**
+     * Retrieves the unique name for the given identifier (class, struct, enum, etc.).
+     * 
+     * @param name The identifier's name.
+     * @return The unique name.
+     */
+    static string getUniqueName(string name);
+
+    /**
+     * Retrieves the unique name for the given ref id.
+     * 
+     * @param refId The ref id.
+     * @return The unique name.
+     */
+    string getUniqueNameFromRef(string refId);
+
+    /**
+     * Gets the scope path for a given fully resolved classname.
+     * 
+     * @param classname The class name.
+     * @param ns The namespace of the class if it has one.
+     * @return The scope path.
+     */
+    static vector<string> getScopePath(string classname, string ns = string());
+
+    /**
+     * Retrieves the class/struct/enum name for the given ref id.
+     * 
+     * @param refId The ref id.
+     * @return The class/struct/enum name.
+     */
+    string getIdentifier(string refId);
+
+    /**
+     * Gets the given class name (without the namespace) and stores the class's namespace in the given string pointer (if non-null).
+     * 
+     * @param classname The fully qualified name of the class.
+     * @param ns Output variable for the namespace of the class.
+     * @return The class name without the namespace.
+     */
+    string getClassNameAndNamespace(string classname, string* ns);
+
+    /**
+     * Sets the given ref id and class/struct/enum name pair.
+     * 
+     * @param refId The ref id.
+     * @param classname The class/struct/enum name.
+     */
+    void setIdentifier(string refId, string classname);
+
+    /**
+     * Generates Lua bindings for all classes defined within the given input directory
+     * and places the generated class bindings in the given output directory.
+     * Note that the input directory must point to a folder containing the Doxygen XML 
+     * output files for the classes that the user wants to generate bindings for.
+     * 
+     * @param inDir The input directory (must contain Doxygen XML output files).
+     * @param outDir The output directory.
+     * @param bindingNS The namespace to generate the bindings within.
+     */
+    void run(string inDir, string outDir, string* bindingNS = NULL);
+
+    /**
+     * Retrieves whether the given class is derived from Ref.
+     * 
+     * @param classname The name of the class.
+     * @return True if the class is derived from Ref; false otherwise.
+     */
+    bool isRef(string classname);
+
+protected:
+    /**
+     * Constructor.
+     */
+    Generator();
+
+    /**
+     * Destructor.
+     */
+    ~Generator();
+
+    // Checks if the given class name specifies a class derived from the class represented by the given class binding.
+    bool isDerived(const ClassBinding& c, string classname);
+
+    // Gets the name of the namespace, file, class, or struct.
+    string getCompoundName(XMLElement* node);
+
+    // Parses the non-member functions and adds them to the list (optionally within the given namespace).
+    void getFunctions(XMLElement* classNode, string ns = "");
+
+    // Parses the namespace (with the given name).
+    void getNamespace(XMLElement* nsNode, const string& name);
+
+    // Parses the class (with the given name) and adds it to the list.
+    void getClass(XMLElement* classNode, const string& name);
+
+    // Parses all enumerations within a file (optionally within a namespace).
+    void getEnums(XMLElement* fileNode, string ns = "");
+    
+    // Parses the enumeration type and adds it to the global list.
+    void getEnum(XMLElement* e, string classname = "", string ns = "", string include = "");
+
+    // Parses all typedefs within a file (optionall within a namespace).
+    void getTypedefs(XMLElement* fileNode, string ns = "");
+
+    // Parses the typedef and adds it to the global list.
+    void getTypedef(XMLElement* e, string classname = "", string ns = "");
+
+    // Gets the script flag if it is specified.
+    string getScriptFlag(XMLElement* e);
+
+    // Gets whether the current function has been marked as a creation function
+    // (indicating that the return value is owned by the script runtime and not C++).
+    void getCreateFlag(XMLElement* e, FunctionBinding& b);
+
+    // Gets the name of the binding.
+    string getName(XMLElement* e);
+
+    // Gets whether the type is const or not.
+    bool getIsConstType(XMLElement* e);
+
+    // Gets the parameter or return value, optionally within the scope of the given class.
+    FunctionBinding::Param getParam(XMLElement* e, bool isVariable = false,  string classname = "");
+
+    // Gets all of the parameters for a function.
+    void getParams(XMLElement* e, FunctionBinding& b);
+
+    // Resolves members for all classes' derived from class 'c'.
+    void resolveMembers(const ClassBinding& c);
+
+    // Resolves the inheritance.
+    void resolveInheritance();
+
+    // Resolves includes for all classes' derived from class 'c'.
+    void resolveIncludes(const ClassBinding& c);
+
+    // Resolves inherited include files.
+    void resolveInheritedIncludes();
+
+    // Resolves the type for a single parameter/return value 
+    // (also takes the function that the parameter/return value is for along
+    // with the header file that the parameter/return value belongs to-the original
+    // class header file for class bindings or the global Lua bindings header file
+    // for global bindings).
+    void resolveType(FunctionBinding::Param* param, string functionName, string header);
+
+    // Resolves all unrecognized types.
+    void resolveTypes();
+
+    // Generates the bindings to C++ header and source files.
+    void generateBindings(string* bindingNS);
+    
+    // Gets the set off all classes that derives from the given class.
+    void getAllDerived(set<string>& derived, string classname);
+
+    // Gets the included files for a cpp file.
+    void getIncludes(XMLElement* e, string filename);
+
+private:
+    static Generator* __instance;
+
+    const char* _file;
+    map<string, string> _refIds;
+    string _outDir;
+    map<string, ClassBinding> _classes;
+    vector<string> _topLevelBaseClasses;
+    map<string, set<string> > _includes;
+    map<string, vector<FunctionBinding> > _functions;
+    map<string, EnumBinding> _enums;
+    map<string, set<string> > _namespaces;
+    map<string, TypedefBinding> _typedefs;
+    set<string> __warnings;
+};
+
+#endif

+ 16 - 0
gameplay-luagen/src/TypedefBinding.h

@@ -0,0 +1,16 @@
+#ifndef TYPEDEFBINDING_H_
+#define TYPEDEFBINDING_H_
+
+/**
+ * Represents a typedef.
+ * 
+ * Note: the name of the typedef is stored as the key in the 
+ * map containing all typedefs. The refId member is set if
+ * the typedef is a class, struct, or enumerated type.
+ */
+struct TypedefBinding
+{
+    string refId;
+};
+
+#endif

+ 42 - 0
gameplay-luagen/src/main.cpp

@@ -0,0 +1,42 @@
+#include "Base.h"
+#include "Generator.h"
+
+//TRACK_MEMORY();
+
+void printError(const char* format, ...)
+{
+    va_list argptr;
+    va_start(argptr, format);
+#ifdef WIN32
+    int sz = vfprintf(stderr, format, argptr);
+    if (sz > 0)
+    {
+        char* buf = new char[sz + 1];
+        vsprintf(buf, format, argptr);
+        buf[sz] = 0;
+        OutputDebugStringA(buf);
+        SAFE_DELETE_ARRAY(buf);
+    }
+#else
+    vfprintf(stderr, format, argptr);
+#endif
+    va_end(argptr);
+}
+
+int main(int argc, char** argv)
+{
+    // Ensure the user is calling the program correctly.
+    if (argc < 2 || argc > 4)
+    {
+        GP_ERROR("Usage: gameplay-luagen <doxygen-xml-input-directory> [output-directory] [binding-namespace]");
+    }
+
+    // Generate the bindings.
+    string* bindingNS = (argc >= 4) ? new string(argv[3]) : NULL;
+    Generator::getInstance()->run(argv[1], (argc >= 3) ? argv[2] : argv[1], bindingNS);
+    Generator::releaseInstance();
+    SAFE_DELETE(bindingNS);
+
+    system("pause");
+    return 0;
+}

+ 5 - 1
gameplay-newproject.sh

@@ -145,7 +145,11 @@ common_path=$projPath
 back=
 while [ "${gpPathAbs#$common_path}" = "${gpPathAbs}" ]; do
 	common_path=$(dirname $common_path)
-	back="../${back}"
+	if [ -z "$back" ]; then
+		back=".."
+	else
+		back="../${back}"
+	fi
 done
 gpPath=${back}${gpPathAbs#$common_path/}
 if [[ ${gpPathAbs} == ${common_path} ]]; then

+ 10 - 2
gameplay-template/android/jni/template.Android.mk

@@ -16,6 +16,7 @@
 SAMPLE_PATH := $(call my-dir)/../../src
 LIBPNG_PATH := ../GAMEPLAY_PATH/external-deps/libpng/lib/android/arm
 ZLIB_PATH := ../GAMEPLAY_PATH/external-deps/zlib/lib/android/arm
+LUA_PATH := ../GAMEPLAY_PATH/external-deps/lua/lib/android/arm
 BULLET_PATH := ../GAMEPLAY_PATH/external-deps/bullet/lib/android/arm
 VORBIS_PATH := ../GAMEPLAY_PATH/external-deps/oggvorbis/lib/android/arm
 OPENAL_PATH := ../GAMEPLAY_PATH/external-deps/openal/lib/android/arm
@@ -41,6 +42,13 @@ LOCAL_MODULE    := libzlib
 LOCAL_SRC_FILES := libzlib.a
 include $(PREBUILT_STATIC_LIBRARY)
 
+# liblua
+LOCAL_PATH := $(LUA_PATH)
+include $(CLEAR_VARS)
+LOCAL_MODULE    := liblua
+LOCAL_SRC_FILES := liblua.a
+include $(PREBUILT_STATIC_LIBRARY)
+
 # libbullet
 LOCAL_PATH := $(BULLET_PATH)
 include $(CLEAR_VARS)
@@ -70,9 +78,9 @@ LOCAL_MODULE    := TEMPLATE_PROJECT
 LOCAL_SRC_FILES := ../GAMEPLAY_PATH/gameplay/src/gameplay-main-android.cpp TemplateGame.cpp
 
 LOCAL_LDLIBS    := -llog -landroid -lEGL -lGLESv2 -lOpenSLES
-LOCAL_CFLAGS    := -D__ANDROID__ -I"../GAMEPLAY_PATH/external-deps/bullet/include" -I"../GAMEPLAY_PATH/external-deps/libpng/include" -I"../GAMEPLAY_PATH/external-deps/oggvorbis/include" -I"../GAMEPLAY_PATH/external-deps/openal/include" -I"../GAMEPLAY_PATH/gameplay/src"
+LOCAL_CFLAGS    := -D__ANDROID__ -Wno-psabi -I"../GAMEPLAY_PATH/external-deps/lua/include" -I"../GAMEPLAY_PATH/external-deps/bullet/include" -I"../GAMEPLAY_PATH/external-deps/libpng/include" -I"../GAMEPLAY_PATH/external-deps/oggvorbis/include" -I"../GAMEPLAY_PATH/external-deps/openal/include" -I"../GAMEPLAY_PATH/gameplay/src"
 
-LOCAL_STATIC_LIBRARIES := android_native_app_glue libgameplay libpng libzlib libbullet libvorbis libOpenAL
+LOCAL_STATIC_LIBRARIES := android_native_app_glue libgameplay libpng libzlib liblua libbullet libvorbis libOpenAL
 
 include $(BUILD_SHARED_LIBRARY)
 $(call import-module,android/native_app_glue)

+ 2 - 2
gameplay-template/android/template.build.xml

@@ -64,8 +64,8 @@
     <target name="-post-compile">
         <copy file="../res/box.gpb" tofile="assets/res/box.gpb"/>
         <copy file="../res/box.material" tofile="assets/res/box.material"/>
-        <copy file="../res/colored.vsh" tofile="assets/res/colored.vsh"/>
-        <copy file="../res/colored.fsh" tofile="assets/res/colored.fsh"/>
+        <copy file="../res/colored.vert" tofile="assets/res/colored.vert"/>
+        <copy file="../res/colored.frag" tofile="assets/res/colored.frag"/>
     </target>
 
     <!-- Import the actual build file.

+ 11 - 11
gameplay-template/gameplay-template.vcxproj

@@ -74,15 +74,15 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/lua/include;GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/bullet/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;GAMEPLAY_PATH/external-deps/oggvorbis/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/lua/lib/win32;GAMEPLAY_PATH/external-deps/bullet/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;GAMEPLAY_PATH/external-deps/oggvorbis/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     <PostBuildEvent>
       <Command>
@@ -104,7 +104,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;GAMEPLAY_MEM_LEAK_DETECTION;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/lua/include;GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <ShowIncludes>false</ShowIncludes>
       <PreprocessToFile>false</PreprocessToFile>
@@ -113,8 +113,8 @@
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/bullet/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;GAMEPLAY_PATH/external-deps/oggvorbis/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/lua/lib/win32;GAMEPLAY_PATH/external-deps/bullet/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;GAMEPLAY_PATH/external-deps/oggvorbis/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     <PostBuildEvent>
       <Command>
@@ -138,15 +138,15 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/lua/include;GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/bullet/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;GAMEPLAY_PATH/external-deps/oggvorbis/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/lua/lib/win32;GAMEPLAY_PATH/external-deps/bullet/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;GAMEPLAY_PATH/external-deps/oggvorbis/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     <PostBuildEvent>
       <Command>
@@ -169,8 +169,8 @@
     <None Include="res\box.dae" />
     <None Include="res\box.gpb" />
     <None Include="res\box.material" />
-    <None Include="res\colored.fsh" />
-    <None Include="res\colored.vsh" />
+    <None Include="res\colored.frag" />
+    <None Include="res\colored.vert" />
   </ItemGroup> 
   <ItemGroup>
     <ClCompile Include="src\TemplateGame.cpp" />

+ 2 - 2
gameplay-template/gameplay-template.vcxproj.filters

@@ -18,10 +18,10 @@
     <None Include="res\box.material">
       <Filter>res</Filter>
     </None>
-    <None Include="res\colored.fsh">
+    <None Include="res\colored.frag">
       <Filter>res</Filter>
     </None>
-    <None Include="res\colored.vsh">
+    <None Include="res\colored.vert">
       <Filter>res</Filter>
     </None>
   </ItemGroup>

+ 3 - 3
gameplay-template/gameplay-template.vcxproj.user

@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;</LocalDebuggerEnvironment>
+    <LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/bin/win32;</LocalDebuggerEnvironment>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-	<LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;</LocalDebuggerEnvironment>
+	<LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/bin/win32;</LocalDebuggerEnvironment>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|Win32'">
-    <LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/external-deps/zlib/lib/win32;GAMEPLAY_PATH/external-deps/libpng/lib/win32;GAMEPLAY_PATH/external-deps/glew/lib/win32;GAMEPLAY_PATH/external-deps/openal/lib/win32;</LocalDebuggerEnvironment>
+    <LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/bin/win32;</LocalDebuggerEnvironment>
 	<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
   </PropertyGroup>
 </Project>

+ 4 - 0
gameplay-template/gameplay-template.xcodeproj/project.pbxproj

@@ -434,6 +434,7 @@
 					"GAMEPLAY_PATH/external-deps/libpng/include",
 					"GAMEPLAY_PATH/external-deps/bullet/include",
 					"GAMEPLAY_PATH/external-deps/oggvorbis/include",
+					"GAMEPLAY_PATH/external-deps/lua/include",
 				);
 				INFOPLIST_FILE = "TEMPLATE_PROJECT-macosx.plist";
 				LIBRARY_SEARCH_PATHS = (
@@ -460,6 +461,7 @@
 					"GAMEPLAY_PATH/external-deps/libpng/include",
 					"GAMEPLAY_PATH/external-deps/bullet/include",
 					"GAMEPLAY_PATH/external-deps/oggvorbis/include",
+					"GAMEPLAY_PATH/external-deps/lua/include",
 				);
 				INFOPLIST_FILE = "TEMPLATE_PROJECT-macosx.plist";
 				LIBRARY_SEARCH_PATHS = (
@@ -487,6 +489,7 @@
 					"GAMEPLAY_PATH/external-deps/libpng/include",
 					"GAMEPLAY_PATH/external-deps/bullet/include",
 					"GAMEPLAY_PATH/external-deps/oggvorbis/include",
+					"GAMEPLAY_PATH/external-deps/lua/include",
 				);
 				INFOPLIST_FILE = "TEMPLATE_PROJECT-ios.plist";
                 IPHONEOS_DEPLOYMENT_TARGET = 5.1;
@@ -516,6 +519,7 @@
 					"GAMEPLAY_PATH/external-deps/libpng/include",
 					"GAMEPLAY_PATH/external-deps/bullet/include",
 					"GAMEPLAY_PATH/external-deps/oggvorbis/include",
+					"GAMEPLAY_PATH/external-deps/lua/include",
 				);
 				INFOPLIST_FILE = "TEMPLATE_PROJECT-ios.plist";
                 IPHONEOS_DEPLOYMENT_TARGET = 5.1;

+ 2 - 2
gameplay-template/res/box.material

@@ -5,8 +5,8 @@ material box
         pass
         {
             // shaders
-            vertexShader = res/colored.vsh
-            fragmentShader = res/colored.fsh
+            vertexShader = res/colored.vert
+            fragmentShader = res/colored.frag
             
             // uniforms
             u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX

+ 35 - 0
gameplay-template/res/colored.frag

@@ -0,0 +1,35 @@
+#ifdef OPENGL_ES
+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
+
+// Inputs
+varying vec3 v_normalVector;                    // Normal vector in view space.
+
+void main()
+{
+	// Base color
+    vec4 baseColor = u_diffuseColor;
+
+    // Normalize the vectors.
+    vec3 lightDirection = normalize(u_lightDirection);
+    vec3 normalVector = normalize(v_normalVector);
+
+    // Ambient
+    vec3 ambientColor = baseColor.rgb * u_ambientColor;
+
+    // Diffuse
+	float attenuation = 1.0;
+    float ddot = dot(normalVector, lightDirection);
+    float intensity =  max(0.0, attenuation * ddot);
+    vec3 diffuseColor = u_lightColor * baseColor.rgb * intensity;
+
+    // Light the pixel
+    gl_FragColor.a = baseColor.a;
+    gl_FragColor.rgb = ambientColor + diffuseColor;
+}

+ 0 - 111
gameplay-template/res/colored.fsh

@@ -1,111 +0,0 @@
-#ifdef OPENGL_ES
-precision highp float;
-#endif
-
-// Uniforms
-uniform vec3 u_lightColor;                      // Light color
-uniform vec3 u_ambientColor;                    // Ambient color
-uniform vec4 u_diffuseColor;                    // Diffuse color
-#if defined(GLOBAL_ALPHA)
-uniform float u_globalAlpha;                    // Global alpha value
-#endif
-
-// Inputs
-varying vec3 v_normalVector;                    // NormalVector in view space.
-
-// Global variables
-vec4 _baseColor;                                // Base color
-vec3 _ambientColor;                             // Ambient Color
-vec3 _diffuseColor;                             // Diffuse Color
-
-void lighting(vec3 normalVector, vec3 lightDirection, float attenuation)
-{
-    // Ambient
-    _ambientColor = _baseColor.rgb * u_ambientColor;
-
-    // Diffuse
-    float ddot = dot(normalVector, lightDirection);
-    float diffuseIntensity = attenuation * ddot;
-    diffuseIntensity = max(0.0, diffuseIntensity);
-    _diffuseColor = u_lightColor * _baseColor.rgb * diffuseIntensity;
-}
-
-#if defined(POINT_LIGHT)
-
-varying vec4 v_vertexToPointLightDirection;     // Light direction w.r.t current vertex.
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    
-    vec3 vertexToPointLightDirection = normalize(v_vertexToPointLightDirection.xyz);
-    
-    // Fetch point light attenuation.
-    float pointLightAttenuation = v_vertexToPointLightDirection.w;
-    lighting(normalVector, vertexToPointLightDirection, pointLightAttenuation);
-}
-
-#elif defined(SPOT_LIGHT)
-
-uniform vec3 u_spotLightDirection;              // Direction of the 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]
-varying vec3 v_vertexToSpotLightDirection;      // Light direction w.r.t current vertex.
-varying float v_spotLightAttenuation;           // Attenuation of spot light.
-
-float lerpstep( float lower, float upper, float s)
-{
-    return clamp( ( s - lower ) / ( upper - lower ), 0.0, 1.0 );
-}
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    vec3 spotLightDirection = u_spotLightDirection; 
-    vec3 vertexToSpotLightDirection = normalize(v_vertexToSpotLightDirection);
-
-    // "-lightDirection" is used because light direction points in opposite direction to
-    // to spot direction.
-    // Calculate spot light effect.
-    float spotCurrentAngleCos = max(0.0, dot(spotLightDirection, -vertexToSpotLightDirection));
-
-    // Intensity of spot depends on the spot light attenuation and the 
-    // part of the cone vertexToSpotLightDirection points to (inner or outer).
-    float spotLightAttenuation = clamp(v_spotLightAttenuation, 0.0, 1.0);
-    spotLightAttenuation *= lerpstep(u_spotLightOuterAngleCos, u_spotLightInnerAngleCos, spotCurrentAngleCos);
-
-    lighting(normalVector, vertexToSpotLightDirection, spotLightAttenuation);
-}
-
-#else
-
-uniform vec3 u_lightDirection;       	        // Light direction
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    vec3 lightDirection = normalize(u_lightDirection);
-
-    lighting(normalVector, -lightDirection, 1.0);
-}
-#endif
-
-void main()
-{
-    // Fetch diffuse color from texture.
-    _baseColor = u_diffuseColor;
-
-    // Apply light
-    applyLight();
-
-    // Light the pixel
-    gl_FragColor.a = _baseColor.a;
-    gl_FragColor.rgb = _ambientColor + _diffuseColor;
-
-#if defined(GLOBAL_ALPHA)
-    gl_FragColor.a *= u_globalAlpha;
-#endif
-}

+ 24 - 0
gameplay-template/res/colored.vert

@@ -0,0 +1,24 @@
+// Inputs
+attribute vec4 a_position;                          // Vertex Position (x, y, z, w)
+attribute vec3 a_normal;                            // Vertex Normal (x, y, z)
+
+// 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.
+
+// Outputs
+varying vec3 v_normalVector;                        // Normal vector in view space.
+
+void main()
+{
+	// Vertex attributes
+    vec4 position = a_position;
+    vec3 normal = a_normal;
+        
+    // Transform position to clip space.
+    gl_Position = u_worldViewProjectionMatrix * position;
+
+    // Transform normal to view space.
+    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldViewMatrix[0].xyz, u_inverseTransposeWorldViewMatrix[1].xyz, u_inverseTransposeWorldViewMatrix[2].xyz);
+    v_normalVector = inverseTransposeWorldViewMatrix * normal;
+}

+ 0 - 183
gameplay-template/res/colored.vsh

@@ -1,183 +0,0 @@
-// 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.
-
-// Inputs
-attribute vec4 a_position;                          // Vertex Position (x, y, z, w)
-attribute vec3 a_normal;                            // Vertex Normal (x, y, z)
-
-// Outputs
-varying vec3 v_normalVector;                        // NormalVector in view space.
-
-#if defined(SKINNING)
-
-attribute vec4 a_blendWeights;
-attribute vec4 a_blendIndices;
-
-// 32 4x3 matrices as an array of floats
-uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];
-
-// Common vectors.
-vec4 _skinnedPosition;
-vec3 _skinnedNormal;
-
-void skinPosition(float blendWeight, int matrixIndex)
-{
-    vec4 tmp;
-
-    tmp.x = dot(a_position, u_matrixPalette[matrixIndex]);
-    tmp.y = dot(a_position, u_matrixPalette[matrixIndex + 1]);
-    tmp.z = dot(a_position, u_matrixPalette[matrixIndex + 2]);
-    tmp.w = a_position.w;
-
-    _skinnedPosition += blendWeight * tmp;
-}
-
-vec4 getPosition()
-{
-    _skinnedPosition = vec4(0.0);
-
-    // Transform position to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    return _skinnedPosition;    
-}
-
-void skinNormal(float blendWeight, int matrixIndex)
-{
-    vec3 tmp;
-
-    tmp.x = dot(a_normal, u_matrixPalette[matrixIndex].xyz);
-    tmp.y = dot(a_normal, u_matrixPalette[matrixIndex + 1].xyz);
-    tmp.z = dot(a_normal, u_matrixPalette[matrixIndex + 2].xyz);
-
-    _skinnedNormal += blendWeight * tmp;
-}
-
-vec3 getNormal()
-{
-    _skinnedNormal = vec3(0.0);
-
-    // Transform normal to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    return _skinnedNormal;
-}
-
-#else
-
-vec4 getPosition()
-{
-    return a_position;    
-}
-
-vec3 getNormal()
-{
-    return a_normal;
-}
-
-#endif
-
-#if defined(POINT_LIGHT)
-
-uniform mat4 u_worldViewMatrix;                     // Matrix to tranform a position to view space.
-uniform vec3 u_pointLightPosition;                  // Position
-uniform float u_pointLightRangeInverse;             // Inverse of light range.
-varying vec4 v_vertexToPointLightDirection;         // Light direction w.r.t current vertex.
-
-void applyLight(vec4 position)
-{
-    vec4 positionWorldViewSpace = u_worldViewMatrix * position;
-    
-    // Compute the light direction.
-    vec3 lightDirection = u_pointLightPosition - positionWorldViewSpace.xyz;
-    
-    vec4 vertexToPointLightDirection;
-    vertexToPointLightDirection.xyz = lightDirection;
-    
-    // Attenuation.
-    vertexToPointLightDirection.w = 1.0 - dot(lightDirection * u_pointLightRangeInverse, lightDirection * u_pointLightRangeInverse);
-
-    // Output light direction.
-    v_vertexToPointLightDirection =  vertexToPointLightDirection;
-}
-
-#elif defined(SPOT_LIGHT)
-
-uniform mat4 u_worldViewMatrix;                     // Matrix to tranform a position to view space.
-uniform vec3 u_spotLightPosition;                   // Position
-uniform float u_spotLightRangeInverse;              // Inverse of light range.
-varying vec3 v_vertexToSpotLightDirection;          // Light direction w.r.t current vertex.
-varying float v_spotLightAttenuation;               // Attenuation of spot light.
-
-void applyLight(vec4 position)
-{
-    vec4 positionWorldViewSpace = u_worldViewMatrix * position;
-
-    // Compute the light direction.
-    vec3 lightDirection = u_spotLightPosition - positionWorldViewSpace.xyz;
-
-    // Attenuation
-    v_spotLightAttenuation = 1.0 - dot(lightDirection * u_spotLightRangeInverse, lightDirection * u_spotLightRangeInverse);
-
-    // Output light direction.
-    v_vertexToSpotLightDirection = lightDirection;
-}
-
-#else
-
-void applyLight(vec4 position)
-{
-}
-
-#endif
-
-void main()
-{
-    vec4 position = getPosition();
-    vec3 normal = getNormal();
-        
-    // Transform position to clip space.
-    gl_Position = u_worldViewProjectionMatrix * position;
-
-    // Transform normal to view space.
-    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldViewMatrix[0].xyz,
-                                                u_inverseTransposeWorldViewMatrix[1].xyz,
-                                                u_inverseTransposeWorldViewMatrix[2].xyz);
-    v_normalVector = inverseTransposeWorldViewMatrix * normal;
-
-    // Apply light.
-    applyLight(position);
-}

+ 17 - 2
gameplay-template/src/TemplateGame.cpp

@@ -26,6 +26,8 @@ void TemplateGame::initialize()
     Node* boxNode = _scene->findNode("box");
     Model* boxModel = boxNode->getModel();
     Material* boxMaterial = boxModel->setMaterial("res/box.material");
+	boxMaterial->getParameter("u_ambientColor")->setValue(_scene->getAmbientColor());
+	boxMaterial->getParameter("u_ambientColor")->setValue(_scene->getAmbientColor());
     boxMaterial->getParameter("u_lightColor")->setValue(light->getColor());
     boxMaterial->getParameter("u_lightDirection")->setValue(lightNode->getForwardVectorView());
 }
@@ -35,13 +37,13 @@ void TemplateGame::finalize()
     SAFE_RELEASE(_scene);
 }
 
-void TemplateGame::update(long elapsedTime)
+void TemplateGame::update(float elapsedTime)
 {
     // Rotate model
     _scene->findNode("box")->rotateY(MATH_DEG_TO_RAD((float)elapsedTime / 1000.0f * 180.0f));
 }
 
-void TemplateGame::render(long elapsedTime)
+void TemplateGame::render(float elapsedTime)
 {
     // Clear the color and depth buffers
     clear(CLEAR_COLOR_DEPTH, Vector4::zero(), 1.0f, 0);
@@ -61,6 +63,19 @@ bool TemplateGame::drawScene(Node* node)
     return true;
 }
 
+void TemplateGame::keyEvent(Keyboard::KeyEvent evt, int key)
+{
+    if (evt == Keyboard::KEY_PRESS)
+    {
+        switch (key)
+        {
+        case Keyboard::KEY_ESCAPE:
+            exit();
+            break;
+        }
+    }
+}
+
 void TemplateGame::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
 {
     switch (evt)

+ 7 - 2
gameplay-template/src/TemplateGame.h

@@ -17,6 +17,11 @@ public:
      */
     TemplateGame();
 
+    /**
+     * @see Game::keyEvent
+     */
+	void keyEvent(Keyboard::KeyEvent evt, int key);
+	
     /**
      * @see Game::touchEvent
      */
@@ -37,12 +42,12 @@ protected:
     /**
      * @see Game::update
      */
-    void update(long elapsedTime);
+    void update(float elapsedTime);
 
     /**
      * @see Game::render
      */
-    void render(long elapsedTime);
+    void render(float elapsedTime);
 
 private:
 

+ 50 - 8
gameplay-template/template.cproject

@@ -30,10 +30,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1368017357" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.220599794" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.553483674" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -51,6 +55,7 @@
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/lib"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/arm&quot;"/>
 								</option>
@@ -65,6 +70,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>
@@ -110,10 +116,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1438345058" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.145250449" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.2006281313" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -129,6 +139,7 @@
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/lib"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/arm&quot;"/>
 								</option>
@@ -143,6 +154,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>
@@ -189,10 +201,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.2039847498" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.1151876862" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.502016742" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -210,6 +226,7 @@
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/lib"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/arm&quot;"/>
 								</option>
@@ -224,6 +241,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>
@@ -270,10 +288,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.197126708" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.383272251" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.1630912693" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -292,6 +314,7 @@
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/lib"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/arm&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/arm&quot;"/>
 								</option>
@@ -306,6 +329,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>
@@ -350,10 +374,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.456477750" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.2030100054" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.1374999439" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -371,6 +399,7 @@
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/x86/lib"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/x86/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/x86&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/x86&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/x86&quot;"/>
 								</option>
@@ -385,6 +414,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>
@@ -430,10 +460,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.923690234" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.1329574373" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.1843174104" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -449,11 +483,12 @@
 								<option id="com.qnx.qcc.option.linker.langcpp.634706544" name="C++ (-lang-c++)" superClass="com.qnx.qcc.option.linker.langcpp" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.linker.security.1149202874" name="Enhanced Security (-Wl,-z,relro -Wl,-z,now)" superClass="com.qnx.qcc.option.linker.security" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.linker.libraryPaths.836471121" name="Library Paths (-L)" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths">
-									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/lib"/>
-									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/usr/lib"/>
+									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/x86/lib"/>
+									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/x86/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/arm&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/arm&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/x86&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/x86&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/x86&quot;"/>
 								</option>
 								<option id="com.qnx.qcc.option.linker.libraries.1203875316" name="Libraries (-l)" superClass="com.qnx.qcc.option.linker.libraries" valueType="libs">
 									<listOptionValue builtIn="false" value="GLESv2"/>
@@ -466,6 +501,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>
@@ -511,10 +547,14 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1486948386" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/src&quot;"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.552975054" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.1418704610" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.785476179" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -530,11 +570,12 @@
 								<option id="com.qnx.qcc.option.linker.langcpp.1437332425" name="C++ (-lang-c++)" superClass="com.qnx.qcc.option.linker.langcpp" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.linker.security.1625644976" name="Enhanced Security (-Wl,-z,relro -Wl,-z,now)" superClass="com.qnx.qcc.option.linker.security" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.linker.libraryPaths.1870486762" name="Library Paths (-L)" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths">
-									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/lib"/>
-									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/armle-v7/usr/lib"/>
+									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/x86/lib"/>
+									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/x86/usr/lib"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/gameplay/${ConfigName}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/arm&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/arm&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/lua/lib/qnx/x86&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/bullet/lib/qnx/x86&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/GAMEPLAY_PATH/external-deps/oggvorbis/lib/qnx/x86&quot;"/>
 								</option>
 								<option id="com.qnx.qcc.option.linker.libraries.2055007034" name="Libraries (-l)" superClass="com.qnx.qcc.option.linker.libraries" valueType="libs">
 									<listOptionValue builtIn="false" value="GLESv2"/>
@@ -547,6 +588,7 @@
 									<listOptionValue builtIn="false" value="OpenAL"/>
 									<listOptionValue builtIn="false" value="asound"/>
 									<listOptionValue builtIn="false" value="gameplay"/>
+                                    <listOptionValue builtIn="false" value="lua"/>
 									<listOptionValue builtIn="false" value="bullet"/>
 									<listOptionValue builtIn="false" value="vorbis"/>
 								</option>

+ 98 - 63
gameplay.doxyfile

@@ -1,4 +1,4 @@
-# Doxyfile 1.7.5.1
+# Doxyfile 1.8.1
 
 # This file describes the settings to be used by the documentation system
 # doxygen (www.doxygen.org) for a project
@@ -32,7 +32,7 @@ PROJECT_NAME           = gameplay
 # This could be handy for archiving the generated documentation or 
 # if some version control system is used.
 
-PROJECT_NUMBER         = 1.3.0
+PROJECT_NUMBER         = 1.4.0
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description 
 # for a project that appears at the top of each page and should give viewer 
@@ -194,7 +194,7 @@ SEPARATE_MEMBER_PAGES  = NO
 # The TAB_SIZE tag can be used to set the number of spaces in a tab. 
 # Doxygen uses this value to replace tabs by spaces in code fragments.
 
-TAB_SIZE               = 8
+TAB_SIZE               = 4
 
 # This tag can be used to specify a number of aliases that acts 
 # as commands in the documentation. An alias has the form "name=value". 
@@ -203,7 +203,14 @@ TAB_SIZE               = 8
 # will result in a user-defined paragraph with heading "Side Effects:". 
 # You can put \n's in the value part of an alias to insert newlines.
 
-ALIASES                = 
+ALIASES                = "script{1} = \xmlonly <xmlonly>\1</xmlonly> \endxmlonly"
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only). 
+# A mapping has the form "name=value". For example adding 
+# "class=itcl::class" will allow you to use the command class in the 
+# itcl::class meaning.
+
+TCL_SUBST              = 
 
 # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
 # sources only. Doxygen will then generate output that is more tailored for C. 
@@ -243,6 +250,15 @@ OPTIMIZE_OUTPUT_VHDL   = NO
 
 EXTENSION_MAPPING      = 
 
+# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all 
+# comments according to the Markdown format, which allows for more readable 
+# documentation. See http://daringfireball.net/projects/markdown/ for details. 
+# The output of markdown processing is further processed by doxygen, so you 
+# can mix doxygen, HTML, and XML commands with Markdown formatting. 
+# Disable only in case of backward compatibilities issues.
+
+MARKDOWN_SUPPORT       = YES
+
 # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 
 # to include (a tag file for) the STL sources as input, then you should 
 # set this tag to YES in order to let doxygen match functions declarations and 
@@ -325,10 +341,21 @@ TYPEDEF_HIDES_STRUCT   = NO
 # a logarithmic scale so increasing the size by one will roughly double the 
 # memory usage. The cache size is given by this formula: 
 # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, 
-# corresponding to a cache size of 2^16 = 65536 symbols
+# corresponding to a cache size of 2^16 = 65536 symbols.
 
 SYMBOL_CACHE_SIZE      = 0
 
+# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be 
+# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given 
+# their name and scope. Since this can be an expensive process and often the 
+# same symbol appear multiple times in the code, doxygen keeps a cache of 
+# pre-resolved symbols. If the cache is too small doxygen will become slower. 
+# If the cache is too large, memory is wasted. The cache size is given by this 
+# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, 
+# corresponding to a cache size of 2^16 = 65536 symbols.
+
+LOOKUP_CACHE_SIZE      = 0
+
 #---------------------------------------------------------------------------
 # Build related configuration options
 #---------------------------------------------------------------------------
@@ -345,6 +372,11 @@ EXTRACT_ALL            = NO
 
 EXTRACT_PRIVATE        = NO
 
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+
+EXTRACT_PACKAGE        = NO
+
 # If the EXTRACT_STATIC tag is set to YES all static members of a file 
 # will be included in the documentation.
 
@@ -354,7 +386,7 @@ EXTRACT_STATIC         = NO
 # defined locally in source files will be included in the documentation. 
 # If set to NO only classes defined in header files are included.
 
-EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_CLASSES  = NO
 
 # This flag is only useful for Objective-C code. When set to YES local 
 # methods, which are defined in the implementation section but not in 
@@ -391,7 +423,7 @@ HIDE_UNDOC_CLASSES     = NO
 # If set to NO (the default) these declarations will be included in the 
 # documentation.
 
-HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_FRIEND_COMPOUNDS  = YES
 
 # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
 # documentation blocks found inside the body of a function. 
@@ -532,12 +564,6 @@ MAX_INITIALIZER_LINES  = 30
 
 SHOW_USED_FILES        = NO
 
-# If the sources in your project are distributed over multiple directories 
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES       = NO
-
 # Set the SHOW_FILES tag to NO to disable the generation of the Files page. 
 # This will remove the Files entry from the Quick Index and from the 
 # Folder Tree View (if specified). The default is YES.
@@ -574,7 +600,8 @@ LAYOUT_FILE            =
 # .bib extension is automatically appended if omitted. Using this command 
 # requires the bibtex tool to be installed. See also 
 # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style 
-# of the bibliography can be controlled using LATEX_BIB_STYLE.
+# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this 
+# feature you need bibtex and perl available in the search path.
 
 CITE_BIB_FILES         = 
 
@@ -665,14 +692,15 @@ FILE_PATTERNS          = *.h \
 
 RECURSIVE              = NO
 
-# The EXCLUDE tag can be used to specify files and/or directories that should 
+# The EXCLUDE tag can be used to specify files and/or directories that should be 
 # excluded from the INPUT source files. This way you can easily exclude a 
 # subdirectory from a directory tree whose root is specified with the INPUT tag. 
-# Note that relative paths are relative to directory from which doxygen is run.
+# Note that relative paths are relative to the directory from which doxygen is 
+# run.
 
 EXCLUDE                = 
 
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or 
 # directories that are symbolic links (a Unix file system feature) are excluded 
 # from the input.
 
@@ -857,7 +885,7 @@ HTML_FILE_EXTENSION    = .html
 # standard header. Note that when using a custom header you are responsible  
 # for the proper inclusion of any scripts and style sheets that doxygen 
 # needs, which is dependent on the configuration options used. 
-# It is adviced to generate a default header using "doxygen -w html 
+# It is advised to generate a default header using "doxygen -w html 
 # header.html footer.html stylesheet.css YourConfigFile" and then modify 
 # that header. Note that the header is subject to change so you typically 
 # have to redo this when upgrading to a newer version of doxygen or when 
@@ -876,7 +904,7 @@ HTML_FOOTER            =
 # fine-tune the look of the HTML output. If the tag is left blank doxygen 
 # will generate a default style sheet. Note that doxygen will try to copy 
 # the style sheet file to the HTML output directory, so don't put your own 
-# stylesheet in the HTML output directory as well, or it will be erased!
+# style sheet in the HTML output directory as well, or it will be erased!
 
 HTML_STYLESHEET        = 
 
@@ -890,7 +918,7 @@ HTML_STYLESHEET        =
 HTML_EXTRA_FILES       = 
 
 # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. 
-# Doxygen will adjust the colors in the stylesheet and background images 
+# Doxygen will adjust the colors in the style sheet and background images 
 # according to this color. Hue is specified as an angle on a colorwheel, 
 # see http://en.wikipedia.org/wiki/Hue for more information. 
 # For instance the value 0 represents red, 60 is yellow, 120 is green, 
@@ -920,20 +948,23 @@ HTML_COLORSTYLE_GAMMA  = 80
 
 HTML_TIMESTAMP         = YES
 
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
-# files or namespaces will be aligned in HTML using tables. If set to 
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS     = YES
-
 # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
 # documentation will contain sections that can be hidden and shown after the 
-# page has loaded. For this to work a browser that supports 
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+# page has loaded.
 
 HTML_DYNAMIC_SECTIONS  = NO
 
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of 
+# entries shown in the various tree structured indices initially; the user 
+# can expand and collapse entries dynamically later on. Doxygen will expand 
+# the tree to such a level that at most the specified number of entries are 
+# visible (unless a fully collapsed tree already exceeds this amount). 
+# So setting the number of entries 1 will produce a full collapsed tree by 
+# default. 0 is a special value representing an infinite number of entries 
+# and will result in a full expanded tree by default.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
 # If the GENERATE_DOCSET tag is set to YES, additional index files 
 # will be generated that can be used as input for Apple's Xcode 3 
 # integrated development environment, introduced with OSX 10.5 (Leopard). 
@@ -1085,33 +1116,32 @@ GENERATE_ECLIPSEHELP   = NO
 
 ECLIPSE_DOC_ID         = org.doxygen.Project
 
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
-# top of each HTML page. The value NO (the default) enables the index and 
-# the value YES disables it.
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) 
+# at top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it. Since the tabs have the same information as the 
+# navigation tree you can set this option to NO if you already set 
+# GENERATE_TREEVIEW to YES.
 
 DISABLE_INDEX          = NO
 
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values 
-# (range [0,1..20]) that doxygen will group on one line in the generated HTML 
-# documentation. Note that a value of 0 will completely suppress the enum 
-# values from appearing in the overview section.
-
-ENUM_VALUES_PER_LINE   = 4
-
 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index 
 # structure should be generated to display hierarchical information. 
 # If the tag value is set to YES, a side panel will be generated 
 # containing a tree-like index structure (just like the one that 
 # is generated for HTML Help). For this to work a browser that supports 
 # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). 
-# Windows users are probably better off using the HTML help feature.
+# Windows users are probably better off using the HTML help feature. 
+# Since the tree basically has the same information as the tab index you 
+# could consider to set DISABLE_INDEX to NO when enabling this option.
 
 GENERATE_TREEVIEW      = NO
 
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, 
-# and Class Hierarchy pages using a tree view instead of an ordered list.
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values 
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML 
+# documentation. Note that a value of 0 will completely suppress the enum 
+# values from appearing in the overview section.
 
-USE_INLINE_TREES       = NO
+ENUM_VALUES_PER_LINE   = 4
 
 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
 # used to set the initial width (in pixels) of the frame in which the tree 
@@ -1144,7 +1174,7 @@ FORMULA_TRANSPARENT    = YES
 # (see http://www.mathjax.org) which uses client side Javascript for the 
 # rendering instead of using prerendered bitmaps. Use this if you do not 
 # have LaTeX installed or if you want to formulas look prettier in the HTML 
-# output. When enabled you also need to install MathJax separately and 
+# output. When enabled you may also need to install MathJax separately and 
 # configure the path to it using the MATHJAX_RELPATH option.
 
 USE_MATHJAX            = NO
@@ -1153,10 +1183,10 @@ USE_MATHJAX            = NO
 # HTML output directory using the MATHJAX_RELPATH option. The destination 
 # directory should contain the MathJax.js script. For instance, if the mathjax 
 # directory is located at the same level as the HTML output directory, then 
-# MATHJAX_RELPATH should be ../mathjax. The default value points to the 
-# mathjax.org site, so you can quickly see the result without installing 
-# MathJax, but it is strongly recommended to install a local copy of MathJax 
-# before deployment.
+# MATHJAX_RELPATH should be ../mathjax. The default value points to 
+# the MathJax Content Delivery Network so you can quickly see the result without 
+# installing MathJax.  However, it is strongly recommended to install a local 
+# copy of MathJax from http://www.mathjax.org before deployment.
 
 MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
 
@@ -1315,7 +1345,7 @@ COMPACT_RTF            = NO
 
 RTF_HYPERLINKS         = NO
 
-# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# Load style sheet definitions from file. Syntax is similar to doxygen's 
 # config file, i.e. a series of assignments. You only have to provide 
 # replacements, missing definitions are set to their default value.
 
@@ -1387,7 +1417,7 @@ XML_DTD                =
 # and cross-referencing information) to the XML output. Note that 
 # enabling this will significantly increase the size of the XML output.
 
-XML_PROGRAMLISTING     = YES
+XML_PROGRAMLISTING     = NO
 
 #---------------------------------------------------------------------------
 # configuration options for the AutoGen Definitions output
@@ -1504,20 +1534,16 @@ SKIP_FUNCTION_MACROS   = YES
 # Configuration::additions related to external references
 #---------------------------------------------------------------------------
 
-# The TAGFILES option can be used to specify one or more tagfiles. 
-# Optionally an initial location of the external documentation 
-# can be added for each tagfile. The format of a tag file without 
-# this location is as follows: 
+# The TAGFILES option can be used to specify one or more tagfiles. For each 
+# tag file the location of the external documentation should be added. The 
+# format of a tag file without this location is as follows: 
 #   TAGFILES = file1 file2 ... 
 # Adding location for the tag files is done as follows: 
 #   TAGFILES = file1=loc1 "file2 = loc2" ... 
-# where "loc1" and "loc2" can be relative or absolute paths or 
-# URLs. If a location is present for each tag, the installdox tool 
-# does not have to be run to correct the links. 
-# Note that each tag file must have a unique name 
-# (where the name does NOT include the path) 
-# If a tag file is not located in the directory in which doxygen 
-# is run, you must also specify the path to the tagfile here.
+# where "loc1" and "loc2" can be relative or absolute paths 
+# or URLs. Note that each tag file must have a unique name (where the name does 
+# NOT include the path). If a tag file is not located in the directory in which 
+# doxygen is run, you must also specify the path to the tagfile here.
 
 TAGFILES               = 
 
@@ -1608,7 +1634,7 @@ DOT_FONTPATH           =
 # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
 # will generate a graph for each documented class showing the direct and 
 # indirect inheritance relations. Setting this tag to YES will force the 
-# the CLASS_DIAGRAMS tag to NO.
+# CLASS_DIAGRAMS tag to NO.
 
 CLASS_GRAPH            = YES
 
@@ -1630,6 +1656,15 @@ GROUP_GRAPHS           = YES
 
 UML_LOOK               = NO
 
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside 
+# the class node. If there are many fields or methods and many nodes the 
+# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS 
+# threshold limits the number of items for each type to make the size more 
+# managable. Set this to 0 for no limit. Note that the threshold may be 
+# exceeded by 50% before the limit is enforced.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
 # If set to YES, the inheritance and collaboration graphs will show the 
 # relations between templates and their instances.
 
@@ -1670,7 +1705,7 @@ CALLER_GRAPH           = NO
 
 GRAPHICAL_HIERARCHY    = YES
 
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES 
 # then doxygen will show the dependencies a directory has on other directories 
 # in a graphical way. The dependency relations are determined by the #include 
 # relations between the files in the directories.

+ 11 - 8
gameplay.sln

@@ -18,8 +18,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample03-character", "gamep
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gameplay-encoder", "gameplay-encoder\gameplay-encoder.vcxproj", "{9D69B743-4872-4DD1-8E30-0087C64298D7}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample04-particles", "gameplay-samples\sample04-particles\sample04-particles.vcxproj", "{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
@@ -30,6 +28,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample00-mesh", "gameplay-s
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample05-lua", "gameplay-samples\sample05-lua\sample05-lua.vcxproj", "{C6121A62-AA46-BA6D-A1CE-8000544456AA}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -61,12 +64,6 @@ Global
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|Win32.ActiveCfg = Release|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|Win32.Build.0 = Release|Win32
-		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Debug|Win32.ActiveCfg = Debug|Win32
-		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Debug|Win32.Build.0 = Debug|Win32
-		{9D69B743-4872-4DD1-8E30-0087C64298D7}.DebugMem|Win32.ActiveCfg = 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.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
@@ -79,6 +76,12 @@ Global
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|Win32.Build.0 = DebugMem|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|Win32.ActiveCfg = Release|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|Win32.Build.0 = Release|Win32
+		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Debug|Win32.Build.0 = Debug|Win32
+		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
+		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.DebugMem|Win32.Build.0 = DebugMem|Win32
+		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Release|Win32.ActiveCfg = Release|Win32
+		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 3 - 3
gameplay.xcworkspace/contents.xcworkspacedata

@@ -4,9 +4,6 @@
    <FileRef
       location = "group:gameplay/gameplay.xcodeproj">
    </FileRef>
-   <FileRef
-      location = "group:gameplay-encoder/gameplay-encoder.xcodeproj">
-   </FileRef>
    <FileRef
       location = "group:gameplay-samples/sample00-mesh/sample00-mesh.xcodeproj">
    </FileRef>
@@ -22,4 +19,7 @@
    <FileRef
       location = "group:gameplay-samples/sample04-particles/sample04-particles.xcodeproj">
    </FileRef>
+   <FileRef
+      location = "group:gameplay-samples/sample05-lua/sample05-lua.xcodeproj">
+   </FileRef>
 </Workspace>

+ 38 - 4
gameplay/.cproject

@@ -25,11 +25,15 @@
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.2133604142" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
-								<option id="com.qnx.qcc.option.compiler.qccoptions.1968057343" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions"/>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.1968057343" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<option id="com.qnx.qcc.option.compiler.ccoptions.1078137668" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList">
 									<listOptionValue builtIn="false" value="-mfpu=neon"/>
 								</option>
@@ -83,12 +87,17 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1670164593" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.ccoptions.1122311163" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList">
 									<listOptionValue builtIn="false" value="-mfpu=neon"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.1770609643" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.1380846613" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.855139060" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -138,12 +147,17 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1503059677" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.ccoptions.1956270067" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList">
 									<listOptionValue builtIn="false" value="-mfpu=neon"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.1366354884" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.81809638" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.2145279747" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -196,12 +210,17 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1769677874" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.ccoptions.47607907" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList">
 									<listOptionValue builtIn="false" value="-mfpu=neon"/>
 								</option>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.146547607" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.2007171407" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.1537562121" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -252,10 +271,15 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.847642559" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
-								<option id="com.qnx.qcc.option.compiler.ccoptions.1432778691" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList"/>
+								<option id="com.qnx.qcc.option.compiler.ccoptions.1432778691" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions"/>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.245518255" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.1038720310" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.521146732" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -306,10 +330,15 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.513622172" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
-								<option id="com.qnx.qcc.option.compiler.ccoptions.663337616" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList"/>
+								<option id="com.qnx.qcc.option.compiler.ccoptions.663337616" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions"/>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.288926109" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.1961855927" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.1089440729" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
@@ -361,10 +390,15 @@
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.1685994750" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/bullet/include&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;../../external-deps/lua/include&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;../../external-deps/oggvorbis/include&quot;"/>
 									<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
 								</option>
-								<option id="com.qnx.qcc.option.compiler.ccoptions.346770186" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions" valueType="stringList"/>
+								<option id="com.qnx.qcc.option.compiler.ccoptions.346770186" name="Compiler Options (-Wc,)" superClass="com.qnx.qcc.option.compiler.ccoptions"/>
+								<option id="com.qnx.qcc.option.compiler.qccoptions.1085566269" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
+									<listOptionValue builtIn="false" value="-Wno-psabi"/>
+								</option>
 								<inputType id="com.qnx.qcc.inputType.compiler.1658185881" superClass="com.qnx.qcc.inputType.compiler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.746786008" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">

+ 255 - 2
gameplay/android/jni/Android.mk

@@ -16,8 +16,261 @@ LOCAL_PATH := $(call my-dir)/../../src
 
 include $(CLEAR_VARS)
 LOCAL_MODULE    := libgameplay
-LOCAL_SRC_FILES := AbsoluteLayout.cpp Animation.cpp AnimationClip.cpp AnimationController.cpp AnimationTarget.cpp AnimationValue.cpp AudioBuffer.cpp AudioController.cpp AudioListener.cpp AudioSource.cpp BoundingBox.cpp BoundingSphere.cpp Bundle.cpp Button.cpp Camera.cpp CheckBox.cpp Container.cpp Control.cpp Curve.cpp DebugNew.cpp DepthStencilTarget.cpp Effect.cpp FileSystem.cpp FlowLayout.cpp Font.cpp Form.cpp FrameBuffer.cpp Frustum.cpp Game.cpp gameplay-main-android.cpp Image.cpp Joint.cpp Joystick.cpp Label.cpp Layout.cpp Light.cpp Material.cpp MaterialParameter.cpp Matrix.cpp Mesh.cpp MeshBatch.cpp MeshPart.cpp MeshSkin.cpp Model.cpp Node.cpp ParticleEmitter.cpp Pass.cpp PhysicsCharacter.cpp PhysicsCollisionObject.cpp PhysicsCollisionShape.cpp PhysicsConstraint.cpp PhysicsController.cpp PhysicsFixedConstraint.cpp PhysicsGenericConstraint.cpp PhysicsGhostObject.cpp PhysicsHingeConstraint.cpp PhysicsMotionState.cpp PhysicsRigidBody.cpp PhysicsSocketConstraint.cpp PhysicsSpringConstraint.cpp Plane.cpp PlatformAndroid.cpp Properties.cpp Quaternion.cpp RadioButton.cpp Ray.cpp Rectangle.cpp Ref.cpp RenderState.cpp RenderTarget.cpp Scene.cpp SceneLoader.cpp Slider.cpp SpriteBatch.cpp Technique.cpp TextBox.cpp Texture.cpp Theme.cpp ThemeStyle.cpp Transform.cpp Vector2.cpp Vector3.cpp Vector4.cpp VertexAttributeBinding.cpp VertexFormat.cpp VerticalLayout.cpp
-LOCAL_CFLAGS := -D__ANDROID__ -I"../../external-deps/bullet/include" -I"../../external-deps/libpng/include" -I"../../external-deps/oggvorbis/include" -I"../../external-deps/openal/include"
+LOCAL_SRC_FILES := \
+    AbsoluteLayout.cpp \
+    AIAgent.cpp \
+    AIController.cpp \
+    AIMessage.cpp \
+    AIState.cpp \
+    AIStateMachine.cpp \
+    Animation.cpp \
+    AnimationClip.cpp \
+    AnimationController.cpp \
+    AnimationTarget.cpp \
+    AnimationValue.cpp \
+    AudioBuffer.cpp \
+    AudioController.cpp \
+    AudioListener.cpp \
+    AudioSource.cpp \
+    BoundingBox.cpp \
+    BoundingSphere.cpp \
+    Bundle.cpp \
+    Button.cpp \
+    Camera.cpp \
+    CheckBox.cpp \
+    Container.cpp \
+    Control.cpp \
+    Curve.cpp \
+    DebugNew.cpp \
+    DepthStencilTarget.cpp \
+    Effect.cpp \
+    FileSystem.cpp \
+    FlowLayout.cpp \
+    Font.cpp \
+    Form.cpp \
+    FrameBuffer.cpp \
+    Frustum.cpp \
+    Game.cpp \
+    Gamepad.cpp \
+    gameplay-main-android.cpp \
+    Image.cpp \
+    Joint.cpp \
+    Joystick.cpp \
+    Label.cpp \
+    Layout.cpp \
+    Light.cpp \
+    Material.cpp \
+    MaterialParameter.cpp \
+    Matrix.cpp \
+    Mesh.cpp \
+    MeshBatch.cpp \
+    MeshPart.cpp \
+    MeshSkin.cpp \
+    Model.cpp \
+    Node.cpp \
+    ParticleEmitter.cpp \
+    Pass.cpp \
+    PhysicsCharacter.cpp \
+    PhysicsCollisionObject.cpp \
+    PhysicsCollisionShape.cpp \
+    PhysicsConstraint.cpp \
+    PhysicsController.cpp \
+    PhysicsFixedConstraint.cpp \
+    PhysicsGenericConstraint.cpp \
+    PhysicsGhostObject.cpp \
+    PhysicsHingeConstraint.cpp \
+    PhysicsRigidBody.cpp \
+    PhysicsSocketConstraint.cpp \
+    PhysicsSpringConstraint.cpp \
+    Plane.cpp \
+    PlatformAndroid.cpp \
+    Properties.cpp \
+    Quaternion.cpp \
+    RadioButton.cpp \
+    Ray.cpp \
+    Rectangle.cpp \
+    Ref.cpp \
+    RenderState.cpp \
+    RenderTarget.cpp \
+    Scene.cpp \
+    SceneLoader.cpp \
+    ScreenDisplayer.cpp \
+    ScriptController.cpp \
+    ScriptTarget.cpp \
+    Slider.cpp \
+    SpriteBatch.cpp \
+    Technique.cpp \
+    TextBox.cpp \
+    Texture.cpp \
+    Theme.cpp \
+    ThemeStyle.cpp \
+    Transform.cpp \
+    Vector2.cpp \
+    Vector3.cpp \
+    Vector4.cpp \
+    VertexAttributeBinding.cpp \
+    VertexFormat.cpp \
+    VerticalLayout.cpp \
+    lua/lua_AbsoluteLayout.cpp \
+    lua/lua_AIAgent.cpp \
+    lua/lua_AIAgentListener.cpp \
+    lua/lua_AIController.cpp \
+    lua/lua_AIMessage.cpp \
+    lua/lua_AIMessageParameterType.cpp \
+    lua/lua_AIState.cpp \
+    lua/lua_AIStateListener.cpp \
+    lua/lua_AIStateMachine.cpp \
+    lua/lua_all_bindings.cpp \
+    lua/lua_Animation.cpp \
+    lua/lua_AnimationClip.cpp \
+    lua/lua_AnimationClipListener.cpp \
+    lua/lua_AnimationClipListenerEventType.cpp \
+    lua/lua_AnimationController.cpp \
+    lua/lua_AnimationTarget.cpp \
+    lua/lua_AnimationValue.cpp \
+    lua/lua_AudioBuffer.cpp \
+    lua/lua_AudioController.cpp \
+    lua/lua_AudioListener.cpp \
+    lua/lua_AudioSource.cpp \
+    lua/lua_AudioSourceState.cpp \
+    lua/lua_BoundingBox.cpp \
+    lua/lua_BoundingSphere.cpp \
+    lua/lua_Bundle.cpp \
+    lua/lua_Button.cpp \
+    lua/lua_Camera.cpp \
+    lua/lua_CameraType.cpp \
+    lua/lua_CheckBox.cpp \
+    lua/lua_Container.cpp \
+    lua/lua_ContainerScroll.cpp \
+    lua/lua_Control.cpp \
+    lua/lua_ControlAlignment.cpp \
+    lua/lua_ControlListener.cpp \
+    lua/lua_ControlListenerEventType.cpp \
+    lua/lua_ControlState.cpp \
+    lua/lua_Curve.cpp \
+    lua/lua_CurveInterpolationType.cpp \
+    lua/lua_DepthStencilTarget.cpp \
+    lua/lua_DepthStencilTargetFormat.cpp \
+    lua/lua_Effect.cpp \
+    lua/lua_FileSystem.cpp \
+    lua/lua_FlowLayout.cpp \
+    lua/lua_Font.cpp \
+    lua/lua_FontJustify.cpp \
+    lua/lua_FontStyle.cpp \
+    lua/lua_FontText.cpp \
+    lua/lua_Form.cpp \
+    lua/lua_FrameBuffer.cpp \
+    lua/lua_Frustum.cpp \
+    lua/lua_Game.cpp \
+    lua/lua_GameClearFlags.cpp \
+    lua/lua_Gamepad.cpp \
+    lua/lua_GamepadButtonState.cpp \
+    lua/lua_GamepadGamepadEvent.cpp \
+    lua/lua_GameState.cpp \
+    lua/lua_Global.cpp \
+    lua/lua_Image.cpp \
+    lua/lua_ImageFormat.cpp \
+    lua/lua_Joint.cpp \
+    lua/lua_Joystick.cpp \
+    lua/lua_Keyboard.cpp \
+    lua/lua_KeyboardKey.cpp \
+    lua/lua_KeyboardKeyEvent.cpp \
+    lua/lua_Label.cpp \
+    lua/lua_Layout.cpp \
+    lua/lua_LayoutType.cpp \
+    lua/lua_Light.cpp \
+    lua/lua_LightType.cpp \
+    lua/lua_Material.cpp \
+    lua/lua_MaterialParameter.cpp \
+    lua/lua_MathUtil.cpp \
+    lua/lua_Matrix.cpp \
+    lua/lua_Mesh.cpp \
+    lua/lua_MeshBatch.cpp \
+    lua/lua_MeshIndexFormat.cpp \
+    lua/lua_MeshPart.cpp \
+    lua/lua_MeshPrimitiveType.cpp \
+    lua/lua_MeshSkin.cpp \
+    lua/lua_Model.cpp \
+    lua/lua_Mouse.cpp \
+    lua/lua_MouseMouseEvent.cpp \
+    lua/lua_Node.cpp \
+    lua/lua_NodeCloneContext.cpp \
+    lua/lua_NodeType.cpp \
+    lua/lua_ParticleEmitter.cpp \
+    lua/lua_ParticleEmitterTextureBlending.cpp \
+    lua/lua_Pass.cpp \
+    lua/lua_PhysicsCharacter.cpp \
+    lua/lua_PhysicsCollisionObject.cpp \
+    lua/lua_PhysicsCollisionObjectCollisionListener.cpp \
+    lua/lua_PhysicsCollisionObjectCollisionListenerEventType.cpp \
+    lua/lua_PhysicsCollisionObjectCollisionPair.cpp \
+    lua/lua_PhysicsCollisionObjectType.cpp \
+    lua/lua_PhysicsCollisionShape.cpp \
+    lua/lua_PhysicsCollisionShapeDefinition.cpp \
+    lua/lua_PhysicsCollisionShapeType.cpp \
+    lua/lua_PhysicsConstraint.cpp \
+    lua/lua_PhysicsController.cpp \
+    lua/lua_PhysicsControllerHitFilter.cpp \
+    lua/lua_PhysicsControllerHitResult.cpp \
+    lua/lua_PhysicsControllerListener.cpp \
+    lua/lua_PhysicsControllerListenerEventType.cpp \
+    lua/lua_PhysicsFixedConstraint.cpp \
+    lua/lua_PhysicsGenericConstraint.cpp \
+    lua/lua_PhysicsGhostObject.cpp \
+    lua/lua_PhysicsHingeConstraint.cpp \
+    lua/lua_PhysicsRigidBody.cpp \
+    lua/lua_PhysicsRigidBodyParameters.cpp \
+    lua/lua_PhysicsSocketConstraint.cpp \
+    lua/lua_PhysicsSpringConstraint.cpp \
+    lua/lua_Plane.cpp \
+    lua/lua_Platform.cpp \
+    lua/lua_Properties.cpp \
+    lua/lua_PropertiesType.cpp \
+    lua/lua_Quaternion.cpp \
+    lua/lua_RadioButton.cpp \
+    lua/lua_Ray.cpp \
+    lua/lua_Rectangle.cpp \
+    lua/lua_Ref.cpp \
+    lua/lua_RenderState.cpp \
+    lua/lua_RenderStateAutoBinding.cpp \
+    lua/lua_RenderStateBlend.cpp \
+    lua/lua_RenderStateStateBlock.cpp \
+    lua/lua_RenderTarget.cpp \
+    lua/lua_Scene.cpp \
+    lua/lua_SceneDebugFlags.cpp \
+    lua/lua_ScreenDisplayer.cpp \
+    lua/lua_ScriptController.cpp \
+    lua/lua_ScriptTarget.cpp \
+    lua/lua_Slider.cpp \
+    lua/lua_SpriteBatch.cpp \
+    lua/lua_Technique.cpp \
+    lua/lua_TextBox.cpp \
+    lua/lua_Texture.cpp \
+    lua/lua_TextureFilter.cpp \
+    lua/lua_TextureFormat.cpp \
+    lua/lua_TextureSampler.cpp \
+    lua/lua_TextureWrap.cpp \
+    lua/lua_Theme.cpp \
+    lua/lua_ThemeSideRegions.cpp \
+    lua/lua_ThemeStyle.cpp \
+    lua/lua_ThemeThemeImage.cpp \
+    lua/lua_ThemeUVs.cpp \
+    lua/lua_Touch.cpp \
+    lua/lua_TouchTouchEvent.cpp \
+    lua/lua_Transform.cpp \
+    lua/lua_TransformListener.cpp \
+    lua/lua_Uniform.cpp \
+    lua/lua_Vector2.cpp \
+    lua/lua_Vector3.cpp \
+    lua/lua_Vector4.cpp \
+    lua/lua_VertexAttributeBinding.cpp \
+    lua/lua_VertexFormat.cpp \
+    lua/lua_VertexFormatElement.cpp \
+    lua/lua_VertexFormatUsage.cpp \
+    lua/lua_VerticalLayout.cpp
+
+    
+LOCAL_CFLAGS := -D__ANDROID__ -I"../../external-deps/lua/include" -I"../../external-deps/bullet/include" -I"../../external-deps/libpng/include" -I"../../external-deps/oggvorbis/include" -I"../../external-deps/openal/include"
 LOCAL_STATIC_LIBRARIES := android_native_app_glue
 
 include $(BUILD_STATIC_LIBRARY)

+ 355 - 27
gameplay/gameplay.vcxproj

@@ -16,6 +16,11 @@
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="src\AbsoluteLayout.cpp" />
+    <ClCompile Include="src\AIAgent.cpp" />
+    <ClCompile Include="src\AIController.cpp" />
+    <ClCompile Include="src\AIMessage.cpp" />
+    <ClCompile Include="src\AIState.cpp" />
+    <ClCompile Include="src\AIStateMachine.cpp" />
     <ClCompile Include="src\Animation.cpp" />
     <ClCompile Include="src\AnimationClip.cpp" />
     <ClCompile Include="src\AnimationController.cpp" />
@@ -43,6 +48,7 @@
     <ClCompile Include="src\FrameBuffer.cpp" />
     <ClCompile Include="src\Frustum.cpp" />
     <ClCompile Include="src\Game.cpp" />
+    <ClCompile Include="src\Gamepad.cpp" />
     <ClCompile Include="src\gameplay-main-android.cpp" />
     <ClCompile Include="src\gameplay-main-qnx.cpp" />
     <ClCompile Include="src\gameplay-main-win32.cpp" />
@@ -52,6 +58,163 @@
     <ClCompile Include="src\Label.cpp" />
     <ClCompile Include="src\Layout.cpp" />
     <ClCompile Include="src\Light.cpp" />
+    <ClCompile Include="src\lua\lua_AbsoluteLayout.cpp" />
+    <ClCompile Include="src\lua\lua_AIAgent.cpp" />
+    <ClCompile Include="src\lua\lua_AIAgentListener.cpp" />
+    <ClCompile Include="src\lua\lua_AIController.cpp" />
+    <ClCompile Include="src\lua\lua_AIMessage.cpp" />
+    <ClCompile Include="src\lua\lua_AIMessageParameterType.cpp" />
+    <ClCompile Include="src\lua\lua_AIState.cpp" />
+    <ClCompile Include="src\lua\lua_AIStateListener.cpp" />
+    <ClCompile Include="src\lua\lua_AIStateMachine.cpp" />
+    <ClCompile Include="src\lua\lua_all_bindings.cpp" />
+    <ClCompile Include="src\lua\lua_Animation.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationClip.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationClipListener.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationClipListenerEventType.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationController.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationTarget.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationValue.cpp" />
+    <ClCompile Include="src\lua\lua_AudioBuffer.cpp" />
+    <ClCompile Include="src\lua\lua_AudioController.cpp" />
+    <ClCompile Include="src\lua\lua_AudioListener.cpp" />
+    <ClCompile Include="src\lua\lua_AudioSource.cpp" />
+    <ClCompile Include="src\lua\lua_AudioSourceState.cpp" />
+    <ClCompile Include="src\lua\lua_BoundingBox.cpp" />
+    <ClCompile Include="src\lua\lua_BoundingSphere.cpp" />
+    <ClCompile Include="src\lua\lua_Bundle.cpp" />
+    <ClCompile Include="src\lua\lua_Button.cpp" />
+    <ClCompile Include="src\lua\lua_Camera.cpp" />
+    <ClCompile Include="src\lua\lua_CameraType.cpp" />
+    <ClCompile Include="src\lua\lua_CheckBox.cpp" />
+    <ClCompile Include="src\lua\lua_Container.cpp" />
+    <ClCompile Include="src\lua\lua_ContainerScroll.cpp" />
+    <ClCompile Include="src\lua\lua_Control.cpp" />
+    <ClCompile Include="src\lua\lua_ControlAlignment.cpp" />
+    <ClCompile Include="src\lua\lua_ControlListener.cpp" />
+    <ClCompile Include="src\lua\lua_ControlListenerEventType.cpp" />
+    <ClCompile Include="src\lua\lua_ControlState.cpp" />
+    <ClCompile Include="src\lua\lua_Curve.cpp" />
+    <ClCompile Include="src\lua\lua_CurveInterpolationType.cpp" />
+    <ClCompile Include="src\lua\lua_DepthStencilTarget.cpp" />
+    <ClCompile Include="src\lua\lua_DepthStencilTargetFormat.cpp" />
+    <ClCompile Include="src\lua\lua_Effect.cpp" />
+    <ClCompile Include="src\lua\lua_FileSystem.cpp" />
+    <ClCompile Include="src\lua\lua_FlowLayout.cpp" />
+    <ClCompile Include="src\lua\lua_Font.cpp" />
+    <ClCompile Include="src\lua\lua_FontJustify.cpp" />
+    <ClCompile Include="src\lua\lua_FontStyle.cpp" />
+    <ClCompile Include="src\lua\lua_FontText.cpp" />
+    <ClCompile Include="src\lua\lua_Form.cpp" />
+    <ClCompile Include="src\lua\lua_FrameBuffer.cpp" />
+    <ClCompile Include="src\lua\lua_Frustum.cpp" />
+    <ClCompile Include="src\lua\lua_Game.cpp" />
+    <ClCompile Include="src\lua\lua_GameClearFlags.cpp" />
+    <ClCompile Include="src\lua\lua_Gamepad.cpp" />
+    <ClCompile Include="src\lua\lua_GamepadButtonState.cpp" />
+    <ClCompile Include="src\lua\lua_GamepadGamepadEvent.cpp" />
+    <ClCompile Include="src\lua\lua_GameState.cpp" />
+    <ClCompile Include="src\lua\lua_Global.cpp" />
+    <ClCompile Include="src\lua\lua_Image.cpp" />
+    <ClCompile Include="src\lua\lua_ImageFormat.cpp" />
+    <ClCompile Include="src\lua\lua_Joint.cpp" />
+    <ClCompile Include="src\lua\lua_Joystick.cpp" />
+    <ClCompile Include="src\lua\lua_Keyboard.cpp" />
+    <ClCompile Include="src\lua\lua_KeyboardKey.cpp" />
+    <ClCompile Include="src\lua\lua_KeyboardKeyEvent.cpp" />
+    <ClCompile Include="src\lua\lua_Label.cpp" />
+    <ClCompile Include="src\lua\lua_Layout.cpp" />
+    <ClCompile Include="src\lua\lua_LayoutType.cpp" />
+    <ClCompile Include="src\lua\lua_Light.cpp" />
+    <ClCompile Include="src\lua\lua_LightType.cpp" />
+    <ClCompile Include="src\lua\lua_Material.cpp" />
+    <ClCompile Include="src\lua\lua_MaterialParameter.cpp" />
+    <ClCompile Include="src\lua\lua_MathUtil.cpp" />
+    <ClCompile Include="src\lua\lua_Matrix.cpp" />
+    <ClCompile Include="src\lua\lua_Mesh.cpp" />
+    <ClCompile Include="src\lua\lua_MeshBatch.cpp" />
+    <ClCompile Include="src\lua\lua_MeshIndexFormat.cpp" />
+    <ClCompile Include="src\lua\lua_MeshPart.cpp" />
+    <ClCompile Include="src\lua\lua_MeshPrimitiveType.cpp" />
+    <ClCompile Include="src\lua\lua_MeshSkin.cpp" />
+    <ClCompile Include="src\lua\lua_Model.cpp" />
+    <ClCompile Include="src\lua\lua_Mouse.cpp" />
+    <ClCompile Include="src\lua\lua_MouseMouseEvent.cpp" />
+    <ClCompile Include="src\lua\lua_Node.cpp" />
+    <ClCompile Include="src\lua\lua_NodeCloneContext.cpp" />
+    <ClCompile Include="src\lua\lua_NodeType.cpp" />
+    <ClCompile Include="src\lua\lua_ParticleEmitter.cpp" />
+    <ClCompile Include="src\lua\lua_ParticleEmitterTextureBlending.cpp" />
+    <ClCompile Include="src\lua\lua_Pass.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCharacter.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObject.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectCollisionListener.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectCollisionListenerEventType.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectCollisionPair.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectType.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionShape.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionShapeDefinition.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionShapeType.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsController.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsControllerHitFilter.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsControllerHitResult.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsControllerListener.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsControllerListenerEventType.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsFixedConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsGenericConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsGhostObject.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsHingeConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsRigidBody.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsRigidBodyParameters.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsSocketConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsSpringConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_Plane.cpp" />
+    <ClCompile Include="src\lua\lua_Platform.cpp" />
+    <ClCompile Include="src\lua\lua_Properties.cpp" />
+    <ClCompile Include="src\lua\lua_PropertiesType.cpp" />
+    <ClCompile Include="src\lua\lua_Quaternion.cpp" />
+    <ClCompile Include="src\lua\lua_RadioButton.cpp" />
+    <ClCompile Include="src\lua\lua_Ray.cpp" />
+    <ClCompile Include="src\lua\lua_Rectangle.cpp" />
+    <ClCompile Include="src\lua\lua_Ref.cpp" />
+    <ClCompile Include="src\lua\lua_RenderState.cpp" />
+    <ClCompile Include="src\lua\lua_RenderStateAutoBinding.cpp" />
+    <ClCompile Include="src\lua\lua_RenderStateBlend.cpp" />
+    <ClCompile Include="src\lua\lua_RenderStateStateBlock.cpp" />
+    <ClCompile Include="src\lua\lua_RenderTarget.cpp" />
+    <ClCompile Include="src\lua\lua_Scene.cpp" />
+    <ClCompile Include="src\lua\lua_SceneDebugFlags.cpp" />
+    <ClCompile Include="src\lua\lua_ScreenDisplayer.cpp" />
+    <ClCompile Include="src\lua\lua_ScriptController.cpp" />
+    <ClCompile Include="src\lua\lua_ScriptTarget.cpp" />
+    <ClCompile Include="src\lua\lua_Slider.cpp" />
+    <ClCompile Include="src\lua\lua_SpriteBatch.cpp" />
+    <ClCompile Include="src\lua\lua_Technique.cpp" />
+    <ClCompile Include="src\lua\lua_TextBox.cpp" />
+    <ClCompile Include="src\lua\lua_Texture.cpp" />
+    <ClCompile Include="src\lua\lua_TextureFilter.cpp" />
+    <ClCompile Include="src\lua\lua_TextureFormat.cpp" />
+    <ClCompile Include="src\lua\lua_TextureSampler.cpp" />
+    <ClCompile Include="src\lua\lua_TextureWrap.cpp" />
+    <ClCompile Include="src\lua\lua_Theme.cpp" />
+    <ClCompile Include="src\lua\lua_ThemeSideRegions.cpp" />
+    <ClCompile Include="src\lua\lua_ThemeStyle.cpp" />
+    <ClCompile Include="src\lua\lua_ThemeThemeImage.cpp" />
+    <ClCompile Include="src\lua\lua_ThemeUVs.cpp" />
+    <ClCompile Include="src\lua\lua_Touch.cpp" />
+    <ClCompile Include="src\lua\lua_TouchTouchEvent.cpp" />
+    <ClCompile Include="src\lua\lua_Transform.cpp" />
+    <ClCompile Include="src\lua\lua_TransformListener.cpp" />
+    <ClCompile Include="src\lua\lua_Uniform.cpp" />
+    <ClCompile Include="src\lua\lua_Vector2.cpp" />
+    <ClCompile Include="src\lua\lua_Vector3.cpp" />
+    <ClCompile Include="src\lua\lua_Vector4.cpp" />
+    <ClCompile Include="src\lua\lua_VertexAttributeBinding.cpp" />
+    <ClCompile Include="src\lua\lua_VertexFormat.cpp" />
+    <ClCompile Include="src\lua\lua_VertexFormatElement.cpp" />
+    <ClCompile Include="src\lua\lua_VertexFormatUsage.cpp" />
+    <ClCompile Include="src\lua\lua_VerticalLayout.cpp" />
     <ClCompile Include="src\Material.cpp" />
     <ClCompile Include="src\MeshBatch.cpp" />
     <ClCompile Include="src\Pass.cpp" />
@@ -73,7 +236,6 @@
     <ClCompile Include="src\PhysicsGenericConstraint.cpp" />
     <ClCompile Include="src\PhysicsGhostObject.cpp" />
     <ClCompile Include="src\PhysicsHingeConstraint.cpp" />
-    <ClCompile Include="src\PhysicsMotionState.cpp" />
     <ClCompile Include="src\PhysicsRigidBody.cpp" />
     <ClCompile Include="src\PhysicsSocketConstraint.cpp" />
     <ClCompile Include="src\PhysicsSpringConstraint.cpp" />
@@ -91,6 +253,9 @@
     <ClCompile Include="src\RenderTarget.cpp" />
     <ClCompile Include="src\Scene.cpp" />
     <ClCompile Include="src\SceneLoader.cpp" />
+    <ClCompile Include="src\ScreenDisplayer.cpp" />
+    <ClCompile Include="src\ScriptController.cpp" />
+    <ClCompile Include="src\ScriptTarget.cpp" />
     <ClCompile Include="src\Slider.cpp" />
     <ClCompile Include="src\SpriteBatch.cpp" />
     <ClCompile Include="src\Technique.cpp" />
@@ -108,6 +273,11 @@
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="src\AbsoluteLayout.h" />
+    <ClInclude Include="src\AIAgent.h" />
+    <ClInclude Include="src\AIController.h" />
+    <ClInclude Include="src\AIMessage.h" />
+    <ClInclude Include="src\AIState.h" />
+    <ClInclude Include="src\AIStateMachine.h" />
     <ClInclude Include="src\Animation.h" />
     <ClInclude Include="src\AnimationClip.h" />
     <ClInclude Include="src\AnimationController.h" />
@@ -136,6 +306,7 @@
     <ClInclude Include="src\FrameBuffer.h" />
     <ClInclude Include="src\Frustum.h" />
     <ClInclude Include="src\Game.h" />
+    <ClInclude Include="src\Gamepad.h" />
     <ClInclude Include="src\gameplay.h" />
     <ClInclude Include="src\Image.h" />
     <ClInclude Include="src\Joint.h" />
@@ -144,6 +315,163 @@
     <ClInclude Include="src\Label.h" />
     <ClInclude Include="src\Layout.h" />
     <ClInclude Include="src\Light.h" />
+    <ClInclude Include="src\lua\lua_AbsoluteLayout.h" />
+    <ClInclude Include="src\lua\lua_AIAgent.h" />
+    <ClInclude Include="src\lua\lua_AIAgentListener.h" />
+    <ClInclude Include="src\lua\lua_AIController.h" />
+    <ClInclude Include="src\lua\lua_AIMessage.h" />
+    <ClInclude Include="src\lua\lua_AIMessageParameterType.h" />
+    <ClInclude Include="src\lua\lua_AIState.h" />
+    <ClInclude Include="src\lua\lua_AIStateListener.h" />
+    <ClInclude Include="src\lua\lua_AIStateMachine.h" />
+    <ClInclude Include="src\lua\lua_all_bindings.h" />
+    <ClInclude Include="src\lua\lua_Animation.h" />
+    <ClInclude Include="src\lua\lua_AnimationClip.h" />
+    <ClInclude Include="src\lua\lua_AnimationClipListener.h" />
+    <ClInclude Include="src\lua\lua_AnimationClipListenerEventType.h" />
+    <ClInclude Include="src\lua\lua_AnimationController.h" />
+    <ClInclude Include="src\lua\lua_AnimationTarget.h" />
+    <ClInclude Include="src\lua\lua_AnimationValue.h" />
+    <ClInclude Include="src\lua\lua_AudioBuffer.h" />
+    <ClInclude Include="src\lua\lua_AudioController.h" />
+    <ClInclude Include="src\lua\lua_AudioListener.h" />
+    <ClInclude Include="src\lua\lua_AudioSource.h" />
+    <ClInclude Include="src\lua\lua_AudioSourceState.h" />
+    <ClInclude Include="src\lua\lua_BoundingBox.h" />
+    <ClInclude Include="src\lua\lua_BoundingSphere.h" />
+    <ClInclude Include="src\lua\lua_Bundle.h" />
+    <ClInclude Include="src\lua\lua_Button.h" />
+    <ClInclude Include="src\lua\lua_Camera.h" />
+    <ClInclude Include="src\lua\lua_CameraType.h" />
+    <ClInclude Include="src\lua\lua_CheckBox.h" />
+    <ClInclude Include="src\lua\lua_Container.h" />
+    <ClInclude Include="src\lua\lua_ContainerScroll.h" />
+    <ClInclude Include="src\lua\lua_Control.h" />
+    <ClInclude Include="src\lua\lua_ControlAlignment.h" />
+    <ClInclude Include="src\lua\lua_ControlListener.h" />
+    <ClInclude Include="src\lua\lua_ControlListenerEventType.h" />
+    <ClInclude Include="src\lua\lua_ControlState.h" />
+    <ClInclude Include="src\lua\lua_Curve.h" />
+    <ClInclude Include="src\lua\lua_CurveInterpolationType.h" />
+    <ClInclude Include="src\lua\lua_DepthStencilTarget.h" />
+    <ClInclude Include="src\lua\lua_DepthStencilTargetFormat.h" />
+    <ClInclude Include="src\lua\lua_Effect.h" />
+    <ClInclude Include="src\lua\lua_FileSystem.h" />
+    <ClInclude Include="src\lua\lua_FlowLayout.h" />
+    <ClInclude Include="src\lua\lua_Font.h" />
+    <ClInclude Include="src\lua\lua_FontJustify.h" />
+    <ClInclude Include="src\lua\lua_FontStyle.h" />
+    <ClInclude Include="src\lua\lua_FontText.h" />
+    <ClInclude Include="src\lua\lua_Form.h" />
+    <ClInclude Include="src\lua\lua_FrameBuffer.h" />
+    <ClInclude Include="src\lua\lua_Frustum.h" />
+    <ClInclude Include="src\lua\lua_Game.h" />
+    <ClInclude Include="src\lua\lua_GameClearFlags.h" />
+    <ClInclude Include="src\lua\lua_Gamepad.h" />
+    <ClInclude Include="src\lua\lua_GamepadButtonState.h" />
+    <ClInclude Include="src\lua\lua_GamepadGamepadEvent.h" />
+    <ClInclude Include="src\lua\lua_GameState.h" />
+    <ClInclude Include="src\lua\lua_Global.h" />
+    <ClInclude Include="src\lua\lua_Image.h" />
+    <ClInclude Include="src\lua\lua_ImageFormat.h" />
+    <ClInclude Include="src\lua\lua_Joint.h" />
+    <ClInclude Include="src\lua\lua_Joystick.h" />
+    <ClInclude Include="src\lua\lua_Keyboard.h" />
+    <ClInclude Include="src\lua\lua_KeyboardKey.h" />
+    <ClInclude Include="src\lua\lua_KeyboardKeyEvent.h" />
+    <ClInclude Include="src\lua\lua_Label.h" />
+    <ClInclude Include="src\lua\lua_Layout.h" />
+    <ClInclude Include="src\lua\lua_LayoutType.h" />
+    <ClInclude Include="src\lua\lua_Light.h" />
+    <ClInclude Include="src\lua\lua_LightType.h" />
+    <ClInclude Include="src\lua\lua_Material.h" />
+    <ClInclude Include="src\lua\lua_MaterialParameter.h" />
+    <ClInclude Include="src\lua\lua_MathUtil.h" />
+    <ClInclude Include="src\lua\lua_Matrix.h" />
+    <ClInclude Include="src\lua\lua_Mesh.h" />
+    <ClInclude Include="src\lua\lua_MeshBatch.h" />
+    <ClInclude Include="src\lua\lua_MeshIndexFormat.h" />
+    <ClInclude Include="src\lua\lua_MeshPart.h" />
+    <ClInclude Include="src\lua\lua_MeshPrimitiveType.h" />
+    <ClInclude Include="src\lua\lua_MeshSkin.h" />
+    <ClInclude Include="src\lua\lua_Model.h" />
+    <ClInclude Include="src\lua\lua_Mouse.h" />
+    <ClInclude Include="src\lua\lua_MouseMouseEvent.h" />
+    <ClInclude Include="src\lua\lua_Node.h" />
+    <ClInclude Include="src\lua\lua_NodeCloneContext.h" />
+    <ClInclude Include="src\lua\lua_NodeType.h" />
+    <ClInclude Include="src\lua\lua_ParticleEmitter.h" />
+    <ClInclude Include="src\lua\lua_ParticleEmitterTextureBlending.h" />
+    <ClInclude Include="src\lua\lua_Pass.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCharacter.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObject.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectCollisionListener.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectCollisionListenerEventType.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectCollisionPair.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectType.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionShape.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionShapeDefinition.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionShapeType.h" />
+    <ClInclude Include="src\lua\lua_PhysicsConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsController.h" />
+    <ClInclude Include="src\lua\lua_PhysicsControllerHitFilter.h" />
+    <ClInclude Include="src\lua\lua_PhysicsControllerHitResult.h" />
+    <ClInclude Include="src\lua\lua_PhysicsControllerListener.h" />
+    <ClInclude Include="src\lua\lua_PhysicsControllerListenerEventType.h" />
+    <ClInclude Include="src\lua\lua_PhysicsFixedConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsGenericConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsGhostObject.h" />
+    <ClInclude Include="src\lua\lua_PhysicsHingeConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsRigidBody.h" />
+    <ClInclude Include="src\lua\lua_PhysicsRigidBodyParameters.h" />
+    <ClInclude Include="src\lua\lua_PhysicsSocketConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsSpringConstraint.h" />
+    <ClInclude Include="src\lua\lua_Plane.h" />
+    <ClInclude Include="src\lua\lua_Platform.h" />
+    <ClInclude Include="src\lua\lua_Properties.h" />
+    <ClInclude Include="src\lua\lua_PropertiesType.h" />
+    <ClInclude Include="src\lua\lua_Quaternion.h" />
+    <ClInclude Include="src\lua\lua_RadioButton.h" />
+    <ClInclude Include="src\lua\lua_Ray.h" />
+    <ClInclude Include="src\lua\lua_Rectangle.h" />
+    <ClInclude Include="src\lua\lua_Ref.h" />
+    <ClInclude Include="src\lua\lua_RenderState.h" />
+    <ClInclude Include="src\lua\lua_RenderStateAutoBinding.h" />
+    <ClInclude Include="src\lua\lua_RenderStateBlend.h" />
+    <ClInclude Include="src\lua\lua_RenderStateStateBlock.h" />
+    <ClInclude Include="src\lua\lua_RenderTarget.h" />
+    <ClInclude Include="src\lua\lua_Scene.h" />
+    <ClInclude Include="src\lua\lua_SceneDebugFlags.h" />
+    <ClInclude Include="src\lua\lua_ScreenDisplayer.h" />
+    <ClInclude Include="src\lua\lua_ScriptController.h" />
+    <ClInclude Include="src\lua\lua_ScriptTarget.h" />
+    <ClInclude Include="src\lua\lua_Slider.h" />
+    <ClInclude Include="src\lua\lua_SpriteBatch.h" />
+    <ClInclude Include="src\lua\lua_Technique.h" />
+    <ClInclude Include="src\lua\lua_TextBox.h" />
+    <ClInclude Include="src\lua\lua_Texture.h" />
+    <ClInclude Include="src\lua\lua_TextureFilter.h" />
+    <ClInclude Include="src\lua\lua_TextureFormat.h" />
+    <ClInclude Include="src\lua\lua_TextureSampler.h" />
+    <ClInclude Include="src\lua\lua_TextureWrap.h" />
+    <ClInclude Include="src\lua\lua_Theme.h" />
+    <ClInclude Include="src\lua\lua_ThemeSideRegions.h" />
+    <ClInclude Include="src\lua\lua_ThemeStyle.h" />
+    <ClInclude Include="src\lua\lua_ThemeThemeImage.h" />
+    <ClInclude Include="src\lua\lua_ThemeUVs.h" />
+    <ClInclude Include="src\lua\lua_Touch.h" />
+    <ClInclude Include="src\lua\lua_TouchTouchEvent.h" />
+    <ClInclude Include="src\lua\lua_Transform.h" />
+    <ClInclude Include="src\lua\lua_TransformListener.h" />
+    <ClInclude Include="src\lua\lua_Uniform.h" />
+    <ClInclude Include="src\lua\lua_Vector2.h" />
+    <ClInclude Include="src\lua\lua_Vector3.h" />
+    <ClInclude Include="src\lua\lua_Vector4.h" />
+    <ClInclude Include="src\lua\lua_VertexAttributeBinding.h" />
+    <ClInclude Include="src\lua\lua_VertexFormat.h" />
+    <ClInclude Include="src\lua\lua_VertexFormatElement.h" />
+    <ClInclude Include="src\lua\lua_VertexFormatUsage.h" />
+    <ClInclude Include="src\lua\lua_VerticalLayout.h" />
     <ClInclude Include="src\Material.h" />
     <ClInclude Include="src\MathUtil.h" />
     <ClInclude Include="src\MeshBatch.h" />
@@ -167,7 +495,6 @@
     <ClInclude Include="src\PhysicsGenericConstraint.h" />
     <ClInclude Include="src\PhysicsGhostObject.h" />
     <ClInclude Include="src\PhysicsHingeConstraint.h" />
-    <ClInclude Include="src\PhysicsMotionState.h" />
     <ClInclude Include="src\PhysicsRigidBody.h" />
     <ClInclude Include="src\PhysicsSocketConstraint.h" />
     <ClInclude Include="src\PhysicsSpringConstraint.h" />
@@ -184,6 +511,8 @@
     <ClInclude Include="src\Scene.h" />
     <ClInclude Include="src\SceneLoader.h" />
     <ClInclude Include="src\ScreenDisplayer.h" />
+    <ClInclude Include="src\ScriptController.h" />
+    <ClInclude Include="src\ScriptTarget.h" />
     <ClInclude Include="src\Slider.h" />
     <ClInclude Include="src\SpriteBatch.h" />
     <ClInclude Include="src\Technique.h" />
@@ -206,29 +535,27 @@
     <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-specular.fsh" />
-    <None Include="res\shaders\bumped-specular.vsh" />
-    <None Include="res\shaders\bumped.fsh" />
-    <None Include="res\shaders\bumped.vsh" />
-    <None Include="res\shaders\colored-specular.fsh" />
-    <None Include="res\shaders\colored-specular.vsh" />
-    <None Include="res\shaders\colored.fsh" />
-    <None Include="res\shaders\colored.vsh" />
-    <None Include="res\shaders\diffuse-specular.fsh" />
-    <None Include="res\shaders\diffuse-specular.vsh" />
-    <None Include="res\shaders\diffuse.fsh" />
-    <None Include="res\shaders\diffuse.vsh" />
-    <None Include="res\shaders\parallax-specular.fsh" />
-    <None Include="res\shaders\parallax-specular.vsh" />
-    <None Include="res\shaders\parallax.fsh" />
-    <None Include="res\shaders\parallax.vsh" />
-    <None Include="res\shaders\solid.fsh" />
-    <None Include="res\shaders\solid.vsh" />
-    <None Include="res\shaders\textured.fsh" />
-    <None Include="res\shaders\textured.vsh" />
+    <None Include="res\shaders\colored-unlit.frag" />
+    <None Include="res\shaders\colored-unlit.vert" />
+    <None Include="res\shaders\colored.frag" />
+    <None Include="res\shaders\colored.vert" />
+    <None Include="res\shaders\lib\attributes-skinning.vert" />
+    <None Include="res\shaders\lib\attributes.vert" />
+    <None Include="res\shaders\lib\lighting-directional.frag" />
+    <None Include="res\shaders\lib\lighting-directional.vert" />
+    <None Include="res\shaders\lib\lighting-point.frag" />
+    <None Include="res\shaders\lib\lighting-point.vert" />
+    <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" />
+    <None Include="res\shaders\textured.vert" />
     <None Include="src\BoundingBox.inl" />
     <None Include="src\BoundingSphere.inl" />
-    <None Include="src\Curve.inl" />
     <None Include="src\Game.inl" />
     <None Include="src\gameplay-main-ios.mm" />
     <None Include="src\gameplay-main-macosx.mm" />
@@ -243,6 +570,7 @@
     <None Include="src\PlatformMacOSX.mm" />
     <None Include="src\Quaternion.inl" />
     <None Include="src\Ray.inl" />
+    <None Include="src\ScriptController.inl" />
     <None Include="src\Vector2.inl" />
     <None Include="src\Vector3.inl" />
     <None Include="src\Vector4.inl" />
@@ -314,7 +642,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>
       </RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -331,7 +659,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </ClCompile>
@@ -353,7 +681,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -365,4 +693,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>

File diff suppressed because it is too large
+ 999 - 69
gameplay/gameplay.vcxproj.filters


File diff suppressed because it is too large
+ 996 - 5
gameplay/gameplay.xcodeproj/project.pbxproj


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

@@ -1,124 +0,0 @@
-#ifdef OPENGL_ES
-precision highp float;
-#endif
-
-// Uniforms
-uniform vec3 u_lightColor;                  // Light color.
-uniform vec3 u_ambientColor;                // Ambient color.
-uniform float u_specularExponent;           // Specular exponent or shininess property.
-uniform sampler2D u_diffuseTexture;         // Diffuse texture.
-uniform sampler2D u_normalMapTexture;       // Normal map texture.
-#if defined(GLOBAL_ALPHA)
-uniform float u_globalAlpha;                    // Global alpha value
-#endif
-
-// Inputs
-varying vec2 v_texCoord;                    // Texture Coordinate.
-varying vec3 v_cameraDirection;             // Direction the camera is looking at in tangent space.
-
-// Global variables
-vec4 _baseColor;                            // Base color
-vec3 _ambientColor;                         // Ambient Color
-vec3 _diffuseColor;                         // Diffuse Color
-vec3 _specularColor;                        // Specular color
-
-void lighting(vec3 normalVector, vec3 cameraDirection, vec3 lightDirection, float attenuation)
-{
-    // Ambient
-    _ambientColor = _baseColor.rgb * u_ambientColor;
-
-    // Diffuse
-    float diffuseIntensity = attenuation * max(0.0, dot(normalVector, lightDirection));
-    diffuseIntensity = max(0.0, diffuseIntensity);
-    _diffuseColor = u_lightColor * _baseColor.rgb * diffuseIntensity;
-
-    // Specular
-    vec3 halfVector = normalize(cameraDirection + lightDirection);
-    float specularIntensity = attenuation * max(0.0, pow(dot(normalVector, halfVector), u_specularExponent));
-    specularIntensity = max(0.0, specularIntensity);
-    _specularColor = u_lightColor * _baseColor.rgb * specularIntensity;
-}
-
-#if defined(POINT_LIGHT)
-
-varying vec3 v_vertexToPointLightDirection;   // Light direction w.r.t current vertex in tangent space.
-varying float v_pointLightAttenuation;        // Attenuation of point light.
-
-void applyLight()
-{
-    // Normalize the vectors.
-    // Fetch normals from the normal map.
-    vec3 normalVector = normalize(texture2D(u_normalMapTexture, v_texCoord).rgb * 2.0 - 1.0);
-    vec3 cameraDirection = normalize(v_cameraDirection);
-    vec3 vertexToPointLightDirection = normalize(v_vertexToPointLightDirection);
-    
-    float pointLightAttenuation = clamp(v_pointLightAttenuation, 0.0, 1.0);
-    
-    lighting(normalVector, cameraDirection, vertexToPointLightDirection, pointLightAttenuation);
-}
-
-#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]
-varying vec3 v_spotLightDirection;            // Direction of spot light in tangent space.
-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.
-
-float lerpstep( float lower, float upper, float s)
-{
-    return clamp( ( s - lower ) / ( upper - lower ), 0.0, 1.0 );
-}
-
-void applyLight()
-{
-    // Fetch normals from the normal map.
-    vec3 normalVector = normalize(texture2D(u_normalMapTexture, v_texCoord).rgb * 2.0 - 1.0);
-    vec3 cameraDirection = normalize(v_cameraDirection);
-    vec3 spotLightDirection = normalize(v_spotLightDirection);
-    vec3 vertexToSpotLightDirection = normalize(v_vertexToSpotLightDirection);
-    
-    // "-lightDirection" because light direction points in opposite direction to
-    // to spot direction.
-    // Calculate spot light effect.
-    float spotCurrentAngleCos = max(0.0, dot(spotLightDirection, -vertexToSpotLightDirection));
-    
-    // Intensity of spot depends on the spot light attenuation and the 
-    // part of the cone vertexToSpotLightDirection points to (inner or outer).
-    float spotLightAttenuation = clamp(v_spotLightAttenuation, 0.0, 1.0);
-    spotLightAttenuation *= lerpstep(u_spotLightOuterAngleCos, u_spotLightInnerAngleCos, spotCurrentAngleCos);
-
-    lighting(normalVector, cameraDirection, vertexToSpotLightDirection, spotLightAttenuation);
-}
-
-#else
-
-varying vec3 v_lightDirection;                 // Direction of light in tangent space.
-
-void applyLight()
-{
-    // Fetch normals from the normal map
-    vec3 normalVector = normalize(texture2D(u_normalMapTexture, v_texCoord).rgb * 2.0 - 1.0);
-    vec3 cameraDirection = normalize(v_cameraDirection);
-    vec3 lightDirection = normalize(v_lightDirection);
-
-    lighting(normalVector, cameraDirection, -lightDirection, 1.0);
-}
-#endif
-
-void main()
-{
-    // Fetch diffuse color from texture.
-    _baseColor = texture2D(u_diffuseTexture, v_texCoord);
-
-    // Apply light
-    applyLight();
-
-    // Light the pixel
-    gl_FragColor.a = _baseColor.a;
-    gl_FragColor.rgb = _ambientColor + _diffuseColor + _specularColor;
-
-#if defined(GLOBAL_ALPHA)
-    gl_FragColor.a *= u_globalAlpha;
-#endif
-}

+ 0 - 248
gameplay/res/shaders/bumped-specular.vsh

@@ -1,248 +0,0 @@
-// Uniforms
-uniform mat4 u_worldViewMatrix;                     // Matrix to tranform a position to view space.
-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 vec3 u_cameraPosition;                      // Position of the camera.
-
-// Inputs
-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)
-attribute vec3 a_tangent;                           // Vertex Tangent (x, y, z)
-attribute vec3 a_binormal;                          // Vertex Binormal (actually Bi-tangent) (x, y, z)
-
-// Outputs
-varying vec2 v_texCoord;                            // Texture Coordinate (u,v)
-varying vec3 v_cameraDirection;                     // Direction the camera is looking at in tangent space.
-
-#if defined(SKINNING)
-
-attribute vec4 a_blendWeights;
-attribute vec4 a_blendIndices;
-
-// 32 4x3 matrices as an array of floats
-uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];
-
-// Common vectors.
-vec4 _skinnedPosition;
-vec3 _skinnedNormal;
-
-void skinPosition(float blendWeight, int matrixIndex)
-{
-    vec4 tmp;
-
-    tmp.x = dot(a_position, u_matrixPalette[matrixIndex]);
-    tmp.y = dot(a_position, u_matrixPalette[matrixIndex + 1]);
-    tmp.z = dot(a_position, u_matrixPalette[matrixIndex + 2]);
-    tmp.w = a_position.w;
-
-    _skinnedPosition += blendWeight * tmp;
-}
-
-vec4 getPosition()
-{
-    _skinnedPosition = vec4(0.0);
-
-    // Transform position to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    return _skinnedPosition;    
-}
-
-void skinTangentSpaceVector(vec3 vector, float blendWeight, int matrixIndex)
-{
-    vec3 tmp;
-
-    tmp.x = dot(vector, u_matrixPalette[matrixIndex].xyz);
-    tmp.y = dot(vector, u_matrixPalette[matrixIndex + 1].xyz);
-    tmp.z = dot(vector, u_matrixPalette[matrixIndex + 2].xyz);
-
-    _skinnedNormal += blendWeight * tmp;
-}
-
-vec3 getTangentSpaceVector(vec3 vector)
-{
-    _skinnedNormal = vec3(0.0);
-
-    // Transform normal to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinTangentSpaceVector(vector, blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinTangentSpaceVector(vector, blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinTangentSpaceVector(vector, blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinTangentSpaceVector(vector, blendWeight, matrixIndex);
-
-    return _skinnedNormal;
-}
-
-vec3 getNormal()
-{
-    return getTangentSpaceVector(a_normal);
-}
-
-vec3 getTangent()
-{
-    return getTangentSpaceVector(a_tangent);
-}
-
-vec3 getBinormal()
-{
-    return getTangentSpaceVector(a_binormal);
-}
-
-#else
-
-vec4 getPosition()
-{
-    return a_position;    
-}
-
-vec3 getNormal()
-{
-    return a_normal;
-}
-
-vec3 getTangent()
-{
-    return a_tangent;
-}
-
-vec3 getBinormal()
-{
-    return a_binormal;
-}
-
-#endif
-
-#if defined(POINT_LIGHT)
-
-uniform vec3 u_pointLightPosition;                  // Position
-uniform float u_pointLightRangeInverse;             // Inverse of light range 
-varying vec3 v_vertexToPointLightDirection;         // Direction of point light w.r.t current vertex in tangent space.
-varying float v_pointLightAttenuation;              // Attenuation of point light.
-
-void applyLight(mat3 tangentSpaceTransformMatrix)
-{
-    vec4 positionWorldViewSpace = u_worldViewMatrix * a_position;
-    
-    // Compute camera direction and transform it to tangent space.
-    v_cameraDirection = tangentSpaceTransformMatrix * (u_cameraPosition - positionWorldViewSpace.xyz);
-    
-    // Compute the light direction with light position and the vertex position.
-    vec3 lightDirection = u_pointLightPosition - positionWorldViewSpace.xyz;
-    
-    // Transform current light direction to tangent space.
-    vec3 vertexToPointLightDirection = tangentSpaceTransformMatrix * lightDirection;
-
-    // Attenuation
-    v_pointLightAttenuation = 1.0 - dot(lightDirection * u_pointLightRangeInverse, lightDirection * u_pointLightRangeInverse);
-
-    // Output light direction.
-    v_vertexToPointLightDirection =  vertexToPointLightDirection;
-}
-
-#elif defined(SPOT_LIGHT)
-
-uniform vec3 u_spotLightPosition;                   // Position
-uniform float u_spotLightRangeInverse;              // Inverse of light range.
-uniform vec3 u_spotLightDirection;                  // Direction
-varying vec3 v_spotLightDirection;                  // Direction of spot light in tangent space.
-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.
-
-void applyLight(mat3 tangentSpaceTransformMatrix)
-{
-    vec4 positionWorldViewSpace = u_worldViewMatrix * a_position;
-    
-    // Compute camera direction and transform it to tangent space.
-    v_cameraDirection = tangentSpaceTransformMatrix * (u_cameraPosition - positionWorldViewSpace.xyz);
-
-    // Transform spot light direction to tangent space.
-    v_spotLightDirection = tangentSpaceTransformMatrix * u_spotLightDirection;
-
-    // Compute the light direction with light position and the vertex position.
-    vec3 lightDirection = u_spotLightPosition - positionWorldViewSpace.xyz;
-    
-    // Transform current light direction to tangent space.
-    lightDirection = tangentSpaceTransformMatrix * lightDirection;
-    
-    // Attenuation
-    v_spotLightAttenuation = 1.0 - dot(lightDirection * u_spotLightRangeInverse, lightDirection * u_spotLightRangeInverse);
-
-    // Output light direction.
-    v_vertexToSpotLightDirection = lightDirection;
-}
-
-#else
-
-uniform vec3 u_lightDirection;                      // Direction
-varying vec3 v_lightDirection;                      // Direction of light in tangent space.
-
-void applyLight(mat3 tangentSpaceTransformMatrix)
-{
-    vec4 positionWorldViewSpace = u_worldViewMatrix * a_position;
-    
-    // Compute camera direction and transform it to tangent space.
-    v_cameraDirection = tangentSpaceTransformMatrix * (u_cameraPosition - positionWorldViewSpace.xyz);
-    
-    // Transform light direction to tangent space.
-    v_lightDirection = tangentSpaceTransformMatrix * u_lightDirection;
-}
-
-#endif
-
-void main()
-{
-    vec4 position = getPosition();
-    vec3 normal = getNormal();
-    vec3 tangent = getTangent();
-    vec3 binormal = getBinormal();
-    
-    // Transform position to clip space.
-    gl_Position = u_worldViewProjectionMatrix * position;
-
-    // Transform the normal, tangent and binormals to  view space.
-    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldViewMatrix[0].xyz,
-                                                u_inverseTransposeWorldViewMatrix[1].xyz,
-                                                u_inverseTransposeWorldViewMatrix[2].xyz);
-    vec3 tangentVector  = normalize(inverseTransposeWorldViewMatrix * tangent);
-    vec3 normalVector = normalize(inverseTransposeWorldViewMatrix * normal);
-    vec3 binormalVector = normalize(inverseTransposeWorldViewMatrix * binormal);
-
-    // Create a transform to convert a vector to tangent space.
-    mat3 tangentSpaceTransformMatrix = mat3(tangentVector.x, binormalVector.x, normalVector.x,
-                                            tangentVector.y, binormalVector.y, normalVector.y,
-                                            tangentVector.z, binormalVector.z, normalVector.z);
-    // Apply light.
-    applyLight(tangentSpaceTransformMatrix);
-
-    // Pass on the texture coordinates to Fragment shader.
-    v_texCoord = a_texCoord;
-}

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

@@ -1,113 +0,0 @@
-#ifdef OPENGL_ES
-precision highp float;
-#endif
-
-// Uniforms
-uniform vec3 u_lightColor;                   // Light color.
-uniform vec3 u_ambientColor;                 // Ambient color.
-uniform sampler2D u_diffuseTexture;          // Diffuse texture.
-uniform sampler2D u_normalMapTexture;        // Normal map texture.
-#if defined(GLOBAL_ALPHA)
-uniform float u_globalAlpha;                    // Global alpha value
-#endif
-
-// Inputs
-varying vec2 v_texCoord;                     // Texture Coordinate.
-
-// Common colors
-vec4 _baseColor;                             // Base color
-vec3 _ambientColor;                          // Ambient Color
-vec3 _diffuseColor;                          // Diffuse Color
-
-void lighting(vec3 normalVector, vec3 lightDirection, float attenuation)
-{
-    // Ambient
-    _ambientColor = _baseColor.rgb * u_ambientColor;
-
-    // Diffuse
-    float diffuseIntensity = attenuation * max(0.0, dot(normalVector, lightDirection));
-    diffuseIntensity = max(0.0, diffuseIntensity);
-    _diffuseColor = u_lightColor * _baseColor.rgb * diffuseIntensity;
-}
-
-#if defined(POINT_LIGHT)
-
-varying vec3 v_vertexToPointLightDirection;  // Light direction w.r.t current vertex in tangent space.
-varying float v_pointLightAttenuation;       // Attenuation of point light.
-
-void applyLight()
-{
-    // Normalize the vectors.
-    // Fetch normals from the normal map.
-    vec3 normalVector = normalize(texture2D(u_normalMapTexture, v_texCoord).rgb * 2.0 - 1.0);
-    vec3 vertexToPointLightDirection = normalize(v_vertexToPointLightDirection);
-    float pointLightAttenuation = clamp(v_pointLightAttenuation, 0.0, 1.0);
-    
-    // Fetch point light attenuation.
-    lighting(normalVector, vertexToPointLightDirection, pointLightAttenuation);
-}
-
-#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]
-varying vec3 v_spotLightDirection;            // Direction of spot light in tangent space.
-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.
-
-float lerpstep( float lower, float upper, float s)
-{
-    return clamp( ( s - lower ) / ( upper - lower ), 0.0, 1.0 );
-}
-
-void applyLight()
-{
-    // Fetch normals from the normal map.
-    vec3 normalVector = normalize(texture2D(u_normalMapTexture, v_texCoord).xyz * 2.0 - 1.0);
-    vec3 spotLightDirection =normalize(v_spotLightDirection);
-    vec3 vertexToSpotLightDirection = normalize(v_vertexToSpotLightDirection);
-    
-    // "-lightDirection" because light direction points in opposite direction to
-    // to spot direction.
-    // Calculate spot light effect.
-    float spotCurrentAngleCos = max(0.0, dot(spotLightDirection, -vertexToSpotLightDirection));
-    
-    // Intensity of spot depends on the spot light attenuation and the 
-    // part of the cone vertexToSpotLightDirection points to (inner or outer).
-    float spotLightAttenuation = clamp(v_spotLightAttenuation, 0.0, 1.0);
-    spotLightAttenuation *= lerpstep(u_spotLightOuterAngleCos, u_spotLightInnerAngleCos, spotCurrentAngleCos);
-
-    lighting(normalVector, vertexToSpotLightDirection, spotLightAttenuation);
-}
-
-#else
-
-varying vec3 v_lightDirection;                  // Direction of light in tangent space.
-
-void applyLight()
-{
-    // Normalize vectors.
-    // Fetch normals from the normal map
-    vec3 normalVector = normalize(texture2D(u_normalMapTexture, v_texCoord).xyz * 2.0 - 1.0);
-    vec3 lightDirection = normalize(v_lightDirection);
-
-    lighting(normalVector, -lightDirection, 1.0);
-}
-#endif
-
-void main()
-{
-    // Fetch diffuse color from texture.
-    _baseColor = texture2D(u_diffuseTexture, v_texCoord);
-
-    // Apply light
-    applyLight();
-
-    // Light the pixel
-    gl_FragColor.a = _baseColor.a;
-    gl_FragColor.rgb = _ambientColor + _diffuseColor;
-
-#if defined(GLOBAL_ALPHA)
-    gl_FragColor.a *= u_globalAlpha;
-#endif
-}

+ 0 - 236
gameplay/res/shaders/bumped.vsh

@@ -1,236 +0,0 @@
-// 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.
-
-// Inputs
-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)
-attribute vec3 a_tangent;                       // Vertex Tangent (x, y, z)
-attribute vec3 a_binormal;                      // Vertex Binormal (actually Bi-tangent) (x, y, z)
-
-// Outputs
-varying vec2 v_texCoord;                        // Texture Coordinate (u,v)
-
-#if defined(SKINNING)
-
-attribute vec4 a_blendWeights;
-attribute vec4 a_blendIndices;
-
-// 32 4x3 matrices as an array of floats
-uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];
-
-// Common vectors.
-vec4 _skinnedPosition;
-vec3 _skinnedNormal;
-
-void skinPosition(float blendWeight, int matrixIndex)
-{
-    vec4 tmp;
-
-    tmp.x = dot(a_position, u_matrixPalette[matrixIndex]);
-    tmp.y = dot(a_position, u_matrixPalette[matrixIndex + 1]);
-    tmp.z = dot(a_position, u_matrixPalette[matrixIndex + 2]);
-    tmp.w = a_position.w;
-
-    _skinnedPosition += blendWeight * tmp;
-}
-
-vec4 getPosition()
-{
-    _skinnedPosition = vec4(0.0);
-
-    // Transform position to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    return _skinnedPosition;    
-}
-
-void skinTangentSpaceVector(vec3 vector, float blendWeight, int matrixIndex)
-{
-    vec3 tmp;
-
-    tmp.x = dot(vector, u_matrixPalette[matrixIndex].xyz);
-    tmp.y = dot(vector, u_matrixPalette[matrixIndex + 1].xyz);
-    tmp.z = dot(vector, u_matrixPalette[matrixIndex + 2].xyz);
-
-    _skinnedNormal += blendWeight * tmp;
-}
-
-vec3 getTangentSpaceVector(vec3 vector)
-{
-    _skinnedNormal = vec3(0.0);
-
-    // Transform normal to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinTangentSpaceVector(vector, blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinTangentSpaceVector(vector, blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinTangentSpaceVector(vector, blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinTangentSpaceVector(vector, blendWeight, matrixIndex);
-
-    return _skinnedNormal;
-}
-
-vec3 getNormal()
-{
-    return getTangentSpaceVector(a_normal);
-}
-
-vec3 getTangent()
-{
-    return getTangentSpaceVector(a_tangent);
-}
-
-vec3 getBinormal()
-{
-    return getTangentSpaceVector(a_binormal);
-}
-
-#else
-
-vec4 getPosition()
-{
-    return a_position;    
-}
-
-vec3 getNormal()
-{
-    return a_normal;
-}
-
-vec3 getTangent()
-{
-    return a_tangent;
-}
-
-vec3 getBinormal()
-{
-    return a_binormal;
-}
-
-#endif
-
-#if defined(POINT_LIGHT)
-
-uniform mat4 u_worldViewMatrix;                 // Matrix to tranform a position to view space.
-uniform vec3 u_pointLightPosition;              // Position
-uniform float u_pointLightRangeInverse;         // Inverse of light range.
-varying vec3 v_vertexToPointLightDirection;     // Direction of point light w.r.t current vertex in tangent space.
-varying float v_pointLightAttenuation;          // Attenuation of point light.
-
-void applyLight(mat3 tangentSpaceTransformMatrix)
-{
-    // World space position.
-    vec4 positionWorldViewSpace = u_worldViewMatrix * a_position;
-    
-    // Compute the light direction with light position and the vertex position.
-    vec3 lightDirection = u_pointLightPosition - positionWorldViewSpace.xyz;
-    
-    // Transform current light direction to tangent space.
-    vec3 vertexToSpotLightDirection = tangentSpaceTransformMatrix * lightDirection;
-
-    // Attenuation
-    v_pointLightAttenuation = 1.0 - dot(lightDirection * u_pointLightRangeInverse, lightDirection * u_pointLightRangeInverse);
-
-    // Output light direction.
-    v_vertexToPointLightDirection =  vertexToSpotLightDirection;
-}
-
-#elif defined(SPOT_LIGHT)
-
-uniform mat4 u_worldViewMatrix;                 // Matrix to tranform a position to view space.
-uniform vec3 u_spotLightPosition;               // Position
-uniform float u_spotLightRangeInverse;          // Inverse of light range.
-uniform vec3 u_spotLightDirection;              // Direction
-varying vec3 v_spotLightDirection;              // Direction of spot light in tangent space.
-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.
-
-void applyLight(mat3 tangentSpaceTransformMatrix)
-{
-    vec4 positionWorldViewSpace = u_worldViewMatrix * a_position;
-
-    // Transform spot light direction to tangent space.
-    v_spotLightDirection = tangentSpaceTransformMatrix * u_spotLightDirection;
-
-    // Compute the light direction with light position and the vertex position.
-    vec3 lightDirection = u_spotLightPosition - positionWorldViewSpace.xyz;
-    
-    // Transform current light direction to tangent space.
-    lightDirection = tangentSpaceTransformMatrix * lightDirection;
-    
-    // Attenuation
-    v_spotLightAttenuation = 1.0 - dot(lightDirection * u_spotLightRangeInverse, lightDirection * u_spotLightRangeInverse);
-
-    // Output light direction.
-    v_vertexToSpotLightDirection = lightDirection;
-}
-
-#else
-
-uniform vec3 u_lightDirection;                  // Direction
-varying vec3 v_lightDirection;                  // Direction of light in tangent space.
-
-void applyLight(mat3 tangentSpaceTransformMatrix)
-{
-    // Transform light direction to tangent space.
-    v_lightDirection = tangentSpaceTransformMatrix * u_lightDirection;
-}
-
-#endif
-
-void main()
-{
-    vec4 position = getPosition();
-    vec3 normal = getNormal();
-    vec3 tangent = getTangent();
-    vec3 binormal = getBinormal();
-    
-    // Transform position to clip space.
-    gl_Position = u_worldViewProjectionMatrix * position;
-
-    // Transform the normal, tangent and binormals to  view space.
-    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldViewMatrix);
-    vec3 tangentVector  = normalize(inverseTransposeWorldViewMatrix * tangent);
-    vec3 normalVector = normalize(inverseTransposeWorldViewMatrix * normal);
-    vec3 binormalVector = normalize(inverseTransposeWorldViewMatrix * binormal);
-
-    // Create a transform to convert a vector to tangent space.
-    mat3 tangentSpaceTransformMatrix = mat3(tangentVector.x, binormalVector.x, normalVector.x,
-                                            tangentVector.y, binormalVector.y, normalVector.y,
-                                            tangentVector.z, binormalVector.z, normalVector.z);
-
-    // Apply light.
-    applyLight(tangentSpaceTransformMatrix);
-
-    // Pass on the texture coordinates to Fragment shader.
-    v_texCoord = a_texCoord;
-}

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

@@ -1,132 +0,0 @@
-#ifdef OPENGL_ES
-precision highp float;
-#endif
-
-// Uniforms
-uniform vec3 u_lightColor;                      // Light color
-uniform vec3 u_ambientColor;                    // Ambient color
-uniform float u_specularExponent;               // Specular exponent or shininess property
-#if !defined(VERTEX_COLOR)
-uniform vec4 u_diffuseColor;                    // Diffuse color
-#endif
-#if defined(GLOBAL_ALPHA)
-uniform float u_globalAlpha;                    // Global alpha value
-#endif
-
-// Inputs
-varying vec3 v_normalVector;                    // NormalVector in view space
-varying vec3 v_cameraDirection;                 // Camera direction
-#if defined(VERTEX_COLOR)
-varying vec4 v_color;							// Vertex color
-#endif
-
-// Global variables
-vec4 _baseColor;                                // Base color
-vec3 _ambientColor;                             // Ambient Color
-vec3 _diffuseColor;                             // Diffuse Color
-vec3 _specularColor;                            // Specular color
-
-void lighting(vec3 normalVector, vec3 cameraDirection, vec3 lightDirection, float attenuation)
-{
-    // Ambient
-    _ambientColor = _baseColor.rgb * u_ambientColor;
-
-    // Diffuse
-    float ddot = abs(dot(normalVector, lightDirection));
-    float diffuseIntensity = attenuation * ddot;
-    diffuseIntensity = max(0.0, diffuseIntensity);
-    _diffuseColor = u_lightColor * _baseColor.rgb * diffuseIntensity;
-
-    // Specular
-    vec3 halfVector = normalize(cameraDirection + lightDirection);
-    float specularIntensity = attenuation * max(0.0, pow(dot(normalVector, halfVector), u_specularExponent));
-    specularIntensity = max(0.0, specularIntensity);
-    _specularColor = u_lightColor * _baseColor.rgb * specularIntensity;
-}
-
-#if defined(POINT_LIGHT)
-
-varying vec4 v_vertexToPointLightDirection;      // Light direction w.r.t current vertex.
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    vec3 cameraDirection = normalize(v_cameraDirection);
-
-    vec3 vertexToPointLightDirection = normalize(v_vertexToPointLightDirection.xyz);
-
-    // Fetch point light attenuation.
-    float pointLightAttenuation = v_vertexToPointLightDirection.w;
-    lighting(normalVector, cameraDirection, vertexToPointLightDirection, pointLightAttenuation);
-}
-
-#elif defined(SPOT_LIGHT)
-
-uniform vec3 u_spotLightDirection;              // Direction of the 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]
-varying vec3 v_vertexToSpotLightDirection;      // Light direction w.r.t current vertex.
-varying float v_spotLightAttenuation;           // Attenuation of spot light.
-
-float lerpstep( float lower, float upper, float s)
-{
-    return clamp( ( s - lower ) / ( upper - lower ), 0.0, 1.0 );
-}
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    vec3 cameraDirection = normalize(v_cameraDirection);
-    vec3 spotLightDirection = normalize(u_spotLightDirection); 
-    vec3 vertexToSpotLightDirection = normalize(v_vertexToSpotLightDirection);
-
-    // "-lightDirection" is used because light direction points in opposite direction to
-    // to spot direction.
-    // Calculate spot light effect.
-    float spotCurrentAngleCos = max(0.0, dot(spotLightDirection, -vertexToSpotLightDirection));
-
-    // Intensity of spot depends on the spot light attenuation and the 
-    // part of the cone vertexToSpotLightDirection points to (inner or outer).
-    float spotLightAttenuation = clamp(v_spotLightAttenuation, 0.0, 1.0);
-    spotLightAttenuation *= lerpstep(u_spotLightOuterAngleCos, u_spotLightInnerAngleCos, spotCurrentAngleCos);
-
-    lighting(normalVector, cameraDirection, vertexToSpotLightDirection, spotLightAttenuation);
-}
-
-#else
-
-uniform vec3 u_lightDirection;                  // Light direction
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    vec3 cameraDirection = normalize(v_cameraDirection);
-    vec3 lightDirection = normalize(u_lightDirection);
-
-    lighting(normalVector, cameraDirection, -lightDirection, 1.0);
-}
-#endif
-
-void main()
-{
-    // Set base diffuse color
-#if defined(VERTEX_COLOR)
-	_baseColor = v_color;
-#else
-	_baseColor = u_diffuseColor;
-#endif
-
-    // Apply light
-    applyLight();
-
-    // Light the pixel
-    gl_FragColor.a = _baseColor.a;
-    gl_FragColor.rgb = _ambientColor + _diffuseColor + _specularColor;
-
-#if defined(GLOBAL_ALPHA)
-    gl_FragColor.a *= u_globalAlpha;
-#endif
-}

+ 0 - 203
gameplay/res/shaders/colored-specular.vsh

@@ -1,203 +0,0 @@
-// 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_worldMatrix;                         // Matrix to tranform a position to world space.
-uniform vec3 u_cameraPosition;                      // Position of the camera.
-
-// Inputs
-attribute vec4 a_position;                          // Vertex Position (x, y, z, w)
-attribute vec3 a_normal;                            // Vertex Normal (x, y, z)
-#if defined(VERTEX_COLOR)
-attribute vec4 a_color;
-#endif
-
-// Outputs
-varying vec3 v_normalVector;                        // NormalVector in view space
-varying vec3 v_cameraDirection;                     // Camera direction
-#if defined(VERTEX_COLOR)
-varying vec4 v_color;								// Vertex color
-#endif
-
-#if defined(SKINNING)
-
-attribute vec4 a_blendWeights;
-attribute vec4 a_blendIndices;
-
-// 32 4x3 matrices as an array of floats
-uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];
-
-// Common vectors.
-vec4 _skinnedPosition;
-vec3 _skinnedNormal;
-
-void skinPosition(float blendWeight, int matrixIndex)
-{
-    vec4 tmp;
-
-    tmp.x = dot(a_position, u_matrixPalette[matrixIndex]);
-    tmp.y = dot(a_position, u_matrixPalette[matrixIndex + 1]);
-    tmp.z = dot(a_position, u_matrixPalette[matrixIndex + 2]);
-    tmp.w = a_position.w;
-
-    _skinnedPosition += blendWeight * tmp;
-}
-
-vec4 getPosition()
-{
-    _skinnedPosition = vec4(0.0);
-
-    // Transform position to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    return _skinnedPosition;    
-}
-
-void skinNormal(float blendWeight, int matrixIndex)
-{
-    vec3 tmp;
-
-    tmp.x = dot(a_normal, u_matrixPalette[matrixIndex].xyz);
-    tmp.y = dot(a_normal, u_matrixPalette[matrixIndex + 1].xyz);
-    tmp.z = dot(a_normal, u_matrixPalette[matrixIndex + 2].xyz);
-
-    _skinnedNormal += blendWeight * tmp;
-}
-
-vec3 getNormal()
-{
-    _skinnedNormal = vec3(0.0);
-
-    // Transform normal to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    return _skinnedNormal;
-}
-
-#else
-
-vec4 getPosition()
-{
-    return a_position;    
-}
-
-vec3 getNormal()
-{
-    return a_normal;
-}
-
-#endif
-
-
-#if defined(POINT_LIGHT)
-
-uniform mat4 u_worldViewMatrix;                     // Matrix to tranform a position to view space.
-uniform vec3 u_pointLightPosition;                  // Position
-uniform float u_pointLightRangeInverse;             // Inverse of light range. 
-varying vec4 v_vertexToPointLightDirection;         // Light direction w.r.t current vertex.
-
-void applyLight(vec4 position)
-{
-    // World space position.
-    vec4 positionWorldViewSpace = u_worldViewMatrix * position;
-    
-    // Compute the light direction with light position and the vertex position.
-    vec3 lightDirection = u_pointLightPosition - positionWorldViewSpace.xyz;
-    
-    vec4 vertexToPointLightDirection;
-    vertexToPointLightDirection.xyz = lightDirection;
-    
-    // Attenuation
-    vertexToPointLightDirection.w = 1.0 - dot(lightDirection * u_pointLightRangeInverse, lightDirection * u_pointLightRangeInverse);
-
-    // Output light direction.
-    v_vertexToPointLightDirection =  vertexToPointLightDirection;
-}
-
-#elif defined(SPOT_LIGHT)
-
-uniform mat4 u_worldViewMatrix;                     // Matrix to tranform a position to view space.
-uniform vec3 u_spotLightPosition;                   // Position
-uniform float u_spotLightRangeInverse;              // Inverse of light range.
-varying vec3 v_vertexToSpotLightDirection;          // Light direction w.r.t current vertex.
-varying float v_spotLightAttenuation;               // Attenuation of spot light.
-
-void applyLight(vec4 position)
-{
-    // World space position.
-    vec4 positionWorldViewSpace = u_worldViewMatrix * position;
-
-    // Compute the light direction with light position and the vertex position.
-    vec3 lightDirection = u_spotLightPosition - positionWorldViewSpace.xyz;
-
-    // Attenuation
-    v_spotLightAttenuation = 1.0 - dot(lightDirection * u_spotLightRangeInverse, lightDirection * u_spotLightRangeInverse);
-
-    // Compute the light direction with light position and the vertex position.
-    v_vertexToSpotLightDirection = lightDirection;
-}
-
-#else
-
-void applyLight(vec4 position)
-{
-}
-
-#endif
-
-void main()
-{
-    vec4 position = getPosition();
-    vec3 normal = getNormal();
-
-    // Transform position to clip space.
-    gl_Position = u_worldViewProjectionMatrix * position;
-
-    // Transform normal to view space.
-    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldViewMatrix[0].xyz,
-                                                u_inverseTransposeWorldViewMatrix[1].xyz,
-                                                u_inverseTransposeWorldViewMatrix[2].xyz);
-    v_normalVector = inverseTransposeWorldViewMatrix * normal;
-
-    // Compute the camera direction.
-    vec4 positionWorldSpace = u_worldMatrix * position;
-    v_cameraDirection = u_cameraPosition - positionWorldSpace.xyz;
-
-#if defined(VERTEX_COLOR)
-	v_color = a_color;
-#endif
-
-    // Apply light.
-    applyLight(position);
-}

+ 42 - 0
gameplay/res/shaders/colored-unlit.frag

@@ -0,0 +1,42 @@
+#ifdef OPENGL_ES
+precision highp float;
+#endif
+
+// Inputs
+#if defined(VERTEX_COLOR)
+varying vec3 v_color;						// Input Vertex color ( r g b )
+#endif
+
+// 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
+#if defined(MODULATE_ALPHA)
+uniform float u_modulateAlpha;              // Modulation alpha
+#endif
+
+// Fragment program
+void main()
+{
+    // Set base diffuse color
+    #if defined(VERTEX_COLOR)
+	gl_FragColor.rgb = v_color;
+	#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;
+	#endif
+	#if defined(MODULATE_ALPHA)
+    gl_FragColor.a *= u_modulateAlpha;
+    #endif
+}

+ 39 - 0
gameplay/res/shaders/colored-unlit.vert

@@ -0,0 +1,39 @@
+// Inputs
+attribute vec4 a_position;									// Vertex Position							(x, y, z, w)
+#if defined(SKINNING)
+attribute vec4 a_blendWeights;								// Vertex blend weight, up to 4				(0, 1, 2, 3) 
+attribute vec4 a_blendIndices;								// Vertex blend index int u_matrixPalette	(0, 1, 2, 3)
+#endif
+#if defined(VERTEX_COLOR)
+attribute vec3 a_color;										// Vertex Color								(r, g, b)
+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
+#if defined(SKINNING)
+#include "lib/attributes-skinning.vert"
+#else
+#include "lib/attributes.vert" 
+#endif
+
+// Vertex Program
+void main()
+{
+    // Get the vertex position
+    vec4 position = getPosition();
+    
+    // Transform position to clip space.a
+    gl_Position = u_worldViewProjectionMatrix *  position;
+    
+     // Pass on vertex color to fragment shader
+    #if defined(VERTEX_COLOR)
+	v_color = a_color;
+    #endif
+}

+ 70 - 0
gameplay/res/shaders/colored.frag

@@ -0,0 +1,70 @@
+#define LIGHTING
+#ifdef OPENGL_ES
+precision highp float;
+#endif
+
+// Inputs
+varying vec3 v_normalVector;					// Normal vector in view space
+#if defined(VERTEX_COLOR)
+varying vec3 v_color;							// Vertex color
+#endif
+#if defined(POINT_LIGHT)
+varying vec3 v_vertexToPointLightDirection;		// Light direction w.r.t current vertex in tangent space
+varying float v_pointLightAttenuation;			// Attenuation of point light
+#elif defined(SPOT_LIGHT)
+varying vec3 v_spotLightDirection;				// Direction of spot light in tangent space.
+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
+#else
+varying vec3 v_lightDirection;					// Direction of light in tangent space
+#endif
+#if defined(SPECULAR)
+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"
+#if defined(POINT_LIGHT)
+#include "lib/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"
+#else
+#include "lib/lighting-directional.frag"
+#endif
+
+// Fragment program
+void main()
+{
+    // Set base diffuse color
+    #if defined(VERTEX_COLOR)
+	_baseColor.rgb = v_color;
+	#else
+	_baseColor = u_diffuseColor;
+	#endif
+
+    // Light the pixel
+    gl_FragColor.a = _baseColor.a;
+    gl_FragColor.rgb = getLitPixel();
+    
+	#if defined(MODULATE_COLOR)
+    gl_FragColor.a *= u_modulateColor;
+    #endif
+	#if defined(MODULATE_ALPHA)
+    gl_FragColor.a *= u_modulateAlpha;
+    #endif
+}

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

@@ -1,111 +0,0 @@
-#ifdef OPENGL_ES
-precision highp float;
-#endif
-
-// Uniforms
-uniform vec3 u_lightColor;                      // Light color
-uniform vec3 u_ambientColor;                    // Ambient color
-uniform vec4 u_diffuseColor;                    // Diffuse color
-#if defined(GLOBAL_ALPHA)
-uniform float u_globalAlpha;                    // Global alpha value
-#endif
-
-// Inputs
-varying vec3 v_normalVector;                    // NormalVector in view space.
-
-// Global variables
-vec4 _baseColor;                                // Base color
-vec3 _ambientColor;                             // Ambient Color
-vec3 _diffuseColor;                             // Diffuse Color
-
-void lighting(vec3 normalVector, vec3 lightDirection, float attenuation)
-{
-    // Ambient
-    _ambientColor = _baseColor.rgb * u_ambientColor;
-
-    // Diffuse
-    float ddot = dot(normalVector, lightDirection);
-    float diffuseIntensity = attenuation * ddot;
-    diffuseIntensity = max(0.0, diffuseIntensity);
-    _diffuseColor = u_lightColor * _baseColor.rgb * diffuseIntensity;
-}
-
-#if defined(POINT_LIGHT)
-
-varying vec4 v_vertexToPointLightDirection;     // Light direction w.r.t current vertex.
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    
-    vec3 vertexToPointLightDirection = normalize(v_vertexToPointLightDirection.xyz);
-    
-    // Fetch point light attenuation.
-    float pointLightAttenuation = v_vertexToPointLightDirection.w;
-    lighting(normalVector, vertexToPointLightDirection, pointLightAttenuation);
-}
-
-#elif defined(SPOT_LIGHT)
-
-uniform vec3 u_spotLightDirection;              // Direction of the 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]
-varying vec3 v_vertexToSpotLightDirection;      // Light direction w.r.t current vertex.
-varying float v_spotLightAttenuation;           // Attenuation of spot light.
-
-float lerpstep( float lower, float upper, float s)
-{
-    return clamp( ( s - lower ) / ( upper - lower ), 0.0, 1.0 );
-}
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    vec3 spotLightDirection = u_spotLightDirection; 
-    vec3 vertexToSpotLightDirection = normalize(v_vertexToSpotLightDirection);
-
-    // "-lightDirection" is used because light direction points in opposite direction to
-    // to spot direction.
-    // Calculate spot light effect.
-    float spotCurrentAngleCos = max(0.0, dot(spotLightDirection, -vertexToSpotLightDirection));
-
-    // Intensity of spot depends on the spot light attenuation and the 
-    // part of the cone vertexToSpotLightDirection points to (inner or outer).
-    float spotLightAttenuation = clamp(v_spotLightAttenuation, 0.0, 1.0);
-    spotLightAttenuation *= lerpstep(u_spotLightOuterAngleCos, u_spotLightInnerAngleCos, spotCurrentAngleCos);
-
-    lighting(normalVector, vertexToSpotLightDirection, spotLightAttenuation);
-}
-
-#else
-
-uniform vec3 u_lightDirection;       	        // Light direction
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    vec3 lightDirection = normalize(u_lightDirection);
-
-    lighting(normalVector, -lightDirection, 1.0);
-}
-#endif
-
-void main()
-{
-    // Fetch diffuse color from texture.
-    _baseColor = u_diffuseColor;
-
-    // Apply light
-    applyLight();
-
-    // Light the pixel
-    gl_FragColor.a = _baseColor.a;
-    gl_FragColor.rgb = _ambientColor + _diffuseColor;
-
-#if defined(GLOBAL_ALPHA)
-    gl_FragColor.a *= u_globalAlpha;
-#endif
-}

+ 81 - 0
gameplay/res/shaders/colored.vert

@@ -0,0 +1,81 @@
+#define LIGHTING
+
+// Inputs
+attribute vec4 a_position;									// Vertex Position							(x, y, z, w)
+attribute vec3 a_normal;									// Vertex Normal							(x, y, z)
+#if defined(SKINNING)
+attribute vec4 a_blendWeights;								// Vertex blend weight, up to 4				(0, 1, 2, 3) 
+attribute vec4 a_blendIndices;								// Vertex blend index int u_matrixPalette	(0, 1, 2, 3)
+#endif
+#if defined(VERTEX_COLOR)
+attribute vec3 a_color;										// Output Vertex Color
+varying vec3 v_color;										// Output Vertex Color 
+#endif
+
+// 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(SKINNING)
+uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];		// Array of 4x3 matrices
+#endif
+#if defined(SPECULAR)
+uniform mat4 u_worldViewMatrix;								// Matrix to tranform a position to view space.
+uniform vec3 u_cameraPosition;                 				// Position of the camera in view space.
+#endif
+#if defined(POINT_LIGHT)
+uniform vec3 u_pointLightPosition;							// Position of light
+uniform float u_pointLightRangeInverse;						// Inverse of light range 
+#elif defined(SPOT_LIGHT)
+uniform vec3 u_spotLightPosition;							// Position of light
+uniform float u_spotLightRangeInverse;						// Inverse of light range.
+#else
+#endif
+
+// Outputs
+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"
+#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"
+#else
+uniform vec3 u_lightDirection;								// Direction of light
+#include "lib/lighting-directional.vert"
+#endif
+
+// Vertex attribute accessors
+#if defined(SKINNING)
+#include "lib/attributes-skinning.vert"
+#else
+#include "lib/attributes.vert" 
+#endif
+
+// Vertex program
+void main()
+{
+    // Get the position and normal
+    vec4 position = getPosition();
+    vec3 normal = getNormal();
+
+    // Transform position to clip space.
+    gl_Position = u_worldViewProjectionMatrix * position;
+
+    // Transform normal to view space.
+    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldViewMatrix[0].xyz, u_inverseTransposeWorldViewMatrix[1].xyz, u_inverseTransposeWorldViewMatrix[2].xyz);
+    v_normalVector = inverseTransposeWorldViewMatrix * normal;
+
+    // Apply light.
+    applyLight(position);
+    
+    // Pass the vertex color to fragment shader
+    #if defined(VERTEX_COLOR)
+	v_color = a_color;
+    #endif
+}

+ 0 - 183
gameplay/res/shaders/colored.vsh

@@ -1,183 +0,0 @@
-// 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.
-
-// Inputs
-attribute vec4 a_position;                          // Vertex Position (x, y, z, w)
-attribute vec3 a_normal;                            // Vertex Normal (x, y, z)
-
-// Outputs
-varying vec3 v_normalVector;                        // NormalVector in view space.
-
-#if defined(SKINNING)
-
-attribute vec4 a_blendWeights;
-attribute vec4 a_blendIndices;
-
-// 32 4x3 matrices as an array of floats
-uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];
-
-// Common vectors.
-vec4 _skinnedPosition;
-vec3 _skinnedNormal;
-
-void skinPosition(float blendWeight, int matrixIndex)
-{
-    vec4 tmp;
-
-    tmp.x = dot(a_position, u_matrixPalette[matrixIndex]);
-    tmp.y = dot(a_position, u_matrixPalette[matrixIndex + 1]);
-    tmp.z = dot(a_position, u_matrixPalette[matrixIndex + 2]);
-    tmp.w = a_position.w;
-
-    _skinnedPosition += blendWeight * tmp;
-}
-
-vec4 getPosition()
-{
-    _skinnedPosition = vec4(0.0);
-
-    // Transform position to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    return _skinnedPosition;    
-}
-
-void skinNormal(float blendWeight, int matrixIndex)
-{
-    vec3 tmp;
-
-    tmp.x = dot(a_normal, u_matrixPalette[matrixIndex].xyz);
-    tmp.y = dot(a_normal, u_matrixPalette[matrixIndex + 1].xyz);
-    tmp.z = dot(a_normal, u_matrixPalette[matrixIndex + 2].xyz);
-
-    _skinnedNormal += blendWeight * tmp;
-}
-
-vec3 getNormal()
-{
-    _skinnedNormal = vec3(0.0);
-
-    // Transform normal to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    return _skinnedNormal;
-}
-
-#else
-
-vec4 getPosition()
-{
-    return a_position;    
-}
-
-vec3 getNormal()
-{
-    return a_normal;
-}
-
-#endif
-
-#if defined(POINT_LIGHT)
-
-uniform mat4 u_worldViewMatrix;                     // Matrix to tranform a position to view space.
-uniform vec3 u_pointLightPosition;                  // Position
-uniform float u_pointLightRangeInverse;             // Inverse of light range.
-varying vec4 v_vertexToPointLightDirection;         // Light direction w.r.t current vertex.
-
-void applyLight(vec4 position)
-{
-    vec4 positionWorldViewSpace = u_worldViewMatrix * position;
-    
-    // Compute the light direction.
-    vec3 lightDirection = u_pointLightPosition - positionWorldViewSpace.xyz;
-    
-    vec4 vertexToPointLightDirection;
-    vertexToPointLightDirection.xyz = lightDirection;
-    
-    // Attenuation.
-    vertexToPointLightDirection.w = 1.0 - dot(lightDirection * u_pointLightRangeInverse, lightDirection * u_pointLightRangeInverse);
-
-    // Output light direction.
-    v_vertexToPointLightDirection =  vertexToPointLightDirection;
-}
-
-#elif defined(SPOT_LIGHT)
-
-uniform mat4 u_worldViewMatrix;                     // Matrix to tranform a position to view space.
-uniform vec3 u_spotLightPosition;                   // Position
-uniform float u_spotLightRangeInverse;              // Inverse of light range.
-varying vec3 v_vertexToSpotLightDirection;          // Light direction w.r.t current vertex.
-varying float v_spotLightAttenuation;               // Attenuation of spot light.
-
-void applyLight(vec4 position)
-{
-    vec4 positionWorldViewSpace = u_worldViewMatrix * position;
-
-    // Compute the light direction.
-    vec3 lightDirection = u_spotLightPosition - positionWorldViewSpace.xyz;
-
-    // Attenuation
-    v_spotLightAttenuation = 1.0 - dot(lightDirection * u_spotLightRangeInverse, lightDirection * u_spotLightRangeInverse);
-
-    // Output light direction.
-    v_vertexToSpotLightDirection = lightDirection;
-}
-
-#else
-
-void applyLight(vec4 position)
-{
-}
-
-#endif
-
-void main()
-{
-    vec4 position = getPosition();
-    vec3 normal = getNormal();
-        
-    // Transform position to clip space.
-    gl_Position = u_worldViewProjectionMatrix * position;
-
-    // Transform normal to view space.
-    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldViewMatrix[0].xyz,
-                                                u_inverseTransposeWorldViewMatrix[1].xyz,
-                                                u_inverseTransposeWorldViewMatrix[2].xyz);
-    v_normalVector = inverseTransposeWorldViewMatrix * normal;
-
-    // Apply light.
-    applyLight(position);
-}

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

@@ -1,124 +0,0 @@
-#ifdef OPENGL_ES
-precision highp float;
-#endif
-
-// Uniforms
-uniform vec3 u_lightColor;                      // Light color
-uniform vec3 u_ambientColor;                    // Ambient color
-uniform float u_specularExponent;               // Specular exponent or shininess property.
-uniform sampler2D u_diffuseTexture;             // Diffuse texture.
-#if defined(GLOBAL_ALPHA)
-uniform float u_globalAlpha;                    // Global alpha value
-#endif
-
-// Inputs
-varying vec3 v_normalVector;                    // NormalVector in view space.
-varying vec2 v_texCoord;                        // Texture coordinate (u, v).
-varying vec3 v_cameraDirection;                 // Camera direction
-
-// Global variables
-vec4 _baseColor;                                // Base color
-vec3 _ambientColor;                             // Ambient Color
-vec3 _diffuseColor;                             // Diffuse Color
-vec3 _specularColor;                            // Specular color
-
-void lighting(vec3 normalVector, vec3 cameraDirection, vec3 lightDirection, float attenuation)
-{
-    // Ambient
-    _ambientColor = _baseColor.rgb * u_ambientColor;
-
-    // Diffuse
-    float ddot = dot(normalVector, lightDirection);
-    float diffuseIntensity = attenuation * ddot;
-    diffuseIntensity = max(0.0, diffuseIntensity);
-    _diffuseColor = u_lightColor * _baseColor.rgb * diffuseIntensity;
-
-    // Specular
-    vec3 halfVector = normalize(lightDirection + cameraDirection);
-    float specularIntensity = attenuation * max(0.0, pow(dot(normalVector, halfVector), u_specularExponent));
-    specularIntensity = max(0.0, specularIntensity);
-    _specularColor = u_lightColor * _baseColor.rgb * specularIntensity;
-}
-
-#if defined(POINT_LIGHT)
-
-varying vec4 v_vertexToPointLightDirection;      // Light direction w.r.t current vertex.
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    vec3 cameraDirection = normalize(v_cameraDirection);
-    
-    vec3 vertexToPointLightDirection = normalize(v_vertexToPointLightDirection.xyz);
-    
-    // Fetch point light attenuation.
-    float pointLightAttenuation = v_vertexToPointLightDirection.w;
-    lighting(normalVector, cameraDirection, vertexToPointLightDirection, pointLightAttenuation);
-}
-
-#elif defined(SPOT_LIGHT)
-
-uniform vec3 u_spotLightDirection;              // Direction of the 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]
-varying vec3 v_vertexToSpotLightDirection;      // Light direction w.r.t current vertex.
-varying float v_spotLightAttenuation;           // Attenuation of spot light.
-
-float lerpstep( float lower, float upper, float s)
-{
-    return clamp( ( s - lower ) / ( upper - lower ), 0.0, 1.0 );
-}
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    vec3 cameraDirection = normalize(v_cameraDirection);
-    vec3 spotLightDirection = normalize(u_spotLightDirection); 
-    vec3 vertexToSpotLightDirection = normalize(v_vertexToSpotLightDirection);
-
-    // "-lightDirection" is used because light direction points in opposite direction to
-    // to spot direction.
-    // Calculate spot light effect.
-    float spotCurrentAngleCos = max(0.0, dot(spotLightDirection, -vertexToSpotLightDirection));
-    
-    // Intensity of spot depends on the spot light attenuation and the 
-    // part of the cone vertexToSpotLightDirection points to (inner or outer).
-    float spotLightAttenuation = clamp(v_spotLightAttenuation, 0.0, 1.0);
-    spotLightAttenuation *= lerpstep(u_spotLightOuterAngleCos, u_spotLightInnerAngleCos, spotCurrentAngleCos);
-
-    lighting(normalVector, cameraDirection, vertexToSpotLightDirection, spotLightAttenuation);
-}
-
-#else
-
-uniform vec3 u_lightDirection;                  // Light direction
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    vec3 cameraDirection = normalize(v_cameraDirection);
-    vec3 lightDirection = normalize(u_lightDirection);
-
-    lighting(normalVector, cameraDirection, -lightDirection, 1.0);
-}
-#endif
-
-void main()
-{
-    // Fetch diffuse color from texture.
-    _baseColor = texture2D(u_diffuseTexture, v_texCoord);
-
-    // Apply light
-    applyLight();
-
-    // Light the pixel
-    gl_FragColor.a = _baseColor.a;
-    gl_FragColor.rgb = _ambientColor + _diffuseColor + _specularColor;
-
-#if defined(GLOBAL_ALPHA)
-    gl_FragColor.a *= u_globalAlpha;
-#endif
-}

+ 0 - 194
gameplay/res/shaders/diffuse-specular.vsh

@@ -1,194 +0,0 @@
-// 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;                     // Matrix to tranform a position to view space.
-uniform vec3 u_cameraPosition;                      // Position of the camera in view space.
-
-// Inputs
-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)
-
-// Outputs
-varying vec3 v_normalVector;                        // NormalVector in view space.
-varying vec2 v_texCoord;                            // Texture coordinate (u, v).
-varying vec3 v_cameraDirection;                     // Camera direction
-
-#if defined(SKINNING)
-
-attribute vec4 a_blendWeights;
-attribute vec4 a_blendIndices;
-
-// 32 4x3 matrices as an array of floats
-uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];
-
-// Common vectors.
-vec4 _skinnedPosition;
-vec3 _skinnedNormal;
-
-void skinPosition(float blendWeight, int matrixIndex)
-{
-    vec4 tmp;
-
-    tmp.x = dot(a_position, u_matrixPalette[matrixIndex]);
-    tmp.y = dot(a_position, u_matrixPalette[matrixIndex + 1]);
-    tmp.z = dot(a_position, u_matrixPalette[matrixIndex + 2]);
-    tmp.w = a_position.w;
-
-    _skinnedPosition += blendWeight * tmp;
-}
-
-vec4 getPosition()
-{
-    _skinnedPosition = vec4(0.0);
-
-    // Transform position to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    return _skinnedPosition;    
-}
-
-void skinNormal(float blendWeight, int matrixIndex)
-{
-    vec3 tmp;
-
-    tmp.x = dot(a_normal, u_matrixPalette[matrixIndex].xyz);
-    tmp.y = dot(a_normal, u_matrixPalette[matrixIndex + 1].xyz);
-    tmp.z = dot(a_normal, u_matrixPalette[matrixIndex + 2].xyz);
-
-    _skinnedNormal += blendWeight * tmp;
-}
-
-vec3 getNormal()
-{
-    _skinnedNormal = vec3(0.0);
-
-    // Transform normal to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    return _skinnedNormal;
-}
-
-#else
-
-vec4 getPosition()
-{
-    return a_position;    
-}
-
-vec3 getNormal()
-{
-    return a_normal;
-}
-
-#endif
-
-#if defined(POINT_LIGHT)
-
-uniform vec3 u_pointLightPosition;                      // Position
-uniform float u_pointLightRangeInverse;                 // Inverse of light range.
-varying vec4 v_vertexToPointLightDirection;             // Light direction w.r.t current vertex.
-
-void applyLight(vec4 position)
-{
-    vec4 positionWorldViewSpace = u_worldViewMatrix * position;
-    
-    // Compute the light direction with light position and the vertex position.
-    vec3 lightDirection = u_pointLightPosition - positionWorldViewSpace.xyz;
-
-    vec4 vertexToPointLightDirection;
-    vertexToPointLightDirection.xyz = lightDirection;
-
-    // Attenuation
-    vertexToPointLightDirection.w = 1.0 - dot(lightDirection * u_pointLightRangeInverse, lightDirection * u_pointLightRangeInverse);
-
-    // Output light direction.
-    v_vertexToPointLightDirection =  vertexToPointLightDirection;
-}
-
-#elif defined(SPOT_LIGHT)
-
-uniform vec3 u_spotLightPosition;                       // Position
-uniform float u_spotLightRangeInverse;                  // Inverse of light range.
-varying vec3 v_vertexToSpotLightDirection;              // Light direction w.r.t current vertex.
-varying float v_spotLightAttenuation;                   // Attenuation of spot light.
-
-void applyLight(vec4 position)
-{
-    // World space position.
-    vec4 positionWorldViewSpace = u_worldViewMatrix * position;
-
-    // Compute the light direction with light position and the vertex position.
-    vec3 lightDirection = u_spotLightPosition - positionWorldViewSpace.xyz;
-
-    // Attenuation
-    v_spotLightAttenuation = 1.0 - dot(lightDirection * u_spotLightRangeInverse, lightDirection * u_spotLightRangeInverse);
-
-    // Compute the light direction with light position and the vertex position.
-    v_vertexToSpotLightDirection = lightDirection;
-}
-
-#else
-
-void applyLight(vec4 position)
-{
-}
-
-#endif
-
-void main()
-{
-    vec4 position = getPosition();
-    vec3 normal = getNormal();
-
-    // Transform position to clip space.
-    gl_Position = u_worldViewProjectionMatrix * position;
-
-    // Transform normal to view space.
-    mat3 normalMatrix = mat3(u_inverseTransposeWorldViewMatrix[0].xyz,
-                             u_inverseTransposeWorldViewMatrix[1].xyz,
-                             u_inverseTransposeWorldViewMatrix[2].xyz);
-    v_normalVector = normalMatrix * normal;
-
-    // Compute the camera direction.
-    vec4 positionWorldSpace = u_worldViewMatrix * position;
-    v_cameraDirection = u_cameraPosition - positionWorldSpace.xyz;
-
-    // Apply light.
-    applyLight(position);
-
-	// Pass on the texture coordinates to Fragment shader.
-    v_texCoord = a_texCoord;
-}

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

@@ -1,111 +0,0 @@
-#ifdef OPENGL_ES
-precision highp float;
-#endif
-
-// Uniforms
-uniform vec3 u_lightColor;                      // Light color
-uniform vec3 u_ambientColor;                    // Ambient color
-uniform sampler2D u_diffuseTexture;             // Diffuse texture.
-#if defined(GLOBAL_ALPHA)
-uniform float u_globalAlpha;                    // Global alpha value
-#endif
-
-// Inputs
-varying vec3 v_normalVector;                    // NormalVector in view space.
-varying vec2 v_texCoord;                        // Texture coordinate (u, v).
-
-// Global variables
-vec4 _baseColor;                                // Base color
-vec3 _ambientColor;                             // Ambient Color
-vec3 _diffuseColor;                             // Diffuse Color
-
-void lighting(vec3 normalVector, vec3 lightDirection, float attenuation)
-{
-    // Ambient
-    _ambientColor = _baseColor.rgb * u_ambientColor;
-
-    // Diffuse
-	float ddot = dot(normalVector, lightDirection);
-    float diffuseIntensity = attenuation * ddot;
-    diffuseIntensity = max(0.0, diffuseIntensity);
-    _diffuseColor = u_lightColor * _baseColor.rgb * diffuseIntensity;
-}
-
-#if defined(POINT_LIGHT)
-
-varying vec4 v_vertexToPointLightDirection;     // Light direction w.r.t current vertex.
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    
-    vec3 vertexToPointLightDirection = normalize(v_vertexToPointLightDirection.xyz);
-    
-    // Fetch point light attenuation.
-    float pointLightAttenuation = v_vertexToPointLightDirection.w;
-    lighting(normalVector, vertexToPointLightDirection, pointLightAttenuation);
-}
-
-#elif defined(SPOT_LIGHT)
-
-uniform vec3 u_spotLightDirection;              // Direction of the 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]
-varying vec3 v_vertexToSpotLightDirection;      // Light direction w.r.t current vertex.
-varying float v_spotLightAttenuation;           // Attenuation of spot light.
-
-float lerpstep( float lower, float upper, float s)
-{
-    return clamp( ( s - lower ) / ( upper - lower ), 0.0, 1.0 );
-}
-
-void applyLight()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    vec3 spotLightDirection =normalize(u_spotLightDirection); 
-    vec3 vertexToSpotLightDirection = normalize(v_vertexToSpotLightDirection);
-
-    // "-lightDirection" is used because light direction points in opposite direction to
-    // to spot direction.
-    // Calculate spot light effect.
-    float spotCurrentAngleCos = max(0.0, dot(spotLightDirection, -vertexToSpotLightDirection));
-
-    // Intensity of spot depends on the spot light attenuation and the 
-    // part of the cone vertexToSpotLightDirection points to (inner or outer).
-    float spotLightAttenuation = clamp(v_spotLightAttenuation, 0.0, 1.0);
-    spotLightAttenuation *= lerpstep(u_spotLightOuterAngleCos, u_spotLightInnerAngleCos, spotCurrentAngleCos);
-
-    lighting(normalVector, vertexToSpotLightDirection, spotLightAttenuation);
-}
-
-#else
-
-uniform vec3 u_lightDirection;                  // Light direction
-
-void applyLight()
-{
-    vec3 normalVector = normalize(v_normalVector);
-    vec3 lightDirection = normalize(u_lightDirection);
-
-    lighting(normalVector, -lightDirection, 1.0);
-}
-#endif
-
-void main()
-{
-    // Fetch diffuse color from texture.
-    _baseColor = texture2D(u_diffuseTexture, v_texCoord);
-
-    // Apply light
-    applyLight();
-
-    // Light the pixel
-    gl_FragColor.a = _baseColor.a;
-    gl_FragColor.rgb = _ambientColor + _diffuseColor;
-
-#if defined(GLOBAL_ALPHA)
-    gl_FragColor.a *= u_globalAlpha;
-#endif
-}

+ 0 - 191
gameplay/res/shaders/diffuse.vsh

@@ -1,191 +0,0 @@
-// 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.
-
-// Inputs
-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)
-
-// Outputs
-varying vec3 v_normalVector;                        // NormalVector in view space.
-varying vec2 v_texCoord;                            // Texture coordinate (u, v).
-varying vec3 v_cameraDirection;                     // Camera direction
-
-#if defined(SKINNING)
-
-attribute vec4 a_blendWeights;
-attribute vec4 a_blendIndices;
-
-// 32 4x3 matrices as an array of floats
-uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];
-
-// Common vectors.
-vec4 _skinnedPosition;
-vec3 _skinnedNormal;
-
-void skinPosition(float blendWeight, int matrixIndex)
-{
-    vec4 tmp;
-
-    tmp.x = dot(a_position, u_matrixPalette[matrixIndex]);
-    tmp.y = dot(a_position, u_matrixPalette[matrixIndex + 1]);
-    tmp.z = dot(a_position, u_matrixPalette[matrixIndex + 2]);
-    tmp.w = a_position.w;
-
-    _skinnedPosition += blendWeight * tmp;
-}
-
-vec4 getPosition()
-{
-    _skinnedPosition = vec4(0.0);
-
-    // Transform position to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinPosition(blendWeight, matrixIndex);
-
-    return _skinnedPosition;    
-}
-
-void skinNormal(float blendWeight, int matrixIndex)
-{
-    vec3 tmp;
-
-    tmp.x = dot(a_normal, u_matrixPalette[matrixIndex].xyz);
-    tmp.y = dot(a_normal, u_matrixPalette[matrixIndex + 1].xyz);
-    tmp.z = dot(a_normal, u_matrixPalette[matrixIndex + 2].xyz);
-
-    _skinnedNormal += blendWeight * tmp;
-}
-
-vec3 getNormal()
-{
-    _skinnedNormal = vec3(0.0);
-
-    // Transform normal to view space using 
-    // matrix palette with four matrices used to transform a vertex.
-
-    float blendWeight = a_blendWeights[0];
-    int matrixIndex = int (a_blendIndices[0]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[1];
-    matrixIndex = int(a_blendIndices[1]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[2];
-    matrixIndex = int(a_blendIndices[2]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    blendWeight = a_blendWeights[3];
-    matrixIndex = int(a_blendIndices[3]) * 3;
-    skinNormal(blendWeight, matrixIndex);
-
-    return _skinnedNormal;
-}
-
-#else
-
-vec4 getPosition()
-{
-    return a_position;    
-}
-
-vec3 getNormal()
-{
-    return a_normal;
-}
-
-#endif
-
-#if defined(POINT_LIGHT)
-
-uniform mat4 u_worldViewMatrix;                     // Matrix to tranform a position to view space.
-uniform vec3 u_pointLightPosition;                  // Position
-uniform float u_pointLightRange;                    // Inverse of light range.
-varying vec4 v_vertexToPointLightDirection;         // Light direction w.r.t current vertex.
-
-void applyLight(vec4 position)
-{
-    // World space position.
-    vec4 positionWorldViewSpace = u_worldViewMatrix * position;
-    
-    // Compute the light direction.
-    vec3 lightDirection = u_pointLightPosition - positionWorldViewSpace.xyz;
-    
-    vec4 vertexToPointLightDirection;
-    vertexToPointLightDirection.xyz = lightDirection;
-    
-    // Attenuation
-    vertexToPointLightDirection.w = 1.0 - dot(lightDirection * u_pointLightRangeInverse, lightDirection * u_pointLightRangeInverse);
-
-    // Output light direction.
-    v_vertexToPointLightDirection =  vertexToPointLightDirection;
-}
-
-#elif defined(SPOT_LIGHT)
-
-uniform mat4 u_worldViewMatrix;                     // Matrix to tranform a position to view space.
-uniform vec3 u_spotLightPosition;                   // Position
-uniform float u_spotLightRangeInverse;              // Inverse of light range.
-varying vec3 v_vertexToSpotLightDirection;          // Light direction w.r.t current vertex.
-varying float v_spotLightAttenuation;               // Attenuation of spot light.
-
-void applyLight(vec4 position)
-{
-    // World space position.
-    vec4 positionWorldViewSpace = u_worldViewMatrix * position;
-
-    // Compute the light direction with light position and the vertex position.
-    vec3 lightDirection = u_spotLightPosition - positionWorldViewSpace.xyz;
-
-    // Attenuation
-    v_spotLightAttenuation = 1.0 - dot(lightDirection * u_spotLightRangeInverse, lightDirection * u_spotLightRangeInverse);
-
-    // Output light direction.
-    v_vertexToSpotLightDirection = lightDirection;
-}
-
-#else
-
-void applyLight(vec4 position)
-{
-}
-
-#endif
-
-void main()
-{
-    vec4 position = getPosition();
-    vec3 normal = getNormal();
-    
-    // Transform position to clip space.
-    gl_Position = u_worldViewProjectionMatrix * position;
-
-    // Transform normal to view space.
-    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldViewMatrix[0].xyz,
-                                                u_inverseTransposeWorldViewMatrix[1].xyz,
-                                                u_inverseTransposeWorldViewMatrix[2].xyz);
-    v_normalVector = inverseTransposeWorldViewMatrix * normal;
-
-    // Apply light.
-    applyLight(position);
-
-    // Pass on the texture coordinates to Fragment shader.
-    v_texCoord = a_texCoord;
-}

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

@@ -0,0 +1,93 @@
+vec4 _skinnedPosition;
+#if defined(LIGHTING)
+vec3 _skinnedNormal;
+#endif
+
+void skinPosition(float blendWeight, int matrixIndex)
+{
+    vec4 tmp;
+    tmp.x = dot(a_position, u_matrixPalette[matrixIndex]);
+    tmp.y = dot(a_position, u_matrixPalette[matrixIndex + 1]);
+    tmp.z = dot(a_position, u_matrixPalette[matrixIndex + 2]);
+    tmp.w = a_position.w;
+    _skinnedPosition += blendWeight * tmp;
+}
+
+vec4 getPosition()
+{
+    _skinnedPosition = vec4(0.0);
+
+    // Transform position to view space using matrix palette with four matrices used to transform a vertex.
+    float blendWeight = a_blendWeights[0];
+    int matrixIndex = int (a_blendIndices[0]) * 3;
+    skinPosition(blendWeight, matrixIndex);
+
+    blendWeight = a_blendWeights[1];
+    matrixIndex = int(a_blendIndices[1]) * 3;
+    skinPosition(blendWeight, matrixIndex);
+
+    blendWeight = a_blendWeights[2];
+    matrixIndex = int(a_blendIndices[2]) * 3;
+    skinPosition(blendWeight, matrixIndex);
+
+    blendWeight = a_blendWeights[3];
+    matrixIndex = int(a_blendIndices[3]) * 3;
+    skinPosition(blendWeight, matrixIndex);
+
+    return _skinnedPosition;    
+}
+
+void skinTangentSpaceVector(vec3 vector, float blendWeight, int matrixIndex)
+{
+    vec3 tmp;
+    tmp.x = dot(vector, u_matrixPalette[matrixIndex].xyz);
+    tmp.y = dot(vector, u_matrixPalette[matrixIndex + 1].xyz);
+    tmp.z = dot(vector, u_matrixPalette[matrixIndex + 2].xyz);
+    _skinnedNormal += blendWeight * tmp;
+}
+
+vec3 getTangentSpaceVector(vec3 vector)
+{
+    _skinnedNormal = vec3(0.0);
+
+    // Transform normal to view space using matrix palette with four matrices used to transform a vertex.
+    float blendWeight = a_blendWeights[0];
+    int matrixIndex = int (a_blendIndices[0]) * 3;
+    skinTangentSpaceVector(vector, blendWeight, matrixIndex);
+
+    blendWeight = a_blendWeights[1];
+    matrixIndex = int(a_blendIndices[1]) * 3;
+    skinTangentSpaceVector(vector, blendWeight, matrixIndex);
+
+    blendWeight = a_blendWeights[2];
+    matrixIndex = int(a_blendIndices[2]) * 3;
+    skinTangentSpaceVector(vector, blendWeight, matrixIndex);
+
+    blendWeight = a_blendWeights[3];
+    matrixIndex = int(a_blendIndices[3]) * 3;
+    skinTangentSpaceVector(vector, blendWeight, matrixIndex);
+
+    return _skinnedNormal;
+}
+
+#if defined(LIGHTING)
+
+vec3 getNormal()
+{
+    return getTangentSpaceVector(a_normal);
+}
+
+#if defined(BUMPED)
+
+vec3 getTangent()
+{
+    return getTangentSpaceVector(a_tangent);
+}
+
+vec3 getBinormal()
+{
+    return getTangentSpaceVector(a_binormal);
+}
+
+#endif
+#endif

+ 27 - 0
gameplay/res/shaders/lib/attributes.vert

@@ -0,0 +1,27 @@
+vec4 getPosition()
+{
+    return a_position;    
+}
+
+#if defined(LIGHTING)
+
+vec3 getNormal()
+{
+    return a_normal;
+}
+
+#if defined(BUMPED)
+
+vec3 getTangent()
+{
+    return a_tangent;
+}
+
+vec3 getBinormal()
+{
+    return a_binormal;
+}
+
+#endif
+
+#endif

Some files were not shown because too many files changed in this diff