Parcourir la source

Merge pull request #1207 from seanpaultaylor/next

Next
Sean Taylor il y a 12 ans
Parent
commit
8856363ff6
78 fichiers modifiés avec 1486 ajouts et 5493 suppressions
  1. 1 12
      gameplay/gameplay.vcxproj
  2. 335 368
      gameplay/gameplay.vcxproj.filters
  3. 0 45
      gameplay/res/shaders/colored-unlit.frag
  4. 0 53
      gameplay/res/shaders/colored-unlit.vert
  5. 93 38
      gameplay/res/shaders/colored.frag
  6. 96 41
      gameplay/res/shaders/colored.vert
  7. 10 4
      gameplay/res/shaders/font.frag
  8. 4 0
      gameplay/res/shaders/font.vert
  9. 2 0
      gameplay/res/shaders/form.frag
  10. 3 0
      gameplay/res/shaders/form.vert
  11. 0 41
      gameplay/res/shaders/lighting-directional.frag
  12. 0 31
      gameplay/res/shaders/lighting-directional.vert
  13. 0 46
      gameplay/res/shaders/lighting-point.frag
  14. 0 50
      gameplay/res/shaders/lighting-point.vert
  15. 0 63
      gameplay/res/shaders/lighting-spot.frag
  16. 0 52
      gameplay/res/shaders/lighting-spot.vert
  17. 78 38
      gameplay/res/shaders/lighting.frag
  18. 66 0
      gameplay/res/shaders/lighting.vert
  19. 0 2
      gameplay/res/shaders/skinning-none.vert
  20. 33 15
      gameplay/res/shaders/skinning.vert
  21. 2 0
      gameplay/res/shaders/sprite.frag
  22. 3 0
      gameplay/res/shaders/sprite.vert
  23. 7 6
      gameplay/res/shaders/terrain.vert
  24. 0 76
      gameplay/res/shaders/textured-bumped.frag
  25. 0 106
      gameplay/res/shaders/textured-bumped.vert
  26. 0 47
      gameplay/res/shaders/textured-unlit.frag
  27. 0 57
      gameplay/res/shaders/textured-unlit.vert
  28. 102 39
      gameplay/res/shaders/textured.frag
  29. 123 52
      gameplay/res/shaders/textured.vert
  30. 21 0
      gameplay/src/Effect.cpp
  31. 1 1
      gameplay/src/Effect.h
  32. 2 2
      samples/browser/res/common/box.material
  33. 2 3
      samples/browser/res/common/duck.material
  34. 3 3
      samples/browser/res/common/grid.material
  35. 26 26
      samples/browser/res/common/light.material
  36. 1 1
      samples/browser/res/common/physics.material
  37. 7 3
      samples/browser/res/common/sample.material
  38. 3 2
      samples/browser/res/common/terrain/shapes.material
  39. 2 2
      samples/browser/res/common/terrain/sky.material
  40. 0 316
      samples/browser/res/design/box.dae
  41. 0 183
      samples/browser/res/design/duck.dae
  42. 4 2
      samples/browser/res/design/physics-encode.bat
  43. 0 1435
      samples/browser/res/design/physics.dae
  44. 5 3
      samples/browser/res/design/scene-encode.bat
  45. 0 654
      samples/browser/res/design/scene.dae
  46. 0 750
      samples/browser/res/design/sphere.dae
  47. 79 0
      samples/browser/sample-browser.vcxproj
  48. 247 0
      samples/browser/sample-browser.vcxproj.filters
  49. 7 6
      samples/browser/src/Audio3DSample.cpp
  50. 1 1
      samples/browser/src/Audio3DSample.h
  51. 2 2
      samples/browser/src/BillboardSample.cpp
  52. 5 6
      samples/browser/src/CreateSceneSample.cpp
  53. 29 29
      samples/browser/src/LightSample.cpp
  54. 0 33
      samples/browser/src/LoadSceneSample.cpp
  55. 1 1
      samples/browser/src/MeshBatchSample.cpp
  56. 5 5
      samples/browser/src/MeshPrimitiveSample.cpp
  57. 3 2
      samples/browser/src/PhysicsCollisionObjectSample.cpp
  58. 5 6
      samples/browser/src/PostProcessSample.cpp
  59. 1 1
      samples/browser/src/TextureSample.cpp
  60. 1 1
      samples/browser/src/TriangleSample.cpp
  61. 6 4
      samples/character/res/common/scene.material
  62. 18 8
      samples/character/src/CharacterGame.cpp
  63. 0 316
      samples/lua/res/box.dae
  64. 2 2
      samples/lua/res/box.material
  65. 1 1
      samples/lua/res/game.lua
  66. 2 2
      samples/lua/res/grid.material
  67. 0 1
      samples/lua/sample-lua.vcxproj
  68. 0 3
      samples/lua/sample-lua.vcxproj.filters
  69. 2 2
      samples/mesh/res/duck.material
  70. 2 2
      samples/mesh/res/grid.material
  71. 1 1
      samples/mesh/src/MeshGame.cpp
  72. 2 2
      samples/particles/res/grid.material
  73. 7 5
      samples/racer/res/common/game.material
  74. 5 3
      samples/racer/src/RacerGame.cpp
  75. 0 360
      samples/spaceship/res/spaceship.dae
  76. 0 1
      samples/spaceship/sample-spaceship.vcxproj
  77. 0 3
      samples/spaceship/sample-spaceship.vcxproj.filters
  78. 17 16
      samples/spaceship/src/SpaceshipGame.cpp

+ 1 - 12
gameplay/gameplay.vcxproj

@@ -661,31 +661,20 @@
     <None Include="res\logo_powered_black.png" />
     <None Include="res\logo_powered_white.png" />
     <None Include="res\logo_white.png" />
-    <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\font.frag" />
     <None Include="res\shaders\font.vert" />
     <None Include="res\shaders\form.frag" />
     <None Include="res\shaders\form.vert" />
-    <None Include="res\shaders\lighting-directional.frag" />
-    <None Include="res\shaders\lighting-directional.vert" />
-    <None Include="res\shaders\lighting-point.frag" />
-    <None Include="res\shaders\lighting-point.vert" />
-    <None Include="res\shaders\lighting-spot.frag" />
-    <None Include="res\shaders\lighting-spot.vert" />
     <None Include="res\shaders\lighting.frag" />
+    <None Include="res\shaders\lighting.vert" />
     <None Include="res\shaders\skinning-none.vert" />
     <None Include="res\shaders\skinning.vert" />
     <None Include="res\shaders\sprite.frag" />
     <None Include="res\shaders\sprite.vert" />
     <None Include="res\shaders\terrain.frag" />
     <None Include="res\shaders\terrain.vert" />
-    <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" />

+ 335 - 368
gameplay/gameplay.vcxproj.filters

@@ -18,78 +18,12 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="src\Animation.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\AnimationClip.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\AnimationController.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\AnimationValue.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\BoundingBox.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\BoundingSphere.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Camera.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Curve.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Effect.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\FileSystem.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Font.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Frustum.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Game.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Light.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Matrix.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Mesh.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\MeshPart.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\MeshSkin.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Model.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Node.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\Plane.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\gameplay-main-blackberry.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\PlatformBlackBerry.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\gameplay-main-windows.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\PlatformWindows.cpp">
       <Filter>src</Filter>
     </ClCompile>
@@ -132,36 +66,9 @@
     <ClCompile Include="src\VertexFormat.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\AudioController.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\AudioListener.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\AudioSource.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\AudioBuffer.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\AnimationTarget.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\MaterialParameter.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Joint.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\ParticleEmitter.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\Properties.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\Material.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\Technique.cpp">
       <Filter>src</Filter>
     </ClCompile>
@@ -171,9 +78,6 @@
     <ClCompile Include="src\RenderState.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\DebugNew.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\PhysicsController.cpp">
       <Filter>src</Filter>
     </ClCompile>
@@ -201,45 +105,15 @@
     <ClCompile Include="src\SceneLoader.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\Image.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\RenderTarget.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\FrameBuffer.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\DepthStencilTarget.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\MeshBatch.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\gameplay-main-android.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\PlatformAndroid.cpp">
       <Filter>src</Filter>
     </ClCompile>
     <ClCompile Include="src\AbsoluteLayout.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\Button.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\CheckBox.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Container.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Control.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Label.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\RadioButton.cpp">
       <Filter>src</Filter>
     </ClCompile>
@@ -249,9 +123,6 @@
     <ClCompile Include="src\VerticalLayout.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\Form.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\Theme.cpp">
       <Filter>src</Filter>
     </ClCompile>
@@ -273,18 +144,6 @@
     <ClCompile Include="src\ThemeStyle.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\Layout.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Bundle.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\FlowLayout.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Joystick.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\ScriptController.cpp">
       <Filter>src</Filter>
     </ClCompile>
@@ -618,9 +477,6 @@
     <ClCompile Include="src\lua\lua_Gamepad.cpp">
       <Filter>src\lua</Filter>
     </ClCompile>
-    <ClCompile Include="src\Gamepad.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\ScreenDisplayer.cpp">
       <Filter>src</Filter>
     </ClCompile>
@@ -744,12 +600,6 @@
     <ClCompile Include="src\AIMessage.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\AIState.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\AIStateMachine.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\lua\lua_AIAgent.cpp">
       <Filter>src\lua</Filter>
     </ClCompile>
@@ -780,9 +630,6 @@
     <ClCompile Include="src\lua\lua_ScriptTarget.cpp">
       <Filter>src\lua</Filter>
     </ClCompile>
-    <ClCompile Include="src\gameplay-main-linux.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\PlatformLinux.cpp">
       <Filter>src</Filter>
     </ClCompile>
@@ -804,12 +651,6 @@
     <ClCompile Include="src\lua\lua_PhysicsVehicleWheel.cpp">
       <Filter>src\lua</Filter>
     </ClCompile>
-    <ClCompile Include="src\MathUtil.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
-    <ClCompile Include="src\Logger.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\lua\lua_LoggerLevel.cpp">
       <Filter>src\lua</Filter>
     </ClCompile>
@@ -834,18 +675,12 @@
     <ClCompile Include="src\lua\lua_RenderStateDepthFunction.cpp">
       <Filter>src\lua</Filter>
     </ClCompile>
-    <ClCompile Include="src\HeightField.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\lua\lua_HeightField.cpp">
       <Filter>src\lua</Filter>
     </ClCompile>
     <ClCompile Include="src\Platform.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\ImageControl.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\lua\lua_ImageControl.cpp">
       <Filter>src\lua</Filter>
     </ClCompile>
@@ -918,77 +753,173 @@
     <ClCompile Include="src\lua\lua_VisibleSetDefault.cpp">
       <Filter>src\lua</Filter>
     </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="src\Animation.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\AnimationClip.h">
+    <ClCompile Include="src\AIState.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\AnimationController.h">
+    </ClCompile>
+    <ClCompile Include="src\AIStateMachine.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\AnimationTarget.h">
+    </ClCompile>
+    <ClCompile Include="src\Animation.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\AnimationValue.h">
+    </ClCompile>
+    <ClCompile Include="src\AnimationClip.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Base.h">
+    </ClCompile>
+    <ClCompile Include="src\AnimationController.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\BoundingBox.h">
+    </ClCompile>
+    <ClCompile Include="src\AnimationTarget.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\BoundingSphere.h">
+    </ClCompile>
+    <ClCompile Include="src\AnimationValue.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Camera.h">
+    </ClCompile>
+    <ClCompile Include="src\AudioBuffer.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Curve.h">
+    </ClCompile>
+    <ClCompile Include="src\AudioController.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Effect.h">
+    </ClCompile>
+    <ClCompile Include="src\AudioListener.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\FileSystem.h">
+    </ClCompile>
+    <ClCompile Include="src\AudioSource.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Font.h">
+    </ClCompile>
+    <ClCompile Include="src\BoundingBox.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Frustum.h">
+    </ClCompile>
+    <ClCompile Include="src\BoundingSphere.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Game.h">
+    </ClCompile>
+    <ClCompile Include="src\Bundle.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\gameplay.h">
+    </ClCompile>
+    <ClCompile Include="src\Button.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Light.h">
+    </ClCompile>
+    <ClCompile Include="src\Camera.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Matrix.h">
+    </ClCompile>
+    <ClCompile Include="src\CheckBox.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Mesh.h">
+    </ClCompile>
+    <ClCompile Include="src\Container.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\MeshPart.h">
+    </ClCompile>
+    <ClCompile Include="src\Control.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\MeshSkin.h">
+    </ClCompile>
+    <ClCompile Include="src\Curve.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Model.h">
+    </ClCompile>
+    <ClCompile Include="src\DebugNew.cpp">
       <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Node.h">
+    </ClCompile>
+    <ClCompile Include="src\DepthStencilTarget.cpp">
       <Filter>src</Filter>
-    </ClInclude>
+    </ClCompile>
+    <ClCompile Include="src\Effect.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\FileSystem.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\FlowLayout.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Font.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Form.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\FrameBuffer.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Frustum.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Game.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Gamepad.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\gameplay-main-android.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\gameplay-main-blackberry.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\gameplay-main-linux.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\gameplay-main-windows.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\HeightField.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Image.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\ImageControl.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Joint.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Joystick.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Label.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Layout.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Light.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Logger.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Material.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\MaterialParameter.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\MathUtil.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Matrix.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Mesh.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\MeshBatch.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\MeshPart.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\MeshSkin.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Model.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Node.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\ParticleEmitter.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
     <ClInclude Include="src\Plane.h">
       <Filter>src</Filter>
     </ClInclude>
@@ -1034,33 +965,12 @@
     <ClInclude Include="src\VertexFormat.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\AudioController.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\AudioListener.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\AudioSource.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\AudioBuffer.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\MaterialParameter.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Joint.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\ParticleEmitter.h">
       <Filter>src</Filter>
     </ClInclude>
     <ClInclude Include="src\Properties.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\Material.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\Technique.h">
       <Filter>src</Filter>
     </ClInclude>
@@ -1070,9 +980,6 @@
     <ClInclude Include="src\RenderState.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\DebugNew.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\PhysicsController.h">
       <Filter>src</Filter>
     </ClInclude>
@@ -1100,51 +1007,15 @@
     <ClInclude Include="src\SceneLoader.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\Image.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\RenderTarget.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\FrameBuffer.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\DepthStencilTarget.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Keyboard.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\Touch.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\MeshBatch.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Mouse.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\AbsoluteLayout.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\Button.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\CheckBox.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Container.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Control.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Label.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Layout.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\RadioButton.h">
       <Filter>src</Filter>
     </ClInclude>
@@ -1154,9 +1025,6 @@
     <ClInclude Include="src\VerticalLayout.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\Form.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\Theme.h">
       <Filter>src</Filter>
     </ClInclude>
@@ -1184,18 +1052,6 @@
     <ClInclude Include="src\ThemeStyle.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\Bundle.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\FlowLayout.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\Joystick.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\MathUtil.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\ScriptController.h">
       <Filter>src</Filter>
     </ClInclude>
@@ -1529,9 +1385,6 @@
     <ClInclude Include="src\lua\lua_Gamepad.h">
       <Filter>src\lua</Filter>
     </ClInclude>
-    <ClInclude Include="src\Gamepad.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\lua\lua_AnimationClipListenerEventType.h">
       <Filter>src\lua</Filter>
     </ClInclude>
@@ -1643,21 +1496,12 @@
     <ClInclude Include="src\lua\lua_VertexFormatUsage.h">
       <Filter>src\lua</Filter>
     </ClInclude>
-    <ClInclude Include="src\AIStateMachine.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\AIAgent.h">
       <Filter>src</Filter>
     </ClInclude>
     <ClInclude Include="src\AIController.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\AIMessage.h">
-      <Filter>src</Filter>
-    </ClInclude>
-    <ClInclude Include="src\AIState.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\lua\lua_AIAgent.h">
       <Filter>src\lua</Filter>
     </ClInclude>
@@ -1688,9 +1532,6 @@
     <ClInclude Include="src\lua\lua_ScriptTarget.h">
       <Filter>src\lua</Filter>
     </ClInclude>
-    <ClInclude Include="src\Gesture.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\lua\lua_Gesture.h">
       <Filter>src\lua</Filter>
     </ClInclude>
@@ -1709,9 +1550,6 @@
     <ClInclude Include="src\lua\lua_PhysicsVehicleWheel.h">
       <Filter>src\lua</Filter>
     </ClInclude>
-    <ClInclude Include="src\Logger.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\lua\lua_Logger.h">
       <Filter>src\lua</Filter>
     </ClInclude>
@@ -1739,15 +1577,9 @@
     <ClInclude Include="src\lua\lua_RenderStateDepthFunction.h">
       <Filter>src\lua</Filter>
     </ClInclude>
-    <ClInclude Include="src\HeightField.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\lua\lua_HeightField.h">
       <Filter>src\lua</Filter>
     </ClInclude>
-    <ClInclude Include="src\ImageControl.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\lua\lua_ImageControl.h">
       <Filter>src\lua</Filter>
     </ClInclude>
@@ -1826,17 +1658,176 @@
     <ClInclude Include="src\lua\lua_VisibleSetDefault.h">
       <Filter>src\lua</Filter>
     </ClInclude>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="src\Game.inl">
+    <ClInclude Include="src\AIMessage.h">
       <Filter>src</Filter>
-    </None>
-    <None Include="src\Image.inl">
+    </ClInclude>
+    <ClInclude Include="src\AIState.h">
       <Filter>src</Filter>
-    </None>
-    <None Include="src\MeshBatch.inl">
+    </ClInclude>
+    <ClInclude Include="src\AIStateMachine.h">
       <Filter>src</Filter>
-    </None>
+    </ClInclude>
+    <ClInclude Include="src\Animation.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\AnimationClip.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\AnimationController.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\AnimationTarget.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\AnimationValue.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\AudioBuffer.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\AudioController.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\AudioListener.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\AudioSource.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Base.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\BoundingBox.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\BoundingSphere.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Bundle.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Button.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Camera.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\CheckBox.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Container.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Control.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Curve.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\DebugNew.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\DepthStencilTarget.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Effect.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\FileSystem.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\FlowLayout.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Font.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Form.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\FrameBuffer.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Frustum.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Game.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Gamepad.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\gameplay.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Gesture.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\HeightField.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Image.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\ImageControl.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Joint.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Joystick.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Keyboard.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Label.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Layout.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Light.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Logger.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Material.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\MaterialParameter.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\MathUtil.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Matrix.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Mesh.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\MeshBatch.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\MeshPart.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\MeshSkin.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Model.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Mouse.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\Node.h">
+      <Filter>src</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
     <None Include="res\logo_black.png">
       <Filter>res</Filter>
     </None>
@@ -1849,16 +1840,34 @@
     <None Include="res\logo_white.png">
       <Filter>res</Filter>
     </None>
+    <None Include="src\ScriptController.inl">
+      <Filter>src</Filter>
+    </None>
+    <None Include="src\BoundingBox.inl">
+      <Filter>src</Filter>
+    </None>
+    <None Include="src\BoundingSphere.inl">
+      <Filter>src</Filter>
+    </None>
+    <None Include="src\Game.inl">
+      <Filter>src</Filter>
+    </None>
+    <None Include="src\Image.inl">
+      <Filter>src</Filter>
+    </None>
+    <None Include="src\Joystick.inl">
+      <Filter>src</Filter>
+    </None>
     <None Include="src\MathUtil.inl">
       <Filter>src</Filter>
     </None>
     <None Include="src\MathUtilNeon.inl">
       <Filter>src</Filter>
     </None>
-    <None Include="src\Joystick.inl">
+    <None Include="src\Matrix.inl">
       <Filter>src</Filter>
     </None>
-    <None Include="src\ScriptController.inl">
+    <None Include="src\MeshBatch.inl">
       <Filter>src</Filter>
     </None>
     <None Include="res\shaders\colored.frag">
@@ -1867,12 +1876,6 @@
     <None Include="res\shaders\colored.vert">
       <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\colored-unlit.frag">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\colored-unlit.vert">
-      <Filter>res\shaders</Filter>
-    </None>
     <None Include="res\shaders\font.frag">
       <Filter>res\shaders</Filter>
     </None>
@@ -1888,28 +1891,7 @@
     <None Include="res\shaders\lighting.frag">
       <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\lighting-directional.frag">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\lighting-directional.vert">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\lighting-point.frag">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\lighting-point.vert">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\lighting-spot.frag">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\lighting-spot.vert">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\skinning.vert">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\skinning-none.vert">
+    <None Include="res\shaders\lighting.vert">
       <Filter>res\shaders</Filter>
     </None>
     <None Include="res\shaders\sprite.frag">
@@ -1930,16 +1912,10 @@
     <None Include="res\shaders\textured.vert">
       <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\textured-bumped.frag">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\textured-bumped.vert">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\textured-unlit.frag">
+    <None Include="res\shaders\skinning.vert">
       <Filter>res\shaders</Filter>
     </None>
-    <None Include="res\shaders\textured-unlit.vert">
+    <None Include="res\shaders\skinning-none.vert">
       <Filter>res\shaders</Filter>
     </None>
   </ItemGroup>
@@ -1947,21 +1923,12 @@
     <None Include="src\PhysicsFixedConstraint.inl">
       <Filter>src</Filter>
     </None>
-    <None Include="src\BoundingBox.inl">
-      <Filter>src</Filter>
-    </None>
     <None Include="src\PhysicsGenericConstraint.inl">
       <Filter>src</Filter>
     </None>
-    <None Include="src\BoundingSphere.inl">
-      <Filter>src</Filter>
-    </None>
     <None Include="src\PhysicsSpringConstraint.inl">
       <Filter>src</Filter>
     </None>
-    <None Include="src\Matrix.inl">
-      <Filter>src</Filter>
-    </None>
     <None Include="src\PhysicsRigidBody.inl">
       <Filter>src</Filter>
     </None>

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

@@ -1,45 +0,0 @@
-#ifdef OPENGL_ES
-precision highp float;
-#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
-
-// Varyings
-#if defined(VERTEX_COLOR)
-varying vec3 v_color;						// Input Vertex color ( r g b )
-#endif
-#if defined(TEXTURE_LIGHTMAP)
-varying vec2 v_texCoord;
-#endif
-
-
-void main()
-{
-    // Set base diffuse color
-    #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.rgb *= lightColor.rgb;
-	#endif
-	// Global color modulation
-	#if defined(MODULATE_COLOR)
-	gl_FragColor *= u_modulateColor;
-	#endif
-	#if defined(MODULATE_ALPHA)
-    gl_FragColor.a *= u_modulateAlpha;
-    #endif
-}

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

@@ -1,53 +0,0 @@
-// Attributes
-attribute vec4 a_position;									// Vertex Position							(x, y, z, w)
-#if defined(TEXTURE_LIGHTMAP)
-attribute vec2 a_texCoord;                                  // Texture Coordinate (for lightmapping)
-#endif
-#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)
-#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
-
-// Varyings
-#if defined(TEXTURE_LIGHTMAP)
-varying vec2 v_texCoord;                                    // Output Texture Coordinate
-#endif
-#if defined(VERTEX_COLOR)
-varying vec3 v_color;										// Output Vertex color						(r, g, b)
-#endif
-
-// Skinning
-#if defined(SKINNING)
-#include "skinning.vert"
-#else
-#include "skinning-none.vert" 
-#endif
-
-
-void main()
-{
-    // Get the vertex position
-    vec4 position = getPosition();
-    
-    // Transform position to clip space.a
-    gl_Position = u_worldViewProjectionMatrix *  position;
-    
-    // Pass lightmap tex coord to fragment shader
-    #if defined(TEXTURE_LIGHTMAP)
-    v_texCoord0 = a_texCoord0;
-    #endif
-
-     // Pass on vertex color to fragment shader
-    #if defined(VERTEX_COLOR)
-	v_color = a_color;
-    #endif
-}

+ 93 - 38
gameplay/res/shaders/colored.frag

@@ -1,73 +1,128 @@
-#define LIGHTING
 #ifdef OPENGL_ES
 precision highp float;
 #endif
 
+#ifndef DIRECTIONAL_LIGHT_COUNT
+#define DIRECTIONAL_LIGHT_COUNT 0
+#endif
+#ifndef SPOT_LIGHT_COUNT
+#define SPOT_LIGHT_COUNT 0
+#endif
+#ifndef POINT_LIGHT_COUNT
+#define POINT_LIGHT_COUNT 0
+#endif
+#if (DIRECTIONAL_LIGHT_COUNT > 0) || (POINT_LIGHT_COUNT > 0) || (SPOT_LIGHT_COUNT > 0)
+#define LIGHTING
+#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
+uniform vec3 u_ambientColor;
+uniform vec4 u_diffuseColor;
+
+#if defined(LIGHTMAP)
+uniform sampler2D u_lightmapTexture;
+#endif
+
+#if defined(LIGHTING)
+
+#if (DIRECTIONAL_LIGHT_COUNT > 0)
+uniform vec3 u_directionalLightColor[DIRECTIONAL_LIGHT_COUNT];
+uniform vec3 u_directionalLightDirection[DIRECTIONAL_LIGHT_COUNT];
+#endif
+
+#if (POINT_LIGHT_COUNT > 0)
+uniform vec3 u_pointLightColor[POINT_LIGHT_COUNT];
+uniform vec3 u_pointLightPosition[POINT_LIGHT_COUNT];
+uniform float u_pointLightRangeInverse[POINT_LIGHT_COUNT];
+#endif
+
+#if (SPOT_LIGHT_COUNT > 0)
+uniform vec3 u_spotLightColor[SPOT_LIGHT_COUNT];
+uniform vec3 u_spotLightDirection[SPOT_LIGHT_COUNT];
+uniform float u_spotLightRangeInverse[SPOT_LIGHT_COUNT];
+uniform float u_spotLightInnerAngleCos[SPOT_LIGHT_COUNT];
+uniform float u_spotLightOuterAngleCos[SPOT_LIGHT_COUNT];
+#endif
+
 #if defined(SPECULAR)
-uniform float u_specularExponent;				// Specular exponent
+uniform float u_specularExponent;
 #endif
-#if defined(SPOT_LIGHT)
-uniform float u_spotLightInnerAngleCos;			// The bright spot [0.0 - 1.0]
-uniform float u_spotLightOuterAngleCos;			// The soft outer part [0.0 - 1.0]
-uniform vec3 u_spotLightDirection;              // Direction of a spot light source
+
 #endif
+
 #if defined(MODULATE_COLOR)
-uniform vec4 u_modulateColor;					// Modulation color
+uniform vec4 u_modulateColor;
 #endif
+
 #if defined(MODULATE_ALPHA)
-uniform float u_modulateAlpha;					// Modulation alpha
+uniform float u_modulateAlpha;
 #endif
 
-// Inputs
-varying vec3 v_normalVector;					// Normal vector in view space
+///////////////////////////////////////////////////////////
+// Variables
+vec4 _baseColor;
+
+///////////////////////////////////////////////////////////
+// Varyings
 #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
+varying vec3 v_color;
 #endif
+
+#if defined(LIGHTING)
+
+varying vec3 v_normalVector;
+
+#if (POINT_LIGHT_COUNT > 0)
+varying vec3 v_vertexToPointLightDirection[POINT_LIGHT_COUNT];
+#endif
+
+#if (SPOT_LIGHT_COUNT > 0)
+varying vec3 v_vertexToSpotLightDirection[SPOT_LIGHT_COUNT];
+#endif
+
 #if defined(SPECULAR)
-varying vec3 v_cameraDirection;                 // Camera direction
+varying vec3 v_cameraDirection; 
 #endif
 
-// Lighting
 #include "lighting.frag"
-#if defined(POINT_LIGHT)
-#include "lighting-point.frag"
-#elif defined(SPOT_LIGHT)
-#include "lighting-spot.frag"
-#else
-#include "lighting-directional.frag"
+
 #endif
 
+
 void main()
 {
-    // Set base diffuse color
+    
+    #if defined(LIGHTING)
+
     #if defined(VERTEX_COLOR)
 	_baseColor.rgb = v_color;
-	#else
-	_baseColor = u_diffuseColor;
+    #else
+    _baseColor = u_diffuseColor;
 	#endif
-
-    // Light the pixel
+    
     gl_FragColor.a = _baseColor.a;
     gl_FragColor.rgb = getLitPixel();
     
+    #else
+    
+    #if defined(VERTEX_COLOR)
+    gl_FragColor.rgb = v_color;
+    #else
+    gl_FragColor = u_diffuseColor;
+    #endif
+    
+    #endif
+
+	#if defined(LIGHTMAP)
+	vec4 lightColor = texture2D(u_lightmapTexture, v_texCoord1);
+	gl_FragColor.rgb *= lightColor.rgb;
+	#endif
+
 	#if defined(MODULATE_COLOR)
     gl_FragColor *= u_modulateColor;
     #endif
+
 	#if defined(MODULATE_ALPHA)
     gl_FragColor.a *= u_modulateAlpha;
     #endif

+ 96 - 41
gameplay/res/shaders/colored.vert

@@ -1,57 +1,105 @@
+#ifndef DIRECTIONAL_LIGHT_COUNT
+#define DIRECTIONAL_LIGHT_COUNT 0
+#endif
+#ifndef SPOT_LIGHT_COUNT
+#define SPOT_LIGHT_COUNT 0
+#endif
+#ifndef POINT_LIGHT_COUNT
+#define POINT_LIGHT_COUNT 0
+#endif
+#if (DIRECTIONAL_LIGHT_COUNT > 0) || (POINT_LIGHT_COUNT > 0) || (SPOT_LIGHT_COUNT > 0)
 #define LIGHTING
+#endif
 
+///////////////////////////////////////////////////////////
 // Attributes
-attribute vec4 a_position;									// Vertex Position							(x, y, z, w)
-attribute vec3 a_normal;									// Vertex Normal							(x, y, z)
+attribute vec4 a_position;
+
 #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)
+attribute vec4 a_blendWeights;
+attribute vec4 a_blendIndices;
+#endif
+
+#if defined(LIGHTMAP)
+attribute vec2 a_texCoord1;
 #endif
+
+#if defined(LIGHTING)
+attribute vec3 a_normal;
+#endif
+
 #if defined(VERTEX_COLOR)
-attribute vec3 a_color;										// Output Vertex Color
-varying vec3 v_color;										// Output Vertex Color 
+attribute vec3 a_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
-uniform mat4 u_worldViewMatrix;								// Matrix to tranform a position to view space.
+uniform mat4 u_worldViewProjectionMatrix;
+
 #if defined(SKINNING)
-uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];		// Array of 4x3 matrices
+uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];
 #endif
+
+#if defined(LIGHTING)
+uniform mat4 u_inverseTransposeWorldViewMatrix;
+
+#if (POINT_LIGHT_COUNT > 0) || (SPOT_LIGHT_COUNT > 0) || defined(SPECULAR)
+uniform mat4 u_worldViewMatrix;
+#endif
+
+#if (DIRECTION_LIGHT_COUNT > 0)
+uniform vec3 u_directionalLightDirection[DIRECTION_LIGHT_COUNT];
+#endif
+
+#if (POINT_LIGHT_COUNT > 0) 
+uniform vec3 u_pointLightPosition[POINT_LIGHT_COUNT];
+#endif
+
+#if (SPOT_LIGHT_COUNT > 0)
+uniform vec3 u_spotLightPosition[SPOT_LIGHT_COUNT];
+uniform vec3 u_spotLightDirection[SPOT_LIGHT_COUNT];
+#endif
+
 #if defined(SPECULAR)
-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
+uniform vec3 u_cameraPosition;
 #endif
 
+#endif
+
+///////////////////////////////////////////////////////////
 // Varyings
-varying vec3 v_normalVector;								// Normal vector in view space.
+#if defined(LIGHTMAP)
+varying vec2 v_texCoord1;
+#endif
+
+#if defined(VERTEX_COLOR)
+varying vec3 v_color;
+#endif
+
+#if defined(LIGHTING)
+
+varying vec3 v_normalVector;
+
+#if (DIRECTIONAL_LIGHT_COUNT > 0) 
+varying vec3 v_lightDirection[DIRECTIONAL_LIGHT_COUNT];
+#endif
+
+#if (POINT_LIGHT_COUNT > 0)
+varying vec3 v_vertexToPointLightDirection[POINT_LIGHT_COUNT];
+#endif
+
+#if (SPOT_LIGHT_COUNT > 0)
+varying vec3 v_vertexToSpotLightDirection[SPOT_LIGHT_COUNT];
+#endif
+
 #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 "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 "lighting-spot.vert"
-#else
-uniform vec3 u_lightDirection;								// Direction of light
-#include "lighting-directional.vert"
+varying vec3 v_cameraDirection;
+#endif
+
+#include "lighting.vert"
+
 #endif
 
-// Skinning
 #if defined(SKINNING)
 #include "skinning.vert"
 #else
@@ -61,21 +109,28 @@ uniform vec3 u_lightDirection;								// Direction of light
 
 void main()
 {
-    // Get the position and normal
     vec4 position = getPosition();
-    vec3 normal = getNormal();
-
-    // Transform position to clip space.
     gl_Position = u_worldViewProjectionMatrix * position;
 
+    #if defined (LIGHTING)
+
+    vec3 normal = getNormal();
+
     // 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);
+
+    #endif
+
+    // Pass the lightmap texture coordinate
+    #if defined(LIGHTMAP)
+    v_texCoord1 = a_texCoord1;
+    #endif
     
-    // Pass the vertex color to fragment shader
+    // Pass the vertex color
     #if defined(VERTEX_COLOR)
 	v_color = a_color;
     #endif

+ 10 - 4
gameplay/res/shaders/font.frag

@@ -3,12 +3,15 @@ precision highp float;
 #extension GL_OES_standard_derivatives : enable
 #endif
 
+///////////////////////////////////////////////////////////
 // Uniforms
 uniform sampler2D u_texture;
+
 #ifdef DISTANCE_FIELD
 uniform vec2 u_cutoff;
 #endif
 
+///////////////////////////////////////////////////////////
 // Varyings
 varying vec2 v_texCoord;
 varying vec4 v_color;
@@ -16,15 +19,18 @@ varying vec4 v_color;
 
 void main()
 { 
-#ifdef DISTANCE_FIELD
+    #ifdef DISTANCE_FIELD
+    
     gl_FragColor = v_color;
     float distance = texture2D(u_texture, v_texCoord).a;
     float smoothing = fwidth(distance);
     float alpha = smoothstep(0.5 - smoothing * u_cutoff.x, 0.5 + smoothing * u_cutoff.y, distance);
     gl_FragColor.a = alpha * v_color.a;
-
-#else
+    
+    #else
+    
     gl_FragColor = v_color;
     gl_FragColor.a = texture2D(u_texture, v_texCoord).a * v_color.a;
-#endif
+    
+    #endif
 }

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

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

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

@@ -2,9 +2,11 @@
 precision highp float;
 #endif
 
+///////////////////////////////////////////////////////////
 // Uniforms
 uniform sampler2D u_texture;
 
+///////////////////////////////////////////////////////////
 // Varyings
 varying vec2 v_texCoord;
 

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

@@ -1,10 +1,13 @@
+///////////////////////////////////////////////////////////
 // Attributes
 attribute vec3 a_position;
 attribute vec2 a_texCoord;
 
+///////////////////////////////////////////////////////////
 // Uniforms
 uniform mat4 u_worldViewProjectionMatrix;
 
+///////////////////////////////////////////////////////////
 // Varyings
 varying vec2 v_texCoord;
 

+ 0 - 41
gameplay/res/shaders/lighting-directional.frag

@@ -1,41 +0,0 @@
-#if defined(BUMPED)
-
-vec3 getLitPixel()
-{
-    // Fetch normals from the normal map
-    vec3 normalVector = normalize(texture2D(u_normalmapTexture, v_texCoord).rgb * 2.0 - 1.0);
-    vec3 lightDirection = normalize(v_lightDirection);
-    
-    #if defined(SPECULAR)
-    
-    vec3 cameraDirection = normalize(v_cameraDirection);
-    return computeLighting(normalVector, -lightDirection, 1.0, cameraDirection);
-    
-    #else
-    
-    return computeLighting(normalVector, -lightDirection, 1.0);
-    
-    #endif
-}
-
-#else
-
-vec3 getLitPixel()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);
-    vec3 lightDirection = normalize(u_lightDirection);
-
-    #if defined(SPECULAR)
-    
-    vec3 cameraDirection = normalize(v_cameraDirection);
-    return computeLighting(normalVector, -lightDirection, 1.0, cameraDirection);
-    
-    #else
-    
-    return computeLighting(normalVector, -lightDirection, 1.0);
-    
-    #endif
-}
-
-#endif

+ 0 - 31
gameplay/res/shaders/lighting-directional.vert

@@ -1,31 +0,0 @@
-#if defined(BUMPED)
-
-void applyLight(mat3 tangentSpaceTransformMatrix)
-{
-    // Transform light direction to tangent space
-    v_lightDirection = tangentSpaceTransformMatrix * u_lightDirection;
-    
-    #if defined(SPECULAR)
-
-    // Compute the camera direction for specular lighting
-	vec4 positionWorldViewSpace = u_worldViewMatrix * a_position;
-    v_cameraDirection = u_cameraPosition - positionWorldViewSpace.xyz;
-
-    #endif
-}
-
-#else
-
-void applyLight(vec4 position)
-{
-    
-    #if defined(SPECULAR)
-
-    // Compute the camera direction for specular lighting
-	vec4 positionWorldViewSpace = u_worldViewMatrix * position;
-    v_cameraDirection = u_cameraPosition - positionWorldViewSpace.xyz;
-
-    #endif
-}
-
-#endif

+ 0 - 46
gameplay/res/shaders/lighting-point.frag

@@ -1,46 +0,0 @@
-#if defined(BUMPED)
-
-vec3 getLitPixel()
-{
-    // Fetch normals from the normal map and normalize the vectors
-    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);
-    
-    #if defined(SPECULAR)
-    
-    vec3 cameraDirection = normalize(v_cameraDirection);
-    return computeLighting(normalVector, vertexToPointLightDirection, pointLightAttenuation, cameraDirection);
-    
-    #else
-    
-    return computeLighting(normalVector, vertexToPointLightDirection, pointLightAttenuation);
-    
-    #endif
-}
-
-#else
-
-vec3 getLitPixel()
-{
-    // Normalize the vectors.
-    vec3 normalVector = normalize(v_normalVector);    
-    vec3 vertexToPointLightDirection = normalize(v_vertexToPointLightDirection);
-    
-    // Fetch point light attenuation.
-    float pointLightAttenuation = v_pointLightAttenuation;
-    
-    #if defined (SPECULAR)
-    
-    vec3 cameraDirection = normalize(v_cameraDirection);    
-    return computeLighting(normalVector, vertexToPointLightDirection, pointLightAttenuation, cameraDirection);
-    
-    #else
-    
-    return computeLighting(normalVector, vertexToPointLightDirection, pointLightAttenuation);
-    
-    #endif
-}
-
-#endif

+ 0 - 50
gameplay/res/shaders/lighting-point.vert

@@ -1,50 +0,0 @@
-#if defined(BUMPED)
-
-void applyLight(mat3 tangentSpaceTransformMatrix)
-{
-    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 vertexToPointLightDirection = tangentSpaceTransformMatrix * lightDirection;
-
-    // Attenuation
-    v_pointLightAttenuation = 1.0 - dot(lightDirection * u_pointLightRangeInverse, lightDirection * u_pointLightRangeInverse);
-
-    // Output light direction.
-    v_vertexToPointLightDirection =  vertexToPointLightDirection;
-    
-    #if defined (SPECULAR)
- 
-    // Compute camera direction and transform it to tangent space.
-    v_cameraDirection = tangentSpaceTransformMatrix * (u_cameraPosition - positionWorldViewSpace.xyz);
-    
-    #endif
-}
-
-#else
-
-void applyLight(vec4 position)
-{
-    // World view space position.
-	vec4 positionWorldViewSpace = u_worldViewMatrix * position;
-    
-    // Compute the light direction with light position and the vertex position.
-	v_vertexToPointLightDirection = u_pointLightPosition - positionWorldViewSpace.xyz;
-   
-    // Attenuation
-    v_pointLightAttenuation = 1.0 - dot(v_vertexToPointLightDirection * u_pointLightRangeInverse, v_vertexToPointLightDirection * u_pointLightRangeInverse);
-
-    // Output light direction.
-    //v_vertexToPointLightDirection = lightDirection;
-   
-    #if defined (SPECULAR)  
-
-	v_cameraDirection = u_cameraPosition - positionWorldViewSpace.xyz;
-	
-    #endif
-}
-
-#endif

+ 0 - 63
gameplay/res/shaders/lighting-spot.frag

@@ -1,63 +0,0 @@
-float lerpstep( float lower, float upper, float s)
-{
-    return clamp( ( s - lower ) / ( upper - lower ), 0.0, 1.0 );
-}
-
-#if defined(BUMPED)
-
-vec3 getLitPixel()
-{
-    // Fetch normals from the normal map.
-    vec3 normalVector = normalize(texture2D(u_normalmapTexture, v_texCoord).rgb * 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.
-    float spotCurrentAngleCos = 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);
-
-    #if defined(SPECULAR)
-    
-    vec3 cameraDirection = normalize(v_cameraDirection);
-    return computeLighting(normalVector, vertexToSpotLightDirection, spotLightAttenuation, cameraDirection);
-    
-    #else
-    
-    return computeLighting(normalVector, vertexToSpotLightDirection, spotLightAttenuation);
-    
-    #endif
-}
-
-#else
-
-vec3 getLitPixel()
-{
-    // 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 spot direction.
-    float spotCurrentAngleCos = 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);
-
-    #if defined(SPECULAR)
-    
-    vec3 cameraDirection = normalize(v_cameraDirection);
-    return computeLighting(normalVector, vertexToSpotLightDirection, spotLightAttenuation, cameraDirection);
-    
-    #else
-    
-    return computeLighting(normalVector, vertexToSpotLightDirection, spotLightAttenuation);
-    
-    #endif
-}
-
-#endif

+ 0 - 52
gameplay/res/shaders/lighting-spot.vert

@@ -1,52 +0,0 @@
-#if defined(BUMPED)
-
-void applyLight(mat3 tangentSpaceTransformMatrix)
-{
-    //vec4 positionWorldSpace = u_worldMatrix * a_position;
-	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;
-    
-    #if defined(SPECULAR)
-    
-    // Compute camera direction and transform it to tangent space.
-	v_cameraDirection = tangentSpaceTransformMatrix * (u_cameraPosition - positionWorldViewSpace.xyz);
-    
-    #endif
-}
-
-#else
-
-void applyLight(vec4 position)
-{
-    // World view space position.
-	vec4 positionWorldViewSpace = u_worldViewMatrix * position;
-
-    // Compute the light direction with light position and the vertex position.
-	v_vertexToSpotLightDirection = u_spotLightPosition - positionWorldViewSpace.xyz;
-    
-    // Attenuation
-    v_spotLightAttenuation = 1.0 - dot(v_vertexToSpotLightDirection * u_spotLightRangeInverse, v_vertexToSpotLightDirection * u_spotLightRangeInverse);
-  
-    // Compute camera direction and transform it to tangent space.
-	#if defined(SPECULAR)
-	
-	v_cameraDirection = u_cameraPosition - positionWorldViewSpace.xyz;
-	
-	#endif
-}
-
-#endif

+ 78 - 38
gameplay/res/shaders/lighting.frag

@@ -1,46 +1,86 @@
-vec4 _baseColor;
-vec3 _ambientColor;
-vec3 _diffuseColor;
 
-#if defined(SPECULAR)
+vec3 computeLighting(vec3 normalVector, vec3 lightDirection, vec3 lightColor, float attenuation)
+{
+    float diffuse = clamp(dot(normalVector, lightDirection), 0.0, 1.0);
+    vec3 diffuseColor = lightColor * _baseColor.rgb * diffuse;
 
-vec3 _specularColor;
+    #if defined(SPECULAR)
 
-vec3 computeLighting(vec3 normalVector, vec3 lightDirection, float attenuation, vec3 cameraDirection)
-{
-    // 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;
-	
-	return _ambientColor + _diffuseColor + _specularColor;
-}
+    vec3 vertexToEye = normalize(v_cameraDirection);
+    vec3 reflect = normalize(normalVector * diffuse * 2.0 - lightDirection);  
+    float specular = pow(clamp(dot(reflect, vertexToEye), 0.0, 1.0), u_specularExponent);
+    vec3 specularColor = vec3(specular, specular, specular); 
+    
+    return (diffuseColor + specularColor) * attenuation;
 
-#else
+    #else
+    
+        return diffuseColor * attenuation;
+    
+    #endif
+}
 
-vec3 computeLighting(vec3 normalVector, vec3 lightDirection, float attenuation)
+vec3 getLitPixel()
 {
-    // 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;
-	
-	return _ambientColor + _diffuseColor;
-}
+    #if defined(BUMPED)
+    
+    vec3 normalVector = normalize(texture2D(u_normalmapTexture, v_texCoord).rgb * 2.0 - 1.0);
+    
+    #else
+    
+    vec3 normalVector = normalize(v_normalVector);
+    
+    #endif
+    
+    vec3 ambientColor = _baseColor.rgb * u_ambientColor;
+    vec3 combinedColor = ambientColor;
 
-#endif
+    // Directional light contribution
+    #if (DIRECTIONAL_LIGHT_COUNT > 0)
+    for (int i = 0; i < DIRECTIONAL_LIGHT_COUNT; ++i)
+    {
+        #if defined(BUMPED)
+        vec3 lightDirection = normalize(v_directionalLightDirection[i]);
+        #else
+        vec3 lightDirection = normalize(u_directionalLightDirection[i]);
+        #endif 
+        combinedColor += computeLighting(normalVector, -lightDirection, u_directionalLightColor[i], 1.0);
+    }
+    #endif
 
+    // Point light contribution
+    #if (POINT_LIGHT_COUNT > 0)
+    for (int i = 0; i < POINT_LIGHT_COUNT; ++i)
+    {
+        vec3 ldir = v_vertexToPointLightDirection[i] * u_pointLightRangeInverse[i];
+        float attenuation = clamp(1.0 - dot(ldir, ldir), 0.0, 1.0);
+        combinedColor += computeLighting(normalVector, normalize(v_vertexToPointLightDirection[i]), u_pointLightColor[i], attenuation);
+    }
+    #endif
+
+    // Spot light contribution
+    #if (SPOT_LIGHT_COUNT > 0)
+    for (int i = 0; i < SPOT_LIGHT_COUNT; ++i)
+    {
+        // Compute range attenuation
+        vec3 ldir = v_vertexToSpotLightDirection[i] * u_spotLightRangeInverse[i];
+        float att = clamp(1.0 - dot(ldir, ldir), 0.0, 1.0);
+        vec3 vertexToSpotLightDirection = normalize(v_vertexToSpotLightDirection[i]);
+
+        // TODO: 
+        // Let app normalize this! Need Node::getForwardVectorViewNorm
+        // This needs to be in TANGENT SPACE for bump mapping
+        // and should always pass from vertex shader via v_spotLightDirection[i]
+        vec3 spotLightDirection = normalize(u_spotLightDirection[i]);
+
+        // "-lightDirection" is used because light direction points in opposite direction to spot direction.
+        float spotCurrentAngleCos = dot(spotLightDirection, -vertexToSpotLightDirection);
+
+		// Apply spot attenuation
+        att *= smoothstep(u_spotLightOuterAngleCos[i], u_spotLightInnerAngleCos[i], spotCurrentAngleCos);
+        combinedColor += computeLighting(normalVector, vertexToSpotLightDirection, u_spotLightColor[i], att);
+    }
+    #endif
+    
+    return combinedColor;
+}

+ 66 - 0
gameplay/res/shaders/lighting.vert

@@ -0,0 +1,66 @@
+
+#if defined(BUMPED)
+void applyLight(vec4 position, mat3 tangentSpaceTransformMatrix)
+{
+    #if (defined(SPECULAR) || (POINT_LIGHT_COUNT > 0) || (SPOT_LIGHT_COUNT > 0))
+    vec4 positionWorldViewSpace = u_worldViewMatrix * position;
+    #endif
+    
+    #if (DIRECTIONAL_LIGHT_COUNT > 0)
+    for (int i = 0; i < DIRECTIONAL_LIGHT_COUNT; ++i)
+    {
+        // Transform light direction to tangent space
+        v_directionalLightDirection[i] = tangentSpaceTransformMatrix * u_directionalLightDirection[i];
+    }
+    #endif
+    
+    #if (POINT_LIGHT_COUNT > 0)
+    for (int i = 0; i < POINT_LIGHT_COUNT; ++i)
+    {
+        // Compute the vertex to light direction, in tangent space
+        v_vertexToPointLightDirection[i] = tangentSpaceTransformMatrix * (u_pointLightPosition[i] - positionWorldViewSpace.xyz);
+    }
+    #endif
+    
+    #if (SPOT_LIGHT_COUNT > 0)
+    for (int i = 0; i < SPOT_LIGHT_COUNT; ++i)
+    {
+        // Compute the vertex to light direction, in tangent space
+	    v_vertexToSpotLightDirection[i] = tangentSpaceTransformMatrix * (u_spotLightPosition[i] - positionWorldViewSpace.xyz);
+    }
+    #endif
+    
+    #if defined(SPECULAR)
+    // Compute camera direction and transform it to tangent space.
+    v_cameraDirection = tangentSpaceTransformMatrix * (u_cameraPosition - positionWorldViewSpace.xyz);
+    #endif
+}
+#else
+void applyLight(vec4 position)
+{
+    #if defined(SPECULAR) || (POINT_LIGHT_COUNT > 0) || (SPOT_LIGHT_COUNT > 0)
+	vec4 positionWorldViewSpace = u_worldViewMatrix * position;
+    #endif
+    
+    #if (POINT_LIGHT_COUNT > 0)
+    for (int i = 0; i < POINT_LIGHT_COUNT; ++i)
+    {
+        // Compute the light direction with light position and the vertex position.
+        v_vertexToPointLightDirection[i] = u_pointLightPosition[i] - positionWorldViewSpace.xyz;
+    }
+    #endif
+    
+    #if (SPOT_LIGHT_COUNT > 0)
+    for (int i = 0; i < SPOT_LIGHT_COUNT; ++i)
+    {
+        // Compute the light direction with light position and the vertex position.
+	    v_vertexToSpotLightDirection[i] = u_spotLightPosition[i] - positionWorldViewSpace.xyz;
+    }
+    #endif
+
+    #if defined(SPECULAR)  
+	v_cameraDirection = u_cameraPosition - positionWorldViewSpace.xyz;
+    #endif
+}
+
+#endif

+ 0 - 2
gameplay/res/shaders/skinning-none.vert

@@ -11,7 +11,6 @@ vec3 getNormal()
 }
 
 #if defined(BUMPED)
-
 vec3 getTangent()
 {
     return a_tangent;
@@ -21,7 +20,6 @@ vec3 getBinormal()
 {
     return a_binormal;
 }
-
 #endif
 
 #endif

+ 33 - 15
gameplay/res/shaders/skinning.vert

@@ -1,7 +1,5 @@
+
 vec4 _skinnedPosition;
-#if defined(LIGHTING)
-vec3 _skinnedNormal;
-#endif
 
 void skinPosition(float blendWeight, int matrixIndex)
 {
@@ -16,29 +14,25 @@ void skinPosition(float blendWeight, int matrixIndex)
 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;    
 }
 
 #if defined(LIGHTING)
 
+vec3 _skinnedNormal;
+
 void skinTangentSpaceVector(vec3 vector, float blendWeight, int matrixIndex)
 {
     vec3 tmp;
@@ -51,24 +45,19 @@ void skinTangentSpaceVector(vec3 vector, float blendWeight, int matrixIndex)
 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;
 }
 
@@ -90,4 +79,33 @@ vec3 getBinormal()
 }
 
 #endif
-#endif
+
+#endif
+
+#else
+
+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

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

@@ -2,9 +2,11 @@
 precision highp float;
 #endif
 
+///////////////////////////////////////////////////////////
 // Uniforms
 uniform sampler2D u_texture;
 
+///////////////////////////////////////////////////////////
 // Varyings
 varying vec2 v_texCoord;
 varying vec4 v_color;

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

@@ -1,11 +1,14 @@
+///////////////////////////////////////////////////////////
 // Attributes
 attribute vec3 a_position;
 attribute vec2 a_texCoord;
 attribute vec4 a_color;
 
+///////////////////////////////////////////////////////////
 // Uniforms
 uniform mat4 u_projectionMatrix;
 
+///////////////////////////////////////////////////////////
 // Varyings
 varying vec2 v_texCoord;
 varying vec4 v_color;

+ 7 - 6
gameplay/res/shaders/terrain.vert

@@ -1,20 +1,21 @@
+///////////////////////////////////////////////////////////
 // Attributes
-attribute vec4 a_position;									// Vertex Position							(x, y, z, w)
+attribute vec4 a_position;
 #ifndef NORMAL_MAP
-attribute vec3 a_normal;									// Vertex Normal							(x, y, z)
+attribute vec3 a_normal;
 #endif
 attribute vec2 a_texCoord0;
 
 // Uniforms
-uniform mat4 u_worldViewProjectionMatrix;					// World view projection matrix
+uniform mat4 u_worldViewProjectionMatrix;
 #ifndef NORMAL_MAP
-uniform mat4 u_normalMatrix;					            // Matrix used for normal vector transformation
+uniform mat4 u_normalMatrix;
 #endif
-uniform vec3 u_lightDirection;								// Direction of light
+uniform vec3 u_lightDirection;
 
 // Varyings
 #ifndef NORMAL_MAP
-varying vec3 v_normalVector;								// Normal vector out
+varying vec3 v_normalVector;
 #endif
 varying vec2 v_texCoord0;
 #if LAYER_COUNT > 0

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

@@ -1,76 +0,0 @@
-#define LIGHTING
-#define BUMPED
-
-#ifdef OPENGL_ES
-precision highp float;
-#endif
-
-// Uniforms
-uniform sampler2D u_diffuseTexture;        		// Diffuse map texture
-uniform sampler2D u_normalmapTexture;       	// Normalmap texture
-uniform vec3 u_ambientColor;                    // Ambient color
-uniform vec3 u_lightColor;                      // Light color
-uniform vec3 u_lightDirection;					// Light direction
-#if defined(SPECULAR)
-uniform float u_specularExponent;				// Specular exponent.
-#endif
-#if defined (SPOT_LIGHT)
-uniform float u_spotLightInnerAngleCos;			// The bright spot [0.0 - 1.0]
-uniform float u_spotLightOuterAngleCos;			// The soft outer part [0.0 - 1.0]
-#endif
-#if defined(MODULATE_COLOR)
-uniform vec4 u_modulateColor;					// Modulation color
-#endif
-#if defined(MODULATE_ALPHA)
-uniform float u_modulateAlpha;					// Modulation alpha
-#endif
-
-// Varyings
-varying vec3 v_normalVector;					// Normal vector in view space
-varying vec2 v_texCoord;						// Texture Coordinate
-#if defined(POINT_LIGHT)
-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
-
-// Lighting
-#include "lighting.frag"
-#if defined(POINT_LIGHT)
-#include "lighting-point.frag"
-#elif defined(SPOT_LIGHT)
-#include "lighting-spot.frag"
-#else
-#include "lighting-directional.frag"
-#endif
-
-
-void main()
-{
-    // Fetch diffuse color from texture.
-    _baseColor = texture2D(u_diffuseTexture, v_texCoord);
-
-    // Light the pixel
-    gl_FragColor.a = _baseColor.a;
-    #if defined(TEXTURE_DISCARD_ALPHA)
-    if (gl_FragColor.a < 0.5)
-        discard;
-    #endif
-    gl_FragColor.rgb = getLitPixel();
-
-    // Global color modulation
-    #if defined(MODULATE_COLOR)
-    gl_FragColor *= u_modulateColor;
-    #endif
-    #if defined(MODULATE_ALPHA)
-    gl_FragColor.a *= u_modulateAlpha;
-    #endif
-}

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

@@ -1,106 +0,0 @@
-#define LIGHTING
-#define BUMPED
-
-// 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/Bitangent				(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
-
-// Uniforms
-uniform mat4 u_worldViewProjectionMatrix;					// Matrix to transform a position to clip space
-uniform mat4 u_inverseTransposeWorldViewMatrix;				// Matrix to transform a normal to view space
-#if defined(SPECULAR) || defined(SPOT_LIGHT) || defined(POINT_LIGHT)
-uniform mat4 u_worldViewMatrix;								// Matrix to tranform a position to view space
-uniform mat4 u_worldMatrix;								    // Matrix to tranform a position to world space
-#endif
-#if defined(SKINNING)
-uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];		// Array of 4x3 matrices
-#endif
-#if defined(SPECULAR)
-uniform vec3 u_cameraPosition;                 				// Position of the camera in view space
-#endif
-#if defined(TEXTURE_REPEAT)
-uniform vec2 u_textureRepeat;
-#endif
-#if defined(TEXTURE_OFFSET)
-uniform vec2 u_textureOffset;
-#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
-uniform vec3 u_spotLightDirection;							// Direction of light
-#else
-uniform vec3 u_lightDirection;								// Direction of light
-#endif
-
-// Varyings
-varying vec3 v_normalVector;								// Normal vector in view space
-varying vec2 v_texCoord;									// Texture Coordinate
-#if defined(SPECULAR)
-varying vec3 v_cameraDirection;								// Direction the camera is looking at in tangent space
-#endif
-
-// Lighting
-#if defined(POINT_LIGHT)
-varying vec3 v_vertexToPointLightDirection;					// Direction of point light w.r.t current vertex in tangent space
-varying float v_pointLightAttenuation;						// Attenuation of point light
-#include "lighting-point.vert"
-#elif defined(SPOT_LIGHT)
-varying vec3 v_vertexToSpotLightDirection;					// Direction of the spot light w.r.t current vertex in tangent space
-varying float v_spotLightAttenuation;						// Attenuation of spot light
-varying vec3 v_spotLightDirection;							// Direction of spot light in tangent space
-#include "lighting-spot.vert"
-#else
-varying vec3 v_lightDirection;								// Direction of light
-#include "lighting-directional.vert"
-#endif
-
-// Skinning
-#if defined(SKINNING)
-#include "skinning.vert"
-#else
-#include "skinning-none.vert" 
-#endif
-
-
-void main()
-{
-    // Get the position, normal, tangents and binormals.
-    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 normalVector = normalize(inverseTransposeWorldViewMatrix * normal);
-    
-    // Create a transform to convert a vector to tangent space.
-    vec3 tangentVector  = normalize(inverseTransposeWorldViewMatrix * tangent);
-    vec3 binormalVector = normalize(inverseTransposeWorldViewMatrix * binormal);
-    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);
-    
-    // Texture transformation.
-    v_texCoord = a_texCoord;
-    #if defined(TEXTURE_REPEAT)
-    v_texCoord *= u_textureRepeat;
-    #endif
-    #if defined(TEXTURE_OFFSET)
-    v_texCoord += u_textureOffset;
-    #endif
-}

+ 0 - 47
gameplay/res/shaders/textured-unlit.frag

@@ -1,47 +0,0 @@
-#ifdef OPENGL_ES
-precision highp float;
-#endif
-
-// Uniforms
-uniform sampler2D u_diffuseTexture;     	// Diffuse texture
-#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
-
-// Varyings
-varying vec2 v_texCoord0;                	// Texture coordinate(u, v)
-#if defined(TEXCOORD1)
-varying vec2 v_texCoord1;                   // Second tex coord for multi-texturing
-#endif
-
-
-void main()
-{
-    // Sample the texture for the color
-    gl_FragColor = texture2D(u_diffuseTexture, v_texCoord0);
-    #if defined(TEXTURE_DISCARD_ALPHA)
-    if (gl_FragColor.a < 0.5)
-        discard;
-    #endif
-    #if defined(TEXTURE_LIGHTMAP)
-    #if defined(TEXCOORD1)
-    vec4 lightColor = texture2D(u_lightmapTexture, v_texCoord1);
-    #else
-    vec4 lightColor = texture2D(u_lightmapTexture, v_texCoord0);
-    #endif
-    gl_FragColor.rgb *= lightColor.rgb;
-    #endif
-    // Global color modulation
-    #if defined(MODULATE_COLOR)
-    gl_FragColor *= u_modulateColor;
-    #endif
-    #if defined(MODULATE_ALPHA)
-    gl_FragColor.a *= u_modulateAlpha;
-    #endif
-}

+ 0 - 57
gameplay/res/shaders/textured-unlit.vert

@@ -1,57 +0,0 @@
-// Attributes
-attribute vec4 a_position;									// Vertex Position							(x, y, z, w)
-attribute vec2 a_texCoord0;									// Vertex Texture Coordinate				(u, v)
-#if defined(TEXCOORD1)
-attribute vec2 a_texCoord1;                                 // Second tex coord for multi-texturing
-#endif
-#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
-
-// 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
-#endif
-#if defined(TEXTURE_REPEAT)
-uniform vec2 u_textureRepeat;								// Texture repeat for tiling
-#endif
-#if defined(TEXTURE_OFFSET)
-uniform vec2 u_textureOffset;								// Texture offset
-#endif
-
-// Varyings
-varying vec2 v_texCoord0;									// Texture Coordinate
-#if defined(TEXCOORD1)
-varying vec2 v_texCoord1;                                   // Second tex coord for multi-texturing
-#endif
-
-// Skinning 
-#if defined(SKINNING)
-#include "skinning.vert"
-#else
-#include "skinning-none.vert" 
-#endif
-
-
-void main()
-{
-    // Get the vertex position
-    vec4 position = getPosition();
-
-    // Transform position to clip space.
-    gl_Position = u_worldViewProjectionMatrix * position;
-
-    // Texture transformation.
-    v_texCoord0 = a_texCoord0;
-    #if defined(TEXCOORD1)
-    v_texCoord1 = a_texCoord1;
-    #endif
-    #if defined(TEXTURE_REPEAT)
-    v_texCoord0 *= u_textureRepeat;
-    #endif
-    #if defined(TEXTURE_OFFSET)
-    v_texCoord0 += u_textureOffset;
-    #endif
-}

+ 102 - 39
gameplay/res/shaders/textured.frag

@@ -1,73 +1,136 @@
-#define LIGHTING
-
 #ifdef OPENGL_ES
 precision highp float;
 #endif
 
+#ifndef DIRECTIONAL_LIGHT_COUNT
+#define DIRECTIONAL_LIGHT_COUNT 0
+#endif
+#ifndef SPOT_LIGHT_COUNT
+#define SPOT_LIGHT_COUNT 0
+#endif
+#ifndef POINT_LIGHT_COUNT
+#define POINT_LIGHT_COUNT 0
+#endif
+#if (DIRECTIONAL_LIGHT_COUNT > 0) || (POINT_LIGHT_COUNT > 0) || (SPOT_LIGHT_COUNT > 0)
+#define LIGHTING
+#endif
+
+///////////////////////////////////////////////////////////
 // Uniforms
-uniform sampler2D u_diffuseTexture;             // Diffuse map texture
-uniform vec3 u_ambientColor;                    // Ambient color
-uniform vec3 u_lightColor;                      // Light color
-uniform vec3 u_lightDirection;					// Light direction
+uniform vec3 u_ambientColor;
+
+uniform sampler2D u_diffuseTexture;
+
+#if defined(LIGHTMAP)
+uniform sampler2D u_lightmapTexture;
+#endif
+
+#if defined(LIGHTING)
+
+#if defined(BUMPED)
+uniform sampler2D u_normalmapTexture;
+#endif
+
+#if (DIRECTIONAL_LIGHT_COUNT > 0)
+uniform vec3 u_directionalLightColor[DIRECTIONAL_LIGHT_COUNT];
+uniform vec3 u_directionalLightDirection[DIRECTIONAL_LIGHT_COUNT];
+#endif
+
+#if (POINT_LIGHT_COUNT > 0)
+uniform vec3 u_pointLightColor[POINT_LIGHT_COUNT];
+uniform vec3 u_pointLightPosition[POINT_LIGHT_COUNT];
+uniform float u_pointLightRangeInverse[POINT_LIGHT_COUNT];
+#endif
+
+#if (SPOT_LIGHT_COUNT > 0)
+uniform vec3 u_spotLightColor[SPOT_LIGHT_COUNT];
+uniform vec3 u_spotLightDirection[SPOT_LIGHT_COUNT];
+uniform float u_spotLightRangeInverse[SPOT_LIGHT_COUNT];
+uniform float u_spotLightInnerAngleCos[SPOT_LIGHT_COUNT];
+uniform float u_spotLightOuterAngleCos[SPOT_LIGHT_COUNT];
+#endif
+
 #if defined(SPECULAR)
-uniform float u_specularExponent;				// Specular exponent
+uniform float u_specularExponent;
 #endif
+
+#endif
+
 #if defined(MODULATE_COLOR)
-uniform vec4 u_modulateColor;               	// Modulation color
+uniform vec4 u_modulateColor;
 #endif
+
 #if defined(MODULATE_ALPHA)
-uniform float u_modulateAlpha;              	// Modulation alpha
+uniform float u_modulateAlpha;
 #endif
 
+///////////////////////////////////////////////////////////
+// Variables
+vec4 _baseColor;
+
+///////////////////////////////////////////////////////////
 // Varyings
-varying vec3 v_normalVector;                    // Normal vector in view space
-varying vec2 v_texCoord;                        // Texture coordinate
-#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.
+varying vec2 v_texCoord;
+
+#if defined(LIGHTMAP)
+varying vec2 v_texCoord1;
+#endif
+
+#if defined(LIGHTING)
+
+#if !defined(BUMPED)
+varying vec3 v_normalVector;
+#endif
+
+#if (defined(BUMPED) && (DIRECTIONAL_LIGHT_COUNT > 0))
+varying vec3 v_directionalLightDirection[DIRECTIONAL_LIGHT_COUNT];
+#endif
+
+#if (POINT_LIGHT_COUNT > 0)
+varying vec3 v_vertexToPointLightDirection[POINT_LIGHT_COUNT];
+#endif
+
+#if (SPOT_LIGHT_COUNT > 0)
+varying vec3 v_vertexToSpotLightDirection[SPOT_LIGHT_COUNT];
 #endif
+
 #if defined(SPECULAR)
-varying vec3 v_cameraDirection;                 // Camera direction
+varying vec3 v_cameraDirection; 
 #endif
 
-// Lighting 
 #include "lighting.frag"
-#if defined(POINT_LIGHT)
-#include "lighting-point.frag"
-#elif defined(SPOT_LIGHT)
-uniform float u_spotLightInnerAngleCos;			// The bright spot [0.0 - 1.0]
-uniform float u_spotLightOuterAngleCos;			// The soft outer part [0.0 - 1.0]
-uniform vec3 u_spotLightDirection;              // Direction of a spot light source
-#include "lighting-spot.frag"
-#else
-#include "lighting-directional.frag"
+
 #endif
 
 
 void main()
 {
-    // Sample the diffuse texture for base color
     _baseColor = texture2D(u_diffuseTexture, v_texCoord);
-
-    // Light the pixel
+ 
     gl_FragColor.a = _baseColor.a;
+
     #if defined(TEXTURE_DISCARD_ALPHA)
     if (gl_FragColor.a < 0.5)
         discard;
     #endif
+
+    #if defined(LIGHTING)
+
     gl_FragColor.rgb = getLitPixel();
-	
-	// Global color modulation
-	#if defined(MODULATE_COLOR)
-	gl_FragColor *= u_modulateColor;
+    #else
+    gl_FragColor.rgb = _baseColor.rgb;
+    #endif
+
+	#if defined(LIGHTMAP)
+	vec4 lightColor = texture2D(u_lightmapTexture, v_texCoord1);
+	gl_FragColor.rgb *= lightColor.rgb;
 	#endif
-	#if defined(MODULATE_ALPHA)
+
+    #if defined(MODULATE_COLOR)
+    gl_FragColor *= u_modulateColor;
+    #endif
+
+    #if defined(MODULATE_ALPHA)
     gl_FragColor.a *= u_modulateAlpha;
     #endif
 }

+ 123 - 52
gameplay/res/shaders/textured.vert

@@ -1,63 +1,116 @@
+#ifndef DIRECTIONAL_LIGHT_COUNT
+#define DIRECTIONAL_LIGHT_COUNT 0
+#endif
+#ifndef SPOT_LIGHT_COUNT
+#define SPOT_LIGHT_COUNT 0
+#endif
+#ifndef POINT_LIGHT_COUNT
+#define POINT_LIGHT_COUNT 0
+#endif
+#if (DIRECTIONAL_LIGHT_COUNT > 0) || (POINT_LIGHT_COUNT > 0) || (SPOT_LIGHT_COUNT > 0)
 #define LIGHTING
+#endif
+
+///////////////////////////////////////////////////////////
+// Atributes
+attribute vec4 a_position;
 
-// Attributes
-attribute vec4 a_position;									// Vertex position							(x, y, z, w)
-attribute vec3 a_normal;									// Vertex normal							(x, y, z)
-attribute vec2 a_texCoord;									// Vertex texture coordinate				(u, v)
 #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)
+attribute vec4 a_blendWeights;
+attribute vec4 a_blendIndices;
 #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(SPECULAR) || defined(SPOT_LIGHT) || defined(POINT_LIGHT)
-uniform mat4 u_worldViewMatrix;								// Matrix to tranform a position to view space
+attribute vec2 a_texCoord;
+
+#if defined(LIGHTMAP)
+attribute vec2 a_texCoord1; 
 #endif
+
+#if defined(LIGHTING)
+attribute vec3 a_normal;
+
+#if defined(BUMPED)
+attribute vec3 a_tangent;
+attribute vec3 a_binormal;
+#endif
+
+#endif
+
+///////////////////////////////////////////////////////////
+// Uniforms
+uniform mat4 u_worldViewProjectionMatrix;
 #if defined(SKINNING)
-uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];		// Array of 4x3 matrices
+uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];
+#endif
+
+#if defined(LIGHTING)
+uniform mat4 u_inverseTransposeWorldViewMatrix;
+
+#if defined(SPECULAR) || (POINT_LIGHT_COUNT > 0) || (SPOT_LIGHT_COUNT > 0)
+uniform mat4 u_worldViewMatrix;
 #endif
+
+#if (DIRECTIONAL_LIGHT_COUNT > 0)
+uniform vec3 u_directionalLightDirection[DIRECTIONAL_LIGHT_COUNT];
+#endif
+
+#if (POINT_LIGHT_COUNT > 0)
+uniform vec3 u_pointLightPosition[POINT_LIGHT_COUNT];
+#endif
+
+#if (SPOT_LIGHT_COUNT > 0) 
+uniform vec3 u_spotLightPosition[SPOT_LIGHT_COUNT];
+uniform vec3 u_spotLightDirection[SPOT_LIGHT_COUNT];
+#endif
+
 #if defined(SPECULAR)
-uniform vec3 u_cameraPosition;                 				// Position of the camera in view space
+uniform vec3 u_cameraPosition;
+#endif
+
 #endif
+
 #if defined(TEXTURE_REPEAT)
-uniform vec2 u_textureRepeat;								// Texture repeat for tiling
+uniform vec2 u_textureRepeat;
 #endif
+
 #if defined(TEXTURE_OFFSET)
-uniform vec2 u_textureOffset;								// Texture offset
-#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
-uniform vec3 u_spotLightDirection;                          // Direction of a spot light source
-#else
+uniform vec2 u_textureOffset;
 #endif
 
+///////////////////////////////////////////////////////////
 // Varyings
-varying vec3 v_normalVector;								// Normal vector in view space
-varying vec2 v_texCoord;									// Texture coordinate
+varying vec2 v_texCoord;
+
+#if defined(LIGHTMAP)
+varying vec2 v_texCoord1;
+#endif
+
+#if defined(LIGHTING)
+
+#if !defined(BUMPED)
+varying vec3 v_normalVector;
+#endif
+
+#if defined(BUMPED) && (DIRECTIONAL_LIGHT_COUNT > 0)
+varying vec3 v_directionalLightDirection[DIRECTIONAL_LIGHT_COUNT];
+#endif
+
+#if (POINT_LIGHT_COUNT > 0)
+varying vec3 v_vertexToPointLightDirection[POINT_LIGHT_COUNT];
+#endif
+
+#if (SPOT_LIGHT_COUNT > 0)
+varying vec3 v_vertexToSpotLightDirection[SPOT_LIGHT_COUNT];
+#endif
+
 #if defined(SPECULAR)
-varying vec3 v_cameraDirection;								// Direction the camera is looking at in tangent space
-#endif
-#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 "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
-
-// Lighting
-#include "lighting-spot.vert"
-#else
-#include "lighting-directional.vert"
+varying vec3 v_cameraDirection;
+#endif
+
+#include "lighting.vert"
+
 #endif
 
-// Skinning
 #if defined(SKINNING)
 #include "skinning.vert"
 #else
@@ -67,26 +120,44 @@ varying float v_spotLightAttenuation;						// Attenuation of spot light
 
 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 normalMatrix = mat3(u_inverseTransposeWorldViewMatrix[0].xyz, u_inverseTransposeWorldViewMatrix[1].xyz, u_inverseTransposeWorldViewMatrix[2].xyz);
-    v_normalVector = normalMatrix * normal;
-
-    // Apply light.
+    #if defined(LIGHTING)
+    vec3 normal = getNormal();
+    // 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 normalVector = normalize(inverseTransposeWorldViewMatrix * normal);
+    
+    #if defined(BUMPED)
+    
+    vec3 tangent = getTangent();
+    vec3 binormal = getBinormal();
+    vec3 tangentVector  = normalize(inverseTransposeWorldViewMatrix * tangent);
+    vec3 binormalVector = normalize(inverseTransposeWorldViewMatrix * binormal);
+    mat3 tangentSpaceTransformMatrix = mat3(tangentVector.x, binormalVector.x, normalVector.x, tangentVector.y, binormalVector.y, normalVector.y, tangentVector.z, binormalVector.z, normalVector.z);
+    applyLight(position, tangentSpaceTransformMatrix);
+    
+    #else
+    
+    v_normalVector = normalVector;
     applyLight(position);
-
-    // Texture transformation
+    
+    #endif
+    
+    #endif 
+    
     v_texCoord = a_texCoord;
+    
     #if defined(TEXTURE_REPEAT)
     v_texCoord *= u_textureRepeat;
     #endif
+    
     #if defined(TEXTURE_OFFSET)
     v_texCoord += u_textureOffset;
     #endif
+    
+    #if defined(LIGHTMAP)
+    v_texCoord1 = a_texCoord1;
+    #endif
 }

+ 21 - 0
gameplay/src/Effect.cpp

@@ -476,6 +476,27 @@ VertexAttribute Effect::getVertexAttribute(const char* name) const
 Uniform* Effect::getUniform(const char* name) const
 {
     std::map<std::string, Uniform*>::const_iterator itr = _uniforms.find(name);
+
+    if (itr == _uniforms.end())
+    {
+        GLint uniformLocation;
+        GL_ASSERT( uniformLocation = glGetUniformLocation(_program, name) );
+        if (uniformLocation > -1)
+        {
+            Uniform* uniform = new Uniform();
+            uniform->_effect = const_cast<Effect*>(this);
+            uniform->_name = name;
+            uniform->_location = uniformLocation;
+            uniform->_index = 0;
+            GLchar uniformName[128];
+            GLint uniformSize;
+            GL_ASSERT( glGetActiveUniform(_program, uniformLocation, 128, NULL, &uniformSize, &uniform->_type, uniformName) );
+            _uniforms[name] = uniform;
+
+            return uniform;
+        }
+    }
+
     return (itr == _uniforms.end() ? NULL : itr->second);
 }
 

+ 1 - 1
gameplay/src/Effect.h

@@ -244,7 +244,7 @@ private:
     GLuint _program;
     std::string _id;
     std::map<std::string, VertexAttribute> _vertexAttributes;
-    std::map<std::string, Uniform*> _uniforms;
+    mutable std::map<std::string, Uniform*> _uniforms;
     static Uniform _emptyUniform;
 };
 

+ 2 - 2
samples/browser/res/common/box.material

@@ -7,15 +7,15 @@ material box
             // shaders
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
-            defines = SPECULAR
+            defines = SPECULAR;DIRECTIONAL_LIGHT_COUNT 1
             
             // uniforms
             u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
             u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
             u_cameraPosition = CAMERA_WORLD_POSITION
             u_ambientColor = 0.2, 0.2, 0.2
-            u_lightColor = 0.75, 0.75, 0.75
             u_specularExponent = 50
+            u_directionalLightColor[0] = 0.75, 0.75, 0.75
             
             // samplers
             sampler u_diffuseTexture

+ 2 - 3
samples/browser/res/common/duck.material

@@ -7,16 +7,15 @@ material duck
             // shaders
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
-            defines = SPECULAR
+            defines = SPECULAR;DIRECTIONAL_LIGHT_COUNT 1
             
             // uniforms
             u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
             u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
             u_cameraPosition = CAMERA_WORLD_POSITION
             u_ambientColor = SCENE_AMBIENT_COLOR
-            u_lightColor = 1, 1, 1
-            u_lightDirection = 0, -1, 0
             u_specularExponent = 50
+            u_directionalLightColor[0] = 0.75, 0.75, 0.75
             
             // samplers
             sampler u_diffuseTexture

+ 3 - 3
samples/browser/res/common/grid.material

@@ -5,11 +5,11 @@ material grid
         pass 0
         {
             // shaders
-            vertexShader = res/shaders/colored-unlit.vert
-            fragmentShader = res/shaders/colored-unlit.frag
+            vertexShader = res/shaders/colored.vert
+            fragmentShader = res/shaders/colored.frag
 			defines = VERTEX_COLOR
 
-             // uniforms
+            // uniforms
             u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
             
             // render state

+ 26 - 26
samples/browser/res/common/light.material

@@ -7,8 +7,8 @@ material lighting
         pass 0
         {
             // shaders
-            vertexShader = res/shaders/textured-unlit.vert
-            fragmentShader = res/shaders/textured-unlit.frag
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
 			defines = TEXTURE_REPEAT
 			u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
  
@@ -39,7 +39,7 @@ material lighting
             // shaders
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
-			defines = TEXTURE_REPEAT
+			defines = TEXTURE_REPEAT;DIRECTIONAL_LIGHT_COUNT 1
 			u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
 			u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
             
@@ -70,7 +70,7 @@ material lighting
             // shaders
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
-			defines = TEXTURE_REPEAT; SPECULAR
+			defines = TEXTURE_REPEAT;SPECULAR;DIRECTIONAL_LIGHT_COUNT 1
 			u_worldViewMatrix = WORLD_VIEW_MATRIX
  			u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
 			u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
@@ -100,9 +100,9 @@ material lighting
         pass 0
         {
             // shaders
-            vertexShader = res/shaders/textured-bumped.vert
-            fragmentShader = res/shaders/textured-bumped.frag
-			defines = TEXTURE_REPEAT
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
+			defines = TEXTURE_REPEAT;BUMPED;DIRECTIONAL_LIGHT_COUNT 1
 			u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
 			u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
 
@@ -141,9 +141,9 @@ material lighting
         pass 0
         {
             // shaders
-            vertexShader = res/shaders/textured-bumped.vert
-            fragmentShader = res/shaders/textured-bumped.frag
-			defines = TEXTURE_REPEAT; SPECULAR
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
+			defines = TEXTURE_REPEAT;SPECULAR;BUMPED;DIRECTIONAL_LIGHT_COUNT 1
 			u_cameraPosition = CAMERA_VIEW_POSITION 
 			u_worldViewMatrix = WORLD_VIEW_MATRIX
 			u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
@@ -186,7 +186,7 @@ material lighting
             // shaders
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
-			defines = TEXTURE_REPEAT; SPOT_LIGHT
+			defines = TEXTURE_REPEAT;SPOT_LIGHT_COUNT 1
 			u_worldViewMatrix = WORLD_VIEW_MATRIX
 			u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
 			u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
@@ -218,7 +218,7 @@ material lighting
             // shaders
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
-			defines = TEXTURE_REPEAT; SPOT_LIGHT; SPECULAR
+			defines = TEXTURE_REPEAT;SPECULAR;SPOT_LIGHT_COUNT 1
 			u_worldViewMatrix = WORLD_VIEW_MATRIX
 			u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
 			u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
@@ -248,9 +248,9 @@ material lighting
         pass 0
         {
             // shaders
-            vertexShader = res/shaders/textured-bumped.vert
-            fragmentShader = res/shaders/textured-bumped.frag
-			defines = TEXTURE_REPEAT; SPOT_LIGHT
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
+			defines = TEXTURE_REPEAT;SPOT_LIGHT_COUNT 1
 			u_worldViewMatrix = WORLD_VIEW_MATRIX
 			u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
 			u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
@@ -290,9 +290,9 @@ material lighting
 	    pass 0
         {
             // shaders
-            vertexShader = res/shaders/textured-bumped.vert
-            fragmentShader = res/shaders/textured-bumped.frag
-			defines = TEXTURE_REPEAT; SPOT_LIGHT; SPECULAR
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
+			defines = TEXTURE_REPEAT;SPECULAR;BUMPED;SPOT_LIGHT_COUNT 1
 			u_cameraPosition = CAMERA_VIEW_POSITION 
 			u_worldViewMatrix = WORLD_VIEW_MATRIX
 			u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
@@ -335,7 +335,7 @@ material lighting
             // shaders
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
-			defines = TEXTURE_REPEAT; POINT_LIGHT
+			defines = TEXTURE_REPEAT;POINT_LIGHT_COUNT 1
 			u_worldViewMatrix = WORLD_VIEW_MATRIX
 			u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
 			u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
@@ -367,7 +367,7 @@ material lighting
             // shaders
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
-			defines = TEXTURE_REPEAT; POINT_LIGHT; SPECULAR
+			defines = TEXTURE_REPEAT;SPECULAR;POINT_LIGHT_COUNT 1
 			u_cameraPosition = CAMERA_VIEW_POSITION 
 			u_worldViewMatrix = WORLD_VIEW_MATRIX
 			u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
@@ -398,9 +398,9 @@ material lighting
         pass 0
         {
             // shaders
-            vertexShader = res/shaders/textured-bumped.vert
-            fragmentShader = res/shaders/textured-bumped.frag
-			defines = TEXTURE_REPEAT; POINT_LIGHT
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
+			defines = TEXTURE_REPEAT;BUMPED;POINT_LIGHT_COUNT 1
 			u_worldViewMatrix = WORLD_VIEW_MATRIX
 			u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
 			u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
@@ -440,9 +440,9 @@ material lighting
         pass 0
         {
             // shaders
-            vertexShader = res/shaders/textured-bumped.vert
-            fragmentShader = res/shaders/textured-bumped.frag
-			defines = TEXTURE_REPEAT; POINT_LIGHT; SPECULAR
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
+			defines = TEXTURE_REPEAT;SPECULAR;BUMPED;POINT_LIGHT_COUNT 1
 			u_cameraPosition = CAMERA_VIEW_POSITION 
 			u_worldViewMatrix = WORLD_VIEW_MATRIX
 			u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX

+ 1 - 1
samples/browser/res/common/physics.material

@@ -6,7 +6,7 @@ material colored
         {
             vertexShader = res/shaders/colored.vert
             fragmentShader = res/shaders/colored.frag
-
+            defines = DIRECTIONAL_LIGHT_COUNT 1
             u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
             u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
             

+ 7 - 3
samples/browser/res/common/sample.material

@@ -4,15 +4,19 @@ material colored
     {
         pass
         {
+            // shaders
             vertexShader = res/shaders/colored.vert
             fragmentShader = res/shaders/colored.frag
+            defines = DIRECTIONAL_LIGHT_COUNT 1
 
+            // uniforms
             u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
             u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
             u_ambientColor = SCENE_AMBIENT_COLOR
-            u_lightColor = 1, 1, 1
-            u_lightDirection = 0, -1, 0
-            
+            u_directionalLightColor[0] = 0.75, 0.75, 0.75
+            u_directionalLightDirection[0] = 0, 0, -1
+
+            // render state
             renderState
             {
                 cullFace = true

+ 3 - 2
samples/browser/res/common/terrain/shapes.material

@@ -3,8 +3,8 @@ material textured
     u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
     u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
     u_ambientColor = SCENE_AMBIENT_COLOR
-    u_lightColor = SCENE_LIGHT_COLOR
-    u_lightDirection = SCENE_LIGHT_DIRECTION
+    u_directionalLightColor[0] = 0.75, 0.75, 0.75
+    u_directionalLightDirection[0] = 0, -1, 0
 
     sampler u_diffuseTexture
     {
@@ -27,6 +27,7 @@ material textured
         {
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
+            defines = DIRECTIONAL_LIGHT_COUNT 1
         }
     }
 }

+ 2 - 2
samples/browser/res/common/terrain/sky.material

@@ -22,8 +22,8 @@ material sky
     {
         pass
         {
-            vertexShader = res/shaders/textured-unlit.vert
-            fragmentShader = res/shaders/textured-unlit.frag
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
         }
     }
 }

+ 0 - 316
samples/browser/res/design/box.dae

@@ -1,316 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
-  <asset>
-    <contributor>
-      <author>kcunney</author>
-      <authoring_tool>OpenCOLLADA2011 x64</authoring_tool>
-      <comments>
-			ColladaMaya export options: 
-			bakeTransforms=1;relativePaths=0;copyTextures=0;exportTriangles=1;exportCgfxFileReferences=0;
-			isSampling=0;curveConstrainSampling=0;removeStaticCurves=1;exportPolygonMeshes=1;exportLights=1;
-			exportCameras=1;exportJointsAndSkin=1;exportAnimations=1;exportInvisibleNodes=0;exportDefaultCameras=0;
-			exportTexCoords=1;exportNormals=1;exportNormalsPerVertex=1;exportVertexColors=1;exportVertexColorsPerVertex=1;
-			exportTexTangents=0;exportTangents=0;exportReferencedMaterials=0;exportMaterialsOnly=0;
-			exportXRefs=1;dereferenceXRefs=1;exportCameraAsLookat=0;cameraXFov=0;cameraYFov=1;doublePrecision=0
-		</comments>
-      <source_data>file:///C:/code/git/GamePlay/gameplay-samples/sample05-lua/res/box.mb</source_data>
-    </contributor>
-    <created>2012-07-13T18:33:54</created>
-    <modified>2012-07-13T18:33:54</modified>
-    <unit name="centimeter" meter="0.01"/>
-    <up_axis>Y_UP</up_axis>
-  </asset>
-  <library_lights>
-    <light id="directionalLightShape1-lib" name="directionalLightShape1">
-      <technique_common>
-        <directional>
-          <color>1 1 1</color>
-        </directional>
-      </technique_common>
-      <extra>
-        <technique profile="OpenCOLLADAMaya">
-          <originalMayaNodeId>directionalLightShape1</originalMayaNodeId>
-        </technique>
-      </extra>
-    </light>
-  </library_lights>
-  <library_cameras>
-    <camera id="cameraShape1" name="cameraShape1">
-      <optics>
-        <technique_common>
-          <perspective>
-            <yfov>45</yfov>
-            <aspect_ratio>1.706667</aspect_ratio>
-            <znear>1</znear>
-            <zfar>10000</zfar>
-          </perspective>
-        </technique_common>
-      </optics>
-      <extra>
-        <technique profile="OpenCOLLADAMaya">
-          <film_fit>1</film_fit>
-          <film_fit_offset>0</film_fit_offset>
-          <film_offsetX>0</film_offsetX>
-          <film_offsetY>0</film_offsetY>
-          <horizontal_aperture>4.095993</horizontal_aperture>
-          <lens_squeeze>1</lens_squeeze>
-          <originalMayaNodeId>cameraShape1</originalMayaNodeId>
-          <vertical_aperture>2.399995</vertical_aperture>
-        </technique>
-      </extra>
-    </camera>
-  </library_cameras>
-  <library_materials>
-    <material id="lambert1" name="lambert1">
-      <instance_effect url="#lambert1-fx"/>
-    </material>
-    <material id="blinn1" name="blinn1">
-      <instance_effect url="#blinn1-fx"/>
-    </material>
-  </library_materials>
-  <library_effects>
-    <effect id="blinn1-fx">
-      <profile_COMMON>
-        <newparam sid="file2-surface">
-          <surface type="2D">
-            <init_from>file2</init_from>
-          </surface>
-        </newparam>
-        <newparam sid="file2-sampler">
-          <sampler2D>
-            <source>file2-surface</source>
-          </sampler2D>
-        </newparam>
-        <technique sid="common">
-          <blinn>
-            <emission>
-              <color>0 0 0 1</color>
-            </emission>
-            <ambient>
-              <color>0 0 0 1</color>
-            </ambient>
-            <diffuse>
-              <texture texture="file2-sampler" texcoord="TEX0">
-                <extra>
-                  <technique profile="OpenCOLLADAMaya">
-                    <blend_mode>NONE</blend_mode>
-                    <coverageU>1</coverageU>
-                    <coverageV>1</coverageV>
-                    <fast>0</fast>
-                    <mirrorU>0</mirrorU>
-                    <mirrorV>0</mirrorV>
-                    <noiseU>0</noiseU>
-                    <noiseV>0</noiseV>
-                    <offsetU>0</offsetU>
-                    <offsetV>0</offsetV>
-                    <repeatU>1</repeatU>
-                    <repeatV>1</repeatV>
-                    <rotateFrame>0</rotateFrame>
-                    <rotateUV>0</rotateUV>
-                    <stagger>0</stagger>
-                    <translateFrameU>0</translateFrameU>
-                    <translateFrameV>0</translateFrameV>
-                    <wrapU>1</wrapU>
-                    <wrapV>1</wrapV>
-                  </technique>
-                </extra>
-              </texture>
-            </diffuse>
-            <specular>
-              <color>0 0 0 1</color>
-            </specular>
-            <shininess>
-              <float>0.3</float>
-            </shininess>
-            <reflective>
-              <color>0 0 0 1</color>
-            </reflective>
-            <reflectivity>
-              <float>0.5</float>
-            </reflectivity>
-            <transparent opaque="RGB_ZERO">
-              <color>0 0 0 1</color>
-            </transparent>
-            <transparency>
-              <float>1</float>
-            </transparency>
-            <index_of_refraction>
-              <float>1</float>
-            </index_of_refraction>
-          </blinn>
-        </technique>
-      </profile_COMMON>
-    </effect>
-    <effect id="lambert1-fx">
-      <profile_COMMON>
-        <newparam sid="file3-surface">
-          <surface type="2D">
-            <init_from>file3</init_from>
-          </surface>
-        </newparam>
-        <newparam sid="file3-sampler">
-          <sampler2D>
-            <source>file3-surface</source>
-          </sampler2D>
-        </newparam>
-        <technique sid="common">
-          <lambert>
-            <emission>
-              <color>0 0 0 1</color>
-            </emission>
-            <ambient>
-              <color>0 0 0 1</color>
-            </ambient>
-            <diffuse>
-              <texture texture="file3-sampler" texcoord="TEX0">
-                <extra>
-                  <technique profile="OpenCOLLADAMaya">
-                    <blend_mode>NONE</blend_mode>
-                    <coverageU>1</coverageU>
-                    <coverageV>1</coverageV>
-                    <fast>0</fast>
-                    <mirrorU>0</mirrorU>
-                    <mirrorV>0</mirrorV>
-                    <noiseU>0</noiseU>
-                    <noiseV>0</noiseV>
-                    <offsetU>0</offsetU>
-                    <offsetV>0</offsetV>
-                    <repeatU>1</repeatU>
-                    <repeatV>1</repeatV>
-                    <rotateFrame>0</rotateFrame>
-                    <rotateUV>0</rotateUV>
-                    <stagger>0</stagger>
-                    <translateFrameU>0</translateFrameU>
-                    <translateFrameV>0</translateFrameV>
-                    <wrapU>1</wrapU>
-                    <wrapV>1</wrapV>
-                  </technique>
-                </extra>
-              </texture>
-            </diffuse>
-            <transparent opaque="RGB_ZERO">
-              <color>0 0 0 1</color>
-            </transparent>
-            <transparency>
-              <float>1</float>
-            </transparency>
-          </lambert>
-        </technique>
-      </profile_COMMON>
-    </effect>
-  </library_effects>
-  <library_images>
-    <image id="file3" name="file3">
-      <init_from>file:///C:/code/git/GamePlay/gameplay-samples/sample05-lua/res/box-diffuse.png</init_from>
-      <extra>
-        <technique profile="OpenCOLLADAMaya">
-          <dgnode_type>kFile</dgnode_type>
-          <image_sequence>0</image_sequence>
-          <originalMayaNodeId>file3</originalMayaNodeId>
-        </technique>
-      </extra>
-    </image>
-    <image id="file2" name="file2">
-      <init_from>file:///C:/git/gameplay-public/gameplay-samples/sample00-mesh/res/duck-diffuse.png</init_from>
-      <extra>
-        <technique profile="OpenCOLLADAMaya">
-          <dgnode_type>kFile</dgnode_type>
-          <image_sequence>0</image_sequence>
-          <originalMayaNodeId>file2</originalMayaNodeId>
-        </technique>
-      </extra>
-    </image>
-  </library_images>
-  <library_geometries>
-    <geometry id="boxShape" name="boxShape">
-      <mesh>
-        <source id="boxShape-positions" name="boxShape-positions">
-          <float_array id="boxShape-positions-array" count="24">-0.5 -0.5 0.5 0.5 -0.5 0.5 -0.5 0.5 0.5 0.5 0.5 0.5 -0.5 0.5 -0.5 0.5 0.5 -0.5 -0.5 -0.5 -0.5 0.5 -0.5 -0.5</float_array>
-          <technique_common>
-            <accessor source="#boxShape-positions-array" count="8" stride="3">
-              <param name="X" type="float"/>
-              <param name="Y" type="float"/>
-              <param name="Z" type="float"/>
-            </accessor>
-          </technique_common>
-        </source>
-        <source id="boxShape-normals" name="boxShape-normals">
-          <float_array id="boxShape-normals-array" count="72">0 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 -1 0 0 -1 0 0 -1 0 0 -1 0 1 0 0 1 0 0 1 0 0 1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0</float_array>
-          <technique_common>
-            <accessor source="#boxShape-normals-array" count="24" stride="3">
-              <param name="X" type="float"/>
-              <param name="Y" type="float"/>
-              <param name="Z" type="float"/>
-            </accessor>
-          </technique_common>
-        </source>
-        <source id="boxShape-map1" name="boxShape-map1">
-          <float_array id="boxShape-map1-array" count="48">0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1</float_array>
-          <technique_common>
-            <accessor source="#boxShape-map1-array" count="24" stride="2">
-              <param name="S" type="float"/>
-              <param name="T" type="float"/>
-            </accessor>
-          </technique_common>
-        </source>
-        <vertices id="boxShape-vertices" name="boxShape-vertices">
-          <input semantic="POSITION" source="#boxShape-positions"/>
-        </vertices>
-        <triangles material="initialShadingGroup" count="12">
-          <input semantic="VERTEX" source="#boxShape-vertices" offset="0"/>
-          <input semantic="NORMAL" source="#boxShape-normals" offset="1"/>
-          <input semantic="TEXCOORD" source="#boxShape-map1" offset="2" set="0"/>
-          <p>0 0 0 1 1 1 2 3 2 2 3 2 1 1 1 3 2 3 2 4 4 3 5 5 4 7 6 4 7 6 3 5 5 5 6 7 4 8 8 5 9 9 6 11 10 6 11 10 5 9 9 7 10 11 6 12 12 7 13 13 0 15 14 0 15 14 7 13 13 1 14 15 1 16 16 7 17 17 3 19 18 3 19 18 7 17 17 5 18 19 6 20 20 0 21 21 4 23 22 4 23 22 0 21 21 2 22 23</p>
-        </triangles>
-      </mesh>
-      <extra>
-        <technique profile="OpenCOLLADAMaya">
-          <originalMayaNodeId>boxShape</originalMayaNodeId>
-          <double_sided>1</double_sided>
-        </technique>
-      </extra>
-    </geometry>
-  </library_geometries>
-  <library_visual_scenes>
-    <visual_scene id="VisualSceneNode" name="box">
-      <node id="camera1" name="camera1" type="NODE">
-        <matrix sid="transform">1 0 0 0 0 0.9807853 0.1950903 1 0 -0.1950903 0.9807853 5 0 0 0 1</matrix>
-        <instance_camera url="#cameraShape1"/>
-        <extra>
-          <technique profile="OpenCOLLADAMaya">
-            <originalMayaNodeId>camera1</originalMayaNodeId>
-          </technique>
-        </extra>
-      </node>
-      <node id="directionalLight1" name="directionalLight1" type="NODE">
-        <matrix sid="transform">0.9998477 -0.01745241 0 0 0.01745241 0.9998477 0 0 0 0 1 0 0 0 0 1</matrix>
-        <instance_light url="#directionalLightShape1-lib"/>
-        <extra>
-          <technique profile="OpenCOLLADAMaya">
-            <originalMayaNodeId>directionalLight1</originalMayaNodeId>
-          </technique>
-        </extra>
-      </node>
-      <node id="box" name="box" type="NODE">
-        <matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
-        <instance_geometry url="#boxShape">
-          <bind_material>
-            <technique_common>
-              <instance_material symbol="initialShadingGroup" target="#lambert1">
-                <bind_vertex_input semantic="TEX0" input_semantic="TEXCOORD" input_set="0"/>
-              </instance_material>
-            </technique_common>
-          </bind_material>
-        </instance_geometry>
-        <extra>
-          <technique profile="OpenCOLLADAMaya">
-            <originalMayaNodeId>box</originalMayaNodeId>
-          </technique>
-        </extra>
-      </node>
-    </visual_scene>
-  </library_visual_scenes>
-  <scene>
-    <instance_visual_scene url="#VisualSceneNode"/>
-  </scene>
-</COLLADA>

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 183
samples/browser/res/design/duck.dae


+ 4 - 2
samples/browser/res/design/physics-encode.bat

@@ -1,7 +1,9 @@
-@echo off
+@echo off
+
 
 REM Make collada file.
 
-"..\..\..\bin\win32\gameplay-encoder.exe" physics.dae ../common/physics.gpb
+"..\..\..\bin\win32\gameplay-encoder.exe" physics.fbx ../common/physics.gpb
+
 
 pause

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 1435
samples/browser/res/design/physics.dae


+ 5 - 3
samples/browser/res/design/scene-encode.bat

@@ -1,7 +1,9 @@
-@echo off
+@echo off
 
-REM Make collada file.
 
-"..\..\..\bin\windows\gameplay-encoder.exe" scene.dae ../common/scene.gpb
+REM Make FBX file.
 
+"..\..\..\bin\windows\gameplay-encoder.exe" scene.fbx ../common/scene.gpb
+
+
 pause

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 654
samples/browser/res/design/scene.dae


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 750
samples/browser/res/design/sphere.dae


+ 79 - 0
samples/browser/sample-browser.vcxproj

@@ -639,6 +639,62 @@
       <SubType>Designer</SubType>
     </None>
     <None Include="icon.png" />
+    <None Include="res\common\arial-distance.gpb" />
+    <None Include="res\common\arial.gpb" />
+    <None Include="res\common\badaboom.gpb" />
+    <None Include="res\common\box.gpb" />
+    <None Include="res\common\box.material" />
+    <None Include="res\common\camera.lua" />
+    <None Include="res\common\constraints.gpb" />
+    <None Include="res\common\constraints.physics" />
+    <None Include="res\common\constraints.scene" />
+    <None Include="res\common\custom.gpb" />
+    <None Include="res\common\default.theme" />
+    <None Include="res\common\duck.gpb" />
+    <None Include="res\common\duck.material" />
+    <None Include="res\common\fishfingers.gpb" />
+    <None Include="res\common\forms\formBasicControls.form" />
+    <None Include="res\common\forms\formFlowLayout.form" />
+    <None Include="res\common\forms\formScrolling.form" />
+    <None Include="res\common\forms\formSelect.form" />
+    <None Include="res\common\forms\formVerticalLayout.form" />
+    <None Include="res\common\forms\formZOrder.form" />
+    <None Include="res\common\gamepad.form" />
+    <None Include="res\common\gamepad.theme" />
+    <None Include="res\common\grid.material" />
+    <None Include="res\common\inputs.form" />
+    <None Include="res\common\light.form" />
+    <None Include="res\common\light.material" />
+    <None Include="res\common\lightBrickWall.gpb" />
+    <None Include="res\common\neuropol.gpb" />
+    <None Include="res\common\physics.form" />
+    <None Include="res\common\physics.gpb" />
+    <None Include="res\common\physics.material" />
+    <None Include="res\common\physics.physics" />
+    <None Include="res\common\physics.scene" />
+    <None Include="res\common\postprocess\postprocess.material" />
+    <None Include="res\common\postprocess\postprocess.vert" />
+    <None Include="res\common\postprocess\postprocess_gaussianblur.frag" />
+    <None Include="res\common\postprocess\postprocess_grayscale.frag" />
+    <None Include="res\common\postprocess\postprocess_oldfilm.frag" />
+    <None Include="res\common\postprocess\postprocess_passthrough.frag" />
+    <None Include="res\common\postprocess\postprocess_pixelate.frag" />
+    <None Include="res\common\postprocess\postprocess_sepia.frag" />
+    <None Include="res\common\postprocess\postprocess_sobeledge.frag" />
+    <None Include="res\common\sample.gpb" />
+    <None Include="res\common\sample.material" />
+    <None Include="res\common\sample.scene" />
+    <None Include="res\common\sphere.gpb" />
+    <None Include="res\common\terrain\encode.bat" />
+    <None Include="res\common\terrain\heightmap.r16" />
+    <None Include="res\common\terrain\sample.scene" />
+    <None Include="res\common\terrain\sample.terrain" />
+    <None Include="res\common\terrain\shapes.material" />
+    <None Include="res\common\terrain\sky.fbx" />
+    <None Include="res\common\terrain\sky.gpb" />
+    <None Include="res\common\terrain\sky.material" />
+    <None Include="res\common\terrain\terrain.form" />
+    <None Include="res\common\text.form" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="src\Audio3DSample.cpp" />
@@ -690,6 +746,29 @@
     <ClInclude Include="src\TextureSample.h" />
     <ClInclude Include="src\MeshBatchSample.h" />
   </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\common\terrain\dirt.dds" />
+    <Image Include="res\common\terrain\grass.dds" />
+    <Image Include="res\common\terrain\normalmap.dds" />
+    <Image Include="res\common\terrain\rock.dds" />
+    <Image Include="res\common\terrain\sky.dds" />
+    <Image Include="res\png\box-diffuse.png" />
+    <Image Include="res\png\brick.png" />
+    <Image Include="res\png\brickn.png" />
+    <Image Include="res\png\color-wheel.png" />
+    <Image Include="res\png\crate.png" />
+    <Image Include="res\png\default-theme.png" />
+    <Image Include="res\png\dirt.png" />
+    <Image Include="res\png\duck-diffuse.png" />
+    <Image Include="res\png\gamepad.png" />
+    <Image Include="res\png\grass.png" />
+    <Image Include="res\png\light-directional.png" />
+    <Image Include="res\png\light-point.png" />
+    <Image Include="res\png\light-spot.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <Media Include="res\common\footsteps.wav" />
+  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>

+ 247 - 0
samples/browser/sample-browser.vcxproj.filters

@@ -6,11 +6,197 @@
     <Filter Include="src\common">
       <UniqueIdentifier>{c35d9ec0-a966-49e8-af48-14cbcb2d6818}</UniqueIdentifier>
     </Filter>
+    <Filter Include="res">
+      <UniqueIdentifier>{b0da65f8-9ff6-4813-9af3-3bb222d54acf}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="res\common">
+      <UniqueIdentifier>{6cb7d9bf-0b2d-44df-a48d-d8150c67f38c}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="res\png">
+      <UniqueIdentifier>{6a436bab-00f5-4c87-9e53-b360dba474c2}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="res\common\forms">
+      <UniqueIdentifier>{a3201c29-9b57-40a3-839e-e5b8ad1fe53d}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="res\common\terrain">
+      <UniqueIdentifier>{7486d723-ca70-4cf7-a8fb-034679fad89f}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="res\common\postprocess">
+      <UniqueIdentifier>{97b23ce2-184f-46f4-a2fc-11aca4473fb3}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   <ItemGroup>
     <None Include="game.config" />
     <None Include="icon.png" />
     <None Include="bar-descriptor.xml" />
+    <None Include="res\common\forms\formBasicControls.form">
+      <Filter>res\common\forms</Filter>
+    </None>
+    <None Include="res\common\forms\formFlowLayout.form">
+      <Filter>res\common\forms</Filter>
+    </None>
+    <None Include="res\common\forms\formScrolling.form">
+      <Filter>res\common\forms</Filter>
+    </None>
+    <None Include="res\common\forms\formSelect.form">
+      <Filter>res\common\forms</Filter>
+    </None>
+    <None Include="res\common\forms\formVerticalLayout.form">
+      <Filter>res\common\forms</Filter>
+    </None>
+    <None Include="res\common\forms\formZOrder.form">
+      <Filter>res\common\forms</Filter>
+    </None>
+    <None Include="res\common\postprocess\postprocess.material">
+      <Filter>res\common\postprocess</Filter>
+    </None>
+    <None Include="res\common\postprocess\postprocess.vert">
+      <Filter>res\common\postprocess</Filter>
+    </None>
+    <None Include="res\common\postprocess\postprocess_gaussianblur.frag">
+      <Filter>res\common\postprocess</Filter>
+    </None>
+    <None Include="res\common\postprocess\postprocess_grayscale.frag">
+      <Filter>res\common\postprocess</Filter>
+    </None>
+    <None Include="res\common\postprocess\postprocess_oldfilm.frag">
+      <Filter>res\common\postprocess</Filter>
+    </None>
+    <None Include="res\common\postprocess\postprocess_passthrough.frag">
+      <Filter>res\common\postprocess</Filter>
+    </None>
+    <None Include="res\common\postprocess\postprocess_pixelate.frag">
+      <Filter>res\common\postprocess</Filter>
+    </None>
+    <None Include="res\common\postprocess\postprocess_sepia.frag">
+      <Filter>res\common\postprocess</Filter>
+    </None>
+    <None Include="res\common\postprocess\postprocess_sobeledge.frag">
+      <Filter>res\common\postprocess</Filter>
+    </None>
+    <None Include="res\common\terrain\encode.bat">
+      <Filter>res\common\terrain</Filter>
+    </None>
+    <None Include="res\common\terrain\heightmap.r16">
+      <Filter>res\common\terrain</Filter>
+    </None>
+    <None Include="res\common\terrain\sample.scene">
+      <Filter>res\common\terrain</Filter>
+    </None>
+    <None Include="res\common\terrain\sample.terrain">
+      <Filter>res\common\terrain</Filter>
+    </None>
+    <None Include="res\common\terrain\shapes.material">
+      <Filter>res\common\terrain</Filter>
+    </None>
+    <None Include="res\common\terrain\sky.fbx">
+      <Filter>res\common\terrain</Filter>
+    </None>
+    <None Include="res\common\terrain\sky.gpb">
+      <Filter>res\common\terrain</Filter>
+    </None>
+    <None Include="res\common\terrain\sky.material">
+      <Filter>res\common\terrain</Filter>
+    </None>
+    <None Include="res\common\terrain\terrain.form">
+      <Filter>res\common\terrain</Filter>
+    </None>
+    <None Include="res\common\arial.gpb">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\arial-distance.gpb">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\badaboom.gpb">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\box.gpb">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\box.material">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\camera.lua">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\constraints.gpb">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\constraints.physics">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\constraints.scene">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\custom.gpb">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\default.theme">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\duck.gpb">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\duck.material">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\fishfingers.gpb">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\gamepad.form">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\gamepad.theme">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\grid.material">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\inputs.form">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\light.form">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\light.material">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\lightBrickWall.gpb">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\neuropol.gpb">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\physics.form">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\physics.gpb">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\physics.material">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\physics.physics">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\physics.scene">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\sample.gpb">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\sample.material">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\sample.scene">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\sphere.gpb">
+      <Filter>res\common</Filter>
+    </None>
+    <None Include="res\common\text.form">
+      <Filter>res\common</Filter>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="src\MeshPrimitiveSample.h">
@@ -154,4 +340,65 @@
       <Filter>src</Filter>
     </ClCompile>
   </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\common\terrain\dirt.dds">
+      <Filter>res\common\terrain</Filter>
+    </Image>
+    <Image Include="res\common\terrain\grass.dds">
+      <Filter>res\common\terrain</Filter>
+    </Image>
+    <Image Include="res\common\terrain\normalmap.dds">
+      <Filter>res\common\terrain</Filter>
+    </Image>
+    <Image Include="res\common\terrain\rock.dds">
+      <Filter>res\common\terrain</Filter>
+    </Image>
+    <Image Include="res\common\terrain\sky.dds">
+      <Filter>res\common\terrain</Filter>
+    </Image>
+    <Image Include="res\png\box-diffuse.png">
+      <Filter>res\png</Filter>
+    </Image>
+    <Image Include="res\png\brick.png">
+      <Filter>res\png</Filter>
+    </Image>
+    <Image Include="res\png\brickn.png">
+      <Filter>res\png</Filter>
+    </Image>
+    <Image Include="res\png\color-wheel.png">
+      <Filter>res\png</Filter>
+    </Image>
+    <Image Include="res\png\crate.png">
+      <Filter>res\png</Filter>
+    </Image>
+    <Image Include="res\png\default-theme.png">
+      <Filter>res\png</Filter>
+    </Image>
+    <Image Include="res\png\dirt.png">
+      <Filter>res\png</Filter>
+    </Image>
+    <Image Include="res\png\duck-diffuse.png">
+      <Filter>res\png</Filter>
+    </Image>
+    <Image Include="res\png\gamepad.png">
+      <Filter>res\png</Filter>
+    </Image>
+    <Image Include="res\png\grass.png">
+      <Filter>res\png</Filter>
+    </Image>
+    <Image Include="res\png\light-directional.png">
+      <Filter>res\png</Filter>
+    </Image>
+    <Image Include="res\png\light-point.png">
+      <Filter>res\png</Filter>
+    </Image>
+    <Image Include="res\png\light-spot.png">
+      <Filter>res\png</Filter>
+    </Image>
+  </ItemGroup>
+  <ItemGroup>
+    <Media Include="res\common\footsteps.wav">
+      <Filter>res\common</Filter>
+    </Media>
+  </ItemGroup>
 </Project>

+ 7 - 6
samples/browser/src/Audio3DSample.cpp

@@ -36,8 +36,9 @@ void Audio3DSample::initialize()
     Node* boxNode = _scene->findNode("box");
     Model* boxModel = boxNode->getModel();
     Material* boxMaterial = boxModel->setMaterial("res/common/box.material");
-    boxMaterial->getParameter("u_lightColor")->setValue(light->getColor());
-    boxMaterial->getParameter("u_lightDirection")->setValue(lightNode->getForwardVectorView());
+
+    boxMaterial->getParameter("u_directionalLightColor[0]")->setValue(light->getColor());
+    boxMaterial->getParameter("u_directionalLightDirection[0]")->setValue(lightNode->getForwardVectorView());
 
     // Remove the cube from the scene but keep a reference to it.
     _cubeNode = boxNode;
@@ -315,13 +316,13 @@ void Audio3DSample::drawDebugText(int x, int y)
     static const int V_SPACE = 16;
     AudioListener* audioListener = AudioListener::getInstance();
     drawVector3("Position", audioListener->getPosition(), x, y);
-    drawVector3("Forward", audioListener->getOrientationForward(), x, y+=V_SPACE);
-    drawVector3("Orientation", audioListener->getOrientationUp(), x, y+=V_SPACE);
-    drawVector3("Velocity", audioListener->getVelocity(), x, y+=V_SPACE);
+    drawVector3("Forward", audioListener->getOrientationForward(), x, y+=_font->getSize());
+    drawVector3("Orientation", audioListener->getOrientationUp(), x, y+=_font->getSize());
+    drawVector3("Velocity", audioListener->getVelocity(), x, y+=_font->getSize());
     _font->finish();
 }
 
-void Audio3DSample::drawVector3(const char* str, const Vector3 vector, int x, int y)
+void Audio3DSample::drawVector3(const char* str, const Vector3& vector, int x, int y)
 {
     char buffer[255];
     sprintf(buffer, "%s: (%f, %f, %f)", str, vector.x, vector.y, vector.z);

+ 1 - 1
samples/browser/src/Audio3DSample.h

@@ -41,7 +41,7 @@ private:
 
     void drawDebugText(int x = 0, int y = 0);
 
-    void drawVector3(const char* str, const Vector3 vector, int x, int y);
+    void drawVector3(const char* str, const Vector3& vector, int x, int y);
 
     void loadGrid(Scene* scene);
 

+ 2 - 2
samples/browser/src/BillboardSample.cpp

@@ -284,7 +284,7 @@ void BillboardSample::loadGround()
 	node->setModel(_ground);
     _scene->addNode(node);
 	node->rotateX(MATH_DEG_TO_RAD(90));
-	Effect* effect = Effect::createFromFile("res/shaders/textured-unlit.vert", "res/shaders/textured-unlit.frag", "TEXTURE_REPEAT");    
+	Effect* effect = Effect::createFromFile("res/shaders/textured.vert", "res/shaders/textured.frag", "TEXTURE_REPEAT");    
 	Material* material = Material::create(effect); 
 	material->getStateBlock()->setDepthTest(true);
 	material->getStateBlock()->setBlend(false);
@@ -303,7 +303,7 @@ void BillboardSample::loadBillboards()
 	Mesh* mesh = Mesh::createQuad(-(BILLBOARD_WIDTH / 2.0f), -(BILLBOARD_HEIGHT / 2.0f), BILLBOARD_WIDTH, BILLBOARD_HEIGHT);
 	mesh->setBoundingSphere(BoundingSphere(Vector3::zero(), BILLBOARD_HEIGHT));
 
-    Effect* effect = Effect::createFromFile("res/shaders/textured-unlit.vert", "res/shaders/textured-unlit.frag", "TEXTURE_DISCARD_ALPHA");
+    Effect* effect = Effect::createFromFile("res/shaders/textured.vert", "res/shaders/textured.frag", "TEXTURE_DISCARD_ALPHA");
 
 	// Create the model and node and bind the material
     for ( unsigned int i = 0; i < BILLBOARD_COUNT; i++ ) 

+ 5 - 6
samples/browser/src/CreateSceneSample.cpp

@@ -102,20 +102,19 @@ void CreateSceneSample::initialize()
     SAFE_RELEASE(cubeMesh);
 
     // Create the material for the cube model and assign it to the first mesh part.
-    Material* material = cubeModel->setMaterial("res/shaders/textured.vert", "res/shaders/textured.frag", 0);
+    Material* material = cubeModel->setMaterial("res/shaders/textured.vert", "res/shaders/textured.frag", "DIRECTIONAL_LIGHT_COUNT 1");
 
     // These parameters are normally set in a .material file but this example sets them programmatically.
     // Bind the uniform "u_worldViewProjectionMatrix" to use the WORLD_VIEW_PROJECTION_MATRIX from the scene's active camera and the node that the model belongs to.
     material->setParameterAutoBinding("u_worldViewProjectionMatrix", "WORLD_VIEW_PROJECTION_MATRIX");
     material->setParameterAutoBinding("u_inverseTransposeWorldViewMatrix", "INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX");
-
-    // Bind the light's direction to the material.
-    material->getParameter("u_lightDirection")->bindValue(lightNode, &Node::getForwardVectorView);
-    // Bind the light's color to the material.
-    material->getParameter("u_lightColor")->setValue(lightNode->getLight()->getColor());
     // Set the ambient color of the material.
     material->getParameter("u_ambientColor")->setValue(Vector3(1, 1, 1));
 
+    // Bind the light's color and direction to the material.
+    material->getParameter("u_directionalLightColor[0]")->setValue(lightNode->getLight()->getColor());
+    material->getParameter("u_directionalLightDirection[0]")->bindValue(lightNode, &Node::getForwardVectorView);
+
     // Load the texture from file.
     Texture::Sampler* sampler = material->getParameter("u_diffuseTexture")->setValue("res/png/box-diffuse.png", true);
     sampler->setFilterMode(Texture::LINEAR_MIPMAP_LINEAR, Texture::LINEAR);

+ 29 - 29
samples/browser/src/LightSample.cpp

@@ -366,33 +366,33 @@ void LightSample::controlEvent(Control* control, EventType evt)
 
 void LightSample::initializeDirectionalTechnique(const char* technique)
 {
-    _lighting->getTechnique(technique)->getParameter("u_lightDirection")->bindValue(_directionalLightNode, &Node::getForwardVectorWorld); 
-	_lighting->getTechnique(technique)->getParameter("u_lightColor")->setValue(Vector3(_redSlider->getValue(), _greenSlider->getValue(), _blueSlider->getValue()));
 	_lighting->getTechnique(technique)->getParameter("u_ambientColor")->setValue(Vector3(0.0f, 0.0f, 0.0f));
-}
+    _lighting->getTechnique(technique)->getParameter("u_directionalLightColor[0]")->setValue(Vector3(_redSlider->getValue(), _greenSlider->getValue(), _blueSlider->getValue()));
+    _lighting->getTechnique(technique)->getParameter("u_directionalLightDirection[0]")->bindValue(_directionalLightNode, &Node::getForwardVectorWorld); 
+}	
 
 void LightSample::initializeSpotTechnique(const char* technique)
 {
-	_lighting->getTechnique(technique)->getParameter("u_spotLightInnerAngleCos")->setValue(_spotLightNode->getLight()->getInnerAngleCos());
-	_lighting->getTechnique(technique)->getParameter("u_spotLightOuterAngleCos")->setValue(_spotLightNode->getLight()->getOuterAngleCos());
-	_lighting->getTechnique(technique)->getParameter("u_spotLightRangeInverse")->setValue(_spotLightNode->getLight()->getRangeInverse());
-	_lighting->getTechnique(technique)->getParameter("u_spotLightDirection")->bindValue(_spotLightNode, &Node::getForwardVectorView);
-	_lighting->getTechnique(technique)->getParameter("u_spotLightPosition")->bindValue(_spotLightNode, &Node::getTranslationView);
-	_lighting->getTechnique(technique)->getParameter("u_ambientColor")->setValue(Vector3(0.0f, 0.0f, 0.0f));
-	_lighting->getTechnique(technique)->getParameter("u_lightColor")->setValue(Vector3(_redSlider->getValue(), _greenSlider->getValue(), _blueSlider->getValue()));
+    _lighting->getTechnique(technique)->getParameter("u_ambientColor")->setValue(Vector3(0.0f, 0.0f, 0.0f));
+    _lighting->getTechnique(technique)->getParameter("u_spotLightColor[0]")->setValue(Vector3(_redSlider->getValue(), _greenSlider->getValue(), _blueSlider->getValue()));
+    _lighting->getTechnique(technique)->getParameter("u_spotLightInnerAngleCos[0]")->setValue(_spotLightNode->getLight()->getInnerAngleCos());
+	_lighting->getTechnique(technique)->getParameter("u_spotLightOuterAngleCos[0]")->setValue(_spotLightNode->getLight()->getOuterAngleCos());
+	_lighting->getTechnique(technique)->getParameter("u_spotLightRangeInverse[0]")->setValue(_spotLightNode->getLight()->getRangeInverse());
+	_lighting->getTechnique(technique)->getParameter("u_spotLightDirection[0]")->bindValue(_spotLightNode, &Node::getForwardVectorView);
+	_lighting->getTechnique(technique)->getParameter("u_spotLightPosition[0]")->bindValue(_spotLightNode, &Node::getTranslationView);
 }
 
 void LightSample::initializePointTechnique(const char* technique)
 {
-	_lighting->getTechnique(technique)->getParameter("u_pointLightPosition")->bindValue(_pointLightNode, &Node::getTranslationView);
-	_lighting->getTechnique(technique)->getParameter("u_pointLightRangeInverse")->setValue(_pointLightNode->getLight()->getRangeInverse());
-	_lighting->getTechnique(technique)->getParameter("u_ambientColor")->setValue(Vector3(0.0f, 0.0f, 0.0f));
-	_lighting->getTechnique(technique)->getParameter("u_lightColor")->setValue(Vector3(_redSlider->getValue(), _greenSlider->getValue(), _blueSlider->getValue()));
+    _lighting->getTechnique(technique)->getParameter("u_ambientColor")->setValue(Vector3(0.0f, 0.0f, 0.0f));
+    _lighting->getTechnique(technique)->getParameter("u_pointLightColor[0]")->setValue(Vector3(_redSlider->getValue(), _greenSlider->getValue(), _blueSlider->getValue()));
+	_lighting->getTechnique(technique)->getParameter("u_pointLightPosition[0]")->bindValue(_pointLightNode, &Node::getTranslationView);
+	_lighting->getTechnique(technique)->getParameter("u_pointLightRangeInverse[0]")->setValue(_pointLightNode->getLight()->getRangeInverse());
 }
 
 void LightSample::setUnlitMaterialTexture(Model* model, const char* texturePath, bool mipmap)
 {
-    Material* material = model->setMaterial("res/shaders/textured-unlit.vert", "res/shaders/textured-unlit.frag");
+    Material* material = model->setMaterial("res/shaders/textured.vert", "res/shaders/textured.frag", "DIRECTIONAL_LIGHT_COUNT 1");
     material->setParameterAutoBinding("u_worldViewProjectionMatrix", "WORLD_VIEW_PROJECTION_MATRIX");
 
     // Load the texture from file.
@@ -416,20 +416,20 @@ void LightSample::setUnlitMaterialTexture(Model* model, const char* texturePath,
 
 void LightSample::setColorValue(const Vector3& value)
 {
-	_lighting->getTechnique(("directional"))->getParameter("u_lightColor")->setValue(value);
-	_lighting->getTechnique(("directionalSpecular"))->getParameter("u_lightColor")->setValue(value);
-	_lighting->getTechnique(("directionalBumped"))->getParameter("u_lightColor")->setValue(value);
-	_lighting->getTechnique(("directionalSpecularBumped"))->getParameter("u_lightColor")->setValue(value);
-
-	_lighting->getTechnique(("spot"))->getParameter("u_lightColor")->setValue(value);
-	_lighting->getTechnique(("spotSpecular"))->getParameter("u_lightColor")->setValue(value);
-	_lighting->getTechnique(("spotBumped"))->getParameter("u_lightColor")->setValue(value);
-	_lighting->getTechnique(("spotSpecularBumped"))->getParameter("u_lightColor")->setValue(value);
-
-	_lighting->getTechnique(("point"))->getParameter("u_lightColor")->setValue(value);
-	_lighting->getTechnique(("pointSpecular"))->getParameter("u_lightColor")->setValue(value);
-	_lighting->getTechnique(("pointBumped"))->getParameter("u_lightColor")->setValue(value);
-	_lighting->getTechnique(("pointSpecularBumped"))->getParameter("u_lightColor")->setValue(value);
+	_lighting->getTechnique(("directional"))->getParameter("u_directionalLightColor[0]")->setValue(value);
+	_lighting->getTechnique(("directionalSpecular"))->getParameter("u_directionalLightColor[0]")->setValue(value);
+	_lighting->getTechnique(("directionalBumped"))->getParameter("u_directionalLightColor[0]")->setValue(value);
+	_lighting->getTechnique(("directionalSpecularBumped"))->getParameter("u_directionalLightColor[0]")->setValue(value);
+
+	_lighting->getTechnique(("spot"))->getParameter("u_spotLightColor[0]")->setValue(value);
+	_lighting->getTechnique(("spotSpecular"))->getParameter("u_spotLightColor[0]")->setValue(value);
+	_lighting->getTechnique(("spotBumped"))->getParameter("u_spotLightColor[0]")->setValue(value);
+	_lighting->getTechnique(("spotSpecularBumped"))->getParameter("u_spotLightColor[0]")->setValue(value);
+
+	_lighting->getTechnique(("point"))->getParameter("u_pointLightColor[0]")->setValue(value);
+	_lighting->getTechnique(("pointSpecular"))->getParameter("u_pointLightColor[0]")->setValue(value);
+	_lighting->getTechnique(("pointBumped"))->getParameter("u_pointLightColor[0]")->setValue(value);
+	_lighting->getTechnique(("pointSpecularBumped"))->getParameter("u_pointLightColor[0]")->setValue(value);
 }
 
 void LightSample::setSpecularValue(float value)

+ 0 - 33
samples/browser/src/LoadSceneSample.cpp

@@ -84,36 +84,3 @@ bool LoadSceneSample::drawScene(Node* node)
         model->draw(_wireFrame);
     return true;
 }
-
-/*
-bool LoadSceneSample::bindLights(Node* node)
-{
-    Model* model = node->getModel();
-    if (model)
-    {
-        Material* material = model->getMaterial();
-        if (material)
-        {
-            MaterialParameter* ambientColorParam = material->getParameter("u_ambientColor");
-            if (ambientColorParam)
-            {
-                ambientColorParam->setValue(_scene->getAmbientColor());
-            }
-            if (_lightNode && _lightNode->getLight())
-            {
-                MaterialParameter* lightDirectionParam = material->getParameter("u_lightDirection");
-                MaterialParameter* lightColorParam = material->getParameter("u_lightColor");
-                if (lightDirectionParam)
-                {
-                    lightDirectionParam->bindValue(_lightNode, &Node::getForwardVectorView);
-                }
-                if (lightColorParam)
-                {
-                    lightColorParam->setValue(_lightNode->getLight()->getColor());
-                }
-            }
-        }
-    }
-    return true;
-}
-*/

+ 1 - 1
samples/browser/src/MeshBatchSample.cpp

@@ -7,7 +7,7 @@
 
 static Material* createMaterial()
 {
-    Material* material = Material::create("res/shaders/colored-unlit.vert", "res/shaders/colored-unlit.frag", "VERTEX_COLOR");
+    Material* material = Material::create("res/shaders/colored.vert", "res/shaders/colored.frag", "VERTEX_COLOR");
     GP_ASSERT(material && material->getStateBlock());
     return material;
 }

+ 5 - 5
samples/browser/src/MeshPrimitiveSample.cpp

@@ -11,7 +11,7 @@
 static Mesh* createTriangleMesh()
 {
     // Calculate the vertices of the equilateral triangle.
-    float a = 0.25f;        // Length of side
+    float a = 0.25f;      // Length of side
     Vector2 p1(0.0f,       a / sqrtf(3.0f));
     Vector2 p2(-a / 2.0f, -a / (2.0f * sqrtf(3.0f)));
     Vector2 p3( a / 2.0f, -a / (2.0f * sqrtf(3.0f)));
@@ -205,24 +205,24 @@ void MeshPrimitiveSample::initialize()
     // Create a material from the built-in "colored-unlit" vertex and fragment shaders.
     // This sample doesn't use lighting so the unlit shader is used.
     // This sample uses vertex color so VERTEX_COLOR is defined. Look at the shader source files to see the supported defines.
-    _triangles->setMaterial("res/shaders/colored-unlit.vert", "res/shaders/colored-unlit.frag", "VERTEX_COLOR");
+    _triangles->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "VERTEX_COLOR");
     
     Mesh* triangleStripMesh = createTriangleStripMesh();
     _triangleStrip = Model::create(triangleStripMesh);
     SAFE_RELEASE(triangleStripMesh);
-    Material* material = _triangleStrip->setMaterial("res/shaders/colored-unlit.vert", "res/shaders/colored-unlit.frag", "VERTEX_COLOR");
+    Material* material = _triangleStrip->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "VERTEX_COLOR");
     material->getStateBlock()->setDepthTest(true);
     material->getStateBlock()->setDepthWrite(true);
 
     Mesh* lineStripMesh = createLineStripMesh();
     _lineStrip = Model::create(lineStripMesh);
     SAFE_RELEASE(lineStripMesh);
-    _lineStrip->setMaterial("res/shaders/colored-unlit.vert", "res/shaders/colored-unlit.frag", "VERTEX_COLOR");
+    _lineStrip->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "VERTEX_COLOR");
     
     Mesh* lineMesh = createLinesMesh();
     _lines = Model::create(lineMesh);
     SAFE_RELEASE(lineMesh);
-    _lines->setMaterial("res/shaders/colored-unlit.vert", "res/shaders/colored-unlit.frag", "VERTEX_COLOR");
+    _lines->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "VERTEX_COLOR");
 }
 
 void MeshPrimitiveSample::finalize()

+ 3 - 2
samples/browser/src/PhysicsCollisionObjectSample.cpp

@@ -133,10 +133,11 @@ bool PhysicsCollisionObjectSample::bindLights(Node* node)
             {
                 ambientColorParam->setValue(_scene->getAmbientColor());
             }
+
             if (_lightNode && _lightNode->getLight())
             {
-                MaterialParameter* lightDirectionParam = material->getParameter("u_lightDirection");
-                MaterialParameter* lightColorParam = material->getParameter("u_lightColor");
+                MaterialParameter* lightDirectionParam = material->getParameter("u_directionalLightDirection[0]");
+                MaterialParameter* lightColorParam = material->getParameter("u_directionalLightColor[0]");
                 if (lightDirectionParam)
                 {
                     lightDirectionParam->bindValue(_lightNode, &Node::getForwardVectorView);

+ 5 - 6
samples/browser/src/PostProcessSample.cpp

@@ -84,16 +84,15 @@ void PostProcessSample::initialize()
     // Load game scene from file
     _scene = Scene::load("res/common/duck.gpb");
 
-    // Get light node
-    Node* lightNode = _scene->findNode("directionalLight1");
-    Light* light = lightNode->getLight();
-
     // Initialize box model
     _modelNode = _scene->findNode("duck");
     Model* model = _modelNode->getModel();
     Material* material = model->setMaterial("res/common/duck.material");
-    material->getParameter("u_lightColor")->setValue(light->getColor());
-    material->getParameter("u_lightDirection")->setValue(lightNode->getForwardVectorView());
+    // Get light node
+    Node* lightNode = _scene->findNode("directionalLight1");
+    Light* light = lightNode->getLight();
+    material->getParameter("u_directionalLightColor[0]")->setValue(light->getColor());
+    material->getParameter("u_directionalLightDirection[0]")->setValue(lightNode->getForwardVectorView());
 
     // Create one frame buffer for the full screen compositerss.
     _frameBuffer = FrameBuffer::create("PostProcessSample", FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT);

+ 1 - 1
samples/browser/src/TextureSample.cpp

@@ -25,7 +25,7 @@ Node* addQuadModelAndNode(Scene* scene, float x, float y, float width, float hei
 
 Material* setTextureUnlitMaterial(Model* model, const char* texturePath, bool mipmap = true)
 {
-    Material* material = model->setMaterial("res/shaders/textured-unlit.vert", "res/shaders/textured-unlit.frag");
+    Material* material = model->setMaterial("res/shaders/textured.vert", "res/shaders/textured.frag");
     material->setParameterAutoBinding("u_worldViewProjectionMatrix", "WORLD_VIEW_PROJECTION_MATRIX");
 
     // Load the texture from file.

+ 1 - 1
samples/browser/src/TriangleSample.cpp

@@ -66,7 +66,7 @@ void TriangleSample::initialize()
     // Create a material from the built-in "colored-unlit" vertex and fragment shaders.
     // This sample doesn't use lighting so the unlit shader is used.
     // This sample uses vertex color so VERTEX_COLOR is defined. Look at the shader source files to see the supported defines.
-    _model->setMaterial("res/shaders/colored-unlit.vert", "res/shaders/colored-unlit.frag", "VERTEX_COLOR");
+    _model->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "VERTEX_COLOR");
 }
 
 void TriangleSample::finalize()

+ 6 - 4
samples/character/res/common/scene.material

@@ -4,8 +4,8 @@ material texturedUnlit
     {
         pass
         {
-            vertexShader = res/shaders/textured-unlit.vert
-            fragmentShader = res/shaders/textured-unlit.frag
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
 
             u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
             
@@ -35,7 +35,7 @@ material texturedSpecular
         {
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
-			defines = SPECULAR
+			defines = DIRECTIONAL_LIGHT_COUNT 1;SPECULAR
 
             u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
             u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
@@ -69,6 +69,7 @@ material texturedTransparent
         {
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
+            defines = DIRECTIONAL_LIGHT_COUNT 1
 
             u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
             u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
@@ -102,6 +103,7 @@ material colored
         {
             vertexShader = res/shaders/colored.vert
             fragmentShader = res/shaders/colored.frag
+            defines = DIRECTIONAL_LIGHT_COUNT 1
 
             u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
             u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
@@ -121,7 +123,7 @@ material boy : texturedTransparent
     {
         pass
         {
-            defines = SKINNING;SKINNING_JOINT_COUNT 31;MODULATE_ALPHA
+            defines = SKINNING;SKINNING_JOINT_COUNT 31;MODULATE_ALPHA;DIRECTIONAL_LIGHT_COUNT 1
             u_matrixPalette = MATRIX_PALETTE
             u_modulateAlpha = 1.0
 

+ 18 - 8
samples/character/src/CharacterGame.cpp

@@ -80,10 +80,13 @@ void CharacterGame::initializeMaterial(Scene* scene, Node* node, Material* mater
     // Bind light shader parameters to dynamic objects only
     if (node->hasTag("dynamic"))
     {
-        Node* lightNode = scene->findNode("sun");
         material->getParameter("u_ambientColor")->bindValue(scene, &Scene::getAmbientColor);
-        material->getParameter("u_lightColor")->bindValue(lightNode->getLight(), &Light::getColor);
-        material->getParameter("u_lightDirection")->bindValue(lightNode, &Node::getForwardVectorView);
+        Node* lightNode = scene->findNode("sun");
+        if (lightNode)
+        {
+            material->getParameter("u_directionalLightColor[0]")->bindValue(lightNode->getLight(), &Light::getColor);
+            material->getParameter("u_directionalLightDirection[0]")->bindValue(lightNode, &Node::getForwardVectorView);
+        }
     }
 }
 
@@ -114,8 +117,10 @@ void CharacterGame::initializeCharacter()
     _jumpClip = _animation->getClip("jump");
     _jumpClip->addListener(this, _jumpClip->getDuration() - 250);
     _kickClip = _animation->getClip("kick");
-    _kickClip->addListener(this, _kickClip->getDuration() - 250); // when to cross fade
-    _kickClip->addListener(this, 416);  // when to turn on _isKicking.
+    // when to cross fade
+    _kickClip->addListener(this, _kickClip->getDuration() - 250); 
+    // when to turn on _isKicking.
+    _kickClip->addListener(this, 416);  
 
     // Start playing the idle animation when we load.
     play("idle", true);
@@ -204,8 +209,10 @@ void CharacterGame::update(float elapsedTime)
         // apply impulse from kick.
         Vector3 impulse(-_characterNode->getForwardVectorWorld());
         impulse.normalize();
-        impulse.y = 1.0f; // add some lift to kick
-        impulse.scale(16.6f); //scale the impulse.
+        // add some lift to kick
+        impulse.y = 1.0f; 
+        //scale the impulse.
+        impulse.scale(16.6f);
         ((PhysicsRigidBody*)_basketballNode->getCollisionObject())->applyImpulse(impulse);
         _hasBall = false;
         _applyKick = false;
@@ -326,7 +333,9 @@ void CharacterGame::update(float elapsedTime)
     PhysicsController::HitResult hitResult;
     Vector3 v = _character->getNode()->getTranslationWorld();
     if (getPhysicsController()->rayTest(Ray(Vector3(v.x, v.y + 1.0f, v.z), Vector3(0, -1, 0)), 100.0f, &hitResult, NULL))
+    {
         _characterShadowNode->setTranslation(Vector3(hitResult.point.x, hitResult.point.y + 0.1f, hitResult.point.z));
+    }
 
     if (_hasBall)
     {
@@ -335,7 +344,9 @@ void CharacterGame::update(float elapsedTime)
         // This will ensure the boy cannot walk through walls/objects with the basketball.
         PhysicsRigidBody* basketball = (PhysicsRigidBody*)_basketballNode->getCollisionObject();
         if (basketball->isEnabled())
+        {
             grabBall();
+        }
 
         // Capture the basketball's old position, and then calculate the basketball's new position in front of the character
         _oldBallPosition = _basketballNode->getTranslationWorld();
@@ -356,7 +367,6 @@ void CharacterGame::update(float elapsedTime)
             rotNorm.normalize();
             _basketballNode->rotate(rotNorm, rotationVector.length());
         }
-        
         _basketballNode->setTranslation(translation.x, _floorLevel, translation.z);
     }
 }

+ 0 - 316
samples/lua/res/box.dae

@@ -1,316 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
-  <asset>
-    <contributor>
-      <author>kcunney</author>
-      <authoring_tool>OpenCOLLADA2011 x64</authoring_tool>
-      <comments>
-			ColladaMaya export options: 
-			bakeTransforms=1;relativePaths=0;copyTextures=0;exportTriangles=1;exportCgfxFileReferences=0;
-			isSampling=0;curveConstrainSampling=0;removeStaticCurves=1;exportPolygonMeshes=1;exportLights=1;
-			exportCameras=1;exportJointsAndSkin=1;exportAnimations=1;exportInvisibleNodes=0;exportDefaultCameras=0;
-			exportTexCoords=1;exportNormals=1;exportNormalsPerVertex=1;exportVertexColors=1;exportVertexColorsPerVertex=1;
-			exportTexTangents=0;exportTangents=0;exportReferencedMaterials=0;exportMaterialsOnly=0;
-			exportXRefs=1;dereferenceXRefs=1;exportCameraAsLookat=0;cameraXFov=0;cameraYFov=1;doublePrecision=0
-		</comments>
-      <source_data>file:///C:/code/git/GamePlay/gameplay-samples/sample05-lua/res/box.mb</source_data>
-    </contributor>
-    <created>2012-07-13T18:33:54</created>
-    <modified>2012-07-13T18:33:54</modified>
-    <unit name="centimeter" meter="0.01"/>
-    <up_axis>Y_UP</up_axis>
-  </asset>
-  <library_lights>
-    <light id="directionalLightShape1-lib" name="directionalLightShape1">
-      <technique_common>
-        <directional>
-          <color>1 1 1</color>
-        </directional>
-      </technique_common>
-      <extra>
-        <technique profile="OpenCOLLADAMaya">
-          <originalMayaNodeId>directionalLightShape1</originalMayaNodeId>
-        </technique>
-      </extra>
-    </light>
-  </library_lights>
-  <library_cameras>
-    <camera id="cameraShape1" name="cameraShape1">
-      <optics>
-        <technique_common>
-          <perspective>
-            <yfov>45</yfov>
-            <aspect_ratio>1.706667</aspect_ratio>
-            <znear>1</znear>
-            <zfar>10000</zfar>
-          </perspective>
-        </technique_common>
-      </optics>
-      <extra>
-        <technique profile="OpenCOLLADAMaya">
-          <film_fit>1</film_fit>
-          <film_fit_offset>0</film_fit_offset>
-          <film_offsetX>0</film_offsetX>
-          <film_offsetY>0</film_offsetY>
-          <horizontal_aperture>4.095993</horizontal_aperture>
-          <lens_squeeze>1</lens_squeeze>
-          <originalMayaNodeId>cameraShape1</originalMayaNodeId>
-          <vertical_aperture>2.399995</vertical_aperture>
-        </technique>
-      </extra>
-    </camera>
-  </library_cameras>
-  <library_materials>
-    <material id="lambert1" name="lambert1">
-      <instance_effect url="#lambert1-fx"/>
-    </material>
-    <material id="blinn1" name="blinn1">
-      <instance_effect url="#blinn1-fx"/>
-    </material>
-  </library_materials>
-  <library_effects>
-    <effect id="blinn1-fx">
-      <profile_COMMON>
-        <newparam sid="file2-surface">
-          <surface type="2D">
-            <init_from>file2</init_from>
-          </surface>
-        </newparam>
-        <newparam sid="file2-sampler">
-          <sampler2D>
-            <source>file2-surface</source>
-          </sampler2D>
-        </newparam>
-        <technique sid="common">
-          <blinn>
-            <emission>
-              <color>0 0 0 1</color>
-            </emission>
-            <ambient>
-              <color>0 0 0 1</color>
-            </ambient>
-            <diffuse>
-              <texture texture="file2-sampler" texcoord="TEX0">
-                <extra>
-                  <technique profile="OpenCOLLADAMaya">
-                    <blend_mode>NONE</blend_mode>
-                    <coverageU>1</coverageU>
-                    <coverageV>1</coverageV>
-                    <fast>0</fast>
-                    <mirrorU>0</mirrorU>
-                    <mirrorV>0</mirrorV>
-                    <noiseU>0</noiseU>
-                    <noiseV>0</noiseV>
-                    <offsetU>0</offsetU>
-                    <offsetV>0</offsetV>
-                    <repeatU>1</repeatU>
-                    <repeatV>1</repeatV>
-                    <rotateFrame>0</rotateFrame>
-                    <rotateUV>0</rotateUV>
-                    <stagger>0</stagger>
-                    <translateFrameU>0</translateFrameU>
-                    <translateFrameV>0</translateFrameV>
-                    <wrapU>1</wrapU>
-                    <wrapV>1</wrapV>
-                  </technique>
-                </extra>
-              </texture>
-            </diffuse>
-            <specular>
-              <color>0 0 0 1</color>
-            </specular>
-            <shininess>
-              <float>0.3</float>
-            </shininess>
-            <reflective>
-              <color>0 0 0 1</color>
-            </reflective>
-            <reflectivity>
-              <float>0.5</float>
-            </reflectivity>
-            <transparent opaque="RGB_ZERO">
-              <color>0 0 0 1</color>
-            </transparent>
-            <transparency>
-              <float>1</float>
-            </transparency>
-            <index_of_refraction>
-              <float>1</float>
-            </index_of_refraction>
-          </blinn>
-        </technique>
-      </profile_COMMON>
-    </effect>
-    <effect id="lambert1-fx">
-      <profile_COMMON>
-        <newparam sid="file3-surface">
-          <surface type="2D">
-            <init_from>file3</init_from>
-          </surface>
-        </newparam>
-        <newparam sid="file3-sampler">
-          <sampler2D>
-            <source>file3-surface</source>
-          </sampler2D>
-        </newparam>
-        <technique sid="common">
-          <lambert>
-            <emission>
-              <color>0 0 0 1</color>
-            </emission>
-            <ambient>
-              <color>0 0 0 1</color>
-            </ambient>
-            <diffuse>
-              <texture texture="file3-sampler" texcoord="TEX0">
-                <extra>
-                  <technique profile="OpenCOLLADAMaya">
-                    <blend_mode>NONE</blend_mode>
-                    <coverageU>1</coverageU>
-                    <coverageV>1</coverageV>
-                    <fast>0</fast>
-                    <mirrorU>0</mirrorU>
-                    <mirrorV>0</mirrorV>
-                    <noiseU>0</noiseU>
-                    <noiseV>0</noiseV>
-                    <offsetU>0</offsetU>
-                    <offsetV>0</offsetV>
-                    <repeatU>1</repeatU>
-                    <repeatV>1</repeatV>
-                    <rotateFrame>0</rotateFrame>
-                    <rotateUV>0</rotateUV>
-                    <stagger>0</stagger>
-                    <translateFrameU>0</translateFrameU>
-                    <translateFrameV>0</translateFrameV>
-                    <wrapU>1</wrapU>
-                    <wrapV>1</wrapV>
-                  </technique>
-                </extra>
-              </texture>
-            </diffuse>
-            <transparent opaque="RGB_ZERO">
-              <color>0 0 0 1</color>
-            </transparent>
-            <transparency>
-              <float>1</float>
-            </transparency>
-          </lambert>
-        </technique>
-      </profile_COMMON>
-    </effect>
-  </library_effects>
-  <library_images>
-    <image id="file3" name="file3">
-      <init_from>file:///C:/code/git/GamePlay/gameplay-samples/sample05-lua/res/box-diffuse.png</init_from>
-      <extra>
-        <technique profile="OpenCOLLADAMaya">
-          <dgnode_type>kFile</dgnode_type>
-          <image_sequence>0</image_sequence>
-          <originalMayaNodeId>file3</originalMayaNodeId>
-        </technique>
-      </extra>
-    </image>
-    <image id="file2" name="file2">
-      <init_from>file:///C:/git/gameplay-public/gameplay-samples/sample00-mesh/res/duck-diffuse.png</init_from>
-      <extra>
-        <technique profile="OpenCOLLADAMaya">
-          <dgnode_type>kFile</dgnode_type>
-          <image_sequence>0</image_sequence>
-          <originalMayaNodeId>file2</originalMayaNodeId>
-        </technique>
-      </extra>
-    </image>
-  </library_images>
-  <library_geometries>
-    <geometry id="boxShape" name="boxShape">
-      <mesh>
-        <source id="boxShape-positions" name="boxShape-positions">
-          <float_array id="boxShape-positions-array" count="24">-0.5 -0.5 0.5 0.5 -0.5 0.5 -0.5 0.5 0.5 0.5 0.5 0.5 -0.5 0.5 -0.5 0.5 0.5 -0.5 -0.5 -0.5 -0.5 0.5 -0.5 -0.5</float_array>
-          <technique_common>
-            <accessor source="#boxShape-positions-array" count="8" stride="3">
-              <param name="X" type="float"/>
-              <param name="Y" type="float"/>
-              <param name="Z" type="float"/>
-            </accessor>
-          </technique_common>
-        </source>
-        <source id="boxShape-normals" name="boxShape-normals">
-          <float_array id="boxShape-normals-array" count="72">0 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 -1 0 0 -1 0 0 -1 0 0 -1 0 1 0 0 1 0 0 1 0 0 1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0</float_array>
-          <technique_common>
-            <accessor source="#boxShape-normals-array" count="24" stride="3">
-              <param name="X" type="float"/>
-              <param name="Y" type="float"/>
-              <param name="Z" type="float"/>
-            </accessor>
-          </technique_common>
-        </source>
-        <source id="boxShape-map1" name="boxShape-map1">
-          <float_array id="boxShape-map1-array" count="48">0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1</float_array>
-          <technique_common>
-            <accessor source="#boxShape-map1-array" count="24" stride="2">
-              <param name="S" type="float"/>
-              <param name="T" type="float"/>
-            </accessor>
-          </technique_common>
-        </source>
-        <vertices id="boxShape-vertices" name="boxShape-vertices">
-          <input semantic="POSITION" source="#boxShape-positions"/>
-        </vertices>
-        <triangles material="initialShadingGroup" count="12">
-          <input semantic="VERTEX" source="#boxShape-vertices" offset="0"/>
-          <input semantic="NORMAL" source="#boxShape-normals" offset="1"/>
-          <input semantic="TEXCOORD" source="#boxShape-map1" offset="2" set="0"/>
-          <p>0 0 0 1 1 1 2 3 2 2 3 2 1 1 1 3 2 3 2 4 4 3 5 5 4 7 6 4 7 6 3 5 5 5 6 7 4 8 8 5 9 9 6 11 10 6 11 10 5 9 9 7 10 11 6 12 12 7 13 13 0 15 14 0 15 14 7 13 13 1 14 15 1 16 16 7 17 17 3 19 18 3 19 18 7 17 17 5 18 19 6 20 20 0 21 21 4 23 22 4 23 22 0 21 21 2 22 23</p>
-        </triangles>
-      </mesh>
-      <extra>
-        <technique profile="OpenCOLLADAMaya">
-          <originalMayaNodeId>boxShape</originalMayaNodeId>
-          <double_sided>1</double_sided>
-        </technique>
-      </extra>
-    </geometry>
-  </library_geometries>
-  <library_visual_scenes>
-    <visual_scene id="VisualSceneNode" name="box">
-      <node id="camera1" name="camera1" type="NODE">
-        <matrix sid="transform">1 0 0 0 0 0.9807853 0.1950903 1 0 -0.1950903 0.9807853 5 0 0 0 1</matrix>
-        <instance_camera url="#cameraShape1"/>
-        <extra>
-          <technique profile="OpenCOLLADAMaya">
-            <originalMayaNodeId>camera1</originalMayaNodeId>
-          </technique>
-        </extra>
-      </node>
-      <node id="directionalLight1" name="directionalLight1" type="NODE">
-        <matrix sid="transform">0.9998477 -0.01745241 0 0 0.01745241 0.9998477 0 0 0 0 1 0 0 0 0 1</matrix>
-        <instance_light url="#directionalLightShape1-lib"/>
-        <extra>
-          <technique profile="OpenCOLLADAMaya">
-            <originalMayaNodeId>directionalLight1</originalMayaNodeId>
-          </technique>
-        </extra>
-      </node>
-      <node id="box" name="box" type="NODE">
-        <matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
-        <instance_geometry url="#boxShape">
-          <bind_material>
-            <technique_common>
-              <instance_material symbol="initialShadingGroup" target="#lambert1">
-                <bind_vertex_input semantic="TEX0" input_semantic="TEXCOORD" input_set="0"/>
-              </instance_material>
-            </technique_common>
-          </bind_material>
-        </instance_geometry>
-        <extra>
-          <technique profile="OpenCOLLADAMaya">
-            <originalMayaNodeId>box</originalMayaNodeId>
-          </technique>
-        </extra>
-      </node>
-    </visual_scene>
-  </library_visual_scenes>
-  <scene>
-    <instance_visual_scene url="#VisualSceneNode"/>
-  </scene>
-</COLLADA>

+ 2 - 2
samples/lua/res/box.material

@@ -7,15 +7,15 @@ material box
             // shaders
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
-            defines = SPECULAR
+            defines = SPECULAR;DIRECTIONAL_LIGHT_COUNT 1
             
             // uniforms
             u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
             u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
             u_cameraPosition = CAMERA_WORLD_POSITION
             u_ambientColor = 0.2, 0.2, 0.2
-            u_lightColor = 0.75, 0.75, 0.75
             u_specularExponent = 50
+            u_directionalLightColor[0] = 0.75, 0.75, 0.75
             
             // samplers
             sampler u_diffuseTexture

+ 1 - 1
samples/lua/res/game.lua

@@ -23,7 +23,7 @@ function initialize()
     local lightNode = _scene:findNode("directionalLight1")
 
     -- Bind the light node's direction into the box material.
-    _modelNode:getModel():getMaterial():getParameter("u_lightDirection"):bindValue(lightNode, "&Node::getForwardVectorView")
+    _modelNode:getModel():getMaterial():getParameter("u_directionalLightDirection[0]"):bindValue(lightNode, "&Node::getForwardVectorView")
 
     -- Update the aspect ratio for our scene's camera to match the current device resolution
     local game = Game.getInstance()

+ 2 - 2
samples/lua/res/grid.material

@@ -5,8 +5,8 @@ material grid
         pass 0
         {
             // shaders
-            vertexShader = res/shaders/colored-unlit.vert
-            fragmentShader = res/shaders/colored-unlit.frag
+            vertexShader = res/shaders/colored.vert
+            fragmentShader = res/shaders/colored.frag
 			defines = VERTEX_COLOR
 
              // uniforms

+ 0 - 1
samples/lua/sample-lua.vcxproj

@@ -637,7 +637,6 @@
     <None Include="res\arial.gpb" />
     <None Include="res\arial.ttf" />
     <None Include="res\box-diffuse.png" />
-    <None Include="res\box.dae" />
     <None Include="res\box.gpb" />
     <None Include="res\box.material" />
     <None Include="res\game.lua" />

+ 0 - 3
samples/lua/sample-lua.vcxproj.filters

@@ -9,9 +9,6 @@
   <ItemGroup>
     <None Include="icon.png" />
     <None Include="bar-descriptor.xml" />
-    <None Include="res\box.dae">
-      <Filter>res</Filter>
-    </None>
     <None Include="res\box.gpb">
       <Filter>res</Filter>
     </None>

+ 2 - 2
samples/mesh/res/duck.material

@@ -7,15 +7,15 @@ material duck
             // shaders
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
-            defines = SPECULAR
+            defines = SPECULAR;DIRECTIONAL_LIGHT_COUNT 1
             
             // uniforms
             u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
             u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
             u_cameraPosition = CAMERA_WORLD_POSITION
             u_ambientColor = 0.2, 0.2, 0.2
-            u_lightColor = 0.75, 0.75, 0.75
             u_specularExponent = 50
+            u_directionalLightColor[0] = 0.75, 0.75, 0.75
             
             // samplers
             sampler u_diffuseTexture

+ 2 - 2
samples/mesh/res/grid.material

@@ -5,8 +5,8 @@ material grid
         pass 0
         {
             // shaders
-            vertexShader = res/shaders/colored-unlit.vert
-            fragmentShader = res/shaders/colored-unlit.frag
+            vertexShader = res/shaders/colored.vert
+            fragmentShader = res/shaders/colored.frag
 			defines = VERTEX_COLOR
 
              // uniforms

+ 1 - 1
samples/mesh/src/MeshGame.cpp

@@ -33,7 +33,7 @@ void MeshGame::initialize()
     Node* lightNode = _scene->findNode("directionalLight1");
 
     // Bind the light node's direction into duck's material.
-    _modelNode->getModel()->getMaterial()->getParameter("u_lightDirection")->bindValue(lightNode, &Node::getForwardVectorView);
+    _modelNode->getModel()->getMaterial()->getParameter("u_directionalLightDirection[0]")->bindValue(lightNode, &Node::getForwardVectorView);
 
     // Update the aspect ratio for our scene's camera to match the current device resolution
     _scene->getActiveCamera()->setAspectRatio(getAspectRatio());

+ 2 - 2
samples/particles/res/grid.material

@@ -5,8 +5,8 @@ material grid
         pass 0
         {
             // shaders
-            vertexShader = res/shaders/colored-unlit.vert
-            fragmentShader = res/shaders/colored-unlit.frag
+            vertexShader = res/shaders/colored.vert
+            fragmentShader = res/shaders/colored.frag
 			defines = VERTEX_COLOR
 
              // uniforms

+ 7 - 5
samples/racer/res/common/game.material

@@ -28,6 +28,7 @@ material textured
             // shaders
             vertexShader = res/shaders/textured.vert
             fragmentShader = res/shaders/textured.frag
+            defines = DIRECTIONAL_LIGHT_COUNT 1
         }
     }
 }
@@ -59,8 +60,8 @@ material texturedUnlit
         pass 0
         {
             // shaders
-            vertexShader = res/shaders/textured-unlit.vert
-            fragmentShader = res/shaders/textured-unlit.frag
+            vertexShader = res/shaders/textured.vert
+            fragmentShader = res/shaders/textured.frag
         }
     }
 }
@@ -96,6 +97,7 @@ material colored
             // shaders
             vertexShader = res/shaders/colored.vert
             fragmentShader = res/shaders/colored.frag
+            defines = DIRECTIONAL_LIGHT_COUNT 1
         }
     }
 }
@@ -117,8 +119,8 @@ material coloredUnlit
         pass 0
         {
             // shaders
-            vertexShader = res/shaders/colored-unlit.vert
-            fragmentShader = res/shaders/colored-unlit.frag
+            vertexShader = res/shaders/colored.vert
+            fragmentShader = res/shaders/colored.frag
         }
     }
 }
@@ -284,7 +286,7 @@ material track : texturedUnlit
     {
         pass 0
         {
-            defines = TEXTURE_LIGHTMAP;TEXCOORD1
+            defines = LIGHTMAP;TEXCOORD1
         }
     }
 }

+ 5 - 3
samples/racer/src/RacerGame.cpp

@@ -114,12 +114,14 @@ bool RacerGame::initializeScene(Node* node)
     if (model)
     {
         Material* material = model->getMaterial();
-        if (material && material->getTechnique()->getPassByIndex(0)->getEffect()->getUniform("u_lightDirection"))
+        /*
+        if (material && material->getTechnique()->getPassByIndex(0)->getEffect()->getUniform("u_directionalLightDirection"))
         {
             material->getParameter("u_ambientColor")->setValue(_scene->getAmbientColor());
-            material->getParameter("u_lightColor")->setValue(lightNode->getLight()->getColor());
-            material->getParameter("u_lightDirection")->setValue(lightNode->getForwardVectorView());
+            material->getParameter("u_directionalLightColor[0]")->setValue(lightNode->getLight()->getColor());
+            material->getParameter("u_directionalLightDirection[0]")->setValue(lightNode->getForwardVectorView());
         }
+        */
     }
 
     return true;

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 360
samples/spaceship/res/spaceship.dae


+ 0 - 1
samples/spaceship/sample-spaceship.vcxproj

@@ -602,7 +602,6 @@
     <None Include="res\background.ogg" />
     <None Include="res\background.png" />
     <None Include="res\propulsion_glow.png" />
-    <None Include="res\spaceship.dae" />
     <None Include="res\spaceship.gpb" />
     <None Include="res\spaceship.mb" />
     <None Include="res\spaceship.wav" />

+ 0 - 3
samples/spaceship/sample-spaceship.vcxproj.filters

@@ -20,9 +20,6 @@
     <None Include="res\propulsion_glow.png">
       <Filter>res</Filter>
     </None>
-    <None Include="res\spaceship.dae">
-      <Filter>res</Filter>
-    </None>
     <None Include="res\spaceship.gpb">
       <Filter>res</Filter>
     </None>

+ 17 - 16
samples/spaceship/src/SpaceshipGame.cpp

@@ -150,28 +150,28 @@ void SpaceshipGame::initializeSpaceship()
     // Setup spaceship model
     // Part 0
     _shipNode = _scene->findNode("pSpaceShip");
-    material = _shipNode->getModel()->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "SPECULAR", 0);
+    material = _shipNode->getModel()->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "SPECULAR;DIRECTIONAL_LIGHT_COUNT 1", 0);
     material->getParameter("u_diffuseColor")->setValue(Vector4(0.53544f, 0.53544f, 0.53544f, 1.0f));
     initializeMaterial(material, true, true);
     // Part 1
-    material = _shipNode->getModel()->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "SPECULAR", 1);
+    material = _shipNode->getModel()->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "SPECULAR;DIRECTIONAL_LIGHT_COUNT 1", 1);
     material->getParameter("u_diffuseColor")->setValue(Vector4(0.8f, 0.8f, 0.8f, 1.0f));
     _shipSpecularParameter = material->getParameter("u_specularExponent");
     initializeMaterial(material, true, true);
     // Part 2
-    material = _shipNode->getModel()->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "SPECULAR", 2);
+    material = _shipNode->getModel()->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "SPECULAR;DIRECTIONAL_LIGHT_COUNT 1", 2);
     material->getParameter("u_diffuseColor")->setValue(Vector4(0.280584f, 0.5584863f, 0.6928f, 1.0f));
     initializeMaterial(material, true, true);
 
     // Setup spaceship propulsion model
     _propulsionNode = _scene->findNode("pPropulsion");
-    material = _propulsionNode->getModel()->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "SPECULAR");
+    material = _propulsionNode->getModel()->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "SPECULAR;DIRECTIONAL_LIGHT_COUNT 1");
     material->getParameter("u_diffuseColor")->setValue(Vector4(0.8f, 0.8f, 0.8f, 1.0f));
     initializeMaterial(material, true, true);
 
     // Glow effect node
     _glowNode = _scene->findNode("pGlow");
-    material = _glowNode->getModel()->setMaterial("res/shaders/textured-unlit.vert", "res/shaders/textured-unlit.frag", "MODULATE_COLOR");
+    material = _glowNode->getModel()->setMaterial("res/shaders/textured.vert", "res/shaders/textured.frag", "MODULATE_COLOR");
     material->getParameter("u_diffuseTexture")->setValue("res/propulsion_glow.png", true);
     _glowDiffuseParameter = material->getParameter("u_modulateColor");
     initializeMaterial(material, false, false);
@@ -194,7 +194,7 @@ void SpaceshipGame::initializeEnvironment()
     for (size_t i = 0, count = nodes.size(); i < count; ++i)
     {
         Node* pGround = nodes[i];
-        material = pGround->getModel()->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "SPECULAR");
+        material = pGround->getModel()->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "SPECULAR;DIRECTIONAL_LIGHT_COUNT 1");
         material->getParameter("u_diffuseColor")->setValue(Vector4(0.280584f, 0.5584863f, 0.6928f, 1.0f));
         initializeMaterial(material, true, true);
     }
@@ -205,7 +205,7 @@ void SpaceshipGame::initializeEnvironment()
     for (size_t i = 0, count = nodes.size(); i < count; ++i)
     {
         Node* pRoof = nodes[i];
-        material = pRoof->getModel()->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "SPECULAR");
+        material = pRoof->getModel()->setMaterial("res/shaders/colored.vert", "res/shaders/colored.frag", "SPECULAR;DIRECTIONAL_LIGHT_COUNT 1");
         material->getParameter("u_diffuseColor")->setValue(Vector4(0.280584f, 0.5584863f, 0.6928f, 1.0f));
         initializeMaterial(material, true, true);
     }
@@ -213,7 +213,7 @@ void SpaceshipGame::initializeEnvironment()
     // Setup background model
     nodes.clear();
     Node* pBackground = _scene->findNode("pBackground");
-    material = pBackground->getModel()->setMaterial("res/shaders/textured.vert", "res/shaders/textured.frag");
+    material = pBackground->getModel()->setMaterial("res/shaders/textured.vert", "res/shaders/textured.frag", "DIRECTIONAL_LIGHT_COUNT 1");
     material->getParameter("u_diffuseTexture")->setValue("res/background.png", true);
     initializeMaterial(material, true, false);
 }
@@ -230,16 +230,8 @@ void SpaceshipGame::initializeMaterial(Material* material, bool lighting, bool s
     {
         // Apply lighting material parameters
         material->setParameterAutoBinding("u_inverseTransposeWorldViewMatrix", RenderState::INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX);
-
-        Node* lightNode = _scene->findNode("directionalLight1");
-        Vector3 lightDirection = lightNode->getForwardVector();
-        lightDirection.normalize();
-
-        material->getParameter("u_lightDirection")->setValue(lightDirection);
-        material->getParameter("u_lightColor")->setValue(lightNode->getLight()->getColor());
         material->getParameter("u_ambientColor")->setValue(AMBIENT_LIGHT_COLOR);
 
-
         if (specular)
         {
             // Apply specular lighting parameters
@@ -247,6 +239,15 @@ void SpaceshipGame::initializeMaterial(Material* material, bool lighting, bool s
             material->setParameterAutoBinding("u_worldViewMatrix", RenderState::WORLD_VIEW_MATRIX);
             material->setParameterAutoBinding("u_cameraPosition", RenderState::CAMERA_WORLD_POSITION);
         }
+
+        Node* lightNode = _scene->findNode("directionalLight1");
+        Vector3 lightDirection = lightNode->getForwardVector();
+        lightDirection.normalize();
+        if (lightNode)
+        {
+            material->getParameter("u_directionalLightDirection[0]")->setValue(lightDirection);
+            material->getParameter("u_directionalLightColor[0]")->setValue(lightNode->getLight()->getColor());
+        }
     }
 }
 

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff