Jelajahi Sumber

Added utility library into Renderer

Marko Pintera 13 tahun lalu
induk
melakukan
2242dd3cf1
100 mengubah file dengan 859 tambahan dan 9638 penghapusan
  1. 8 8
      CamelotRenderer/CamelotRenderer.cpp
  2. 6 25
      CamelotRenderer/CamelotRenderer.vcxproj
  3. 0 69
      CamelotRenderer/CamelotRenderer.vcxproj.filters
  4. 0 35
      CamelotRenderer/OgreAxisAlignedBox.cpp
  5. 0 813
      CamelotRenderer/OgreAxisAlignedBox.h
  6. 34 34
      CamelotRenderer/OgreBitwise.h
  7. 3 3
      CamelotRenderer/OgreBlendMode.h
  8. 27 35
      CamelotRenderer/OgreCamera.cpp
  9. 18 18
      CamelotRenderer/OgreCamera.h
  10. 45 45
      CamelotRenderer/OgreColourValue.cpp
  11. 6 6
      CamelotRenderer/OgreColourValue.h
  12. 5 5
      CamelotRenderer/OgreCommon.h
  13. 3 3
      CamelotRenderer/OgreConfig.h
  14. 7 7
      CamelotRenderer/OgreD3D9Device.cpp
  15. 7 7
      CamelotRenderer/OgreD3D9Device.h
  16. 11 11
      CamelotRenderer/OgreD3D9DeviceManager.cpp
  17. 3 3
      CamelotRenderer/OgreD3D9GpuProgram.cpp
  18. 3 3
      CamelotRenderer/OgreD3D9HardwareIndexBuffer.cpp
  19. 1 1
      CamelotRenderer/OgreD3D9HardwareIndexBuffer.h
  20. 2 2
      CamelotRenderer/OgreD3D9HardwarePixelBuffer.cpp
  21. 2 2
      CamelotRenderer/OgreD3D9HardwarePixelBuffer.h
  22. 3 3
      CamelotRenderer/OgreD3D9HardwareVertexBuffer.cpp
  23. 1 1
      CamelotRenderer/OgreD3D9HardwareVertexBuffer.h
  24. 6 6
      CamelotRenderer/OgreD3D9MultiRenderTarget.cpp
  25. 1 1
      CamelotRenderer/OgreD3D9MultiRenderTarget.h
  26. 70 70
      CamelotRenderer/OgreD3D9RenderSystem.cpp
  27. 19 19
      CamelotRenderer/OgreD3D9RenderSystem.h
  28. 1 1
      CamelotRenderer/OgreD3D9RenderWindow.cpp
  29. 5 5
      CamelotRenderer/OgreD3D9Texture.cpp
  30. 1 1
      CamelotRenderer/OgreD3D9Texture.h
  31. 94 104
      CamelotRenderer/OgreFrustum.cpp
  32. 28 28
      CamelotRenderer/OgreFrustum.h
  33. 2 2
      CamelotRenderer/OgreGpuProgram.cpp
  34. 27 27
      CamelotRenderer/OgreGpuProgramParams.cpp
  35. 27 27
      CamelotRenderer/OgreGpuProgramParams.h
  36. 3 3
      CamelotRenderer/OgreHardwareVertexBuffer.cpp
  37. 4 4
      CamelotRenderer/OgreHardwareVertexBuffer.h
  38. 30 30
      CamelotRenderer/OgreImageResampler.h
  39. 0 987
      CamelotRenderer/OgreMath.cpp
  40. 0 656
      CamelotRenderer/OgreMath.h
  41. 0 1510
      CamelotRenderer/OgreMatrix3.cpp
  42. 0 272
      CamelotRenderer/OgreMatrix3.h
  43. 0 260
      CamelotRenderer/OgreMatrix4.cpp
  44. 0 659
      CamelotRenderer/OgreMatrix4.h
  45. 59 59
      CamelotRenderer/OgrePixelFormat.cpp
  46. 4 4
      CamelotRenderer/OgrePixelFormat.h
  47. 0 170
      CamelotRenderer/OgrePlane.cpp
  48. 0 166
      CamelotRenderer/OgrePlane.h
  49. 0 16
      CamelotRenderer/OgrePlatform.h
  50. 3 133
      CamelotRenderer/OgrePrerequisites.h
  51. 0 608
      CamelotRenderer/OgreQuaternion.cpp
  52. 0 271
      CamelotRenderer/OgreQuaternion.h
  53. 0 111
      CamelotRenderer/OgreRay.h
  54. 3 3
      CamelotRenderer/OgreRenderSystem.cpp
  55. 20 20
      CamelotRenderer/OgreRenderSystem.h
  56. 48 48
      CamelotRenderer/OgreRenderSystemCapabilities.h
  57. 5 5
      CamelotRenderer/OgreRenderTarget.h
  58. 0 108
      CamelotRenderer/OgreSphere.h
  59. 3 3
      CamelotRenderer/OgreStringConverter.cpp
  60. 23 23
      CamelotRenderer/OgreStringConverter.h
  61. 5 5
      CamelotRenderer/OgreTexture.cpp
  62. 8 8
      CamelotRenderer/OgreTexture.h
  63. 7 7
      CamelotRenderer/OgreTextureManager.cpp
  64. 11 11
      CamelotRenderer/OgreTextureManager.h
  65. 2 2
      CamelotRenderer/OgreTextureState.h
  66. 0 42
      CamelotRenderer/OgreVector2.cpp
  67. 0 573
      CamelotRenderer/OgreVector2.h
  68. 0 42
      CamelotRenderer/OgreVector3.cpp
  69. 0 796
      CamelotRenderer/OgreVector3.h
  70. 0 34
      CamelotRenderer/OgreVector4.cpp
  71. 0 414
      CamelotRenderer/OgreVector4.h
  72. 28 28
      CamelotRenderer/OgreVertexIndexData.cpp
  73. 2 2
      CamelotRenderer/OgreVertexIndexData.h
  74. 10 10
      CamelotRenderer/OgreViewport.cpp
  75. 8 8
      CamelotRenderer/OgreViewport.h
  76. 5 5
      CamelotRenderer/RenderSystemGL/Include/OgreGLFBORenderTexture.h
  77. 3 3
      CamelotRenderer/RenderSystemGL/Include/OgreGLFrameBufferObject.h
  78. 1 1
      CamelotRenderer/RenderSystemGL/Include/OgreGLGpuNvparseProgram.h
  79. 5 5
      CamelotRenderer/RenderSystemGL/Include/OgreGLGpuProgram.h
  80. 2 2
      CamelotRenderer/RenderSystemGL/Include/OgreGLHardwareBufferManager.h
  81. 1 1
      CamelotRenderer/RenderSystemGL/Include/OgreGLHardwarePixelBuffer.h
  82. 2 2
      CamelotRenderer/RenderSystemGL/Include/OgreGLPBRenderTexture.h
  83. 22 22
      CamelotRenderer/RenderSystemGL/Include/OgreGLRenderSystem.h
  84. 5 5
      CamelotRenderer/RenderSystemGL/Include/OgreGLRenderTexture.h
  85. 3 3
      CamelotRenderer/RenderSystemGL/Source/GLSL/include/OgreGLSLGpuProgram.h
  86. 3 3
      CamelotRenderer/RenderSystemGL/Source/GLSL/include/OgreGLSLLinkProgram.h
  87. 1 1
      CamelotRenderer/RenderSystemGL/Source/GLSL/include/OgreGLSLLinkProgramManager.h
  88. 3 3
      CamelotRenderer/RenderSystemGL/Source/GLSL/src/OgreGLSLGpuProgram.cpp
  89. 3 3
      CamelotRenderer/RenderSystemGL/Source/GLSL/src/OgreGLSLLinkProgram.cpp
  90. 4 4
      CamelotRenderer/RenderSystemGL/Source/GLSL/src/OgreGLSLLinkProgramManager.cpp
  91. 1 1
      CamelotRenderer/RenderSystemGL/Source/GLSL/src/OgreGLSLPreprocessor.cpp
  92. 3 3
      CamelotRenderer/RenderSystemGL/Source/OgreGLFBORenderTexture.cpp
  93. 7 7
      CamelotRenderer/RenderSystemGL/Source/OgreGLFrameBufferObject.cpp
  94. 1 1
      CamelotRenderer/RenderSystemGL/Source/OgreGLGpuNvparseProgram.cpp
  95. 4 4
      CamelotRenderer/RenderSystemGL/Source/OgreGLGpuProgram.cpp
  96. 10 10
      CamelotRenderer/RenderSystemGL/Source/OgreGLHardwareBufferManager.cpp
  97. 1 1
      CamelotRenderer/RenderSystemGL/Source/OgreGLHardwareIndexBuffer.cpp
  98. 4 4
      CamelotRenderer/RenderSystemGL/Source/OgreGLHardwarePixelBuffer.cpp
  99. 1 1
      CamelotRenderer/RenderSystemGL/Source/OgreGLHardwareVertexBuffer.cpp
  100. 2 2
      CamelotRenderer/RenderSystemGL/Source/OgreGLPBRenderTexture.cpp

+ 8 - 8
CamelotRenderer/CamelotRenderer.cpp

@@ -8,19 +8,19 @@
 #include "OgreBuildSettings.h"
 #include "OgreBuildSettings.h"
 #include "OgreColourValue.h"
 #include "OgreColourValue.h"
 #include "OgreConfig.h"
 #include "OgreConfig.h"
-#include "OgreMath.h"
-#include "OgreMatrix3.h"
-#include "OgreMatrix4.h"
-#include "OgrePlane.h"
+#include "CmMath.h"
+#include "CmMatrix3.h"
+#include "CmMatrix4.h"
+#include "CmPlane.h"
 #include "OgrePlatform.h"
 #include "OgrePlatform.h"
 #include "OgrePrerequisites.h"
 #include "OgrePrerequisites.h"
-#include "OgreQuaternion.h"
+#include "CmQuaternion.h"
 #include "OgreString.h"
 #include "OgreString.h"
 #include "OgreStringConverter.h"
 #include "OgreStringConverter.h"
 #include "OgreThreadDefines.h"
 #include "OgreThreadDefines.h"
-#include "OgreVector2.h"
-#include "OgreVector3.h"
-#include "OgreVector4.h"
+#include "CmVector2.h"
+#include "CmVector3.h"
+#include "CmVector4.h"
 #include "OgreHardwareBuffer.h"
 #include "OgreHardwareBuffer.h"
 
 
 #include "OgreD3D9Prerequisites.h"
 #include "OgreD3D9Prerequisites.h"

+ 6 - 25
CamelotRenderer/CamelotRenderer.vcxproj

@@ -56,12 +56,13 @@
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;CM_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;CM_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;RenderSystemGL/Source/nvparse;RenderSystemGL/Source/atifs/include;RenderSystemGL/Source/GLSL/include;RenderSystemGL/Source/win32;RenderSystemGL/Source/nvparse/winheaders;.;RenderSystemGL/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;RenderSystemGL/Source/nvparse;RenderSystemGL/Source/atifs/include;RenderSystemGL/Source/GLSL/include;RenderSystemGL/Source/win32;RenderSystemGL/Source/nvparse/winheaders;.;RenderSystemGL/Include;../CamelotUtility/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>NotSet</SubSystem>
       <SubSystem>NotSet</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>d3d9.lib;d3dx9.lib;DxErr.lib;dxguid.lib;glu32.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>d3d9.lib;d3dx9.lib;DxErr.lib;dxguid.lib;glu32.lib;opengl32.lib;CamelotUtility.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>../lib/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -73,14 +74,15 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;CM_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;CM_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;RenderSystemGL/Source/nvparse;RenderSystemGL/Source/atifs/include;RenderSystemGL/Source/GLSL/include;RenderSystemGL/Source/win32;RenderSystemGL/Source/nvparse/winheaders;.;RenderSystemGL/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;RenderSystemGL/Source/nvparse;RenderSystemGL/Source/atifs/include;RenderSystemGL/Source/GLSL/include;RenderSystemGL/Source/win32;RenderSystemGL/Source/nvparse/winheaders;.;RenderSystemGL/Include;../CamelotUtility/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>NotSet</SubSystem>
       <SubSystem>NotSet</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>d3d9.lib;d3dx9.lib;DxErr.lib;dxguid.lib;glu32.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>d3d9.lib;d3dx9.lib;DxErr.lib;dxguid.lib;glu32.lib;opengl32.lib;CamelotUtility.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>../lib/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
   <ItemGroup>
   <ItemGroup>
@@ -89,13 +91,11 @@
     <Text Include="TODO.txt" />
     <Text Include="TODO.txt" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <ClInclude Include="asm_math.h" />
     <ClInclude Include="CmApplication.h" />
     <ClInclude Include="CmApplication.h" />
     <ClInclude Include="CmD3D9RenderSystemFactory.h" />
     <ClInclude Include="CmD3D9RenderSystemFactory.h" />
     <ClInclude Include="CmRenderSystemFactory.h" />
     <ClInclude Include="CmRenderSystemFactory.h" />
     <ClInclude Include="CmRenderSystemManager.h" />
     <ClInclude Include="CmRenderSystemManager.h" />
     <ClInclude Include="OgreAlignedAllocator.h" />
     <ClInclude Include="OgreAlignedAllocator.h" />
-    <ClInclude Include="OgreAxisAlignedBox.h" />
     <ClInclude Include="OgreBitwise.h" />
     <ClInclude Include="OgreBitwise.h" />
     <ClInclude Include="OgreBlendMode.h" />
     <ClInclude Include="OgreBlendMode.h" />
     <ClInclude Include="OgreBuildSettings.h" />
     <ClInclude Include="OgreBuildSettings.h" />
@@ -146,17 +146,11 @@
     <ClInclude Include="OgreHighLevelGpuProgram.h" />
     <ClInclude Include="OgreHighLevelGpuProgram.h" />
     <ClInclude Include="OgreHighLevelGpuProgramManager.h" />
     <ClInclude Include="OgreHighLevelGpuProgramManager.h" />
     <ClInclude Include="OgreImageResampler.h" />
     <ClInclude Include="OgreImageResampler.h" />
-    <ClInclude Include="OgreMath.h" />
-    <ClInclude Include="OgreMatrix3.h" />
-    <ClInclude Include="OgreMatrix4.h" />
     <ClInclude Include="OgrePixelFormat.h" />
     <ClInclude Include="OgrePixelFormat.h" />
-    <ClInclude Include="OgrePlane.h" />
     <ClInclude Include="OgrePlatform.h" />
     <ClInclude Include="OgrePlatform.h" />
     <ClInclude Include="OgrePlatformInformation.h" />
     <ClInclude Include="OgrePlatformInformation.h" />
     <ClInclude Include="OgrePortMemory.h" />
     <ClInclude Include="OgrePortMemory.h" />
     <ClInclude Include="OgrePrerequisites.h" />
     <ClInclude Include="OgrePrerequisites.h" />
-    <ClInclude Include="OgreQuaternion.h" />
-    <ClInclude Include="OgreRay.h" />
     <ClInclude Include="OgreRenderOperation.h" />
     <ClInclude Include="OgreRenderOperation.h" />
     <ClInclude Include="OgreRenderSystem.h" />
     <ClInclude Include="OgreRenderSystem.h" />
     <ClInclude Include="OgreRenderSystemCapabilities.h" />
     <ClInclude Include="OgreRenderSystemCapabilities.h" />
@@ -164,7 +158,6 @@
     <ClInclude Include="OgreRenderTexture.h" />
     <ClInclude Include="OgreRenderTexture.h" />
     <ClInclude Include="OgreRenderWindow.h" />
     <ClInclude Include="OgreRenderWindow.h" />
     <ClInclude Include="OgreSingleton.h" />
     <ClInclude Include="OgreSingleton.h" />
-    <ClInclude Include="OgreSphere.h" />
     <ClInclude Include="OgreStdHeaders.h" />
     <ClInclude Include="OgreStdHeaders.h" />
     <ClInclude Include="OgreString.h" />
     <ClInclude Include="OgreString.h" />
     <ClInclude Include="OgreStringConverter.h" />
     <ClInclude Include="OgreStringConverter.h" />
@@ -172,9 +165,6 @@
     <ClInclude Include="OgreTextureManager.h" />
     <ClInclude Include="OgreTextureManager.h" />
     <ClInclude Include="OgreTextureState.h" />
     <ClInclude Include="OgreTextureState.h" />
     <ClInclude Include="OgreThreadDefines.h" />
     <ClInclude Include="OgreThreadDefines.h" />
-    <ClInclude Include="OgreVector2.h" />
-    <ClInclude Include="OgreVector3.h" />
-    <ClInclude Include="OgreVector4.h" />
     <ClInclude Include="OgreVertexIndexData.h" />
     <ClInclude Include="OgreVertexIndexData.h" />
     <ClInclude Include="OgreViewport.h" />
     <ClInclude Include="OgreViewport.h" />
     <ClInclude Include="OgreWindowEventUtilities.h" />
     <ClInclude Include="OgreWindowEventUtilities.h" />
@@ -244,7 +234,6 @@
     <ClCompile Include="CmD3D9RenderSystemFactory.cpp" />
     <ClCompile Include="CmD3D9RenderSystemFactory.cpp" />
     <ClCompile Include="CmRenderSystemManager.cpp" />
     <ClCompile Include="CmRenderSystemManager.cpp" />
     <ClCompile Include="OgreAlignedAllocator.cpp" />
     <ClCompile Include="OgreAlignedAllocator.cpp" />
-    <ClCompile Include="OgreAxisAlignedBox.cpp" />
     <ClCompile Include="OgreCamera.cpp" />
     <ClCompile Include="OgreCamera.cpp" />
     <ClCompile Include="OgreColourValue.cpp" />
     <ClCompile Include="OgreColourValue.cpp" />
     <ClCompile Include="OgreD3D9Device.cpp" />
     <ClCompile Include="OgreD3D9Device.cpp" />
@@ -284,12 +273,7 @@
     <ClCompile Include="OgreHardwareVertexBuffer.cpp" />
     <ClCompile Include="OgreHardwareVertexBuffer.cpp" />
     <ClCompile Include="OgreHighLevelGpuProgram.cpp" />
     <ClCompile Include="OgreHighLevelGpuProgram.cpp" />
     <ClCompile Include="OgreHighLevelGpuProgramManager.cpp" />
     <ClCompile Include="OgreHighLevelGpuProgramManager.cpp" />
-    <ClCompile Include="OgreMath.cpp" />
-    <ClCompile Include="OgreMatrix3.cpp" />
-    <ClCompile Include="OgreMatrix4.cpp" />
     <ClCompile Include="OgrePixelFormat.cpp" />
     <ClCompile Include="OgrePixelFormat.cpp" />
-    <ClCompile Include="OgrePlane.cpp" />
-    <ClCompile Include="OgreQuaternion.cpp" />
     <ClCompile Include="OgreRenderSystem.cpp" />
     <ClCompile Include="OgreRenderSystem.cpp" />
     <ClCompile Include="OgreRenderSystemCapabilities.cpp" />
     <ClCompile Include="OgreRenderSystemCapabilities.cpp" />
     <ClCompile Include="OgreRenderTarget.cpp" />
     <ClCompile Include="OgreRenderTarget.cpp" />
@@ -300,9 +284,6 @@
     <ClCompile Include="OgreTexture.cpp" />
     <ClCompile Include="OgreTexture.cpp" />
     <ClCompile Include="OgreTextureManager.cpp" />
     <ClCompile Include="OgreTextureManager.cpp" />
     <ClCompile Include="OgreTextureState.cpp" />
     <ClCompile Include="OgreTextureState.cpp" />
-    <ClCompile Include="OgreVector2.cpp" />
-    <ClCompile Include="OgreVector3.cpp" />
-    <ClCompile Include="OgreVector4.cpp" />
     <ClCompile Include="OgreVertexIndexData.cpp" />
     <ClCompile Include="OgreVertexIndexData.cpp" />
     <ClCompile Include="OgreViewport.cpp" />
     <ClCompile Include="OgreViewport.cpp" />
     <ClCompile Include="OgreWindowEventUtilities.cpp" />
     <ClCompile Include="OgreWindowEventUtilities.cpp" />

+ 0 - 69
CamelotRenderer/CamelotRenderer.vcxproj.filters

@@ -19,12 +19,6 @@
     <Filter Include="Source Files\D3D9RenderSystem">
     <Filter Include="Source Files\D3D9RenderSystem">
       <UniqueIdentifier>{5ab8878b-6adb-4f4a-84c4-9315abf782d2}</UniqueIdentifier>
       <UniqueIdentifier>{5ab8878b-6adb-4f4a-84c4-9315abf782d2}</UniqueIdentifier>
     </Filter>
     </Filter>
-    <Filter Include="Source Files\Math">
-      <UniqueIdentifier>{7b4cde3b-6ac1-46bc-aa5b-c642d1e86d27}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Header Files\Math">
-      <UniqueIdentifier>{8eee0d37-16d4-4894-aa09-7103c1d2b9c4}</UniqueIdentifier>
-    </Filter>
     <Filter Include="Header Files\ForRemoval">
     <Filter Include="Header Files\ForRemoval">
       <UniqueIdentifier>{f916bd59-03a7-42a7-9b9c-60abe94020bc}</UniqueIdentifier>
       <UniqueIdentifier>{f916bd59-03a7-42a7-9b9c-60abe94020bc}</UniqueIdentifier>
     </Filter>
     </Filter>
@@ -101,42 +95,6 @@
     <ClInclude Include="OgreDefaultHardwareBufferManager.h">
     <ClInclude Include="OgreDefaultHardwareBufferManager.h">
       <Filter>Header Files</Filter>
       <Filter>Header Files</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="asm_math.h">
-      <Filter>Header Files\Math</Filter>
-    </ClInclude>
-    <ClInclude Include="OgreAxisAlignedBox.h">
-      <Filter>Header Files\Math</Filter>
-    </ClInclude>
-    <ClInclude Include="OgreMath.h">
-      <Filter>Header Files\Math</Filter>
-    </ClInclude>
-    <ClInclude Include="OgreMatrix3.h">
-      <Filter>Header Files\Math</Filter>
-    </ClInclude>
-    <ClInclude Include="OgreMatrix4.h">
-      <Filter>Header Files\Math</Filter>
-    </ClInclude>
-    <ClInclude Include="OgrePlane.h">
-      <Filter>Header Files\Math</Filter>
-    </ClInclude>
-    <ClInclude Include="OgreQuaternion.h">
-      <Filter>Header Files\Math</Filter>
-    </ClInclude>
-    <ClInclude Include="OgreRay.h">
-      <Filter>Header Files\Math</Filter>
-    </ClInclude>
-    <ClInclude Include="OgreSphere.h">
-      <Filter>Header Files\Math</Filter>
-    </ClInclude>
-    <ClInclude Include="OgreVector2.h">
-      <Filter>Header Files\Math</Filter>
-    </ClInclude>
-    <ClInclude Include="OgreVector3.h">
-      <Filter>Header Files\Math</Filter>
-    </ClInclude>
-    <ClInclude Include="OgreVector4.h">
-      <Filter>Header Files\Math</Filter>
-    </ClInclude>
     <ClInclude Include="OgreBitwise.h">
     <ClInclude Include="OgreBitwise.h">
       <Filter>Header Files\ForRemoval</Filter>
       <Filter>Header Files\ForRemoval</Filter>
     </ClInclude>
     </ClInclude>
@@ -541,33 +499,6 @@
     <ClCompile Include="OgreDefaultHardwareBufferManager.cpp">
     <ClCompile Include="OgreDefaultHardwareBufferManager.cpp">
       <Filter>Source Files</Filter>
       <Filter>Source Files</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="OgreMath.cpp">
-      <Filter>Source Files\Math</Filter>
-    </ClCompile>
-    <ClCompile Include="OgreMatrix3.cpp">
-      <Filter>Source Files\Math</Filter>
-    </ClCompile>
-    <ClCompile Include="OgreMatrix4.cpp">
-      <Filter>Source Files\Math</Filter>
-    </ClCompile>
-    <ClCompile Include="OgrePlane.cpp">
-      <Filter>Source Files\Math</Filter>
-    </ClCompile>
-    <ClCompile Include="OgreQuaternion.cpp">
-      <Filter>Source Files\Math</Filter>
-    </ClCompile>
-    <ClCompile Include="OgreVector2.cpp">
-      <Filter>Source Files\Math</Filter>
-    </ClCompile>
-    <ClCompile Include="OgreVector3.cpp">
-      <Filter>Source Files\Math</Filter>
-    </ClCompile>
-    <ClCompile Include="OgreVector4.cpp">
-      <Filter>Source Files\Math</Filter>
-    </ClCompile>
-    <ClCompile Include="OgreAxisAlignedBox.cpp">
-      <Filter>Source Files\Math</Filter>
-    </ClCompile>
     <ClCompile Include="OgreAlignedAllocator.cpp">
     <ClCompile Include="OgreAlignedAllocator.cpp">
       <Filter>Source Files\ForRemoval</Filter>
       <Filter>Source Files\ForRemoval</Filter>
     </ClCompile>
     </ClCompile>

+ 0 - 35
CamelotRenderer/OgreAxisAlignedBox.cpp

@@ -1,35 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-(Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#include "OgreAxisAlignedBox.h"
-
-namespace CamelotEngine
-{
-	const AxisAlignedBox AxisAlignedBox::BOX_NULL;
-	const AxisAlignedBox AxisAlignedBox::BOX_INFINITE(AxisAlignedBox::EXTENT_INFINITE);
-}
-

+ 0 - 813
CamelotRenderer/OgreAxisAlignedBox.h

@@ -1,813 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-(Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __AxisAlignedBox_H_
-#define __AxisAlignedBox_H_
-
-// Precompiler options
-#include "OgrePrerequisites.h"
-
-#include "OgreVector3.h"
-#include "OgreMatrix4.h"
-
-namespace CamelotEngine {
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Math
-	*  @{
-	*/
-
-	/** A 3D box aligned with the x/y/z axes.
-	@remarks
-	This class represents a simple box which is aligned with the
-	axes. Internally it only stores 2 points as the extremeties of
-	the box, one which is the minima of all 3 axes, and the other
-	which is the maxima of all 3 axes. This class is typically used
-	for an axis-aligned bounding box (AABB) for collision and
-	visibility determination.
-	*/
-	class CM_EXPORT AxisAlignedBox
-	{
-	public:
-		enum Extent
-		{
-			EXTENT_NULL,
-			EXTENT_FINITE,
-			EXTENT_INFINITE
-		};
-	protected:
-
-		Vector3 mMinimum;
-		Vector3 mMaximum;
-		Extent mExtent;
-		mutable Vector3* mpCorners;
-
-	public:
-		/*
-		1-----2
-		/|    /|
-		/ |   / |
-		5-----4  |
-		|  0--|--3
-		| /   | /
-		|/    |/
-		6-----7
-		*/
-		typedef enum {
-			FAR_LEFT_BOTTOM = 0,
-			FAR_LEFT_TOP = 1,
-			FAR_RIGHT_TOP = 2,
-			FAR_RIGHT_BOTTOM = 3,
-			NEAR_RIGHT_BOTTOM = 7,
-			NEAR_LEFT_BOTTOM = 6,
-			NEAR_LEFT_TOP = 5,
-			NEAR_RIGHT_TOP = 4
-		} CornerEnum;
-		inline AxisAlignedBox() : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mpCorners(0)
-		{
-			// Default to a null box 
-			setMinimum( -0.5, -0.5, -0.5 );
-			setMaximum( 0.5, 0.5, 0.5 );
-			mExtent = EXTENT_NULL;
-		}
-		inline AxisAlignedBox(Extent e) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mpCorners(0)
-		{
-			setMinimum( -0.5, -0.5, -0.5 );
-			setMaximum( 0.5, 0.5, 0.5 );
-			mExtent = e;
-		}
-
-		inline AxisAlignedBox(const AxisAlignedBox & rkBox) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mpCorners(0)
-
-		{
-			if (rkBox.isNull())
-				setNull();
-			else if (rkBox.isInfinite())
-				setInfinite();
-			else
-				setExtents( rkBox.mMinimum, rkBox.mMaximum );
-		}
-
-		inline AxisAlignedBox( const Vector3& min, const Vector3& max ) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mpCorners(0)
-		{
-			setExtents( min, max );
-		}
-
-		inline AxisAlignedBox(
-			Real mx, Real my, Real mz,
-			Real Mx, Real My, Real Mz ) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mpCorners(0)
-		{
-			setExtents( mx, my, mz, Mx, My, Mz );
-		}
-
-		AxisAlignedBox& operator=(const AxisAlignedBox& rhs)
-		{
-			// Specifically override to avoid copying mpCorners
-			if (rhs.isNull())
-				setNull();
-			else if (rhs.isInfinite())
-				setInfinite();
-			else
-				setExtents(rhs.mMinimum, rhs.mMaximum);
-
-			return *this;
-		}
-
-		~AxisAlignedBox()
-		{
-			if (mpCorners)
-				free(mpCorners);
-		}
-
-
-		/** Gets the minimum corner of the box.
-		*/
-		inline const Vector3& getMinimum(void) const
-		{ 
-			return mMinimum; 
-		}
-
-		/** Gets a modifiable version of the minimum
-		corner of the box.
-		*/
-		inline Vector3& getMinimum(void)
-		{ 
-			return mMinimum; 
-		}
-
-		/** Gets the maximum corner of the box.
-		*/
-		inline const Vector3& getMaximum(void) const
-		{ 
-			return mMaximum;
-		}
-
-		/** Gets a modifiable version of the maximum
-		corner of the box.
-		*/
-		inline Vector3& getMaximum(void)
-		{ 
-			return mMaximum;
-		}
-
-
-		/** Sets the minimum corner of the box.
-		*/
-		inline void setMinimum( const Vector3& vec )
-		{
-			mExtent = EXTENT_FINITE;
-			mMinimum = vec;
-		}
-
-		inline void setMinimum( Real x, Real y, Real z )
-		{
-			mExtent = EXTENT_FINITE;
-			mMinimum.x = x;
-			mMinimum.y = y;
-			mMinimum.z = z;
-		}
-
-		/** Changes one of the components of the minimum corner of the box
-		used to resize only one dimension of the box
-		*/
-		inline void setMinimumX(Real x)
-		{
-			mMinimum.x = x;
-		}
-
-		inline void setMinimumY(Real y)
-		{
-			mMinimum.y = y;
-		}
-
-		inline void setMinimumZ(Real z)
-		{
-			mMinimum.z = z;
-		}
-
-		/** Sets the maximum corner of the box.
-		*/
-		inline void setMaximum( const Vector3& vec )
-		{
-			mExtent = EXTENT_FINITE;
-			mMaximum = vec;
-		}
-
-		inline void setMaximum( Real x, Real y, Real z )
-		{
-			mExtent = EXTENT_FINITE;
-			mMaximum.x = x;
-			mMaximum.y = y;
-			mMaximum.z = z;
-		}
-
-		/** Changes one of the components of the maximum corner of the box
-		used to resize only one dimension of the box
-		*/
-		inline void setMaximumX( Real x )
-		{
-			mMaximum.x = x;
-		}
-
-		inline void setMaximumY( Real y )
-		{
-			mMaximum.y = y;
-		}
-
-		inline void setMaximumZ( Real z )
-		{
-			mMaximum.z = z;
-		}
-
-		/** Sets both minimum and maximum extents at once.
-		*/
-		inline void setExtents( const Vector3& min, const Vector3& max )
-		{
-            assert( (min.x <= max.x && min.y <= max.y && min.z <= max.z) &&
-                "The minimum corner of the box must be less than or equal to maximum corner" );
-
-			mExtent = EXTENT_FINITE;
-			mMinimum = min;
-			mMaximum = max;
-		}
-
-		inline void setExtents(
-			Real mx, Real my, Real mz,
-			Real Mx, Real My, Real Mz )
-		{
-            assert( (mx <= Mx && my <= My && mz <= Mz) &&
-                "The minimum corner of the box must be less than or equal to maximum corner" );
-
-			mExtent = EXTENT_FINITE;
-
-			mMinimum.x = mx;
-			mMinimum.y = my;
-			mMinimum.z = mz;
-
-			mMaximum.x = Mx;
-			mMaximum.y = My;
-			mMaximum.z = Mz;
-
-		}
-
-		/** Returns a pointer to an array of 8 corner points, useful for
-		collision vs. non-aligned objects.
-		@remarks
-		If the order of these corners is important, they are as
-		follows: The 4 points of the minimum Z face (note that
-		because Ogre uses right-handed coordinates, the minimum Z is
-		at the 'back' of the box) starting with the minimum point of
-		all, then anticlockwise around this face (if you are looking
-		onto the face from outside the box). Then the 4 points of the
-		maximum Z face, starting with maximum point of all, then
-		anticlockwise around this face (looking onto the face from
-		outside the box). Like this:
-		<pre>
-		1-----2
-		/|    /|
-		/ |   / |
-		5-----4  |
-		|  0--|--3
-		| /   | /
-		|/    |/
-		6-----7
-		</pre>
-		@remarks as this implementation uses a static member, make sure to use your own copy !
-		*/
-		inline const Vector3* getAllCorners(void) const
-		{
-			assert( (mExtent == EXTENT_FINITE) && "Can't get corners of a null or infinite AAB" );
-
-			// The order of these items is, using right-handed co-ordinates:
-			// Minimum Z face, starting with Min(all), then anticlockwise
-			//   around face (looking onto the face)
-			// Maximum Z face, starting with Max(all), then anticlockwise
-			//   around face (looking onto the face)
-			// Only for optimization/compatibility.
-			if (!mpCorners)
-				mpCorners = (Vector3*)malloc(sizeof(Vector3) * 8);
-
-			mpCorners[0] = mMinimum;
-			mpCorners[1].x = mMinimum.x; mpCorners[1].y = mMaximum.y; mpCorners[1].z = mMinimum.z;
-			mpCorners[2].x = mMaximum.x; mpCorners[2].y = mMaximum.y; mpCorners[2].z = mMinimum.z;
-			mpCorners[3].x = mMaximum.x; mpCorners[3].y = mMinimum.y; mpCorners[3].z = mMinimum.z;            
-
-			mpCorners[4] = mMaximum;
-			mpCorners[5].x = mMinimum.x; mpCorners[5].y = mMaximum.y; mpCorners[5].z = mMaximum.z;
-			mpCorners[6].x = mMinimum.x; mpCorners[6].y = mMinimum.y; mpCorners[6].z = mMaximum.z;
-			mpCorners[7].x = mMaximum.x; mpCorners[7].y = mMinimum.y; mpCorners[7].z = mMaximum.z;
-
-			return mpCorners;
-		}
-
-		/** gets the position of one of the corners
-		*/
-		Vector3 getCorner(CornerEnum cornerToGet) const
-		{
-			switch(cornerToGet)
-			{
-			case FAR_LEFT_BOTTOM:
-				return mMinimum;
-			case FAR_LEFT_TOP:
-				return Vector3(mMinimum.x, mMaximum.y, mMinimum.z);
-			case FAR_RIGHT_TOP:
-				return Vector3(mMaximum.x, mMaximum.y, mMinimum.z);
-			case FAR_RIGHT_BOTTOM:
-				return Vector3(mMaximum.x, mMinimum.y, mMinimum.z);
-			case NEAR_RIGHT_BOTTOM:
-				return Vector3(mMaximum.x, mMinimum.y, mMaximum.z);
-			case NEAR_LEFT_BOTTOM:
-				return Vector3(mMinimum.x, mMinimum.y, mMaximum.z);
-			case NEAR_LEFT_TOP:
-				return Vector3(mMinimum.x, mMaximum.y, mMaximum.z);
-			case NEAR_RIGHT_TOP:
-				return mMaximum;
-			default:
-				return Vector3();
-			}
-		}
-
-		CM_EXPORT friend std::ostream& operator<<( std::ostream& o, const AxisAlignedBox aab )
-		{
-			switch (aab.mExtent)
-			{
-			case EXTENT_NULL:
-				o << "AxisAlignedBox(null)";
-				return o;
-
-			case EXTENT_FINITE:
-				o << "AxisAlignedBox(min=" << aab.mMinimum << ", max=" << aab.mMaximum << ")";
-				return o;
-
-			case EXTENT_INFINITE:
-				o << "AxisAlignedBox(infinite)";
-				return o;
-
-			default: // shut up compiler
-				assert( false && "Never reached" );
-				return o;
-			}
-		}
-
-		/** Merges the passed in box into the current box. The result is the
-		box which encompasses both.
-		*/
-		void merge( const AxisAlignedBox& rhs )
-		{
-			// Do nothing if rhs null, or this is infinite
-			if ((rhs.mExtent == EXTENT_NULL) || (mExtent == EXTENT_INFINITE))
-			{
-				return;
-			}
-			// Otherwise if rhs is infinite, make this infinite, too
-			else if (rhs.mExtent == EXTENT_INFINITE)
-			{
-				mExtent = EXTENT_INFINITE;
-			}
-			// Otherwise if current null, just take rhs
-			else if (mExtent == EXTENT_NULL)
-			{
-				setExtents(rhs.mMinimum, rhs.mMaximum);
-			}
-			// Otherwise merge
-			else
-			{
-				Vector3 min = mMinimum;
-				Vector3 max = mMaximum;
-				max.makeCeil(rhs.mMaximum);
-				min.makeFloor(rhs.mMinimum);
-
-				setExtents(min, max);
-			}
-
-		}
-
-		/** Extends the box to encompass the specified point (if needed).
-		*/
-		inline void merge( const Vector3& point )
-		{
-			switch (mExtent)
-			{
-			case EXTENT_NULL: // if null, use this point
-				setExtents(point, point);
-				return;
-
-			case EXTENT_FINITE:
-				mMaximum.makeCeil(point);
-				mMinimum.makeFloor(point);
-				return;
-
-			case EXTENT_INFINITE: // if infinite, makes no difference
-				return;
-			}
-
-			assert( false && "Never reached" );
-		}
-
-		/** Transforms the box according to the matrix supplied.
-		@remarks
-		By calling this method you get the axis-aligned box which
-		surrounds the transformed version of this box. Therefore each
-		corner of the box is transformed by the matrix, then the
-		extents are mapped back onto the axes to produce another
-		AABB. Useful when you have a local AABB for an object which
-		is then transformed.
-		*/
-		inline void transform( const Matrix4& matrix )
-		{
-			// Do nothing if current null or infinite
-			if( mExtent != EXTENT_FINITE )
-				return;
-
-			Vector3 oldMin, oldMax, currentCorner;
-
-			// Getting the old values so that we can use the existing merge method.
-			oldMin = mMinimum;
-			oldMax = mMaximum;
-
-			// reset
-			setNull();
-
-			// We sequentially compute the corners in the following order :
-			// 0, 6, 5, 1, 2, 4 ,7 , 3
-			// This sequence allows us to only change one member at a time to get at all corners.
-
-			// For each one, we transform it using the matrix
-			// Which gives the resulting point and merge the resulting point.
-
-			// First corner 
-			// min min min
-			currentCorner = oldMin;
-			merge( matrix * currentCorner );
-
-			// min,min,max
-			currentCorner.z = oldMax.z;
-			merge( matrix * currentCorner );
-
-			// min max max
-			currentCorner.y = oldMax.y;
-			merge( matrix * currentCorner );
-
-			// min max min
-			currentCorner.z = oldMin.z;
-			merge( matrix * currentCorner );
-
-			// max max min
-			currentCorner.x = oldMax.x;
-			merge( matrix * currentCorner );
-
-			// max max max
-			currentCorner.z = oldMax.z;
-			merge( matrix * currentCorner );
-
-			// max min max
-			currentCorner.y = oldMin.y;
-			merge( matrix * currentCorner );
-
-			// max min min
-			currentCorner.z = oldMin.z;
-			merge( matrix * currentCorner ); 
-		}
-
-		/** Transforms the box according to the affine matrix supplied.
-		@remarks
-		By calling this method you get the axis-aligned box which
-		surrounds the transformed version of this box. Therefore each
-		corner of the box is transformed by the matrix, then the
-		extents are mapped back onto the axes to produce another
-		AABB. Useful when you have a local AABB for an object which
-		is then transformed.
-		@note
-		The matrix must be an affine matrix. @see Matrix4::isAffine.
-		*/
-		void transformAffine(const Matrix4& m)
-		{
-			assert(m.isAffine());
-
-			// Do nothing if current null or infinite
-			if ( mExtent != EXTENT_FINITE )
-				return;
-
-			Vector3 centre = getCenter();
-			Vector3 halfSize = getHalfSize();
-
-			Vector3 newCentre = m.transformAffine(centre);
-			Vector3 newHalfSize(
-				Math::Abs(m[0][0]) * halfSize.x + Math::Abs(m[0][1]) * halfSize.y + Math::Abs(m[0][2]) * halfSize.z, 
-				Math::Abs(m[1][0]) * halfSize.x + Math::Abs(m[1][1]) * halfSize.y + Math::Abs(m[1][2]) * halfSize.z,
-				Math::Abs(m[2][0]) * halfSize.x + Math::Abs(m[2][1]) * halfSize.y + Math::Abs(m[2][2]) * halfSize.z);
-
-			setExtents(newCentre - newHalfSize, newCentre + newHalfSize);
-		}
-
-		/** Sets the box to a 'null' value i.e. not a box.
-		*/
-		inline void setNull()
-		{
-			mExtent = EXTENT_NULL;
-		}
-
-		/** Returns true if the box is null i.e. empty.
-		*/
-		inline bool isNull(void) const
-		{
-			return (mExtent == EXTENT_NULL);
-		}
-
-		/** Returns true if the box is finite.
-		*/
-		bool isFinite(void) const
-		{
-			return (mExtent == EXTENT_FINITE);
-		}
-
-		/** Sets the box to 'infinite'
-		*/
-		inline void setInfinite()
-		{
-			mExtent = EXTENT_INFINITE;
-		}
-
-		/** Returns true if the box is infinite.
-		*/
-		bool isInfinite(void) const
-		{
-			return (mExtent == EXTENT_INFINITE);
-		}
-
-		/** Returns whether or not this box intersects another. */
-		inline bool intersects(const AxisAlignedBox& b2) const
-		{
-			// Early-fail for nulls
-			if (this->isNull() || b2.isNull())
-				return false;
-
-			// Early-success for infinites
-			if (this->isInfinite() || b2.isInfinite())
-				return true;
-
-			// Use up to 6 separating planes
-			if (mMaximum.x < b2.mMinimum.x)
-				return false;
-			if (mMaximum.y < b2.mMinimum.y)
-				return false;
-			if (mMaximum.z < b2.mMinimum.z)
-				return false;
-
-			if (mMinimum.x > b2.mMaximum.x)
-				return false;
-			if (mMinimum.y > b2.mMaximum.y)
-				return false;
-			if (mMinimum.z > b2.mMaximum.z)
-				return false;
-
-			// otherwise, must be intersecting
-			return true;
-
-		}
-
-		/// Calculate the area of intersection of this box and another
-		inline AxisAlignedBox intersection(const AxisAlignedBox& b2) const
-		{
-            if (this->isNull() || b2.isNull())
-			{
-				return AxisAlignedBox();
-			}
-			else if (this->isInfinite())
-			{
-				return b2;
-			}
-			else if (b2.isInfinite())
-			{
-				return *this;
-			}
-
-			Vector3 intMin = mMinimum;
-            Vector3 intMax = mMaximum;
-
-            intMin.makeCeil(b2.getMinimum());
-            intMax.makeFloor(b2.getMaximum());
-
-            // Check intersection isn't null
-            if (intMin.x < intMax.x &&
-                intMin.y < intMax.y &&
-                intMin.z < intMax.z)
-            {
-                return AxisAlignedBox(intMin, intMax);
-            }
-
-            return AxisAlignedBox();
-		}
-
-		/// Calculate the volume of this box
-		Real volume(void) const
-		{
-			switch (mExtent)
-			{
-			case EXTENT_NULL:
-				return 0.0f;
-
-			case EXTENT_FINITE:
-				{
-					Vector3 diff = mMaximum - mMinimum;
-					return diff.x * diff.y * diff.z;
-				}
-
-			case EXTENT_INFINITE:
-				return Math::POS_INFINITY;
-
-			default: // shut up compiler
-				assert( false && "Never reached" );
-				return 0.0f;
-			}
-		}
-
-		/** Scales the AABB by the vector given. */
-		inline void scale(const Vector3& s)
-		{
-			// Do nothing if current null or infinite
-			if (mExtent != EXTENT_FINITE)
-				return;
-
-			// NB assumes centered on origin
-			Vector3 min = mMinimum * s;
-			Vector3 max = mMaximum * s;
-			setExtents(min, max);
-		}
-
-		/** Tests whether this box intersects a sphere. */
-		bool intersects(const Sphere& s) const
-		{
-			return Math::intersects(s, *this); 
-		}
-		/** Tests whether this box intersects a plane. */
-		bool intersects(const Plane& p) const
-		{
-			return Math::intersects(p, *this);
-		}
-		/** Tests whether the vector point is within this box. */
-		bool intersects(const Vector3& v) const
-		{
-			switch (mExtent)
-			{
-			case EXTENT_NULL:
-				return false;
-
-			case EXTENT_FINITE:
-				return(v.x >= mMinimum.x  &&  v.x <= mMaximum.x  && 
-					v.y >= mMinimum.y  &&  v.y <= mMaximum.y  && 
-					v.z >= mMinimum.z  &&  v.z <= mMaximum.z);
-
-			case EXTENT_INFINITE:
-				return true;
-
-			default: // shut up compiler
-				assert( false && "Never reached" );
-				return false;
-			}
-		}
-		/// Gets the centre of the box
-		Vector3 getCenter(void) const
-		{
-			assert( (mExtent == EXTENT_FINITE) && "Can't get center of a null or infinite AAB" );
-
-			return Vector3(
-				(mMaximum.x + mMinimum.x) * 0.5f,
-				(mMaximum.y + mMinimum.y) * 0.5f,
-				(mMaximum.z + mMinimum.z) * 0.5f);
-		}
-		/// Gets the size of the box
-		Vector3 getSize(void) const
-		{
-			switch (mExtent)
-			{
-			case EXTENT_NULL:
-				return Vector3::ZERO;
-
-			case EXTENT_FINITE:
-				return mMaximum - mMinimum;
-
-			case EXTENT_INFINITE:
-				return Vector3(
-					Math::POS_INFINITY,
-					Math::POS_INFINITY,
-					Math::POS_INFINITY);
-
-			default: // shut up compiler
-				assert( false && "Never reached" );
-				return Vector3::ZERO;
-			}
-		}
-		/// Gets the half-size of the box
-		Vector3 getHalfSize(void) const
-		{
-			switch (mExtent)
-			{
-			case EXTENT_NULL:
-				return Vector3::ZERO;
-
-			case EXTENT_FINITE:
-				return (mMaximum - mMinimum) * 0.5;
-
-			case EXTENT_INFINITE:
-				return Vector3(
-					Math::POS_INFINITY,
-					Math::POS_INFINITY,
-					Math::POS_INFINITY);
-
-			default: // shut up compiler
-				assert( false && "Never reached" );
-				return Vector3::ZERO;
-			}
-		}
-
-        /** Tests whether the given point contained by this box.
-        */
-        bool contains(const Vector3& v) const
-        {
-            if (isNull())
-                return false;
-            if (isInfinite())
-                return true;
-
-            return mMinimum.x <= v.x && v.x <= mMaximum.x &&
-                   mMinimum.y <= v.y && v.y <= mMaximum.y &&
-                   mMinimum.z <= v.z && v.z <= mMaximum.z;
-        }
-
-        /** Tests whether another box contained by this box.
-        */
-        bool contains(const AxisAlignedBox& other) const
-        {
-            if (other.isNull() || this->isInfinite())
-                return true;
-
-            if (this->isNull() || other.isInfinite())
-                return false;
-
-            return this->mMinimum.x <= other.mMinimum.x &&
-                   this->mMinimum.y <= other.mMinimum.y &&
-                   this->mMinimum.z <= other.mMinimum.z &&
-                   other.mMaximum.x <= this->mMaximum.x &&
-                   other.mMaximum.y <= this->mMaximum.y &&
-                   other.mMaximum.z <= this->mMaximum.z;
-        }
-
-        /** Tests 2 boxes for equality.
-        */
-        bool operator== (const AxisAlignedBox& rhs) const
-        {
-            if (this->mExtent != rhs.mExtent)
-                return false;
-
-            if (!this->isFinite())
-                return true;
-
-            return this->mMinimum == rhs.mMinimum &&
-                   this->mMaximum == rhs.mMaximum;
-        }
-
-        /** Tests 2 boxes for inequality.
-        */
-        bool operator!= (const AxisAlignedBox& rhs) const
-        {
-            return !(*this == rhs);
-        }
-
-		// special values
-		static const AxisAlignedBox BOX_NULL;
-		static const AxisAlignedBox BOX_INFINITE;
-
-
-	};
-
-	/** @} */
-	/** @} */
-} // namespace CamelotEngine
-
-#endif

+ 34 - 34
CamelotRenderer/OgreBitwise.h

@@ -57,7 +57,7 @@ namespace CamelotEngine {
             @note 0 and 1 are powers of two, so 
             @note 0 and 1 are powers of two, so 
                 firstPO2From(0)==0 and firstPO2From(1)==1.
                 firstPO2From(0)==0 and firstPO2From(1)==1.
         */
         */
-        static FORCEINLINE uint32 firstPO2From(uint32 n)
+        static FORCEINLINE UINT32 firstPO2From(UINT32 n)
         {
         {
             --n;            
             --n;            
             n |= n >> 16;
             n |= n >> 16;
@@ -124,7 +124,7 @@ namespace CamelotEngine {
          * Convert N bit colour channel value to P bits. It fills P bits with the
          * Convert N bit colour channel value to P bits. It fills P bits with the
          * bit pattern repeated. (this is /((1<<n)-1) in fixed point)
          * bit pattern repeated. (this is /((1<<n)-1) in fixed point)
          */
          */
-        static inline unsigned int fixedToFixed(uint32 value, unsigned int n, unsigned int p) 
+        static inline unsigned int fixedToFixed(UINT32 value, unsigned int n, unsigned int p) 
         {
         {
             if(n > p) 
             if(n > p) 
             {
             {
@@ -170,24 +170,24 @@ namespace CamelotEngine {
         {
         {
             switch(n) {
             switch(n) {
                 case 1:
                 case 1:
-                    ((uint8*)dest)[0] = (uint8)value;
+                    ((UINT8*)dest)[0] = (UINT8)value;
                     break;
                     break;
                 case 2:
                 case 2:
-                    ((uint16*)dest)[0] = (uint16)value;
+                    ((UINT16*)dest)[0] = (UINT16)value;
                     break;
                     break;
                 case 3:
                 case 3:
 #if OGRE_ENDIAN == OGRE_ENDIAN_BIG      
 #if OGRE_ENDIAN == OGRE_ENDIAN_BIG      
-                    ((uint8*)dest)[0] = (uint8)((value >> 16) & 0xFF);
-                    ((uint8*)dest)[1] = (uint8)((value >> 8) & 0xFF);
-                    ((uint8*)dest)[2] = (uint8)(value & 0xFF);
+                    ((UINT8*)dest)[0] = (UINT8)((value >> 16) & 0xFF);
+                    ((UINT8*)dest)[1] = (UINT8)((value >> 8) & 0xFF);
+                    ((UINT8*)dest)[2] = (UINT8)(value & 0xFF);
 #else
 #else
-                    ((uint8*)dest)[2] = (uint8)((value >> 16) & 0xFF);
-                    ((uint8*)dest)[1] = (uint8)((value >> 8) & 0xFF);
-                    ((uint8*)dest)[0] = (uint8)(value & 0xFF);
+                    ((UINT8*)dest)[2] = (UINT8)((value >> 16) & 0xFF);
+                    ((UINT8*)dest)[1] = (UINT8)((value >> 8) & 0xFF);
+                    ((UINT8*)dest)[0] = (UINT8)(value & 0xFF);
 #endif
 #endif
                     break;
                     break;
                 case 4:
                 case 4:
-                    ((uint32*)dest)[0] = (uint32)value;                
+                    ((UINT32*)dest)[0] = (UINT32)value;                
                     break;                
                     break;                
             }        
             }        
         }
         }
@@ -197,21 +197,21 @@ namespace CamelotEngine {
         static inline unsigned int intRead(const void *src, int n) {
         static inline unsigned int intRead(const void *src, int n) {
             switch(n) {
             switch(n) {
                 case 1:
                 case 1:
-                    return ((uint8*)src)[0];
+                    return ((UINT8*)src)[0];
                 case 2:
                 case 2:
-                    return ((uint16*)src)[0];
+                    return ((UINT16*)src)[0];
                 case 3:
                 case 3:
 #if OGRE_ENDIAN == OGRE_ENDIAN_BIG      
 #if OGRE_ENDIAN == OGRE_ENDIAN_BIG      
-                    return ((uint32)((uint8*)src)[0]<<16)|
-                            ((uint32)((uint8*)src)[1]<<8)|
-                            ((uint32)((uint8*)src)[2]);
+                    return ((UINT32)((UINT8*)src)[0]<<16)|
+                            ((UINT32)((UINT8*)src)[1]<<8)|
+                            ((UINT32)((UINT8*)src)[2]);
 #else
 #else
-                    return ((uint32)((uint8*)src)[0])|
-                            ((uint32)((uint8*)src)[1]<<8)|
-                            ((uint32)((uint8*)src)[2]<<16);
+                    return ((UINT32)((UINT8*)src)[0])|
+                            ((UINT32)((UINT8*)src)[1]<<8)|
+                            ((UINT32)((UINT8*)src)[2]<<16);
 #endif
 #endif
                 case 4:
                 case 4:
-                    return ((uint32*)src)[0];
+                    return ((UINT32*)src)[0];
             } 
             } 
             return 0; // ?
             return 0; // ?
         }
         }
@@ -219,15 +219,15 @@ namespace CamelotEngine {
         /** Convert a float32 to a float16 (NV_half_float)
         /** Convert a float32 to a float16 (NV_half_float)
          	Courtesy of OpenEXR
          	Courtesy of OpenEXR
         */
         */
-        static inline uint16 floatToHalf(float i)
+        static inline UINT16 floatToHalf(float i)
         {
         {
-            union { float f; uint32 i; } v;
+            union { float f; UINT32 i; } v;
             v.f = i;
             v.f = i;
             return floatToHalfI(v.i);
             return floatToHalfI(v.i);
         }
         }
-		/** Converts float in uint32 format to a a half in uint16 format
+		/** Converts float in UINT32 format to a a half in UINT16 format
 		*/
 		*/
-        static inline uint16 floatToHalfI(uint32 i)
+        static inline UINT16 floatToHalfI(UINT32 i)
         {
         {
             register int s =  (i >> 16) & 0x00008000;
             register int s =  (i >> 16) & 0x00008000;
             register int e = ((i >> 23) & 0x000000ff) - (127 - 15);
             register int e = ((i >> 23) & 0x000000ff) - (127 - 15);
@@ -241,28 +241,28 @@ namespace CamelotEngine {
                 }
                 }
                 m = (m | 0x00800000) >> (1 - e);
                 m = (m | 0x00800000) >> (1 - e);
         
         
-                return static_cast<uint16>(s | (m >> 13));
+                return static_cast<UINT16>(s | (m >> 13));
             }
             }
             else if (e == 0xff - (127 - 15))
             else if (e == 0xff - (127 - 15))
             {
             {
                 if (m == 0) // Inf
                 if (m == 0) // Inf
                 {
                 {
-                    return static_cast<uint16>(s | 0x7c00);
+                    return static_cast<UINT16>(s | 0x7c00);
                 } 
                 } 
                 else    // NAN
                 else    // NAN
                 {
                 {
                     m >>= 13;
                     m >>= 13;
-                    return static_cast<uint16>(s | 0x7c00 | m | (m == 0));
+                    return static_cast<UINT16>(s | 0x7c00 | m | (m == 0));
                 }
                 }
             }
             }
             else
             else
             {
             {
                 if (e > 30) // Overflow
                 if (e > 30) // Overflow
                 {
                 {
-                    return static_cast<uint16>(s | 0x7c00);
+                    return static_cast<UINT16>(s | 0x7c00);
                 }
                 }
         
         
-                return static_cast<uint16>(s | (e << 10) | (m >> 13));
+                return static_cast<UINT16>(s | (e << 10) | (m >> 13));
             }
             }
         }
         }
         
         
@@ -270,16 +270,16 @@ namespace CamelotEngine {
          * Convert a float16 (NV_half_float) to a float32
          * Convert a float16 (NV_half_float) to a float32
          * Courtesy of OpenEXR
          * Courtesy of OpenEXR
          */
          */
-        static inline float halfToFloat(uint16 y)
+        static inline float halfToFloat(UINT16 y)
         {
         {
-            union { float f; uint32 i; } v;
+            union { float f; UINT32 i; } v;
             v.i = halfToFloatI(y);
             v.i = halfToFloatI(y);
             return v.f;
             return v.f;
         }
         }
-		/** Converts a half in uint16 format to a float
-		 	in uint32 format
+		/** Converts a half in UINT16 format to a float
+		 	in UINT32 format
 		 */
 		 */
-        static inline uint32 halfToFloatI(uint16 y)
+        static inline UINT32 halfToFloatI(UINT16 y)
         {
         {
             register int s = (y >> 15) & 0x00000001;
             register int s = (y >> 15) & 0x00000001;
             register int e = (y >> 10) & 0x0000001f;
             register int e = (y >> 10) & 0x0000001f;

+ 3 - 3
CamelotRenderer/OgreBlendMode.h

@@ -153,11 +153,11 @@ namespace CamelotEngine {
         /// Manual colour value for manual source2
         /// Manual colour value for manual source2
         ColourValue colourArg2;
         ColourValue colourArg2;
         /// Manual alpha value for manual source1
         /// Manual alpha value for manual source1
-        Real alphaArg1;
+        float alphaArg1;
         /// Manual alpha value for manual source2
         /// Manual alpha value for manual source2
-        Real alphaArg2;
+        float alphaArg2;
         /// Manual blending factor
         /// Manual blending factor
-        Real factor;
+        float factor;
 
 
         bool operator==(const LayerBlendModeEx& rhs) const
         bool operator==(const LayerBlendModeEx& rhs) const
         {
         {

+ 27 - 35
CamelotRenderer/OgreCamera.cpp

@@ -27,10 +27,10 @@ THE SOFTWARE.
 */
 */
 #include "OgreCamera.h"
 #include "OgreCamera.h"
 
 
-#include "OgreMath.h"
-#include "OgreMatrix3.h"
-#include "OgreAxisAlignedBox.h"
-#include "OgreSphere.h"
+#include "CmMath.h"
+#include "CmMatrix3.h"
+#include "CmAxisAlignedBox.h"
+#include "CmSphere.h"
 #include "OgreException.h"
 #include "OgreException.h"
 #include "OgreRenderSystem.h"
 #include "OgreRenderSystem.h"
 
 
@@ -85,7 +85,7 @@ namespace CamelotEngine {
     }
     }
 
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void Camera::setPosition(Real x, Real y, Real z)
+    void Camera::setPosition(float x, float y, float z)
     {
     {
         mPosition.x = x;
         mPosition.x = x;
         mPosition.y = y;
         mPosition.y = y;
@@ -124,7 +124,7 @@ namespace CamelotEngine {
     }
     }
 
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void Camera::setDirection(Real x, Real y, Real z)
+    void Camera::setDirection(float x, float y, float z)
     {
     {
         setDirection(Vector3(x,y,z));
         setDirection(Vector3(x,y,z));
     }
     }
@@ -225,7 +225,7 @@ namespace CamelotEngine {
     }
     }
 
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void Camera::lookAt( Real x, Real y, Real z )
+    void Camera::lookAt( float x, float y, float z )
     {
     {
         Vector3 vTemp( x, y, z );
         Vector3 vTemp( x, y, z );
         this->lookAt(vTemp);
         this->lookAt(vTemp);
@@ -435,27 +435,19 @@ namespace CamelotEngine {
         return mRealOrientation * Vector3::UNIT_X;
         return mRealOrientation * Vector3::UNIT_X;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-	Ray Camera::getCameraToViewportRay(Real screenX, Real screenY) const
+	Ray Camera::getCameraToViewportRay(float screenX, float screenY) const
 	{
 	{
 		Ray ret;
 		Ray ret;
 		getCameraToViewportRay(screenX, screenY, &ret);
 		getCameraToViewportRay(screenX, screenY, &ret);
 		return ret;
 		return ret;
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-    void Camera::getCameraToViewportRay(Real screenX, Real screenY, Ray* outRay) const
+    void Camera::getCameraToViewportRay(float screenX, float screenY, Ray* outRay) const
     {
     {
 		Matrix4 inverseVP = (getProjectionMatrix() * getViewMatrix(true)).inverse();
 		Matrix4 inverseVP = (getProjectionMatrix() * getViewMatrix(true)).inverse();
 
 
-#if OGRE_NO_VIEWPORT_ORIENTATIONMODE == 0
-        // We need to convert screen point to our oriented viewport (temp solution)
-        Real tX = screenX; Real a = getOrientationMode() * Math::HALF_PI;
-        screenX = Math::Cos(a) * (tX-0.5f) + Math::Sin(a) * (screenY-0.5f) + 0.5f;
-        screenY = Math::Sin(a) * (tX-0.5f) + Math::Cos(a) * (screenY-0.5f) + 0.5f;
-        if ((int)getOrientationMode()&1) screenY = 1.f - screenY;
-#endif
-
-		Real nx = (2.0f * screenX) - 1.0f;
-		Real ny = 1.0f - (2.0f * screenY);
+		float nx = (2.0f * screenX) - 1.0f;
+		float ny = 1.0f - (2.0f * screenY);
 		Vector3 nearPoint(nx, ny, -1.f);
 		Vector3 nearPoint(nx, ny, -1.f);
 		// Use midPoint rather than far point to avoid issues with infinite projection
 		// Use midPoint rather than far point to avoid issues with infinite projection
 		Vector3 midPoint (nx, ny,  0.0f);
 		Vector3 midPoint (nx, ny,  0.0f);
@@ -473,7 +465,7 @@ namespace CamelotEngine {
 		outRay->setDirection(rayDirection);
 		outRay->setDirection(rayDirection);
     } 
     } 
     // -------------------------------------------------------------------
     // -------------------------------------------------------------------
-    void Camera::setWindow (Real Left, Real Top, Real Right, Real Bottom)
+    void Camera::setWindow (float Left, float Top, float Right, float Bottom)
     {
     {
         mWLeft = Left;
         mWLeft = Left;
         mWTop = Top;
         mWTop = Top;
@@ -495,16 +487,16 @@ namespace CamelotEngine {
             return;
             return;
 
 
         // Calculate general projection parameters
         // Calculate general projection parameters
-        Real vpLeft, vpRight, vpBottom, vpTop;
+        float vpLeft, vpRight, vpBottom, vpTop;
         calcProjectionParameters(vpLeft, vpRight, vpBottom, vpTop);
         calcProjectionParameters(vpLeft, vpRight, vpBottom, vpTop);
 
 
-        Real vpWidth = vpRight - vpLeft;
-        Real vpHeight = vpTop - vpBottom;
+        float vpWidth = vpRight - vpLeft;
+        float vpHeight = vpTop - vpBottom;
 
 
-        Real wvpLeft   = vpLeft + mWLeft * vpWidth;
-        Real wvpRight  = vpLeft + mWRight * vpWidth;
-        Real wvpTop    = vpTop - mWTop * vpHeight;
-        Real wvpBottom = vpTop - mWBottom * vpHeight;
+        float wvpLeft   = vpLeft + mWLeft * vpWidth;
+        float wvpRight  = vpLeft + mWRight * vpWidth;
+        float wvpTop    = vpTop - mWTop * vpHeight;
+        float wvpBottom = vpTop - mWBottom * vpHeight;
 
 
         Vector3 vp_ul (wvpLeft, wvpTop, -mNearDist);
         Vector3 vp_ul (wvpLeft, wvpTop, -mNearDist);
         Vector3 vp_ur (wvpRight, wvpTop, -mNearDist);
         Vector3 vp_ur (wvpRight, wvpTop, -mNearDist);
@@ -550,7 +542,7 @@ namespace CamelotEngine {
         return mWindowClipPlanes;
         return mWindowClipPlanes;
     }
     }
     // -------------------------------------------------------------------
     // -------------------------------------------------------------------
-    Real Camera::getBoundingRadius(void) const
+    float Camera::getBoundingRadius(void) const
     {
     {
         // return a little bigger than the near distance
         // return a little bigger than the near distance
         // just to keep things just outside
         // just to keep things just outside
@@ -640,7 +632,7 @@ namespace CamelotEngine {
 	}
 	}
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
 	bool Camera::projectSphere(const Sphere& sphere, 
 	bool Camera::projectSphere(const Sphere& sphere, 
-		Real* left, Real* top, Real* right, Real* bottom) const
+		float* left, float* top, float* right, float* bottom) const
 	{
 	{
 		if (mCullFrustum)
 		if (mCullFrustum)
 		{
 		{
@@ -652,7 +644,7 @@ namespace CamelotEngine {
 		}
 		}
 	}
 	}
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	Real Camera::getNearClipDistance(void) const
+	float Camera::getNearClipDistance(void) const
 	{
 	{
 		if (mCullFrustum)
 		if (mCullFrustum)
 		{
 		{
@@ -664,7 +656,7 @@ namespace CamelotEngine {
 		}
 		}
 	}
 	}
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	Real Camera::getFarClipDistance(void) const
+	float Camera::getFarClipDistance(void) const
 	{
 	{
 		if (mCullFrustum)
 		if (mCullFrustum)
 		{
 		{
@@ -711,7 +703,7 @@ namespace CamelotEngine {
 	//| coordinate system in which this is true.			|
 	//| coordinate system in which this is true.			|
 	//|_____________________________________________________|
 	//|_____________________________________________________|
 	//
 	//
-	vector<Vector4>::type Camera::getRayForwardIntersect(const Vector3& anchor, const Vector3 *dir, Real planeOffset) const
+	vector<Vector4>::type Camera::getRayForwardIntersect(const Vector3& anchor, const Vector3 *dir, float planeOffset) const
 	{
 	{
 		vector<Vector4>::type res;
 		vector<Vector4>::type res;
 
 
@@ -723,20 +715,20 @@ namespace CamelotEngine {
 
 
 		// find how much the anchor point must be displaced in the plane's
 		// find how much the anchor point must be displaced in the plane's
 		// constant variable
 		// constant variable
-		Real delta = planeOffset - anchor.z;
+		float delta = planeOffset - anchor.z;
 
 
 		// now set the intersection point and note whether it is a 
 		// now set the intersection point and note whether it is a 
 		// point at infinity or straddles infinity
 		// point at infinity or straddles infinity
 		unsigned int i;
 		unsigned int i;
 		for (i=0; i<4; i++)
 		for (i=0; i<4; i++)
 		{
 		{
-			Real test = dir[i].z * delta;
+			float test = dir[i].z * delta;
 			if (test == 0.0) {
 			if (test == 0.0) {
 				vec[i] = dir[i];
 				vec[i] = dir[i];
 				infpt[i] = 1;
 				infpt[i] = 1;
 			}
 			}
 			else {
 			else {
-				Real lambda = delta / dir[i].z;
+				float lambda = delta / dir[i].z;
 				vec[i] = anchor + (lambda * dir[i]);
 				vec[i] = anchor + (lambda * dir[i]);
 				if(test < 0.0)
 				if(test < 0.0)
 					infpt[i] = 2;
 					infpt[i] = 2;

+ 18 - 18
CamelotRenderer/OgreCamera.h

@@ -34,13 +34,13 @@ THE SOFTWARE.
 #include "OgreString.h"
 #include "OgreString.h"
 
 
 // Matrices & Vectors
 // Matrices & Vectors
-#include "OgreMatrix4.h"
-#include "OgreVector3.h"
-#include "OgrePlane.h"
-#include "OgreQuaternion.h"
+#include "CmMatrix4.h"
+#include "CmVector3.h"
+#include "CmPlane.h"
+#include "CmQuaternion.h"
 #include "OgreCommon.h"
 #include "OgreCommon.h"
 #include "OgreFrustum.h"
 #include "OgreFrustum.h"
-#include "OgreRay.h"
+#include "CmRay.h"
 
 
 
 
 namespace CamelotEngine {
 namespace CamelotEngine {
@@ -93,7 +93,7 @@ namespace CamelotEngine {
         mutable Quaternion mDerivedOrientation;
         mutable Quaternion mDerivedOrientation;
         mutable Vector3 mDerivedPosition;
         mutable Vector3 mDerivedPosition;
 
 
-        /// Real world orientation/position of the camera
+        /// float world orientation/position of the camera
         mutable Quaternion mRealOrientation;
         mutable Quaternion mRealOrientation;
         mutable Vector3 mRealPosition;
         mutable Vector3 mRealPosition;
 
 
@@ -109,7 +109,7 @@ namespace CamelotEngine {
         @remarks
         @remarks
         Generalize camera class for the case, when viewing frustum doesn't cover all viewport.
         Generalize camera class for the case, when viewing frustum doesn't cover all viewport.
         */
         */
-        Real mWLeft, mWTop, mWRight, mWBottom;
+        float mWLeft, mWTop, mWRight, mWBottom;
         /// Is viewing window used.
         /// Is viewing window used.
         bool mWindowSet;
         bool mWindowSet;
         /// Windowed viewport clip planes 
         /// Windowed viewport clip planes 
@@ -142,7 +142,7 @@ namespace CamelotEngine {
         virtual void setWindowImpl(void) const;
         virtual void setWindowImpl(void) const;
 
 
 		/** Helper function for forwardIntersect that intersects rays with canonical plane */
 		/** Helper function for forwardIntersect that intersects rays with canonical plane */
-		virtual vector<Vector4>::type getRayForwardIntersect(const Vector3& anchor, const Vector3 *dir, Real planeOffset) const;
+		virtual vector<Vector4>::type getRayForwardIntersect(const Vector3& anchor, const Vector3 *dir, float planeOffset) const;
 
 
     public:
     public:
         /** Standard constructor.
         /** Standard constructor.
@@ -168,7 +168,7 @@ namespace CamelotEngine {
 
 
         /** Sets the camera's position.
         /** Sets the camera's position.
         */
         */
-        void setPosition(Real x, Real y, Real z);
+        void setPosition(float x, float y, float z);
 
 
         /** Sets the camera's position.
         /** Sets the camera's position.
         */
         */
@@ -191,7 +191,7 @@ namespace CamelotEngine {
                 Note that the 'up' vector for the camera will automatically be recalculated based on the
                 Note that the 'up' vector for the camera will automatically be recalculated based on the
                 current 'up' vector (i.e. the roll will remain the same).
                 current 'up' vector (i.e. the roll will remain the same).
         */
         */
-        void setDirection(Real x, Real y, Real z);
+        void setDirection(float x, float y, float z);
 
 
         /** Sets the camera's direction vector.
         /** Sets the camera's direction vector.
         */
         */
@@ -230,7 +230,7 @@ namespace CamelotEngine {
             @param
             @param
                 z Co-ordinates of the point to look at.
                 z Co-ordinates of the point to look at.
         */
         */
-        void lookAt(Real x, Real y, Real z);
+        void lookAt(float x, float y, float z);
 
 
         /** Rolls the camera anticlockwise, around its local z axis.
         /** Rolls the camera anticlockwise, around its local z axis.
         */
         */
@@ -324,13 +324,13 @@ namespace CamelotEngine {
         @param screenx, screeny The x and y position at which the ray should intersect the viewport, 
         @param screenx, screeny The x and y position at which the ray should intersect the viewport, 
             in normalised screen coordinates [0,1]
             in normalised screen coordinates [0,1]
         */
         */
-        Ray getCameraToViewportRay(Real screenx, Real screeny) const;
+        Ray getCameraToViewportRay(float screenx, float screeny) const;
         /** Gets a world space ray as cast from the camera through a viewport position.
         /** Gets a world space ray as cast from the camera through a viewport position.
         @param screenx, screeny The x and y position at which the ray should intersect the viewport, 
         @param screenx, screeny The x and y position at which the ray should intersect the viewport, 
             in normalised screen coordinates [0,1]
             in normalised screen coordinates [0,1]
 		@param outRay Ray instance to populate with result
 		@param outRay Ray instance to populate with result
         */
         */
-        void getCameraToViewportRay(Real screenx, Real screeny, Ray* outRay) const;
+        void getCameraToViewportRay(float screenx, float screeny, Ray* outRay) const;
 
 
         /** Sets the viewing window inside of viewport.
         /** Sets the viewing window inside of viewport.
         @remarks
         @remarks
@@ -341,7 +341,7 @@ namespace CamelotEngine {
         @param Right Relative to Viewport - 0 corresponds to left edge, 1 - to right edge (default - 1).
         @param Right Relative to Viewport - 0 corresponds to left edge, 1 - to right edge (default - 1).
         @param Bottom Relative to Viewport - 0 corresponds to top edge, 1 - to bottom edge (default - 1).
         @param Bottom Relative to Viewport - 0 corresponds to top edge, 1 - to bottom edge (default - 1).
         */
         */
-        virtual void setWindow (Real Left, Real Top, Real Right, Real Bottom);
+        virtual void setWindow (float Left, float Top, float Right, float Bottom);
         /// Cancel view window.
         /// Cancel view window.
         virtual void resetWindow (void);
         virtual void resetWindow (void);
         /// Returns if a viewport window is being used
         /// Returns if a viewport window is being used
@@ -350,7 +350,7 @@ namespace CamelotEngine {
         const vector<Plane>::type& getWindowPlanes(void) const;
         const vector<Plane>::type& getWindowPlanes(void) const;
 
 
         /** Overridden from MovableObject */
         /** Overridden from MovableObject */
-        Real getBoundingRadius(void) const;
+        float getBoundingRadius(void) const;
 		
 		
         /** Get the last viewport which was attached to this camera. 
         /** Get the last viewport which was attached to this camera. 
         @note This is not guaranteed to be the only viewport which is
         @note This is not guaranteed to be the only viewport which is
@@ -407,11 +407,11 @@ namespace CamelotEngine {
 		const Plane& getFrustumPlane( unsigned short plane ) const;
 		const Plane& getFrustumPlane( unsigned short plane ) const;
 		/// @copydoc Frustum::projectSphere
 		/// @copydoc Frustum::projectSphere
 		bool projectSphere(const Sphere& sphere, 
 		bool projectSphere(const Sphere& sphere, 
-			Real* left, Real* top, Real* right, Real* bottom) const;
+			float* left, float* top, float* right, float* bottom) const;
 		/// @copydoc Frustum::getNearClipDistance
 		/// @copydoc Frustum::getNearClipDistance
-		Real getNearClipDistance(void) const;
+		float getNearClipDistance(void) const;
 		/// @copydoc Frustum::getFarClipDistance
 		/// @copydoc Frustum::getFarClipDistance
-		Real getFarClipDistance(void) const;
+		float getFarClipDistance(void) const;
 		/// @copydoc Frustum::getViewMatrix
 		/// @copydoc Frustum::getViewMatrix
 		const Matrix4& getViewMatrix(void) const;
 		const Matrix4& getViewMatrix(void) const;
 		/** Specialised version of getViewMatrix allowing caller to differentiate
 		/** Specialised version of getViewMatrix allowing caller to differentiate

+ 45 - 45
CamelotRenderer/OgreColourValue.cpp

@@ -27,7 +27,7 @@ THE SOFTWARE.
 */
 */
 
 
 #include "OgreColourValue.h"
 #include "OgreColourValue.h"
-#include "OgreMath.h"
+#include "CmMath.h"
 
 
 namespace CamelotEngine {
 namespace CamelotEngine {
 
 
@@ -45,26 +45,26 @@ namespace CamelotEngine {
     RGBA ColourValue::getAsRGBA(void) const
     RGBA ColourValue::getAsRGBA(void) const
 #endif
 #endif
     {
     {
-        uint8 val8;
-        uint32 val32 = 0;
+        UINT8 val8;
+        UINT32 val32 = 0;
 
 
         // Convert to 32bit pattern
         // Convert to 32bit pattern
         // (RGBA = 8888)
         // (RGBA = 8888)
 
 
         // Red
         // Red
-        val8 = static_cast<uint8>(r * 255);
+        val8 = static_cast<UINT8>(r * 255);
         val32 = val8 << 24;
         val32 = val8 << 24;
 
 
         // Green
         // Green
-        val8 = static_cast<uint8>(g * 255);
+        val8 = static_cast<UINT8>(g * 255);
         val32 += val8 << 16;
         val32 += val8 << 16;
 
 
         // Blue
         // Blue
-        val8 = static_cast<uint8>(b * 255);
+        val8 = static_cast<UINT8>(b * 255);
         val32 += val8 << 8;
         val32 += val8 << 8;
 
 
         // Alpha
         // Alpha
-        val8 = static_cast<uint8>(a * 255);
+        val8 = static_cast<UINT8>(a * 255);
         val32 += val8;
         val32 += val8;
 
 
         return val32;
         return val32;
@@ -76,26 +76,26 @@ namespace CamelotEngine {
     ARGB ColourValue::getAsARGB(void) const
     ARGB ColourValue::getAsARGB(void) const
 #endif
 #endif
     {
     {
-        uint8 val8;
-        uint32 val32 = 0;
+        UINT8 val8;
+        UINT32 val32 = 0;
 
 
         // Convert to 32bit pattern
         // Convert to 32bit pattern
         // (ARGB = 8888)
         // (ARGB = 8888)
 
 
         // Alpha
         // Alpha
-        val8 = static_cast<uint8>(a * 255);
+        val8 = static_cast<UINT8>(a * 255);
         val32 = val8 << 24;
         val32 = val8 << 24;
 
 
         // Red
         // Red
-        val8 = static_cast<uint8>(r * 255);
+        val8 = static_cast<UINT8>(r * 255);
         val32 += val8 << 16;
         val32 += val8 << 16;
 
 
         // Green
         // Green
-        val8 = static_cast<uint8>(g * 255);
+        val8 = static_cast<UINT8>(g * 255);
         val32 += val8 << 8;
         val32 += val8 << 8;
 
 
         // Blue
         // Blue
-        val8 = static_cast<uint8>(b * 255);
+        val8 = static_cast<UINT8>(b * 255);
         val32 += val8;
         val32 += val8;
 
 
 
 
@@ -108,26 +108,26 @@ namespace CamelotEngine {
 	BGRA ColourValue::getAsBGRA(void) const
 	BGRA ColourValue::getAsBGRA(void) const
 #endif
 #endif
 	{
 	{
-		uint8 val8;
-		uint32 val32 = 0;
+		UINT8 val8;
+		UINT32 val32 = 0;
 
 
 		// Convert to 32bit pattern
 		// Convert to 32bit pattern
 		// (ARGB = 8888)
 		// (ARGB = 8888)
 
 
 		// Blue
 		// Blue
-		val8 = static_cast<uint8>(b * 255);
+		val8 = static_cast<UINT8>(b * 255);
 		val32 = val8 << 24;
 		val32 = val8 << 24;
 
 
 		// Green
 		// Green
-		val8 = static_cast<uint8>(g * 255);
+		val8 = static_cast<UINT8>(g * 255);
 		val32 += val8 << 16;
 		val32 += val8 << 16;
 
 
 		// Red
 		// Red
-		val8 = static_cast<uint8>(r * 255);
+		val8 = static_cast<UINT8>(r * 255);
 		val32 += val8 << 8;
 		val32 += val8 << 8;
 
 
 		// Alpha
 		// Alpha
-		val8 = static_cast<uint8>(a * 255);
+		val8 = static_cast<UINT8>(a * 255);
 		val32 += val8;
 		val32 += val8;
 
 
 
 
@@ -140,26 +140,26 @@ namespace CamelotEngine {
     ABGR ColourValue::getAsABGR(void) const
     ABGR ColourValue::getAsABGR(void) const
 #endif
 #endif
     {
     {
-        uint8 val8;
-        uint32 val32 = 0;
+        UINT8 val8;
+        UINT32 val32 = 0;
 
 
         // Convert to 32bit pattern
         // Convert to 32bit pattern
         // (ABRG = 8888)
         // (ABRG = 8888)
 
 
         // Alpha
         // Alpha
-        val8 = static_cast<uint8>(a * 255);
+        val8 = static_cast<UINT8>(a * 255);
         val32 = val8 << 24;
         val32 = val8 << 24;
 
 
         // Blue
         // Blue
-        val8 = static_cast<uint8>(b * 255);
+        val8 = static_cast<UINT8>(b * 255);
         val32 += val8 << 16;
         val32 += val8 << 16;
 
 
         // Green
         // Green
-        val8 = static_cast<uint8>(g * 255);
+        val8 = static_cast<UINT8>(g * 255);
         val32 += val8 << 8;
         val32 += val8 << 8;
 
 
         // Red
         // Red
-        val8 = static_cast<uint8>(r * 255);
+        val8 = static_cast<UINT8>(r * 255);
         val32 += val8;
         val32 += val8;
 
 
 
 
@@ -172,7 +172,7 @@ namespace CamelotEngine {
     void ColourValue::setAsRGBA(const RGBA val)
     void ColourValue::setAsRGBA(const RGBA val)
 #endif
 #endif
     {
     {
-        uint32 val32 = val;
+        UINT32 val32 = val;
 
 
         // Convert from 32bit pattern
         // Convert from 32bit pattern
         // (RGBA = 8888)
         // (RGBA = 8888)
@@ -196,7 +196,7 @@ namespace CamelotEngine {
     void ColourValue::setAsARGB(const ARGB val)
     void ColourValue::setAsARGB(const ARGB val)
 #endif
 #endif
     {
     {
-        uint32 val32 = val;
+        UINT32 val32 = val;
 
 
         // Convert from 32bit pattern
         // Convert from 32bit pattern
         // (ARGB = 8888)
         // (ARGB = 8888)
@@ -220,7 +220,7 @@ namespace CamelotEngine {
 	void ColourValue::setAsBGRA(const BGRA val)
 	void ColourValue::setAsBGRA(const BGRA val)
 #endif
 #endif
 	{
 	{
-		uint32 val32 = val;
+		UINT32 val32 = val;
 
 
 		// Convert from 32bit pattern
 		// Convert from 32bit pattern
 		// (ARGB = 8888)
 		// (ARGB = 8888)
@@ -244,7 +244,7 @@ namespace CamelotEngine {
     void ColourValue::setAsABGR(const ABGR val)
     void ColourValue::setAsABGR(const ABGR val)
 #endif
 #endif
     {
     {
-        uint32 val32 = val;
+        UINT32 val32 = val;
 
 
         // Convert from 32bit pattern
         // Convert from 32bit pattern
         // (ABGR = 8888)
         // (ABGR = 8888)
@@ -275,7 +275,7 @@ namespace CamelotEngine {
         return !(*this == rhs);
         return !(*this == rhs);
     }
     }
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void ColourValue::setHSB(Real hue, Real saturation, Real brightness)
+	void ColourValue::setHSB(float hue, float saturation, float brightness)
 	{
 	{
 		// wrap hue
 		// wrap hue
 		if (hue > 1.0f)
 		if (hue > 1.0f)
@@ -287,10 +287,10 @@ namespace CamelotEngine {
 			hue += (int)hue + 1;
 			hue += (int)hue + 1;
 		}
 		}
 		// clamp saturation / brightness
 		// clamp saturation / brightness
-		saturation = std::min(saturation, (Real)1.0);
-		saturation = std::max(saturation, (Real)0.0);
-		brightness = std::min(brightness, (Real)1.0);
-		brightness = std::max(brightness, (Real)0.0);
+		saturation = std::min(saturation, (float)1.0);
+		saturation = std::max(saturation, (float)0.0);
+		brightness = std::min(brightness, (float)1.0);
+		brightness = std::max(brightness, (float)0.0);
 
 
 		if (brightness == 0.0f)
 		if (brightness == 0.0f)
 		{   
 		{   
@@ -308,16 +308,16 @@ namespace CamelotEngine {
 		}
 		}
 
 
 
 
-		Real hueDomain  = hue * 6.0f;
+		float hueDomain  = hue * 6.0f;
 		if (hueDomain >= 6.0f)
 		if (hueDomain >= 6.0f)
 		{
 		{
 			// wrap around, and allow mathematical errors
 			// wrap around, and allow mathematical errors
 			hueDomain = 0.0f;
 			hueDomain = 0.0f;
 		}
 		}
 		unsigned short domain = (unsigned short)hueDomain;
 		unsigned short domain = (unsigned short)hueDomain;
-		Real f1 = brightness * (1 - saturation);
-		Real f2 = brightness * (1 - saturation * (hueDomain - domain));
-		Real f3 = brightness * (1 - saturation * (1 - (hueDomain - domain)));
+		float f1 = brightness * (1 - saturation);
+		float f2 = brightness * (1 - saturation * (hueDomain - domain));
+		float f3 = brightness * (1 - saturation * (1 - (hueDomain - domain)));
 
 
 		switch (domain)
 		switch (domain)
 		{
 		{
@@ -362,12 +362,12 @@ namespace CamelotEngine {
 
 
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void ColourValue::getHSB(Real* hue, Real* saturation, Real* brightness) const
+	void ColourValue::getHSB(float* hue, float* saturation, float* brightness) const
 	{
 	{
 
 
-		Real vMin = std::min(r, std::min(g, b));
-		Real vMax = std::max(r, std::max(g, b));
-		Real delta = vMax - vMin;
+		float vMin = std::min(r, std::min(g, b));
+		float vMax = std::max(r, std::max(g, b));
+		float delta = vMax - vMin;
 
 
 		*brightness = vMax;
 		*brightness = vMax;
 
 
@@ -382,9 +382,9 @@ namespace CamelotEngine {
 			// a colour
 			// a colour
 			*saturation = delta / vMax;
 			*saturation = delta / vMax;
 
 
-			Real deltaR = (((vMax - r) / 6.0f) + (delta / 2.0f)) / delta;
-			Real deltaG = (((vMax - g) / 6.0f) + (delta / 2.0f)) / delta;
-			Real deltaB = (((vMax - b) / 6.0f) + (delta / 2.0f)) / delta;
+			float deltaR = (((vMax - r) / 6.0f) + (delta / 2.0f)) / delta;
+			float deltaG = (((vMax - g) / 6.0f) + (delta / 2.0f)) / delta;
+			float deltaB = (((vMax - b) / 6.0f) + (delta / 2.0f)) / delta;
 
 
 			if (Math::RealEqual(r, vMax))
 			if (Math::RealEqual(r, vMax))
 				*hue = deltaB - deltaG;
 				*hue = deltaB - deltaG;

+ 6 - 6
CamelotRenderer/OgreColourValue.h

@@ -38,10 +38,10 @@ namespace CamelotEngine {
 	*  @{
 	*  @{
 	*/
 	*/
 
 
-    typedef uint32 RGBA;
-    typedef uint32 ARGB;
-    typedef uint32 ABGR;
-	typedef uint32 BGRA;
+    typedef UINT32 RGBA;
+    typedef UINT32 ARGB;
+    typedef UINT32 ABGR;
+	typedef UINT32 BGRA;
 
 
     /** Class representing colour.
     /** Class representing colour.
 	    @remarks
 	    @remarks
@@ -305,14 +305,14 @@ namespace CamelotEngine {
 		@param saturation Saturation level, [0,1]
 		@param saturation Saturation level, [0,1]
 		@param brightness Brightness level, [0,1]
 		@param brightness Brightness level, [0,1]
 		*/
 		*/
-		void setHSB(Real hue, Real saturation, Real brightness);
+		void setHSB(float hue, float saturation, float brightness);
 
 
 		/** Convert the current colour to Hue, Saturation and Brightness values. 
 		/** Convert the current colour to Hue, Saturation and Brightness values. 
 		@param hue Output hue value, scaled to the [0,1] range as opposed to the 0-360
 		@param hue Output hue value, scaled to the [0,1] range as opposed to the 0-360
 		@param saturation Output saturation level, [0,1]
 		@param saturation Output saturation level, [0,1]
 		@param brightness Output brightness level, [0,1]
 		@param brightness Output brightness level, [0,1]
 		*/
 		*/
-		void getHSB(Real* hue, Real* saturation, Real* brightness) const;
+		void getHSB(float* hue, float* saturation, float* brightness) const;
 
 
 
 
 
 

+ 5 - 5
CamelotRenderer/OgreCommon.h

@@ -51,10 +51,10 @@ namespace CamelotEngine {
 	*/
 	*/
 
 
 	/// Fast general hashing algorithm
 	/// Fast general hashing algorithm
-	uint32 CM_EXPORT FastHash (const char * data, int len, uint32 hashSoFar = 0);
+	UINT32 CM_EXPORT FastHash (const char * data, int len, UINT32 hashSoFar = 0);
 	/// Combine hashes with same style as boost::hash_combine
 	/// Combine hashes with same style as boost::hash_combine
 	template <typename T>
 	template <typename T>
-	uint32 HashCombine (uint32 hashSoFar, const T& data)
+	UINT32 HashCombine (UINT32 hashSoFar, const T& data)
 	{
 	{
 		return FastHash((const char*)&data, sizeof(T), hashSoFar);
 		return FastHash((const char*)&data, sizeof(T), hashSoFar);
 	}
 	}
@@ -309,7 +309,7 @@ namespace CamelotEngine {
 		typedef std::vector<T> VectorImpl;
 		typedef std::vector<T> VectorImpl;
 	protected:
 	protected:
 		VectorImpl mList;
 		VectorImpl mList;
-		mutable uint32 mListHash;
+		mutable UINT32 mListHash;
 		mutable bool mListHashDirty;
 		mutable bool mListHashDirty;
 
 
 		void addToHash(const T& newPtr) const
 		void addToHash(const T& newPtr) const
@@ -499,7 +499,7 @@ namespace CamelotEngine {
 
 
 
 
 		/// Get the hash value
 		/// Get the hash value
-		uint32 getHash() const 
+		UINT32 getHash() const 
 		{ 
 		{ 
 			if (isHashDirty())
 			if (isHashDirty())
 				recalcHash();
 				recalcHash();
@@ -620,7 +620,7 @@ namespace CamelotEngine {
 		/** Structure used to define a rectangle in a 2-D floating point space, 
 		/** Structure used to define a rectangle in a 2-D floating point space, 
 			subject to double / single floating point settings.
 			subject to double / single floating point settings.
 		*/
 		*/
-		typedef TRect<Real> RealRect;
+		typedef TRect<float> RealRect;
 
 
         /** Structure used to define a rectangle in a 2-D integer space.
         /** Structure used to define a rectangle in a 2-D integer space.
         */
         */

+ 3 - 3
CamelotRenderer/OgreConfig.h

@@ -52,7 +52,7 @@ THE SOFTWARE.
 */
 */
 #define OGRE_PRETEND_TEXTURE_UNITS 0
 #define OGRE_PRETEND_TEXTURE_UNITS 0
 
 
-/** If set to 1, Real is typedef'ed to double. Otherwise, Real is typedef'ed
+/** If set to 1, float is typedef'ed to double. Otherwise, float is typedef'ed
     to float. Setting this allows you to perform mathematical operations in the
     to float. Setting this allows you to perform mathematical operations in the
 	CPU (Quaternion, Vector3 etc) with more precision, but bear in mind that the
 	CPU (Quaternion, Vector3 etc) with more precision, but bear in mind that the
 	GPU still operates in single-precision mode.
 	GPU still operates in single-precision mode.
@@ -67,7 +67,7 @@ THE SOFTWARE.
 
 
 /** Define max number of texture layers allowed per pass on any card.
 /** Define max number of texture layers allowed per pass on any card.
 */
 */
-#define OGRE_MAX_TEXTURE_LAYERS 16
+#define CM_MAX_TEXTURE_LAYERS 16
 
 
 /** Define max number of lights allowed per pass.
 /** Define max number of lights allowed per pass.
 */
 */
@@ -116,7 +116,7 @@ THE SOFTWARE.
 #endif
 #endif
 /** Define max number of multiple render targets (MRTs) to render to at once.
 /** Define max number of multiple render targets (MRTs) to render to at once.
 */
 */
-#define OGRE_MAX_MULTIPLE_RENDER_TARGETS 8
+#define CM_MAX_MULTIPLE_RENDER_TARGETS 8
 
 
 /** Support for multithreading, there are 3 options
 /** Support for multithreading, there are 3 options
 
 

+ 7 - 7
CamelotRenderer/OgreD3D9Device.cpp

@@ -266,13 +266,13 @@ namespace CamelotEngine
 	}
 	}
 
 
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	uint D3D9Device::getRenderWindowCount() const
+	UINT32 D3D9Device::getRenderWindowCount() const
 	{
 	{
-		return static_cast<uint>(mMapRenderWindowToResoruces.size());
+		return static_cast<UINT32>(mMapRenderWindowToResoruces.size());
 	}
 	}
 
 
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	D3D9RenderWindow* D3D9Device::getRenderWindow(uint index)
+	D3D9RenderWindow* D3D9Device::getRenderWindow(UINT32 index)
 	{
 	{
 		if (index >= mMapRenderWindowToResoruces.size())
 		if (index >= mMapRenderWindowToResoruces.size())
 		{
 		{
@@ -296,7 +296,7 @@ namespace CamelotEngine
 	}
 	}
 
 
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void D3D9Device::setAdapterOrdinalIndex(D3D9RenderWindow* renderWindow, uint adapterOrdinalInGroupIndex)
+	void D3D9Device::setAdapterOrdinalIndex(D3D9RenderWindow* renderWindow, UINT32 adapterOrdinalInGroupIndex)
 	{
 	{
 		RenderWindowToResorucesIterator it = getRenderWindowIterator(renderWindow);
 		RenderWindowToResorucesIterator it = getRenderWindowIterator(renderWindow);
 
 
@@ -1053,8 +1053,8 @@ namespace CamelotEngine
 			}
 			}
 			else
 			else
 			{
 			{
-				uint targetWidth  = renderWindow->getWidth();
-				uint targetHeight = renderWindow->getHeight();
+				UINT32 targetWidth  = renderWindow->getWidth();
+				UINT32 targetHeight = renderWindow->getHeight();
 
 
 				if (targetWidth == 0)
 				if (targetWidth == 0)
 					targetWidth = 1;
 					targetWidth = 1;
@@ -1156,7 +1156,7 @@ namespace CamelotEngine
 			// 1. Single full screen window - only one allowed per device (this is not multi-head case).
 			// 1. Single full screen window - only one allowed per device (this is not multi-head case).
 			// 2. Multiple window mode windows.
 			// 2. Multiple window mode windows.
 
 
-			uint nextPresParamIndex = 0;
+			UINT32 nextPresParamIndex = 0;
 
 
 			RenderWindowToResorucesIterator it;
 			RenderWindowToResorucesIterator it;
 			D3D9RenderWindow* deviceFocusWindow = NULL;
 			D3D9RenderWindow* deviceFocusWindow = NULL;

+ 7 - 7
CamelotRenderer/OgreD3D9Device.h

@@ -71,11 +71,11 @@ namespace CamelotEngine {
 		IDirect3DSurface9*		getDepthBuffer			(D3D9RenderWindow* renderWindow);
 		IDirect3DSurface9*		getDepthBuffer			(D3D9RenderWindow* renderWindow);
 		IDirect3DSurface9*		getBackBuffer			(D3D9RenderWindow* renderWindow);
 		IDirect3DSurface9*		getBackBuffer			(D3D9RenderWindow* renderWindow);
 
 
-		uint					getRenderWindowCount	() const;
-		D3D9RenderWindow*		getRenderWindow			(uint index);
-		uint					getLastPresentFrame		() const { return mLastPresentFrame; }
+		UINT32					getRenderWindowCount	() const;
+		D3D9RenderWindow*		getRenderWindow			(UINT32 index);
+		UINT32					getLastPresentFrame		() const { return mLastPresentFrame; }
 
 
-		void					setAdapterOrdinalIndex  (D3D9RenderWindow* renderWindow, uint adapterOrdinalInGroupIndex);
+		void					setAdapterOrdinalIndex  (D3D9RenderWindow* renderWindow, UINT32 adapterOrdinalInGroupIndex);
 		void					copyContentsToMemory(D3D9RenderWindow* window, const PixelBox &dst, RenderTarget::FrameBuffer buffer);
 		void					copyContentsToMemory(D3D9RenderWindow* window, const PixelBox &dst, RenderTarget::FrameBuffer buffer);
 		void					clearDeviceStreams		();
 		void					clearDeviceStreams		();
 	
 	
@@ -102,14 +102,14 @@ namespace CamelotEngine {
 		D3DCAPS9						mD3D9DeviceCaps;			// Device caps.	
 		D3DCAPS9						mD3D9DeviceCaps;			// Device caps.	
 		bool							mD3D9DeviceCapsValid;		// True if device caps initialized.				
 		bool							mD3D9DeviceCapsValid;		// True if device caps initialized.				
 		D3DDEVICE_CREATION_PARAMETERS	mCreationParams;			// Creation parameters.
 		D3DDEVICE_CREATION_PARAMETERS	mCreationParams;			// Creation parameters.
-		uint							mLastPresentFrame;			// Last frame that this device present method called.
+		UINT32							mLastPresentFrame;			// Last frame that this device present method called.
 		bool							mDeviceLost;				// True if device entered lost state.
 		bool							mDeviceLost;				// True if device entered lost state.
 	
 	
 		struct RenderWindowResources
 		struct RenderWindowResources
 		{
 		{
 			IDirect3DSwapChain9* 	swapChain;						// Swap chain interface.
 			IDirect3DSwapChain9* 	swapChain;						// Swap chain interface.
-			uint					adapterOrdinalInGroupIndex;		// Relative index of the render window in the group.
-			uint					presentParametersIndex;			// Index of present parameter in the shared array of the device.
+			UINT32					adapterOrdinalInGroupIndex;		// Relative index of the render window in the group.
+			UINT32					presentParametersIndex;			// Index of present parameter in the shared array of the device.
 			IDirect3DSurface9*	 	backBuffer;						// The back buffer of the render window.
 			IDirect3DSurface9*	 	backBuffer;						// The back buffer of the render window.
 			IDirect3DSurface9*	 	depthBuffer;					// The depth buffer of the render window.
 			IDirect3DSurface9*	 	depthBuffer;					// The depth buffer of the render window.
 			D3DPRESENT_PARAMETERS	presentParameters;				// Present parameters of the render window.
 			D3DPRESENT_PARAMETERS	presentParameters;				// Present parameters of the render window.

+ 11 - 11
CamelotRenderer/OgreD3D9DeviceManager.cpp

@@ -67,7 +67,7 @@ namespace CamelotEngine
 			D3D9DriverList*		driverList	 = renderSystem->getDirect3DDrivers();
 			D3D9DriverList*		driverList	 = renderSystem->getDirect3DDrivers();
 
 
 			// Update the active driver member.
 			// Update the active driver member.
-			for (uint i=0; i < driverList->count(); ++i)
+			for (UINT32 i=0; i < driverList->count(); ++i)
 			{
 			{
 				D3D9Driver* currDriver = driverList->item(i);
 				D3D9Driver* currDriver = driverList->item(i);
 				if (currDriver->getAdapterNumber() == mActiveDevice->getAdapterNumber())
 				if (currDriver->getAdapterNumber() == mActiveDevice->getAdapterNumber())
@@ -137,7 +137,7 @@ namespace CamelotEngine
 		renderDevice = selectDevice(renderWindow, renderWindowsGroup);
 		renderDevice = selectDevice(renderWindow, renderWindowsGroup);
 
 
 		// Link the windows group to the new device.
 		// Link the windows group to the new device.
-		for (uint i = 0; i < renderWindowsGroup.size(); ++i)
+		for (UINT32 i = 0; i < renderWindowsGroup.size(); ++i)
 		{
 		{
 			D3D9RenderWindow* currWindow = renderWindowsGroup[i];
 			D3D9RenderWindow* currWindow = renderWindowsGroup[i];
 
 
@@ -247,7 +247,7 @@ namespace CamelotEngine
 				}
 				}
 				else
 				else
 				{
 				{
-					for (uint i = 0; i < driverList->count(); ++i)
+					for (UINT32 i = 0; i < driverList->count(); ++i)
 					{
 					{
 						D3D9Driver* currDriver = driverList->item(i);
 						D3D9Driver* currDriver = driverList->item(i);
 						const D3DCAPS9& currDeviceCaps = currDriver->getD3D9DeviceCaps();
 						const D3DCAPS9& currDeviceCaps = currDriver->getD3D9DeviceCaps();
@@ -265,7 +265,7 @@ namespace CamelotEngine
 				{				
 				{				
 					// Create empty list of render windows composing this group.
 					// Create empty list of render windows composing this group.
 					renderWindowsGroup.resize(masterAdapterCaps.NumberOfAdaptersInGroup);
 					renderWindowsGroup.resize(masterAdapterCaps.NumberOfAdaptersInGroup);
-					for (uint i = 0; i < renderWindowsGroup.size(); ++i)
+					for (UINT32 i = 0; i < renderWindowsGroup.size(); ++i)
 						renderWindowsGroup[i] = NULL;
 						renderWindowsGroup[i] = NULL;
 
 
 
 
@@ -274,7 +274,7 @@ namespace CamelotEngine
 
 
 
 
 					// For each existing window - check if it belongs to the group.
 					// For each existing window - check if it belongs to the group.
-					for (uint i = 0; i < renderSystem->mRenderWindows.size(); ++i)
+					for (UINT32 i = 0; i < renderSystem->mRenderWindows.size(); ++i)
 					{
 					{
 						D3D9RenderWindow* currRenderWindow = renderSystem->mRenderWindows[i];
 						D3D9RenderWindow* currRenderWindow = renderSystem->mRenderWindows[i];
 
 
@@ -296,7 +296,7 @@ namespace CamelotEngine
 
 
 					// Check if render windows group is full and ready to be driven by
 					// Check if render windows group is full and ready to be driven by
 					// the master device.
 					// the master device.
-					for (uint i = 0; i < renderWindowsGroup.size(); ++i)
+					for (UINT32 i = 0; i < renderWindowsGroup.size(); ++i)
 					{
 					{
 						// This group misses required window -> go back to default.
 						// This group misses required window -> go back to default.
 						if (renderWindowsGroup[i] == NULL)
 						if (renderWindowsGroup[i] == NULL)
@@ -313,7 +313,7 @@ namespace CamelotEngine
 					{
 					{
 						bool validateAllDevices = false;
 						bool validateAllDevices = false;
 
 
-						for (uint i = 0; i < renderWindowsGroup.size(); ++i)
+						for (UINT32 i = 0; i < renderWindowsGroup.size(); ++i)
 						{
 						{
 							D3D9RenderWindow* currRenderWindow = renderWindowsGroup[i];
 							D3D9RenderWindow* currRenderWindow = renderWindowsGroup[i];
 							D3D9Device* currDevice = currRenderWindow->getDevice();
 							D3D9Device* currDevice = currRenderWindow->getDevice();
@@ -347,7 +347,7 @@ namespace CamelotEngine
 						// recreated using other handles otherwise create device will fail. 
 						// recreated using other handles otherwise create device will fail. 
 						if (validateAllDevices)
 						if (validateAllDevices)
 						{
 						{
-							for (uint i = 0; i < mRenderDevices.size(); ++i)
+							for (UINT32 i = 0; i < mRenderDevices.size(); ++i)
 								mRenderDevices[i]->validateFocusWindow();
 								mRenderDevices[i]->validateFocusWindow();
 						}	
 						}	
 					}				
 					}				
@@ -371,7 +371,7 @@ namespace CamelotEngine
 		// Try to find a matching device from current device list.
 		// Try to find a matching device from current device list.
 		if (renderDevice == NULL)
 		if (renderDevice == NULL)
 		{
 		{
-			for (uint i = 0; i < mRenderDevices.size(); ++i)
+			for (UINT32 i = 0; i < mRenderDevices.size(); ++i)
 			{
 			{
 				D3D9Device* currDevice = mRenderDevices[i];
 				D3D9Device* currDevice = mRenderDevices[i];
 
 
@@ -389,7 +389,7 @@ namespace CamelotEngine
 		// should be preferred on creation)
 		// should be preferred on creation)
 		if (renderDevice == NULL)
 		if (renderDevice == NULL)
 		{
 		{
-			for (uint i = 0; i < mRenderDevices.size(); ++i)
+			for (UINT32 i = 0; i < mRenderDevices.size(); ++i)
 			{
 			{
 				D3D9Device* currDevice = mRenderDevices[i];
 				D3D9Device* currDevice = mRenderDevices[i];
 
 
@@ -429,7 +429,7 @@ namespace CamelotEngine
 
 
 
 
 		// Find the matching driver using window monitor handle.
 		// Find the matching driver using window monitor handle.
-		for (uint i = 0; i < driverList->count(); ++i)
+		for (UINT32 i = 0; i < driverList->count(); ++i)
 		{
 		{
 			D3D9Driver* currDriver       = driverList->item(i);
 			D3D9Driver* currDriver       = driverList->item(i);
 			HMONITOR hCurrAdpaterMonitor = direct3D9->GetAdapterMonitor(currDriver->getAdapterNumber());
 			HMONITOR hCurrAdpaterMonitor = direct3D9->GetAdapterMonitor(currDriver->getAdapterNumber());

+ 3 - 3
CamelotRenderer/OgreD3D9GpuProgram.cpp

@@ -26,7 +26,7 @@ THE SOFTWARE.
 -----------------------------------------------------------------------------
 -----------------------------------------------------------------------------
 */
 */
 #include "OgreD3D9GpuProgram.h"
 #include "OgreD3D9GpuProgram.h"
-#include "OgreMatrix4.h"
+#include "CmMatrix4.h"
 #include "OgreException.h"
 #include "OgreException.h"
 #include "OgreD3D9Mappings.h"
 #include "OgreD3D9Mappings.h"
 #include "OgreD3D9RenderSystem.h"
 #include "OgreD3D9RenderSystem.h"
@@ -77,7 +77,7 @@ namespace CamelotEngine {
     {
     {
 		D3D9_DEVICE_ACCESS_CRITICAL_SECTION
 		D3D9_DEVICE_ACCESS_CRITICAL_SECTION
 
 
-		for (uint i = 0; i < D3D9RenderSystem::getResourceCreationDeviceCount(); ++i)
+		for (UINT32 i = 0; i < D3D9RenderSystem::getResourceCreationDeviceCount(); ++i)
 		{
 		{
 			IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getResourceCreationDevice(i);
 			IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getResourceCreationDevice(i);
 
 
@@ -110,7 +110,7 @@ namespace CamelotEngine {
     {
     {
 		D3D9_DEVICE_ACCESS_CRITICAL_SECTION
 		D3D9_DEVICE_ACCESS_CRITICAL_SECTION
 
 
-		for (uint i = 0; i < D3D9RenderSystem::getResourceCreationDeviceCount(); ++i)
+		for (UINT32 i = 0; i < D3D9RenderSystem::getResourceCreationDeviceCount(); ++i)
 		{
 		{
 			IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getResourceCreationDevice(i);
 			IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getResourceCreationDevice(i);
 
 

+ 3 - 3
CamelotRenderer/OgreD3D9HardwareIndexBuffer.cpp

@@ -64,7 +64,7 @@ namespace CamelotEngine {
 		// Case we have to create this buffer resource on loading.
 		// Case we have to create this buffer resource on loading.
 		if (D3D9RenderSystem::getResourceManager()->getCreationPolicy() == RCP_CREATE_ON_ALL_DEVICES)
 		if (D3D9RenderSystem::getResourceManager()->getCreationPolicy() == RCP_CREATE_ON_ALL_DEVICES)
 		{
 		{
-			for (uint i = 0; i < D3D9RenderSystem::getResourceCreationDeviceCount(); ++i)
+			for (UINT32 i = 0; i < D3D9RenderSystem::getResourceCreationDeviceCount(); ++i)
 			{
 			{
 				IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getResourceCreationDevice(i);
 				IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getResourceCreationDevice(i);
 
 
@@ -135,8 +135,8 @@ namespace CamelotEngine {
 
 
 		DeviceToBufferResourcesIterator it = mMapDeviceToBufferResources.begin();
 		DeviceToBufferResourcesIterator it = mMapDeviceToBufferResources.begin();
 		// TODO PORT - nextFrameNumber will always be 0 for now. This has potential for errors, so make sure to add a frame counting method before port is done
 		// TODO PORT - nextFrameNumber will always be 0 for now. This has potential for errors, so make sure to add a frame counting method before port is done
-		//uint nextFrameNumber = Root::getSingleton().getNextFrameNumber();
-		uint nextFrameNumber = 0;
+		//UINT32 nextFrameNumber = Root::getSingleton().getNextFrameNumber();
+		UINT32 nextFrameNumber = 0;
 
 
 		while (it != mMapDeviceToBufferResources.end())
 		while (it != mMapDeviceToBufferResources.end())
 		{
 		{

+ 1 - 1
CamelotRenderer/OgreD3D9HardwareIndexBuffer.h

@@ -74,7 +74,7 @@ namespace CamelotEngine {
 			size_t						mLockOffset;
 			size_t						mLockOffset;
 			size_t						mLockLength;
 			size_t						mLockLength;
 			LockOptions					mLockOptions;
 			LockOptions					mLockOptions;
-			uint						mLastUsedFrame;
+			UINT32						mLastUsedFrame;
 		};
 		};
 
 
 	protected:
 	protected:

+ 2 - 2
CamelotRenderer/OgreD3D9HardwarePixelBuffer.cpp

@@ -66,7 +66,7 @@ D3D9HardwarePixelBuffer::~D3D9HardwarePixelBuffer()
 //-----------------------------------------------------------------------------  
 //-----------------------------------------------------------------------------  
 void D3D9HardwarePixelBuffer::bind(IDirect3DDevice9 *dev, IDirect3DSurface9 *surface, 
 void D3D9HardwarePixelBuffer::bind(IDirect3DDevice9 *dev, IDirect3DSurface9 *surface, 
 								   IDirect3DSurface9* fsaaSurface,
 								   IDirect3DSurface9* fsaaSurface,
-								   bool writeGamma, uint fsaa, const String& srcName,
+								   bool writeGamma, UINT32 fsaa, const String& srcName,
 								   IDirect3DBaseTexture9 *mipTex)
 								   IDirect3DBaseTexture9 *mipTex)
 {
 {
 	D3D9_DEVICE_ACCESS_CRITICAL_SECTION
 	D3D9_DEVICE_ACCESS_CRITICAL_SECTION
@@ -964,7 +964,7 @@ RenderTexture *D3D9HardwarePixelBuffer::getRenderTarget(size_t zoffset)
 	return mRenderTexture;
 	return mRenderTexture;
 }
 }
 //-----------------------------------------------------------------------------    
 //-----------------------------------------------------------------------------    
-void D3D9HardwarePixelBuffer::updateRenderTexture(bool writeGamma, uint fsaa, const String& srcName)
+void D3D9HardwarePixelBuffer::updateRenderTexture(bool writeGamma, UINT32 fsaa, const String& srcName)
 {
 {
 	if (mRenderTexture == NULL)
 	if (mRenderTexture == NULL)
 	{
 	{

+ 2 - 2
CamelotRenderer/OgreD3D9HardwarePixelBuffer.h

@@ -89,7 +89,7 @@ namespace CamelotEngine {
 		BufferResources* createBufferResources();
 		BufferResources* createBufferResources();
 	
 	
 		/// updates render texture.
 		/// updates render texture.
-		void updateRenderTexture(bool writeGamma, uint fsaa, const String& srcName);
+		void updateRenderTexture(bool writeGamma, UINT32 fsaa, const String& srcName);
 		/// destroy render texture.
 		/// destroy render texture.
 		void destroyRenderTexture();
 		void destroyRenderTexture();
 
 
@@ -108,7 +108,7 @@ namespace CamelotEngine {
 
 
 		/// Call this to associate a D3D surface or volume with this pixel buffer
 		/// Call this to associate a D3D surface or volume with this pixel buffer
 		void bind(IDirect3DDevice9 *dev, IDirect3DSurface9 *mSurface, IDirect3DSurface9* fsaaSurface,
 		void bind(IDirect3DDevice9 *dev, IDirect3DSurface9 *mSurface, IDirect3DSurface9* fsaaSurface,
-				  bool writeGamma, uint fsaa, const String& srcName, IDirect3DBaseTexture9 *mipTex);
+				  bool writeGamma, UINT32 fsaa, const String& srcName, IDirect3DBaseTexture9 *mipTex);
 		void bind(IDirect3DDevice9 *dev, IDirect3DVolume9 *mVolume, IDirect3DBaseTexture9 *mipTex);
 		void bind(IDirect3DDevice9 *dev, IDirect3DVolume9 *mVolume, IDirect3DBaseTexture9 *mipTex);
 		
 		
 		/// @copydoc HardwarePixelBuffer::blit
 		/// @copydoc HardwarePixelBuffer::blit

+ 3 - 3
CamelotRenderer/OgreD3D9HardwareVertexBuffer.cpp

@@ -64,7 +64,7 @@ namespace CamelotEngine {
 		// Case we have to create this buffer resource on loading.
 		// Case we have to create this buffer resource on loading.
 		if (D3D9RenderSystem::getResourceManager()->getCreationPolicy() == RCP_CREATE_ON_ALL_DEVICES)
 		if (D3D9RenderSystem::getResourceManager()->getCreationPolicy() == RCP_CREATE_ON_ALL_DEVICES)
 		{
 		{
-			for (uint i = 0; i < D3D9RenderSystem::getResourceCreationDeviceCount(); ++i)
+			for (UINT32 i = 0; i < D3D9RenderSystem::getResourceCreationDeviceCount(); ++i)
 			{
 			{
 				IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getResourceCreationDevice(i);
 				IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getResourceCreationDevice(i);
 
 
@@ -135,8 +135,8 @@ namespace CamelotEngine {
 
 
 		DeviceToBufferResourcesIterator it = mMapDeviceToBufferResources.begin();
 		DeviceToBufferResourcesIterator it = mMapDeviceToBufferResources.begin();
 		// TODO PORT - Don't know what the next frame number is. Add a method for that
 		// TODO PORT - Don't know what the next frame number is. Add a method for that
-		//uint nextFrameNumber = Root::getSingleton().getNextFrameNumber();
-		uint nextFrameNumber = 0;
+		//UINT32 nextFrameNumber = Root::getSingleton().getNextFrameNumber();
+		UINT32 nextFrameNumber = 0;
 
 
 		while (it != mMapDeviceToBufferResources.end())
 		while (it != mMapDeviceToBufferResources.end())
 		{
 		{

+ 1 - 1
CamelotRenderer/OgreD3D9HardwareVertexBuffer.h

@@ -74,7 +74,7 @@ namespace CamelotEngine {
 			size_t						mLockOffset;
 			size_t						mLockOffset;
 			size_t						mLockLength;
 			size_t						mLockLength;
 			LockOptions					mLockOptions;
 			LockOptions					mLockOptions;
-			uint						mLastUsedFrame;
+			UINT32						mLastUsedFrame;
 		};
 		};
 
 
 	protected:		
 	protected:		

+ 6 - 6
CamelotRenderer/OgreD3D9MultiRenderTarget.cpp

@@ -41,7 +41,7 @@ namespace CamelotEngine
 		MultiRenderTarget(name)
 		MultiRenderTarget(name)
 	{
 	{
 		/// Clear targets
 		/// Clear targets
-		for(size_t x=0; x<OGRE_MAX_MULTIPLE_RENDER_TARGETS; ++x)
+		for(size_t x=0; x<CM_MAX_MULTIPLE_RENDER_TARGETS; ++x)
 		{
 		{
 			mRenderTargets[x] = 0;
 			mRenderTargets[x] = 0;
 		}
 		}
@@ -52,7 +52,7 @@ namespace CamelotEngine
 
 
 	void D3D9MultiRenderTarget::bindSurfaceImpl(size_t attachment, RenderTexture *target)
 	void D3D9MultiRenderTarget::bindSurfaceImpl(size_t attachment, RenderTexture *target)
 	{
 	{
-		assert(attachment<OGRE_MAX_MULTIPLE_RENDER_TARGETS);
+		assert(attachment<CM_MAX_MULTIPLE_RENDER_TARGETS);
 		/// Get buffer and surface to bind to
 		/// Get buffer and surface to bind to
 		D3D9HardwarePixelBuffer *buffer = 0;
 		D3D9HardwarePixelBuffer *buffer = 0;
 		target->getCustomAttribute("BUFFER", &buffer);
 		target->getCustomAttribute("BUFFER", &buffer);
@@ -60,9 +60,9 @@ namespace CamelotEngine
 
 
 		/// Find first non-null target
 		/// Find first non-null target
 		int y;
 		int y;
-		for(y=0; y<OGRE_MAX_MULTIPLE_RENDER_TARGETS && !mRenderTargets[y]; ++y) ;
+		for(y=0; y<CM_MAX_MULTIPLE_RENDER_TARGETS && !mRenderTargets[y]; ++y) ;
 		
 		
-		if(y!=OGRE_MAX_MULTIPLE_RENDER_TARGETS)
+		if(y!=CM_MAX_MULTIPLE_RENDER_TARGETS)
 		{
 		{
 			/// If there is another target bound, compare sizes
 			/// If there is another target bound, compare sizes
 			if (mRenderTargets[y]->getWidth() != buffer->getWidth() ||
 			if (mRenderTargets[y]->getWidth() != buffer->getWidth() ||
@@ -92,7 +92,7 @@ namespace CamelotEngine
 
 
 	void D3D9MultiRenderTarget::unbindSurfaceImpl(size_t attachment)
 	void D3D9MultiRenderTarget::unbindSurfaceImpl(size_t attachment)
 	{
 	{
-		assert(attachment<OGRE_MAX_MULTIPLE_RENDER_TARGETS);
+		assert(attachment<CM_MAX_MULTIPLE_RENDER_TARGETS);
 		mRenderTargets[attachment] = 0;
 		mRenderTargets[attachment] = 0;
 		checkAndUpdate();
 		checkAndUpdate();
 	}
 	}
@@ -129,7 +129,7 @@ namespace CamelotEngine
         {
         {
             IDirect3DSurface9 ** pSurf = (IDirect3DSurface9 **)pData;
             IDirect3DSurface9 ** pSurf = (IDirect3DSurface9 **)pData;
 			/// Transfer surfaces
 			/// Transfer surfaces
-			for(size_t x=0; x<OGRE_MAX_MULTIPLE_RENDER_TARGETS; ++x)
+			for(size_t x=0; x<CM_MAX_MULTIPLE_RENDER_TARGETS; ++x)
 			{
 			{
 				if(mRenderTargets[x] != NULL)								
 				if(mRenderTargets[x] != NULL)								
 					pSurf[x] = mRenderTargets[x]->getSurface(D3D9RenderSystem::getActiveD3D9Device());			
 					pSurf[x] = mRenderTargets[x]->getSurface(D3D9RenderSystem::getActiveD3D9Device());			

+ 1 - 1
CamelotRenderer/OgreD3D9MultiRenderTarget.h

@@ -47,7 +47,7 @@ namespace CamelotEngine {
 
 
 		bool requiresTextureFlipping() const { return false; }
 		bool requiresTextureFlipping() const { return false; }
 	private:
 	private:
-		D3D9HardwarePixelBuffer *mRenderTargets[OGRE_MAX_MULTIPLE_RENDER_TARGETS];
+		D3D9HardwarePixelBuffer *mRenderTargets[CM_MAX_MULTIPLE_RENDER_TARGETS];
 		virtual void bindSurfaceImpl(size_t attachment, RenderTexture *target);
 		virtual void bindSurfaceImpl(size_t attachment, RenderTexture *target);
 		virtual void unbindSurfaceImpl(size_t attachment);
 		virtual void unbindSurfaceImpl(size_t attachment);
 
 

+ 70 - 70
CamelotRenderer/OgreD3D9RenderSystem.cpp

@@ -34,7 +34,7 @@ THE SOFTWARE.
 #include "OgreD3D9RenderWindow.h"
 #include "OgreD3D9RenderWindow.h"
 #include "OgreD3D9TextureManager.h"
 #include "OgreD3D9TextureManager.h"
 #include "OgreD3D9Texture.h"
 #include "OgreD3D9Texture.h"
-#include "OgreMath.h"
+#include "CmMath.h"
 #include "OgreD3D9HardwareBufferManager.h"
 #include "OgreD3D9HardwareBufferManager.h"
 #include "OgreD3D9HardwareIndexBuffer.h"
 #include "OgreD3D9HardwareIndexBuffer.h"
 #include "OgreD3D9HardwareVertexBuffer.h"
 #include "OgreD3D9HardwareVertexBuffer.h"
@@ -94,7 +94,7 @@ namespace CamelotEngine
 		mFSAASamples = 0;
 		mFSAASamples = 0;
 		
 		
 		// set stages desc. to defaults
 		// set stages desc. to defaults
-		for (size_t n = 0; n < OGRE_MAX_TEXTURE_LAYERS; n++)
+		for (size_t n = 0; n < CM_MAX_TEXTURE_LAYERS; n++)
 		{
 		{
 			mTexStageDesc[n].autoTexCoordType = TEXCALC_NONE;
 			mTexStageDesc[n].autoTexCoordType = TEXCALC_NONE;
 			mTexStageDesc[n].coordIndex = 0;
 			mTexStageDesc[n].coordIndex = 0;
@@ -461,7 +461,7 @@ namespace CamelotEngine
 		it = mOptions.find( "Rendering Device" );
 		it = mOptions.find( "Rendering Device" );
 		bool foundDriver = false;
 		bool foundDriver = false;
 		D3D9DriverList* driverList = getDirect3DDrivers();
 		D3D9DriverList* driverList = getDirect3DDrivers();
-		for( ushort j=0; j < driverList->count(); j++ )
+		for( UINT16 j=0; j < driverList->count(); j++ )
 		{
 		{
 			if( driverList->item(j)->DriverDescription() == it->second.currentValue )
 			if( driverList->item(j)->DriverDescription() == it->second.currentValue )
 			{
 			{
@@ -494,7 +494,7 @@ namespace CamelotEngine
 		// Init using current settings
 		// Init using current settings
 		mActiveD3DDriver = NULL;
 		mActiveD3DDriver = NULL;
 		ConfigOptionMap::iterator opt = mOptions.find( "Rendering Device" );
 		ConfigOptionMap::iterator opt = mOptions.find( "Rendering Device" );
-		for( uint j=0; j < getDirect3DDrivers()->count(); j++ )
+		for( UINT32 j=0; j < getDirect3DDrivers()->count(); j++ )
 		{
 		{
 			if( getDirect3DDrivers()->item(j)->DriverDescription() == opt->second.currentValue )
 			if( getDirect3DDrivers()->item(j)->DriverDescription() == opt->second.currentValue )
 			{
 			{
@@ -752,7 +752,7 @@ namespace CamelotEngine
 		rsc->setCapability(RSC_TEXTURE_3D);			
 		rsc->setCapability(RSC_TEXTURE_3D);			
 		rsc->setCapability(RSC_NON_POWER_OF_2_TEXTURES);
 		rsc->setCapability(RSC_NON_POWER_OF_2_TEXTURES);
 		rsc->setNonPOW2TexturesLimited(false);
 		rsc->setNonPOW2TexturesLimited(false);
-		rsc->setNumMultiRenderTargets(OGRE_MAX_MULTIPLE_RENDER_TARGETS);
+		rsc->setNumMultiRenderTargets(CM_MAX_MULTIPLE_RENDER_TARGETS);
 		rsc->setCapability(RSC_MRT_DIFFERENT_BIT_DEPTHS);		
 		rsc->setCapability(RSC_MRT_DIFFERENT_BIT_DEPTHS);		
 		rsc->setCapability(RSC_POINT_SPRITES);			
 		rsc->setCapability(RSC_POINT_SPRITES);			
 		rsc->setCapability(RSC_POINT_EXTENDED_PARAMETERS);								
 		rsc->setCapability(RSC_POINT_EXTENDED_PARAMETERS);								
@@ -763,7 +763,7 @@ namespace CamelotEngine
 		rsc->setStencilBufferBitDepth(8);
 		rsc->setStencilBufferBitDepth(8);
 		rsc->setCapability(RSC_ADVANCED_BLEND_OPERATIONS);
 		rsc->setCapability(RSC_ADVANCED_BLEND_OPERATIONS);
 
 
-		for (uint i=0; i < mDeviceManager->getDeviceCount(); ++i)
+		for (UINT32 i=0; i < mDeviceManager->getDeviceCount(); ++i)
 		{
 		{
 			D3D9Device* device			 = mDeviceManager->getDevice(i);
 			D3D9Device* device			 = mDeviceManager->getDevice(i);
 			IDirect3DDevice9* d3d9Device = device->getD3D9Device();
 			IDirect3DDevice9* d3d9Device = device->getD3D9Device();
@@ -803,7 +803,7 @@ namespace CamelotEngine
 
 
 			if (rkCurCaps.MaxSimultaneousTextures < rsc->getNumTextureUnits())
 			if (rkCurCaps.MaxSimultaneousTextures < rsc->getNumTextureUnits())
 			{
 			{
-				rsc->setNumTextureUnits(static_cast<ushort>(rkCurCaps.MaxSimultaneousTextures));
+				rsc->setNumTextureUnits(static_cast<UINT16>(rkCurCaps.MaxSimultaneousTextures));
 			}
 			}
 
 
 			// Check for Anisotropy.
 			// Check for Anisotropy.
@@ -862,7 +862,7 @@ namespace CamelotEngine
 			// Number of render targets
 			// Number of render targets
 			if (rkCurCaps.NumSimultaneousRTs < rsc->getNumMultiRenderTargets())
 			if (rkCurCaps.NumSimultaneousRTs < rsc->getNumMultiRenderTargets())
 			{
 			{
-				rsc->setNumMultiRenderTargets(std::min((ushort)rkCurCaps.NumSimultaneousRTs, (ushort)OGRE_MAX_MULTIPLE_RENDER_TARGETS));
+				rsc->setNumMultiRenderTargets(std::min((UINT16)rkCurCaps.NumSimultaneousRTs, (UINT16)CM_MAX_MULTIPLE_RENDER_TARGETS));
 			}	
 			}	
 
 
 			if((rkCurCaps.PrimitiveMiscCaps & D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS) == 0)
 			if((rkCurCaps.PrimitiveMiscCaps & D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS) == 0)
@@ -1054,8 +1054,8 @@ namespace CamelotEngine
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
 	void D3D9RenderSystem::convertVertexShaderCaps(RenderSystemCapabilities* rsc) const
 	void D3D9RenderSystem::convertVertexShaderCaps(RenderSystemCapabilities* rsc) const
 	{
 	{
-		ushort major = 0xFF;
-		ushort minor = 0xFF;
+		UINT16 major = 0xFF;
+		UINT16 minor = 0xFF;
 		D3DCAPS9 minVSCaps;
 		D3DCAPS9 minVSCaps;
 
 
 		// Find the device with the lowest vertex shader caps.
 		// Find the device with the lowest vertex shader caps.
@@ -1063,8 +1063,8 @@ namespace CamelotEngine
 		{
 		{
 			D3D9Driver* pCurDriver      = mDriverList->item(i);			
 			D3D9Driver* pCurDriver      = mDriverList->item(i);			
 			const D3DCAPS9& rkCurCaps   = pCurDriver->getD3D9DeviceCaps();
 			const D3DCAPS9& rkCurCaps   = pCurDriver->getD3D9DeviceCaps();
-			ushort currMajor			= static_cast<ushort>((rkCurCaps.VertexShaderVersion & 0x0000FF00) >> 8);
-			ushort currMinor			= static_cast<ushort>(rkCurCaps.VertexShaderVersion & 0x000000FF);
+			UINT16 currMajor			= static_cast<UINT16>((rkCurCaps.VertexShaderVersion & 0x0000FF00) >> 8);
+			UINT16 currMinor			= static_cast<UINT16>(rkCurCaps.VertexShaderVersion & 0x000000FF);
 
 
 			if (currMajor < major)	
 			if (currMajor < major)	
 			{
 			{
@@ -1087,8 +1087,8 @@ namespace CamelotEngine
 			IDirect3DDevice9* lpD3DDevice9 = getActiveD3D9Device();
 			IDirect3DDevice9* lpD3DDevice9 = getActiveD3D9Device();
 			D3DCAPS9 d3dDeviceCaps9;
 			D3DCAPS9 d3dDeviceCaps9;
 			lpD3DDevice9->GetDeviceCaps(&d3dDeviceCaps9);
 			lpD3DDevice9->GetDeviceCaps(&d3dDeviceCaps9);
-			major = static_cast<ushort>((d3dDeviceCaps9.VertexShaderVersion & 0x0000FF00) >> 8);
-			minor = static_cast<ushort>(d3dDeviceCaps9.VertexShaderVersion & 0x000000FF);
+			major = static_cast<UINT16>((d3dDeviceCaps9.VertexShaderVersion & 0x0000FF00) >> 8);
+			minor = static_cast<UINT16>(d3dDeviceCaps9.VertexShaderVersion & 0x000000FF);
 		}
 		}
 		
 		
 		bool vs2x = false;
 		bool vs2x = false;
@@ -1121,7 +1121,7 @@ namespace CamelotEngine
 			// No integer params allowed
 			// No integer params allowed
 			rsc->setVertexProgramConstantIntCount(0);
 			rsc->setVertexProgramConstantIntCount(0);
 			// float params, always 4D
 			// float params, always 4D
-			rsc->setVertexProgramConstantFloatCount(static_cast<ushort>(minVSCaps.MaxVertexShaderConst));
+			rsc->setVertexProgramConstantFloatCount(static_cast<UINT16>(minVSCaps.MaxVertexShaderConst));
 
 
 			break;
 			break;
 		case 2:
 		case 2:
@@ -1130,7 +1130,7 @@ namespace CamelotEngine
 			// 16 integer params allowed, 4D
 			// 16 integer params allowed, 4D
 			rsc->setVertexProgramConstantIntCount(16);
 			rsc->setVertexProgramConstantIntCount(16);
 			// float params, always 4D
 			// float params, always 4D
-			rsc->setVertexProgramConstantFloatCount(static_cast<ushort>(minVSCaps.MaxVertexShaderConst));
+			rsc->setVertexProgramConstantFloatCount(static_cast<UINT16>(minVSCaps.MaxVertexShaderConst));
 			break;
 			break;
 		case 3:
 		case 3:
 			// 16 boolean params allowed
 			// 16 boolean params allowed
@@ -1138,7 +1138,7 @@ namespace CamelotEngine
 			// 16 integer params allowed, 4D
 			// 16 integer params allowed, 4D
 			rsc->setVertexProgramConstantIntCount(16);
 			rsc->setVertexProgramConstantIntCount(16);
 			// float params, always 4D
 			// float params, always 4D
-			rsc->setVertexProgramConstantFloatCount(static_cast<ushort>(minVSCaps.MaxVertexShaderConst));
+			rsc->setVertexProgramConstantFloatCount(static_cast<UINT16>(minVSCaps.MaxVertexShaderConst));
 			break;
 			break;
 		}
 		}
 
 
@@ -1162,8 +1162,8 @@ namespace CamelotEngine
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
 	void D3D9RenderSystem::convertPixelShaderCaps(RenderSystemCapabilities* rsc) const
 	void D3D9RenderSystem::convertPixelShaderCaps(RenderSystemCapabilities* rsc) const
 	{
 	{
-		ushort major = 0xFF;
-		ushort minor = 0xFF;
+		UINT16 major = 0xFF;
+		UINT16 minor = 0xFF;
 		D3DCAPS9 minPSCaps;
 		D3DCAPS9 minPSCaps;
 
 
 		// Find the device with the lowest pixel shader caps.
 		// Find the device with the lowest pixel shader caps.
@@ -1171,8 +1171,8 @@ namespace CamelotEngine
 		{
 		{
 			D3D9Driver* pCurDriver      = mDriverList->item(i);			
 			D3D9Driver* pCurDriver      = mDriverList->item(i);			
 			const D3DCAPS9& currCaps    = pCurDriver->getD3D9DeviceCaps();
 			const D3DCAPS9& currCaps    = pCurDriver->getD3D9DeviceCaps();
-			ushort currMajor			= static_cast<ushort>((currCaps.PixelShaderVersion & 0x0000FF00) >> 8);
-			ushort currMinor			= static_cast<ushort>(currCaps.PixelShaderVersion & 0x000000FF);
+			UINT16 currMajor			= static_cast<UINT16>((currCaps.PixelShaderVersion & 0x0000FF00) >> 8);
+			UINT16 currMinor			= static_cast<UINT16>(currCaps.PixelShaderVersion & 0x000000FF);
 
 
 			if (currMajor < major)	
 			if (currMajor < major)	
 			{
 			{
@@ -1286,7 +1286,7 @@ namespace CamelotEngine
 		D3DSURFACE_DESC bbSurfDesc;
 		D3DSURFACE_DESC bbSurfDesc;
 		bbSurf->GetDesc(&bbSurfDesc);
 		bbSurf->GetDesc(&bbSurfDesc);
 
 
-		for (uint ipf = static_cast<uint>(PF_L8); ipf < static_cast<uint>(PF_COUNT); ++ipf)
+		for (UINT32 ipf = static_cast<UINT32>(PF_L8); ipf < static_cast<UINT32>(PF_COUNT); ++ipf)
 		{
 		{
 			PixelFormat pf = (PixelFormat)ipf;
 			PixelFormat pf = (PixelFormat)ipf;
 
 
@@ -1327,7 +1327,7 @@ namespace CamelotEngine
 		if (d3dPF == D3DFMT_UNKNOWN)
 		if (d3dPF == D3DFMT_UNKNOWN)
 			return false;
 			return false;
 
 
-		for (uint i = 0; i < mDeviceManager->getDeviceCount(); ++i)
+		for (UINT32 i = 0; i < mDeviceManager->getDeviceCount(); ++i)
 		{
 		{
 			D3D9Device* currDevice = mDeviceManager->getDevice(i);
 			D3D9Device* currDevice = mDeviceManager->getDevice(i);
 			D3D9RenderWindow* currDevicePrimaryWindow = currDevice->getPrimaryWindow();
 			D3D9RenderWindow* currDevicePrimaryWindow = currDevice->getPrimaryWindow();
@@ -1442,13 +1442,13 @@ namespace CamelotEngine
 		}
 		}
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void D3D9RenderSystem::_makeProjectionMatrix(const Radian& fovy, Real aspect, Real nearPlane, 
-		Real farPlane, Matrix4& dest, bool forGpuProgram)
+	void D3D9RenderSystem::_makeProjectionMatrix(const Radian& fovy, float aspect, float nearPlane, 
+		float farPlane, Matrix4& dest, bool forGpuProgram)
 	{
 	{
 		Radian theta ( fovy * 0.5 );
 		Radian theta ( fovy * 0.5 );
-		Real h = 1 / Math::Tan(theta);
-		Real w = h / aspect;
-		Real q, qn;
+		float h = 1 / Math::Tan(theta);
+		float w = h / aspect;
+		float q, qn;
 		if (farPlane == 0)
 		if (farPlane == 0)
 		{
 		{
 			q = 1 - Frustum::INFINITE_FAR_PLANE_ADJUST;
 			q = 1 - Frustum::INFINITE_FAR_PLANE_ADJUST;
@@ -1478,26 +1478,26 @@ namespace CamelotEngine
 		dest[2][3] = qn;
 		dest[2][3] = qn;
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void D3D9RenderSystem::_makeOrthoMatrix(const Radian& fovy, Real aspect, Real nearPlane, Real farPlane, 
+	void D3D9RenderSystem::_makeOrthoMatrix(const Radian& fovy, float aspect, float nearPlane, float farPlane, 
 		Matrix4& dest, bool forGpuProgram )
 		Matrix4& dest, bool forGpuProgram )
 	{
 	{
 		Radian thetaY (fovy / 2.0f);
 		Radian thetaY (fovy / 2.0f);
-		Real tanThetaY = Math::Tan(thetaY);
-
-		//Real thetaX = thetaY * aspect;
-		Real tanThetaX = tanThetaY * aspect; //Math::Tan(thetaX);
-		Real half_w = tanThetaX * nearPlane;
-		Real half_h = tanThetaY * nearPlane;
-		Real iw = static_cast<Real>(1.0 / half_w);
-		Real ih = static_cast<Real>(1.0 / half_h);
-		Real q;
+		float tanThetaY = Math::Tan(thetaY);
+
+		//float thetaX = thetaY * aspect;
+		float tanThetaX = tanThetaY * aspect; //Math::Tan(thetaX);
+		float half_w = tanThetaX * nearPlane;
+		float half_h = tanThetaY * nearPlane;
+		float iw = static_cast<float>(1.0 / half_w);
+		float ih = static_cast<float>(1.0 / half_h);
+		float q;
 		if (farPlane == 0)
 		if (farPlane == 0)
 		{
 		{
 			q = 0;
 			q = 0;
 		}
 		}
 		else
 		else
 		{
 		{
-			q = static_cast<Real>(1.0 / (farPlane - nearPlane));
+			q = static_cast<float>(1.0 / (farPlane - nearPlane));
 		}
 		}
 
 
 		dest = Matrix4::ZERO;
 		dest = Matrix4::ZERO;
@@ -1619,7 +1619,7 @@ namespace CamelotEngine
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
 	void D3D9RenderSystem::_setSurfaceParams( const ColourValue &ambient, const ColourValue &diffuse,
 	void D3D9RenderSystem::_setSurfaceParams( const ColourValue &ambient, const ColourValue &diffuse,
-		const ColourValue &specular, const ColourValue &emissive, Real shininess,
+		const ColourValue &specular, const ColourValue &emissive, float shininess,
 		TrackVertexColourType tracking )
 		TrackVertexColourType tracking )
 	{
 	{
 
 
@@ -1650,9 +1650,9 @@ namespace CamelotEngine
 
 
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void D3D9RenderSystem::_setPointParameters(Real size, 
-		bool attenuationEnabled, Real constant, Real linear, Real quadratic,
-		Real minSize, Real maxSize)
+	void D3D9RenderSystem::_setPointParameters(float size, 
+		bool attenuationEnabled, float constant, float linear, float quadratic,
+		float minSize, float maxSize)
 	{
 	{
 		if(attenuationEnabled)
 		if(attenuationEnabled)
 		{
 		{
@@ -2407,7 +2407,7 @@ namespace CamelotEngine
 			"D3D9RenderSystem::_setColourBufferWriteEnabled");
 			"D3D9RenderSystem::_setColourBufferWriteEnabled");
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void D3D9RenderSystem::_setFog( FogMode mode, const ColourValue& colour, Real densitiy, Real start, Real end )
+	void D3D9RenderSystem::_setFog( FogMode mode, const ColourValue& colour, float densitiy, float start, float end )
 	{
 	{
 		HRESULT hr;
 		HRESULT hr;
 
 
@@ -2464,7 +2464,7 @@ namespace CamelotEngine
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
 	void D3D9RenderSystem::setStencilBufferParams(CompareFunction func, 
 	void D3D9RenderSystem::setStencilBufferParams(CompareFunction func, 
-		uint32 refValue, uint32 mask, StencilOperation stencilFailOp, 
+		UINT32 refValue, UINT32 mask, StencilOperation stencilFailOp, 
 		StencilOperation depthFailOp, StencilOperation passOp, 
 		StencilOperation depthFailOp, StencilOperation passOp, 
 		bool twoSidedOperation)
 		bool twoSidedOperation)
 	{
 	{
@@ -2644,8 +2644,8 @@ namespace CamelotEngine
 			window->_validateDevice();
 			window->_validateDevice();
 		}
 		}
 
 
-		// Retrieve render surfaces (up to OGRE_MAX_MULTIPLE_RENDER_TARGETS)
-		IDirect3DSurface9* pBack[OGRE_MAX_MULTIPLE_RENDER_TARGETS];
+		// Retrieve render surfaces (up to CM_MAX_MULTIPLE_RENDER_TARGETS)
+		IDirect3DSurface9* pBack[CM_MAX_MULTIPLE_RENDER_TARGETS];
 		memset(pBack, 0, sizeof(pBack));
 		memset(pBack, 0, sizeof(pBack));
 		target->getCustomAttribute( "DDBACKBUFFER", &pBack );
 		target->getCustomAttribute( "DDBACKBUFFER", &pBack );
 		if (!pBack[0])
 		if (!pBack[0])
@@ -2673,8 +2673,8 @@ namespace CamelotEngine
 			pDepth = _getDepthStencilFor(srfDesc.Format, srfDesc.MultiSampleType, srfDesc.MultiSampleQuality, srfDesc.Width, srfDesc.Height);
 			pDepth = _getDepthStencilFor(srfDesc.Format, srfDesc.MultiSampleType, srfDesc.MultiSampleQuality, srfDesc.Width, srfDesc.Height);
 		}
 		}
 		// Bind render targets
 		// Bind render targets
-		uint count = mCurrentCapabilities->getNumMultiRenderTargets();
-		for(uint x=0; x<count; ++x)
+		UINT32 count = mCurrentCapabilities->getNumMultiRenderTargets();
+		for(UINT32 x=0; x<count; ++x)
 		{
 		{
 			hr = getActiveD3D9Device()->SetRenderTarget(x, pBack[x]);
 			hr = getActiveD3D9Device()->SetRenderTarget(x, pBack[x]);
 			if (FAILED(hr))
 			if (FAILED(hr))
@@ -2769,8 +2769,8 @@ namespace CamelotEngine
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
 	D3D9RenderSystem::ZBufferIdentifier D3D9RenderSystem::getZBufferIdentifier(RenderTarget* rt)
 	D3D9RenderSystem::ZBufferIdentifier D3D9RenderSystem::getZBufferIdentifier(RenderTarget* rt)
 	{
 	{
-		// Retrieve render surfaces (up to OGRE_MAX_MULTIPLE_RENDER_TARGETS)
-		IDirect3DSurface9* pBack[OGRE_MAX_MULTIPLE_RENDER_TARGETS];
+		// Retrieve render surfaces (up to CM_MAX_MULTIPLE_RENDER_TARGETS)
+		IDirect3DSurface9* pBack[CM_MAX_MULTIPLE_RENDER_TARGETS];
 		memset(pBack, 0, sizeof(pBack));
 		memset(pBack, 0, sizeof(pBack));
 		rt->getCustomAttribute( "DDBACKBUFFER", &pBack );
 		rt->getCustomAttribute( "DDBACKBUFFER", &pBack );
 		assert(pBack[0]);
 		assert(pBack[0]);
@@ -3106,16 +3106,16 @@ namespace CamelotEngine
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
 	void D3D9RenderSystem::bindGpuProgramParameters(GpuProgramType gptype, 
 	void D3D9RenderSystem::bindGpuProgramParameters(GpuProgramType gptype, 
-		GpuProgramParametersSharedPtr params, uint16 variability)
+		GpuProgramParametersSharedPtr params, UINT16 variability)
 	{
 	{
 		// special case pass iteration
 		// special case pass iteration
-		if (variability == (uint16)GPV_PASS_ITERATION_NUMBER)
+		if (variability == (UINT16)GPV_PASS_ITERATION_NUMBER)
 		{
 		{
 			bindGpuProgramPassIterationParameters(gptype);
 			bindGpuProgramPassIterationParameters(gptype);
 			return;
 			return;
 		}
 		}
 		
 		
-		if (variability & (uint16)GPV_GLOBAL)
+		if (variability & (UINT16)GPV_GLOBAL)
 		{
 		{
 			// D3D9 doesn't support shared constant buffers, so use copy routine
 			// D3D9 doesn't support shared constant buffers, so use copy routine
 			params->_copySharedParams();
 			params->_copySharedParams();
@@ -3367,7 +3367,7 @@ namespace CamelotEngine
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
 	void D3D9RenderSystem::clearFrameBuffer(unsigned int buffers, 
 	void D3D9RenderSystem::clearFrameBuffer(unsigned int buffers, 
-		const ColourValue& colour, Real depth, unsigned short stencil)
+		const ColourValue& colour, float depth, unsigned short stencil)
 	{
 	{
 		DWORD flags = 0;
 		DWORD flags = 0;
 		if (buffers & FBT_COLOUR)
 		if (buffers & FBT_COLOUR)
@@ -3398,15 +3398,15 @@ namespace CamelotEngine
 		}
 		}
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void D3D9RenderSystem::_makeProjectionMatrix(Real left, Real right, 
-		Real bottom, Real top, Real nearPlane, Real farPlane, Matrix4& dest,
+	void D3D9RenderSystem::_makeProjectionMatrix(float left, float right, 
+		float bottom, float top, float nearPlane, float farPlane, Matrix4& dest,
 		bool forGpuProgram)
 		bool forGpuProgram)
 	{
 	{
 		// Correct position for off-axis projection matrix
 		// Correct position for off-axis projection matrix
 		if (!forGpuProgram)
 		if (!forGpuProgram)
 		{
 		{
-			Real offsetX = left + right;
-			Real offsetY = top + bottom;
+			float offsetX = left + right;
+			float offsetY = top + bottom;
 
 
 			left -= offsetX;
 			left -= offsetX;
 			right -= offsetX;
 			right -= offsetX;
@@ -3414,9 +3414,9 @@ namespace CamelotEngine
 			bottom -= offsetY;
 			bottom -= offsetY;
 		}
 		}
 
 
-		Real width = right - left;
-		Real height = top - bottom;
-		Real q, qn;
+		float width = right - left;
+		float height = top - bottom;
+		float q, qn;
 		if (farPlane == 0)
 		if (farPlane == 0)
 		{
 		{
 			q = 1 - Frustum::INFINITE_FAR_PLANE_ADJUST;
 			q = 1 - Frustum::INFINITE_FAR_PLANE_ADJUST;
@@ -3446,14 +3446,14 @@ namespace CamelotEngine
 	}
 	}
 
 
 	// ------------------------------------------------------------------
 	// ------------------------------------------------------------------
-	void D3D9RenderSystem::setClipPlane (ushort index, Real A, Real B, Real C, Real D)
+	void D3D9RenderSystem::setClipPlane (UINT16 index, float A, float B, float C, float D)
 	{
 	{
 		float plane[4] = { A, B, C, D };
 		float plane[4] = { A, B, C, D };
 		getActiveD3D9Device()->SetClipPlane (index, plane);
 		getActiveD3D9Device()->SetClipPlane (index, plane);
 	}
 	}
 
 
 	// ------------------------------------------------------------------
 	// ------------------------------------------------------------------
-	void D3D9RenderSystem::enableClipPlane (ushort index, bool enable)
+	void D3D9RenderSystem::enableClipPlane (UINT16 index, bool enable)
 	{
 	{
 		DWORD prev;
 		DWORD prev;
 		getActiveD3D9Device()->GetRenderState(D3DRS_CLIPPLANEENABLE, &prev);
 		getActiveD3D9Device()->GetRenderState(D3DRS_CLIPPLANEENABLE, &prev);
@@ -3468,13 +3468,13 @@ namespace CamelotEngine
 		return ret;
 		return ret;
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	Real D3D9RenderSystem::getHorizontalTexelOffset()
+	float D3D9RenderSystem::getHorizontalTexelOffset()
 	{
 	{
 		// D3D considers the origin to be in the center of a pixel
 		// D3D considers the origin to be in the center of a pixel
 		return -0.5f;
 		return -0.5f;
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	Real D3D9RenderSystem::getVerticalTexelOffset()
+	float D3D9RenderSystem::getVerticalTexelOffset()
 	{
 	{
 		// D3D considers the origin to be in the center of a pixel
 		// D3D considers the origin to be in the center of a pixel
 		return -0.5f;
 		return -0.5f;
@@ -3527,13 +3527,13 @@ namespace CamelotEngine
 		matrix[2][3] = c.w;        
 		matrix[2][3] = c.w;        
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	Real D3D9RenderSystem::getMinimumDepthInputValue()
+	float D3D9RenderSystem::getMinimumDepthInputValue()
 	{
 	{
 		// Range [0.0f, 1.0f]
 		// Range [0.0f, 1.0f]
 		return 0.0f;
 		return 0.0f;
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	Real D3D9RenderSystem::getMaximumDepthInputValue()
+	float D3D9RenderSystem::getMaximumDepthInputValue()
 	{
 	{
 		// Range [0.0f, 1.0f]
 		// Range [0.0f, 1.0f]
 		// D3D inverts even identity view matrices, so maximum INPUT is -1.0
 		// D3D inverts even identity view matrices, so maximum INPUT is -1.0
@@ -3825,7 +3825,7 @@ namespace CamelotEngine
 		mActiveViewport = NULL;
 		mActiveViewport = NULL;
 
 
 		// Reset the texture stages, they will need to be rebound
 		// Reset the texture stages, they will need to be rebound
-		for (size_t i = 0; i < OGRE_MAX_TEXTURE_LAYERS; ++i)
+		for (size_t i = 0; i < CM_MAX_TEXTURE_LAYERS; ++i)
 			_setTexture(i, false, TexturePtr());
 			_setTexture(i, false, TexturePtr());
 
 
 		fireEvent("DeviceRestored");
 		fireEvent("DeviceRestored");
@@ -3865,7 +3865,7 @@ namespace CamelotEngine
 		D3D9Driver* deviceDriver = mActiveD3DDriver;
 		D3D9Driver* deviceDriver = mActiveD3DDriver;
 		D3D9Device* device = mDeviceManager->getDeviceFromD3D9Device(d3d9Device);
 		D3D9Device* device = mDeviceManager->getDeviceFromD3D9Device(d3d9Device);
 
 
-		for (uint i = 0; i < driverList->count(); ++i)
+		for (UINT32 i = 0; i < driverList->count(); ++i)
 		{
 		{
 			D3D9Driver* currDriver = driverList->item(i);
 			D3D9Driver* currDriver = driverList->item(i);
 
 

+ 19 - 19
CamelotRenderer/OgreD3D9RenderSystem.h

@@ -88,7 +88,7 @@ namespace CamelotEngine
 			IDirect3DBaseTexture9 *pTex;
 			IDirect3DBaseTexture9 *pTex;
 			/// vertex texture 
 			/// vertex texture 
 			IDirect3DBaseTexture9 *pVertexTex;
 			IDirect3DBaseTexture9 *pVertexTex;
-		} mTexStageDesc[OGRE_MAX_TEXTURE_LAYERS];
+		} mTexStageDesc[CM_MAX_TEXTURE_LAYERS];
 
 
 		// Array of up to 8 lights, indexed as per API
 		// Array of up to 8 lights, indexed as per API
 		// Note that a null value indicates a free slot
 		// Note that a null value indicates a free slot
@@ -104,7 +104,7 @@ namespace CamelotEngine
 		HRESULT __SetSamplerState(DWORD sampler, D3DSAMPLERSTATETYPE type, DWORD value);
 		HRESULT __SetSamplerState(DWORD sampler, D3DSAMPLERSTATETYPE type, DWORD value);
 		HRESULT __SetTextureStageState(DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value);
 		HRESULT __SetTextureStageState(DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value);
 
 
-		HRESULT __SetFloatRenderState(D3DRENDERSTATETYPE state, Real value)
+		HRESULT __SetFloatRenderState(D3DRENDERSTATETYPE state, float value)
 		{
 		{
 #if OGRE_DOUBLE_PRECISION == 1
 #if OGRE_DOUBLE_PRECISION == 1
 			float temp = static_cast<float>(value);
 			float temp = static_cast<float>(value);
@@ -222,7 +222,7 @@ namespace CamelotEngine
 		VertexElementType getColourVertexElementType() const;
 		VertexElementType getColourVertexElementType() const;
 		void setStencilCheckEnabled(bool enabled);
 		void setStencilCheckEnabled(bool enabled);
         void setStencilBufferParams(CompareFunction func = CMPF_ALWAYS_PASS, 
         void setStencilBufferParams(CompareFunction func = CMPF_ALWAYS_PASS, 
-            uint32 refValue = 0, uint32 mask = 0xFFFFFFFF, 
+            UINT32 refValue = 0, UINT32 mask = 0xFFFFFFFF, 
             StencilOperation stencilFailOp = SOP_KEEP, 
             StencilOperation stencilFailOp = SOP_KEEP, 
             StencilOperation depthFailOp = SOP_KEEP,
             StencilOperation depthFailOp = SOP_KEEP,
             StencilOperation passOp = SOP_KEEP, 
             StencilOperation passOp = SOP_KEEP, 
@@ -234,10 +234,10 @@ namespace CamelotEngine
 		void _setWorldMatrix( const Matrix4 &m );
 		void _setWorldMatrix( const Matrix4 &m );
 		void _setViewMatrix( const Matrix4 &m );
 		void _setViewMatrix( const Matrix4 &m );
 		void _setProjectionMatrix( const Matrix4 &m );
 		void _setProjectionMatrix( const Matrix4 &m );
-		void _setSurfaceParams( const ColourValue &ambient, const ColourValue &diffuse, const ColourValue &specular, const ColourValue &emissive, Real shininess, TrackVertexColourType tracking );
+		void _setSurfaceParams( const ColourValue &ambient, const ColourValue &diffuse, const ColourValue &specular, const ColourValue &emissive, float shininess, TrackVertexColourType tracking );
 		void _setPointSpritesEnabled(bool enabled);
 		void _setPointSpritesEnabled(bool enabled);
-		void _setPointParameters(Real size, bool attenuationEnabled, 
-			Real constant, Real linear, Real quadratic, Real minSize, Real maxSize);
+		void _setPointParameters(float size, bool attenuationEnabled, 
+			float constant, float linear, float quadratic, float minSize, float maxSize);
 		void _setTexture(size_t unit, bool enabled, const TexturePtr &texPtr);
 		void _setTexture(size_t unit, bool enabled, const TexturePtr &texPtr);
 		void _setVertexTexture(size_t unit, const TexturePtr& tex);
 		void _setVertexTexture(size_t unit, const TexturePtr& tex);
 		void _disableTextureUnit(size_t texUnit);
 		void _disableTextureUnit(size_t texUnit);
@@ -264,14 +264,14 @@ namespace CamelotEngine
 		void _setDepthBufferWriteEnabled(bool enabled = true);
 		void _setDepthBufferWriteEnabled(bool enabled = true);
 		void _setDepthBufferFunction( CompareFunction func = CMPF_LESS_EQUAL );
 		void _setDepthBufferFunction( CompareFunction func = CMPF_LESS_EQUAL );
 		void _setDepthBias(float constantBias, float slopeScaleBias);
 		void _setDepthBias(float constantBias, float slopeScaleBias);
-		void _setFog( FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White, Real expDensity = 1.0, Real linearStart = 0.0, Real linearEnd = 1.0 );
+		void _setFog( FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White, float expDensity = 1.0, float linearStart = 0.0, float linearEnd = 1.0 );
 		void _convertProjectionMatrix(const Matrix4& matrix,
 		void _convertProjectionMatrix(const Matrix4& matrix,
             Matrix4& dest, bool forGpuProgram = false);
             Matrix4& dest, bool forGpuProgram = false);
-		void _makeProjectionMatrix(const Radian& fovy, Real aspect, Real nearPlane, Real farPlane, 
+		void _makeProjectionMatrix(const Radian& fovy, float aspect, float nearPlane, float farPlane, 
             Matrix4& dest, bool forGpuProgram = false);
             Matrix4& dest, bool forGpuProgram = false);
-		void _makeProjectionMatrix(Real left, Real right, Real bottom, Real top, Real nearPlane, 
-            Real farPlane, Matrix4& dest, bool forGpuProgram = false);
-		void _makeOrthoMatrix(const Radian& fovy, Real aspect, Real nearPlane, Real farPlane, 
+		void _makeProjectionMatrix(float left, float right, float bottom, float top, float nearPlane, 
+            float farPlane, Matrix4& dest, bool forGpuProgram = false);
+		void _makeOrthoMatrix(const Radian& fovy, float aspect, float nearPlane, float farPlane, 
             Matrix4& dest, bool forGpuProgram = false);
             Matrix4& dest, bool forGpuProgram = false);
         void _applyObliqueDepthProjection(Matrix4& matrix, const Plane& plane, 
         void _applyObliqueDepthProjection(Matrix4& matrix, const Plane& plane, 
             bool forGpuProgram);
             bool forGpuProgram);
@@ -293,20 +293,20 @@ namespace CamelotEngine
           RenderSystem
           RenderSystem
          */
          */
 		void bindGpuProgramParameters(GpuProgramType gptype, 
 		void bindGpuProgramParameters(GpuProgramType gptype, 
-			GpuProgramParametersSharedPtr params, uint16 variabilityMask);
+			GpuProgramParametersSharedPtr params, UINT16 variabilityMask);
         void bindGpuProgramPassIterationParameters(GpuProgramType gptype);
         void bindGpuProgramPassIterationParameters(GpuProgramType gptype);
 
 
         void setScissorTest(bool enabled, size_t left = 0, size_t top = 0, size_t right = 800, size_t bottom = 600);
         void setScissorTest(bool enabled, size_t left = 0, size_t top = 0, size_t right = 800, size_t bottom = 600);
         void clearFrameBuffer(unsigned int buffers, 
         void clearFrameBuffer(unsigned int buffers, 
             const ColourValue& colour = ColourValue::Black, 
             const ColourValue& colour = ColourValue::Black, 
-            Real depth = 1.0f, unsigned short stencil = 0);
-		void setClipPlane (ushort index, Real A, Real B, Real C, Real D);
-		void enableClipPlane (ushort index, bool enable);
+            float depth = 1.0f, unsigned short stencil = 0);
+		void setClipPlane (UINT16 index, float A, float B, float C, float D);
+		void enableClipPlane (UINT16 index, bool enable);
         HardwareOcclusionQuery* createHardwareOcclusionQuery();
         HardwareOcclusionQuery* createHardwareOcclusionQuery();
-        Real getHorizontalTexelOffset();
-        Real getVerticalTexelOffset();
-        Real getMinimumDepthInputValue();
-        Real getMaximumDepthInputValue();
+        float getHorizontalTexelOffset();
+        float getVerticalTexelOffset();
+        float getMinimumDepthInputValue();
+        float getMaximumDepthInputValue();
 		void registerThread();
 		void registerThread();
 		void unregisterThread();
 		void unregisterThread();
 		void preExtraThreadsStarted();
 		void preExtraThreadsStarted();

+ 1 - 1
CamelotRenderer/OgreD3D9RenderWindow.cpp

@@ -179,7 +179,7 @@ namespace CamelotEngine
 			{
 			{
 				IDirect3D9* direct3D9 = D3D9RenderSystem::getDirect3D9();
 				IDirect3D9* direct3D9 = D3D9RenderSystem::getDirect3D9();
 
 
-				for (uint i=0; i < direct3D9->GetAdapterCount(); ++i)
+				for (UINT32 i=0; i < direct3D9->GetAdapterCount(); ++i)
 				{
 				{
 					if (i == monitorIndex)
 					if (i == monitorIndex)
 					{
 					{

+ 5 - 5
CamelotRenderer/OgreD3D9Texture.cpp

@@ -196,7 +196,7 @@ namespace CamelotEngine
 
 
 		D3D9_DEVICE_ACCESS_CRITICAL_SECTION
 		D3D9_DEVICE_ACCESS_CRITICAL_SECTION
 
 
-		for (uint i = 0; i < D3D9RenderSystem::getResourceCreationDeviceCount(); ++i)
+		for (UINT32 i = 0; i < D3D9RenderSystem::getResourceCreationDeviceCount(); ++i)
 		{
 		{
 			IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getResourceCreationDevice(i);
 			IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getResourceCreationDevice(i);
 
 
@@ -222,7 +222,7 @@ namespace CamelotEngine
 		//
 		//
 
 
 		//// Set reading positions of loaded streams to the beginning.
 		//// Set reading positions of loaded streams to the beginning.
-		//for (uint i = 0; i < mLoadedStreams->size(); ++i)
+		//for (UINT32 i = 0; i < mLoadedStreams->size(); ++i)
 		//{
 		//{
 		//	MemoryDataStreamPtr curDataStream = (*mLoadedStreams)[i];
 		//	MemoryDataStreamPtr curDataStream = (*mLoadedStreams)[i];
 
 
@@ -892,7 +892,7 @@ namespace CamelotEngine
 	{
 	{
 		D3D9_DEVICE_ACCESS_CRITICAL_SECTION
 		D3D9_DEVICE_ACCESS_CRITICAL_SECTION
 
 
-		for (uint i = 0; i < D3D9RenderSystem::getResourceCreationDeviceCount(); ++i)
+		for (UINT32 i = 0; i < D3D9RenderSystem::getResourceCreationDeviceCount(); ++i)
 		{
 		{
 			IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getResourceCreationDevice(i);
 			IDirect3DDevice9* d3d9Device = D3D9RenderSystem::getResourceCreationDevice(i);
 
 
@@ -1625,7 +1625,7 @@ namespace CamelotEngine
 			bufusage |= TU_RENDERTARGET;
 			bufusage |= TU_RENDERTARGET;
 		}
 		}
 		
 		
-		uint surfaceCount  = static_cast<uint>((getNumFaces() * (mNumMipmaps + 1)));
+		UINT32 surfaceCount  = static_cast<UINT32>((getNumFaces() * (mNumMipmaps + 1)));
 		bool updateOldList = mSurfaceList.size() == surfaceCount;
 		bool updateOldList = mSurfaceList.size() == surfaceCount;
 		if(!updateOldList)
 		if(!updateOldList)
 		{			
 		{			
@@ -1880,7 +1880,7 @@ namespace CamelotEngine
 	D3D9RenderTexture::D3D9RenderTexture(const String &name, 
 	D3D9RenderTexture::D3D9RenderTexture(const String &name, 
 		D3D9HardwarePixelBuffer *buffer, 
 		D3D9HardwarePixelBuffer *buffer, 
 		bool writeGamma, 
 		bool writeGamma, 
-		uint fsaa) : RenderTexture(buffer, 0)
+		UINT32 fsaa) : RenderTexture(buffer, 0)
 	{
 	{
 		mName = name;
 		mName = name;
 		mHwGamma = writeGamma;
 		mHwGamma = writeGamma;

+ 1 - 1
CamelotRenderer/OgreD3D9Texture.h

@@ -224,7 +224,7 @@ namespace CamelotEngine {
     class _OgreD3D9Export D3D9RenderTexture : public RenderTexture
     class _OgreD3D9Export D3D9RenderTexture : public RenderTexture
     {
     {
     public:
     public:
-		D3D9RenderTexture(const String &name, D3D9HardwarePixelBuffer *buffer, bool writeGamma, uint fsaa);
+		D3D9RenderTexture(const String &name, D3D9HardwarePixelBuffer *buffer, bool writeGamma, UINT32 fsaa);
         ~D3D9RenderTexture() {}
         ~D3D9RenderTexture() {}
 
 
 		virtual void update(bool swap);
 		virtual void update(bool swap);

+ 94 - 104
CamelotRenderer/OgreFrustum.cpp

@@ -28,9 +28,9 @@ THE SOFTWARE.
 
 
 #include "OgreFrustum.h"
 #include "OgreFrustum.h"
 
 
-#include "OgreMath.h"
-#include "OgreMatrix3.h"
-#include "OgreSphere.h"
+#include "CmMath.h"
+#include "CmMatrix3.h"
+#include "CmSphere.h"
 #include "OgreException.h"
 #include "OgreException.h"
 #include "OgreHardwareBufferManager.h"
 #include "OgreHardwareBufferManager.h"
 #include "OgreHardwareVertexBuffer.h"
 #include "OgreHardwareVertexBuffer.h"
@@ -39,7 +39,7 @@ THE SOFTWARE.
 #include "CmRenderSystemManager.h"
 #include "CmRenderSystemManager.h"
 
 
 namespace CamelotEngine {
 namespace CamelotEngine {
-    const Real Frustum::INFINITE_FAR_PLANE_ADJUST = 0.00001f;
+    const float Frustum::INFINITE_FAR_PLANE_ADJUST = 0.00001f;
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
     Frustum::Frustum(const String& name) : 
     Frustum::Frustum(const String& name) : 
         mProjType(PT_PERSPECTIVE), 
         mProjType(PT_PERSPECTIVE), 
@@ -86,20 +86,20 @@ namespace CamelotEngine {
 
 
 
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void Frustum::setFarClipDistance(Real farPlane)
+    void Frustum::setFarClipDistance(float farPlane)
     {
     {
         mFarDist = farPlane;
         mFarDist = farPlane;
         invalidateFrustum();
         invalidateFrustum();
     }
     }
 
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    Real Frustum::getFarClipDistance(void) const
+    float Frustum::getFarClipDistance(void) const
     {
     {
         return mFarDist;
         return mFarDist;
     }
     }
 
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void Frustum::setNearClipDistance(Real nearPlane)
+    void Frustum::setNearClipDistance(float nearPlane)
     {
     {
         if (nearPlane <= 0)
         if (nearPlane <= 0)
             OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Near clip distance must be greater than zero.",
             OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Near clip distance must be greater than zero.",
@@ -109,7 +109,7 @@ namespace CamelotEngine {
     }
     }
 
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    Real Frustum::getNearClipDistance(void) const
+    float Frustum::getNearClipDistance(void) const
     {
     {
         return mNearDist;
         return mNearDist;
     }
     }
@@ -121,7 +121,7 @@ namespace CamelotEngine {
         invalidateFrustum();
         invalidateFrustum();
     }
     }
     //---------------------------------------------------------------------
     //---------------------------------------------------------------------
-    void Frustum::setFrustumOffset(Real horizontal, Real vertical)
+    void Frustum::setFrustumOffset(float horizontal, float vertical)
     {
     {
         setFrustumOffset(Vector2(horizontal, vertical));
         setFrustumOffset(Vector2(horizontal, vertical));
     }
     }
@@ -131,7 +131,7 @@ namespace CamelotEngine {
         return mFrustumOffset;
         return mFrustumOffset;
     }
     }
     //---------------------------------------------------------------------
     //---------------------------------------------------------------------
-    void Frustum::setFocalLength(Real focalLength)
+    void Frustum::setFocalLength(float focalLength)
     {
     {
         if (focalLength <= 0)
         if (focalLength <= 0)
         {
         {
@@ -144,7 +144,7 @@ namespace CamelotEngine {
         invalidateFrustum();
         invalidateFrustum();
     }
     }
     //---------------------------------------------------------------------
     //---------------------------------------------------------------------
-    Real Frustum::getFocalLength() const
+    float Frustum::getFocalLength() const
     {
     {
         return mFocalLength;
         return mFocalLength;
     }
     }
@@ -294,7 +294,7 @@ namespace CamelotEngine {
         return true;
         return true;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void Frustum::calcProjectionParameters(Real& left, Real& right, Real& bottom, Real& top) const
+    void Frustum::calcProjectionParameters(float& left, float& right, float& bottom, float& top) const
     { 
     { 
 		if (mCustomProjMatrix)
 		if (mCustomProjMatrix)
 		{
 		{
@@ -325,14 +325,14 @@ namespace CamelotEngine {
 			else if (mProjType == PT_PERSPECTIVE)
 			else if (mProjType == PT_PERSPECTIVE)
 			{
 			{
 				Radian thetaY (mFOVy * 0.5f);
 				Radian thetaY (mFOVy * 0.5f);
-				Real tanThetaY = Math::Tan(thetaY);
-				Real tanThetaX = tanThetaY * mAspect;
+				float tanThetaY = Math::Tan(thetaY);
+				float tanThetaX = tanThetaY * mAspect;
 
 
-				Real nearFocal = mNearDist / mFocalLength;
-				Real nearOffsetX = mFrustumOffset.x * nearFocal;
-				Real nearOffsetY = mFrustumOffset.y * nearFocal;
-				Real half_w = tanThetaX * mNearDist;
-				Real half_h = tanThetaY * mNearDist;
+				float nearFocal = mNearDist / mFocalLength;
+				float nearOffsetX = mFrustumOffset.x * nearFocal;
+				float nearOffsetY = mFrustumOffset.y * nearFocal;
+				float half_w = tanThetaX * mNearDist;
+				float half_h = tanThetaY * mNearDist;
 
 
 				left   = - half_w + nearOffsetX;
 				left   = - half_w + nearOffsetX;
 				right  = + half_w + nearOffsetX;
 				right  = + half_w + nearOffsetX;
@@ -347,8 +347,8 @@ namespace CamelotEngine {
 			else
 			else
 			{
 			{
 				// Unknown how to apply frustum offset to orthographic camera, just ignore here
 				// Unknown how to apply frustum offset to orthographic camera, just ignore here
-				Real half_w = getOrthoWindowWidth() * 0.5f;
-				Real half_h = getOrthoWindowHeight() * 0.5f;
+				float half_w = getOrthoWindowWidth() * 0.5f;
+				float half_h = getOrthoWindowHeight() * 0.5f;
 
 
 				left   = - half_w;
 				left   = - half_w;
 				right  = + half_w;
 				right  = + half_w;
@@ -367,14 +367,9 @@ namespace CamelotEngine {
 	void Frustum::updateFrustumImpl(void) const
 	void Frustum::updateFrustumImpl(void) const
 	{
 	{
 		// Common calcs
 		// Common calcs
-		Real left, right, bottom, top;
+		float left, right, bottom, top;
 
 
-#if OGRE_NO_VIEWPORT_ORIENTATIONMODE == 0
-        if (mOrientationMode != OR_PORTRAIT)
-            calcProjectionParameters(bottom, top, left, right);
-        else
-#endif
-            calcProjectionParameters(left, right, bottom, top);
+        calcProjectionParameters(left, right, bottom, top);
 
 
 		if (!mCustomProjMatrix)
 		if (!mCustomProjMatrix)
 		{
 		{
@@ -384,19 +379,19 @@ namespace CamelotEngine {
 			// Doesn't optimise manually except division operator, so the 
 			// Doesn't optimise manually except division operator, so the 
 			// code more self-explaining.
 			// code more self-explaining.
 
 
-			Real inv_w = 1 / (right - left);
-			Real inv_h = 1 / (top - bottom);
-			Real inv_d = 1 / (mFarDist - mNearDist);
+			float inv_w = 1 / (right - left);
+			float inv_h = 1 / (top - bottom);
+			float inv_d = 1 / (mFarDist - mNearDist);
 
 
 			// Recalc if frustum params changed
 			// Recalc if frustum params changed
 			if (mProjType == PT_PERSPECTIVE)
 			if (mProjType == PT_PERSPECTIVE)
 			{
 			{
 				// Calc matrix elements
 				// Calc matrix elements
-				Real A = 2 * mNearDist * inv_w;
-				Real B = 2 * mNearDist * inv_h;
-				Real C = (right + left) * inv_w;
-				Real D = (top + bottom) * inv_h;
-				Real q, qn;
+				float A = 2 * mNearDist * inv_w;
+				float B = 2 * mNearDist * inv_h;
+				float C = (right + left) * inv_w;
+				float D = (top + bottom) * inv_h;
+				float q, qn;
 				if (mFarDist == 0)
 				if (mFarDist == 0)
 				{
 				{
 					// Infinite far plane
 					// Infinite far plane
@@ -435,11 +430,11 @@ namespace CamelotEngine {
 			} // perspective
 			} // perspective
 			else if (mProjType == PT_ORTHOGRAPHIC)
 			else if (mProjType == PT_ORTHOGRAPHIC)
 			{
 			{
-				Real A = 2 * inv_w;
-				Real B = 2 * inv_h;
-				Real C = - (right + left) * inv_w;
-				Real D = - (top + bottom) * inv_h;
-				Real q, qn;
+				float A = 2 * inv_w;
+				float B = 2 * inv_h;
+				float C = - (right + left) * inv_w;
+				float D = - (top + bottom) * inv_h;
+				float q, qn;
 				if (mFarDist == 0)
 				if (mFarDist == 0)
 				{
 				{
 					// Can not do infinite far plane here, avoid divided zero only
 					// Can not do infinite far plane here, avoid divided zero only
@@ -478,11 +473,6 @@ namespace CamelotEngine {
 			} // ortho            
 			} // ortho            
 		} // !mCustomProjMatrix
 		} // !mCustomProjMatrix
 
 
-#if OGRE_NO_VIEWPORT_ORIENTATIONMODE == 0
-        // Deal with orientation mode
-        mProjMatrix = mProjMatrix * Quaternion(Degree(mOrientationMode * 90.f), Vector3::UNIT_Z);
-#endif
-
 		RenderSystem* renderSystem = CamelotEngine::RenderSystemManager::getActive();
 		RenderSystem* renderSystem = CamelotEngine::RenderSystemManager::getActive();
 		// API specific
 		// API specific
 		renderSystem->_convertProjectionMatrix(mProjMatrix, mProjMatrixRS);
 		renderSystem->_convertProjectionMatrix(mProjMatrix, mProjMatrixRS);
@@ -493,7 +483,7 @@ namespace CamelotEngine {
 		// Calculate bounding box (local)
 		// Calculate bounding box (local)
 		// Box is from 0, down -Z, max dimensions as determined from far plane
 		// Box is from 0, down -Z, max dimensions as determined from far plane
 		// If infinite view frustum just pick a far value
 		// If infinite view frustum just pick a far value
-		Real farDist = (mFarDist == 0) ? 100000 : mFarDist;
+		float farDist = (mFarDist == 0) ? 100000 : mFarDist;
 		// Near plane bounds
 		// Near plane bounds
 		Vector3 min(left, bottom, -farDist);
 		Vector3 min(left, bottom, -farDist);
 		Vector3 max(right, top, 0);
 		Vector3 max(right, top, 0);
@@ -510,7 +500,7 @@ namespace CamelotEngine {
 		if (mProjType == PT_PERSPECTIVE)
 		if (mProjType == PT_PERSPECTIVE)
 		{
 		{
 			// Merge with far plane bounds
 			// Merge with far plane bounds
-			Real radio = farDist / mNearDist;
+			float radio = farDist / mNearDist;
 			min.makeFloor(Vector3(left * radio, bottom * radio, -farDist));
 			min.makeFloor(Vector3(left * radio, bottom * radio, -farDist));
 			max.makeCeil(Vector3(right * radio, top * radio, 0));
 			max.makeCeil(Vector3(right * radio, top * radio, 0));
 		}
 		}
@@ -551,18 +541,18 @@ namespace CamelotEngine {
             //       still need to working with projection parameters.
             //       still need to working with projection parameters.
 
 
             // Calc near plane corners
             // Calc near plane corners
-            Real vpLeft, vpRight, vpBottom, vpTop;
+            float vpLeft, vpRight, vpBottom, vpTop;
             calcProjectionParameters(vpLeft, vpRight, vpBottom, vpTop);
             calcProjectionParameters(vpLeft, vpRight, vpBottom, vpTop);
 
 
             // Treat infinite fardist as some arbitrary far value
             // Treat infinite fardist as some arbitrary far value
-            Real farDist = (mFarDist == 0) ? 100000 : mFarDist;
+            float farDist = (mFarDist == 0) ? 100000 : mFarDist;
 
 
             // Calc far plane corners
             // Calc far plane corners
-            Real radio = mProjType == PT_PERSPECTIVE ? farDist / mNearDist : 1;
-            Real farLeft = vpLeft * radio;
-            Real farRight = vpRight * radio;
-            Real farBottom = vpBottom * radio;
-            Real farTop = vpTop * radio;
+            float radio = mProjType == PT_PERSPECTIVE ? farDist / mNearDist : 1;
+            float farLeft = vpLeft * radio;
+            float farRight = vpRight * radio;
+            float farBottom = vpBottom * radio;
+            float farTop = vpTop * radio;
 
 
             // Calculate vertex positions (local)
             // Calculate vertex positions (local)
             // 0 is the origin
             // 0 is the origin
@@ -741,7 +731,7 @@ namespace CamelotEngine {
 		// Renormalise any normals which were not unit length
 		// Renormalise any normals which were not unit length
 		for(int i=0; i<6; i++ ) 
 		for(int i=0; i<6; i++ ) 
 		{
 		{
-			Real length = mFrustumPlanes[i].normal.normalise();
+			float length = mFrustumPlanes[i].normal.normalise();
 			mFrustumPlanes[i].d /= length;
 			mFrustumPlanes[i].d /= length;
 		}
 		}
 
 
@@ -768,18 +758,18 @@ namespace CamelotEngine {
 		//       still need to working with projection parameters.
 		//       still need to working with projection parameters.
 
 
 		// Calc near plane corners
 		// Calc near plane corners
-		Real nearLeft, nearRight, nearBottom, nearTop;
+		float nearLeft, nearRight, nearBottom, nearTop;
 		calcProjectionParameters(nearLeft, nearRight, nearBottom, nearTop);
 		calcProjectionParameters(nearLeft, nearRight, nearBottom, nearTop);
 
 
 		// Treat infinite fardist as some arbitrary far value
 		// Treat infinite fardist as some arbitrary far value
-		Real farDist = (mFarDist == 0) ? 100000 : mFarDist;
+		float farDist = (mFarDist == 0) ? 100000 : mFarDist;
 
 
 		// Calc far palne corners
 		// Calc far palne corners
-		Real radio = mProjType == PT_PERSPECTIVE ? farDist / mNearDist : 1;
-		Real farLeft = nearLeft * radio;
-		Real farRight = nearRight * radio;
-		Real farBottom = nearBottom * radio;
-		Real farTop = nearTop * radio;
+		float radio = mProjType == PT_PERSPECTIVE ? farDist / mNearDist : 1;
+		float farLeft = nearLeft * radio;
+		float farRight = nearRight * radio;
+		float farBottom = nearBottom * radio;
+		float farTop = nearTop * radio;
 
 
 		// near
 		// near
 		mWorldSpaceCorners[0] = eyeToWorld.transformAffine(Vector3(nearRight, nearTop,    -mNearDist));
 		mWorldSpaceCorners[0] = eyeToWorld.transformAffine(Vector3(nearRight, nearTop,    -mNearDist));
@@ -808,13 +798,13 @@ namespace CamelotEngine {
     }
     }
 
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    Real Frustum::getAspectRatio(void) const
+    float Frustum::getAspectRatio(void) const
     {
     {
         return mAspect;
         return mAspect;
     }
     }
 
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void Frustum::setAspectRatio(Real r)
+    void Frustum::setAspectRatio(float r)
     {
     {
         mAspect = r;
         mAspect = r;
         invalidateFrustum();
         invalidateFrustum();
@@ -826,7 +816,7 @@ namespace CamelotEngine {
         return mBoundingBox;
         return mBoundingBox;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-	Real Frustum::getBoundingRadius(void) const
+	float Frustum::getBoundingRadius(void) const
 	{
 	{
         return (mFarDist == 0)? 100000 : mFarDist;
         return (mFarDist == 0)? 100000 : mFarDist;
 	}
 	}
@@ -876,7 +866,7 @@ namespace CamelotEngine {
     }
     }
     //---------------------------------------------------------------------
     //---------------------------------------------------------------------
     bool Frustum::projectSphere(const Sphere& sphere, 
     bool Frustum::projectSphere(const Sphere& sphere, 
-        Real* left, Real* top, Real* right, Real* bottom) const
+        float* left, float* top, float* right, float* bottom) const
     {
     {
 		// See http://www.gamasutra.com/features/20021011/lengyel_06.htm
 		// See http://www.gamasutra.com/features/20021011/lengyel_06.htm
         // Transform light position into camera space
         // Transform light position into camera space
@@ -892,15 +882,15 @@ namespace CamelotEngine {
         {
         {
 			updateFrustum();
 			updateFrustum();
 			const Matrix4& projMatrix = getProjectionMatrix();
 			const Matrix4& projMatrix = getProjectionMatrix();
-            Real r = sphere.getRadius();
-			Real rsq = r * r;
+            float r = sphere.getRadius();
+			float rsq = r * r;
 
 
             // early-exit
             // early-exit
             if (eyeSpacePos.squaredLength() <= rsq)
             if (eyeSpacePos.squaredLength() <= rsq)
                 return false;
                 return false;
 
 
-			Real Lxz = Math::Sqr(eyeSpacePos.x) + Math::Sqr(eyeSpacePos.z);
-			Real Lyz = Math::Sqr(eyeSpacePos.y) + Math::Sqr(eyeSpacePos.z);
+			float Lxz = Math::Sqr(eyeSpacePos.x) + Math::Sqr(eyeSpacePos.z);
+			float Lyz = Math::Sqr(eyeSpacePos.y) + Math::Sqr(eyeSpacePos.z);
 
 
 			// Find the tangent planes to the sphere
 			// Find the tangent planes to the sphere
 			// XZ first
 			// XZ first
@@ -909,36 +899,36 @@ namespace CamelotEngine {
 			// a = Lx^2 + Lz^2
 			// a = Lx^2 + Lz^2
 			// b = -2rLx
 			// b = -2rLx
 			// c = r^2 - Lz^2
 			// c = r^2 - Lz^2
-			Real a = Lxz;
-			Real b = -2.0f * r * eyeSpacePos.x;
-			Real c = rsq - Math::Sqr(eyeSpacePos.z);
-			Real D = b*b - 4.0f*a*c;
+			float a = Lxz;
+			float b = -2.0f * r * eyeSpacePos.x;
+			float c = rsq - Math::Sqr(eyeSpacePos.z);
+			float D = b*b - 4.0f*a*c;
 
 
 			// two roots?
 			// two roots?
 			if (D > 0)
 			if (D > 0)
 			{
 			{
-				Real sqrootD = Math::Sqrt(D);
+				float sqrootD = Math::Sqrt(D);
 				// solve the quadratic to get the components of the normal
 				// solve the quadratic to get the components of the normal
-				Real Nx0 = (-b + sqrootD) / (2 * a);
-				Real Nx1 = (-b - sqrootD) / (2 * a);
+				float Nx0 = (-b + sqrootD) / (2 * a);
+				float Nx1 = (-b - sqrootD) / (2 * a);
 				
 				
 				// Derive Z from this
 				// Derive Z from this
-				Real Nz0 = (r - Nx0 * eyeSpacePos.x) / eyeSpacePos.z;
-				Real Nz1 = (r - Nx1 * eyeSpacePos.x) / eyeSpacePos.z;
+				float Nz0 = (r - Nx0 * eyeSpacePos.x) / eyeSpacePos.z;
+				float Nz1 = (r - Nx1 * eyeSpacePos.x) / eyeSpacePos.z;
 
 
 				// Get the point of tangency
 				// Get the point of tangency
 				// Only consider points of tangency in front of the camera
 				// Only consider points of tangency in front of the camera
-				Real Pz0 = (Lxz - rsq) / (eyeSpacePos.z - ((Nz0 / Nx0) * eyeSpacePos.x));
+				float Pz0 = (Lxz - rsq) / (eyeSpacePos.z - ((Nz0 / Nx0) * eyeSpacePos.x));
 				if (Pz0 < 0)
 				if (Pz0 < 0)
 				{
 				{
 					// Project point onto near plane in worldspace
 					// Project point onto near plane in worldspace
-					Real nearx0 = (Nz0 * mNearDist) / Nx0;
+					float nearx0 = (Nz0 * mNearDist) / Nx0;
 					// now we need to map this to viewport coords
 					// now we need to map this to viewport coords
 					// use projection matrix since that will take into account all factors
 					// use projection matrix since that will take into account all factors
 					Vector3 relx0 = projMatrix * Vector3(nearx0, 0, -mNearDist);
 					Vector3 relx0 = projMatrix * Vector3(nearx0, 0, -mNearDist);
 
 
 					// find out whether this is a left side or right side
 					// find out whether this is a left side or right side
-					Real Px0 = -(Pz0 * Nz0) / Nx0;
+					float Px0 = -(Pz0 * Nz0) / Nx0;
 					if (Px0 > eyeSpacePos.x)
 					if (Px0 > eyeSpacePos.x)
 					{
 					{
 						*right = std::min(*right, relx0.x);
 						*right = std::min(*right, relx0.x);
@@ -948,17 +938,17 @@ namespace CamelotEngine {
 						*left = std::max(*left, relx0.x);
 						*left = std::max(*left, relx0.x);
 					}
 					}
 				}
 				}
-				Real Pz1 = (Lxz - rsq) / (eyeSpacePos.z - ((Nz1 / Nx1) * eyeSpacePos.x));
+				float Pz1 = (Lxz - rsq) / (eyeSpacePos.z - ((Nz1 / Nx1) * eyeSpacePos.x));
 				if (Pz1 < 0)
 				if (Pz1 < 0)
 				{
 				{
 					// Project point onto near plane in worldspace
 					// Project point onto near plane in worldspace
-					Real nearx1 = (Nz1 * mNearDist) / Nx1;
+					float nearx1 = (Nz1 * mNearDist) / Nx1;
 					// now we need to map this to viewport coords
 					// now we need to map this to viewport coords
 					// use projection matrix since that will take into account all factors
 					// use projection matrix since that will take into account all factors
 					Vector3 relx1 = projMatrix * Vector3(nearx1, 0, -mNearDist);
 					Vector3 relx1 = projMatrix * Vector3(nearx1, 0, -mNearDist);
 
 
 					// find out whether this is a left side or right side
 					// find out whether this is a left side or right side
-					Real Px1 = -(Pz1 * Nz1) / Nx1;
+					float Px1 = -(Pz1 * Nz1) / Nx1;
 					if (Px1 > eyeSpacePos.x)
 					if (Px1 > eyeSpacePos.x)
 					{
 					{
 						*right = std::min(*right, relx1.x);
 						*right = std::min(*right, relx1.x);
@@ -985,28 +975,28 @@ namespace CamelotEngine {
 			// two roots?
 			// two roots?
 			if (D > 0)
 			if (D > 0)
 			{
 			{
-				Real sqrootD = Math::Sqrt(D);
+				float sqrootD = Math::Sqrt(D);
 				// solve the quadratic to get the components of the normal
 				// solve the quadratic to get the components of the normal
-				Real Ny0 = (-b + sqrootD) / (2 * a);
-				Real Ny1 = (-b - sqrootD) / (2 * a);
+				float Ny0 = (-b + sqrootD) / (2 * a);
+				float Ny1 = (-b - sqrootD) / (2 * a);
 
 
 				// Derive Z from this
 				// Derive Z from this
-				Real Nz0 = (r - Ny0 * eyeSpacePos.y) / eyeSpacePos.z;
-				Real Nz1 = (r - Ny1 * eyeSpacePos.y) / eyeSpacePos.z;
+				float Nz0 = (r - Ny0 * eyeSpacePos.y) / eyeSpacePos.z;
+				float Nz1 = (r - Ny1 * eyeSpacePos.y) / eyeSpacePos.z;
 
 
 				// Get the point of tangency
 				// Get the point of tangency
 				// Only consider points of tangency in front of the camera
 				// Only consider points of tangency in front of the camera
-				Real Pz0 = (Lyz - rsq) / (eyeSpacePos.z - ((Nz0 / Ny0) * eyeSpacePos.y));
+				float Pz0 = (Lyz - rsq) / (eyeSpacePos.z - ((Nz0 / Ny0) * eyeSpacePos.y));
 				if (Pz0 < 0)
 				if (Pz0 < 0)
 				{
 				{
 					// Project point onto near plane in worldspace
 					// Project point onto near plane in worldspace
-					Real neary0 = (Nz0 * mNearDist) / Ny0;
+					float neary0 = (Nz0 * mNearDist) / Ny0;
 					// now we need to map this to viewport coords
 					// now we need to map this to viewport coords
 					// use projection matriy since that will take into account all factors
 					// use projection matriy since that will take into account all factors
 					Vector3 rely0 = projMatrix * Vector3(0, neary0, -mNearDist);
 					Vector3 rely0 = projMatrix * Vector3(0, neary0, -mNearDist);
 
 
 					// find out whether this is a top side or bottom side
 					// find out whether this is a top side or bottom side
-					Real Py0 = -(Pz0 * Nz0) / Ny0;
+					float Py0 = -(Pz0 * Nz0) / Ny0;
 					if (Py0 > eyeSpacePos.y)
 					if (Py0 > eyeSpacePos.y)
 					{
 					{
 						*top = std::min(*top, rely0.y);
 						*top = std::min(*top, rely0.y);
@@ -1016,17 +1006,17 @@ namespace CamelotEngine {
 						*bottom = std::max(*bottom, rely0.y);
 						*bottom = std::max(*bottom, rely0.y);
 					}
 					}
 				}
 				}
-				Real Pz1 = (Lyz - rsq) / (eyeSpacePos.z - ((Nz1 / Ny1) * eyeSpacePos.y));
+				float Pz1 = (Lyz - rsq) / (eyeSpacePos.z - ((Nz1 / Ny1) * eyeSpacePos.y));
 				if (Pz1 < 0)
 				if (Pz1 < 0)
 				{
 				{
 					// Project point onto near plane in worldspace
 					// Project point onto near plane in worldspace
-					Real neary1 = (Nz1 * mNearDist) / Ny1;
+					float neary1 = (Nz1 * mNearDist) / Ny1;
 					// now we need to map this to viewport coords
 					// now we need to map this to viewport coords
 					// use projection matriy since that will take into account all factors
 					// use projection matriy since that will take into account all factors
 					Vector3 rely1 = projMatrix * Vector3(0, neary1, -mNearDist);
 					Vector3 rely1 = projMatrix * Vector3(0, neary1, -mNearDist);
 
 
 					// find out whether this is a top side or bottom side
 					// find out whether this is a top side or bottom side
-					Real Py1 = -(Pz1 * Nz1) / Ny1;
+					float Py1 = -(Pz1 * Nz1) / Ny1;
 					if (Py1 > eyeSpacePos.y)
 					if (Py1 > eyeSpacePos.y)
 					{
 					{
 						*top = std::min(*top, rely1.y);
 						*top = std::min(*top, rely1.y);
@@ -1064,36 +1054,36 @@ namespace CamelotEngine {
 		invalidateFrustum();
 		invalidateFrustum();
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void Frustum::setOrthoWindow(Real w, Real h)
+	void Frustum::setOrthoWindow(float w, float h)
 	{
 	{
 		mOrthoHeight = h;
 		mOrthoHeight = h;
 		mAspect = w / h;
 		mAspect = w / h;
 		invalidateFrustum();
 		invalidateFrustum();
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void Frustum::setOrthoWindowHeight(Real h)
+	void Frustum::setOrthoWindowHeight(float h)
 	{
 	{
 		mOrthoHeight = h;
 		mOrthoHeight = h;
 		invalidateFrustum();
 		invalidateFrustum();
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void Frustum::setOrthoWindowWidth(Real w)
+	void Frustum::setOrthoWindowWidth(float w)
 	{
 	{
 		mOrthoHeight = w / mAspect;
 		mOrthoHeight = w / mAspect;
 		invalidateFrustum();
 		invalidateFrustum();
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	Real Frustum::getOrthoWindowHeight() const
+	float Frustum::getOrthoWindowHeight() const
 	{
 	{
 		return mOrthoHeight;
 		return mOrthoHeight;
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	Real Frustum::getOrthoWindowWidth() const
+	float Frustum::getOrthoWindowWidth() const
 	{
 	{
 		return mOrthoHeight * mAspect;	
 		return mOrthoHeight * mAspect;	
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void Frustum::setFrustumExtents(Real left, Real right, Real top, Real bottom)
+	void Frustum::setFrustumExtents(float left, float right, float top, float bottom)
 	{
 	{
 		mFrustumExtentsManuallySet = true;
 		mFrustumExtentsManuallySet = true;
 		mLeft = left;
 		mLeft = left;
@@ -1110,7 +1100,7 @@ namespace CamelotEngine {
 		invalidateFrustum();
 		invalidateFrustum();
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void Frustum::getFrustumExtents(Real& outleft, Real& outright, Real& outtop, Real& outbottom) const
+	void Frustum::getFrustumExtents(float& outleft, float& outright, float& outtop, float& outbottom) const
 	{
 	{
 		updateFrustum();
 		updateFrustum();
 		outleft = mLeft;
 		outleft = mLeft;

+ 28 - 28
CamelotRenderer/OgreFrustum.h

@@ -29,8 +29,8 @@ THE SOFTWARE.
 #define __Frustum_H__
 #define __Frustum_H__
 
 
 #include "OgrePrerequisites.h"
 #include "OgrePrerequisites.h"
-#include "OgreVector2.h"
-#include "OgreAxisAlignedBox.h"
+#include "CmVector2.h"
+#include "CmAxisAlignedBox.h"
 #include "OgreVertexIndexData.h"
 #include "OgreVertexIndexData.h"
 #include "OgreString.h"
 #include "OgreString.h"
 
 
@@ -69,17 +69,17 @@ namespace CamelotEngine
         /// y-direction field-of-view (default 45)
         /// y-direction field-of-view (default 45)
         Radian mFOVy;
         Radian mFOVy;
         /// Far clip distance - default 10000
         /// Far clip distance - default 10000
-        Real mFarDist;
+        float mFarDist;
         /// Near clip distance - default 100
         /// Near clip distance - default 100
-        Real mNearDist;
+        float mNearDist;
         /// x/y viewport ratio - default 1.3333
         /// x/y viewport ratio - default 1.3333
-        Real mAspect;
+        float mAspect;
 		/// Ortho height size (world units)
 		/// Ortho height size (world units)
-		Real mOrthoHeight;
+		float mOrthoHeight;
         /// Off-axis frustum center offset - default (0.0, 0.0)
         /// Off-axis frustum center offset - default (0.0, 0.0)
         Vector2 mFrustumOffset;
         Vector2 mFrustumOffset;
         /// Focal length of frustum (for stereo rendering, defaults to 1.0)
         /// Focal length of frustum (for stereo rendering, defaults to 1.0)
-        Real mFocalLength;
+        float mFocalLength;
 
 
         /// The 6 main clipping planes
         /// The 6 main clipping planes
         mutable Plane mFrustumPlanes[6];
         mutable Plane mFrustumPlanes[6];
@@ -113,10 +113,10 @@ namespace CamelotEngine
 		/// Have the frustum extents been manually set?
 		/// Have the frustum extents been manually set?
 		bool mFrustumExtentsManuallySet;
 		bool mFrustumExtentsManuallySet;
 		/// Frustum extents
 		/// Frustum extents
-		mutable Real mLeft, mRight, mTop, mBottom;
+		mutable float mLeft, mRight, mTop, mBottom;
 		
 		
         // Internal functions for calcs
         // Internal functions for calcs
-        virtual void calcProjectionParameters(Real& left, Real& right, Real& bottom, Real& top) const;
+        virtual void calcProjectionParameters(float& left, float& right, float& bottom, float& top) const;
 		/// Update frustum if out of date
 		/// Update frustum if out of date
         virtual void updateFrustum(void) const;
         virtual void updateFrustum(void) const;
 		/// Update view if out of date
 		/// Update view if out of date
@@ -179,11 +179,11 @@ namespace CamelotEngine
             @param
             @param
                 near The distance to the near clipping plane from the frustum in world coordinates.
                 near The distance to the near clipping plane from the frustum in world coordinates.
          */
          */
-        virtual void setNearClipDistance(Real nearDist);
+        virtual void setNearClipDistance(float nearDist);
 
 
         /** Sets the position of the near clipping plane.
         /** Sets the position of the near clipping plane.
         */
         */
-        virtual Real getNearClipDistance(void) const;
+        virtual float getNearClipDistance(void) const;
 
 
         /** Sets the distance to the far clipping plane.
         /** Sets the distance to the far clipping plane.
             @remarks
             @remarks
@@ -205,11 +205,11 @@ namespace CamelotEngine
                 distance which is useful especially when projecting shadows; but
                 distance which is useful especially when projecting shadows; but
                 be careful not to use a near distance too close.
                 be careful not to use a near distance too close.
         */
         */
-        virtual void setFarClipDistance(Real farDist);
+        virtual void setFarClipDistance(float farDist);
 
 
         /** Retrieves the distance from the frustum to the far clipping plane.
         /** Retrieves the distance from the frustum to the far clipping plane.
         */
         */
-        virtual Real getFarClipDistance(void) const;
+        virtual float getFarClipDistance(void) const;
 
 
         /** Sets the aspect ratio for the frustum viewport.
         /** Sets the aspect ratio for the frustum viewport.
             @remarks
             @remarks
@@ -219,11 +219,11 @@ namespace CamelotEngine
                 The default for most fullscreen windows is 1.3333 - this is also assumed by Ogre unless you
                 The default for most fullscreen windows is 1.3333 - this is also assumed by Ogre unless you
                 use this method to state otherwise.
                 use this method to state otherwise.
         */
         */
-        virtual void setAspectRatio(Real ratio);
+        virtual void setAspectRatio(float ratio);
 
 
         /** Retreives the current aspect ratio.
         /** Retreives the current aspect ratio.
         */
         */
-        virtual Real getAspectRatio(void) const;
+        virtual float getAspectRatio(void) const;
 
 
         /** Sets frustum offsets, used in stereo rendering.
         /** Sets frustum offsets, used in stereo rendering.
             @remarks
             @remarks
@@ -251,7 +251,7 @@ namespace CamelotEngine
             @param
             @param
                 vertical The vertical plane offset.
                 vertical The vertical plane offset.
         */
         */
-        virtual void setFrustumOffset(Real horizontal = 0.0, Real vertical = 0.0);
+        virtual void setFrustumOffset(float horizontal = 0.0, float vertical = 0.0);
 
 
         /** Retrieves the frustum offsets.
         /** Retrieves the frustum offsets.
         */
         */
@@ -261,21 +261,21 @@ namespace CamelotEngine
             @param
             @param
                 focalLength The distance to the focal plane from the frustum in world coordinates.
                 focalLength The distance to the focal plane from the frustum in world coordinates.
         */
         */
-        virtual void setFocalLength(Real focalLength = 1.0);
+        virtual void setFocalLength(float focalLength = 1.0);
 
 
         /** Returns focal length of frustum.
         /** Returns focal length of frustum.
         */
         */
-        virtual Real getFocalLength() const;
+        virtual float getFocalLength() const;
 
 
 		/** Manually set the extents of the frustum.
 		/** Manually set the extents of the frustum.
 		@param left, right, top, bottom The position where the side clip planes intersect
 		@param left, right, top, bottom The position where the side clip planes intersect
 			the near clip plane, in eye space
 			the near clip plane, in eye space
 		*/
 		*/
-		virtual void setFrustumExtents(Real left, Real right, Real top, Real bottom);
+		virtual void setFrustumExtents(float left, float right, float top, float bottom);
 		/** Reset the frustum extents to be automatically derived from other params. */
 		/** Reset the frustum extents to be automatically derived from other params. */
 		virtual void resetFrustumExtents(); 
 		virtual void resetFrustumExtents(); 
 		/** Get the extents of the frustum in view space. */
 		/** Get the extents of the frustum in view space. */
-		virtual void getFrustumExtents(Real& outleft, Real& outright, Real& outtop, Real& outbottom) const;
+		virtual void getFrustumExtents(float& outleft, float& outright, float& outtop, float& outbottom) const;
 
 
 
 
         /** Gets the projection matrix for this frustum adjusted for the current
         /** Gets the projection matrix for this frustum adjusted for the current
@@ -424,7 +424,7 @@ namespace CamelotEngine
         const AxisAlignedBox& getBoundingBox(void) const;
         const AxisAlignedBox& getBoundingBox(void) const;
 
 
         /** Overridden from MovableObject */
         /** Overridden from MovableObject */
-		Real getBoundingRadius(void) const;
+		float getBoundingRadius(void) const;
 
 
         /** Gets the world space corners of the frustum.
         /** Gets the world space corners of the frustum.
         @remarks
         @remarks
@@ -449,24 +449,24 @@ namespace CamelotEngine
 			particular size.
 			particular size.
 		@param w, h The dimensions of the view window in world units
 		@param w, h The dimensions of the view window in world units
 		*/
 		*/
-		virtual void setOrthoWindow(Real w, Real h);
+		virtual void setOrthoWindow(float w, float h);
 		/** Sets the orthographic window height, for use with orthographic rendering only. 
 		/** Sets the orthographic window height, for use with orthographic rendering only. 
 		@note The width of the window will be calculated from the aspect ratio. 
 		@note The width of the window will be calculated from the aspect ratio. 
 		@param h The height of the view window in world units
 		@param h The height of the view window in world units
 		*/
 		*/
-		virtual void setOrthoWindowHeight(Real h);
+		virtual void setOrthoWindowHeight(float h);
 		/** Sets the orthographic window width, for use with orthographic rendering only. 
 		/** Sets the orthographic window width, for use with orthographic rendering only. 
 		@note The height of the window will be calculated from the aspect ratio. 
 		@note The height of the window will be calculated from the aspect ratio. 
 		@param w The width of the view window in world units
 		@param w The width of the view window in world units
 		*/
 		*/
-		virtual void setOrthoWindowWidth(Real w);
+		virtual void setOrthoWindowWidth(float w);
 		/** Gets the orthographic window height, for use with orthographic rendering only. 
 		/** Gets the orthographic window height, for use with orthographic rendering only. 
 		*/
 		*/
-		virtual Real getOrthoWindowHeight() const;
+		virtual float getOrthoWindowHeight() const;
 		/** Gets the orthographic window width, for use with orthographic rendering only. 
 		/** Gets the orthographic window width, for use with orthographic rendering only. 
 		@note This is calculated from the orthographic height and the aspect ratio
 		@note This is calculated from the orthographic height and the aspect ratio
 		*/
 		*/
-		virtual Real getOrthoWindowWidth() const;
+		virtual float getOrthoWindowWidth() const;
 
 
         /** Project a sphere onto the near plane and get the bounding rectangle. 
         /** Project a sphere onto the near plane and get the bounding rectangle. 
         @param sphere The world-space sphere to project
         @param sphere The world-space sphere to project
@@ -478,10 +478,10 @@ namespace CamelotEngine
             false if the entire near plane was contained
             false if the entire near plane was contained
         */
         */
         virtual bool projectSphere(const Sphere& sphere, 
         virtual bool projectSphere(const Sphere& sphere, 
-            Real* left, Real* top, Real* right, Real* bottom) const;
+            float* left, float* top, float* right, float* bottom) const;
 
 
         /// Small constant used to reduce far plane projection to avoid inaccuracies
         /// Small constant used to reduce far plane projection to avoid inaccuracies
-        static const Real INFINITE_FAR_PLANE_ADJUST;
+        static const float INFINITE_FAR_PLANE_ADJUST;
 
 
 		/** Get the derived position of this frustum. */
 		/** Get the derived position of this frustum. */
 		virtual const Vector3& getPositionForViewUpdate(void) const;
 		virtual const Vector3& getPositionForViewUpdate(void) const;

+ 2 - 2
CamelotRenderer/OgreGpuProgram.cpp

@@ -27,8 +27,8 @@ THE SOFTWARE.
 */
 */
 #include "OgreGpuProgram.h"
 #include "OgreGpuProgram.h"
 #include "OgreHighLevelGpuProgram.h"
 #include "OgreHighLevelGpuProgram.h"
-#include "OgreVector3.h"
-#include "OgreVector4.h"
+#include "CmVector3.h"
+#include "CmVector4.h"
 #include "OgreRenderSystemCapabilities.h"
 #include "OgreRenderSystemCapabilities.h"
 #include "OgreStringConverter.h"
 #include "OgreStringConverter.h"
 #include "OgreException.h"
 #include "OgreException.h"

+ 27 - 27
CamelotRenderer/OgreGpuProgramParams.cpp

@@ -27,8 +27,8 @@ THE SOFTWARE.
 */
 */
 #include "OgreGpuProgramParams.h"
 #include "OgreGpuProgramParams.h"
 //#include "OgreHighLevelGpuProgram.h"
 //#include "OgreHighLevelGpuProgram.h"
-#include "OgreVector3.h"
-#include "OgreVector4.h"
+#include "CmVector3.h"
+#include "CmVector4.h"
 #include "OgreRenderSystemCapabilities.h"
 #include "OgreRenderSystemCapabilities.h"
 #include "OgreStringConverter.h"
 #include "OgreStringConverter.h"
 #include "OgreException.h"
 #include "OgreException.h"
@@ -260,7 +260,7 @@ namespace CamelotEngine
 
 
 		// not used
 		// not used
 		def.logicalIndex = 0;
 		def.logicalIndex = 0;
-		def.variability = (uint16)GPV_GLOBAL;
+		def.variability = (UINT16)GPV_GLOBAL;
 
 
 		if (def.isFloat())
 		if (def.isFloat())
 		{
 		{
@@ -362,7 +362,7 @@ namespace CamelotEngine
 		return mNamedConstants;
 		return mNamedConstants;
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void GpuSharedParameters::setNamedConstant(const String& name, Real val)
+	void GpuSharedParameters::setNamedConstant(const String& name, float val)
 	{
 	{
 		setNamedConstant(name, &val, 1);
 		setNamedConstant(name, &val, 1);
 	}
 	}
@@ -668,7 +668,7 @@ namespace CamelotEngine
 		setConstant(index, vec.ptr(), 1);
 		setConstant(index, vec.ptr(), 1);
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
-	void GpuProgramParameters::setConstant(size_t index, Real val)
+	void GpuProgramParameters::setConstant(size_t index, float val)
 	{
 	{
 		setConstant(index, Vector4(val, 0.0f, 0.0f, 0.0f));
 		setConstant(index, Vector4(val, 0.0f, 0.0f, 0.0f));
 	}
 	}
@@ -769,7 +769,7 @@ namespace CamelotEngine
 		_writeRawConstants(physicalIndex, vec.ptr(), std::min(count, (size_t)4));
 		_writeRawConstants(physicalIndex, vec.ptr(), std::min(count, (size_t)4));
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
-	void GpuProgramParameters::_writeRawConstant(size_t physicalIndex, Real val)
+	void GpuProgramParameters::_writeRawConstant(size_t physicalIndex, float val)
 	{
 	{
 		_writeRawConstants(physicalIndex, &val, 1);
 		_writeRawConstants(physicalIndex, &val, 1);
 	}
 	}
@@ -860,7 +860,7 @@ namespace CamelotEngine
 		memcpy(dest, &mIntConstants[physicalIndex], sizeof(int) * count);
 		memcpy(dest, &mIntConstants[physicalIndex], sizeof(int) * count);
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	uint16 GpuProgramParameters::deriveVariability(GpuProgramParameters::AutoConstantType act)
+	UINT16 GpuProgramParameters::deriveVariability(GpuProgramParameters::AutoConstantType act)
 	{
 	{
 		switch(act)
 		switch(act)
 		{
 		{
@@ -927,7 +927,7 @@ namespace CamelotEngine
 		case ACT_TEXTURE_MATRIX:
 		case ACT_TEXTURE_MATRIX:
 		case ACT_LOD_CAMERA_POSITION:
 		case ACT_LOD_CAMERA_POSITION:
 
 
-			return (uint16)GPV_GLOBAL;
+			return (UINT16)GPV_GLOBAL;
 
 
 		case ACT_WORLD_MATRIX:
 		case ACT_WORLD_MATRIX:
 		case ACT_INVERSE_WORLD_MATRIX:
 		case ACT_INVERSE_WORLD_MATRIX:
@@ -948,7 +948,7 @@ namespace CamelotEngine
 		case ACT_CUSTOM:
 		case ACT_CUSTOM:
 		case ACT_ANIMATION_PARAMETRIC:
 		case ACT_ANIMATION_PARAMETRIC:
 
 
-			return (uint16)GPV_PER_OBJECT;
+			return (UINT16)GPV_PER_OBJECT;
 
 
 		case ACT_LIGHT_POSITION_OBJECT_SPACE:
 		case ACT_LIGHT_POSITION_OBJECT_SPACE:
 		case ACT_LIGHT_DIRECTION_OBJECT_SPACE:
 		case ACT_LIGHT_DIRECTION_OBJECT_SPACE:
@@ -961,7 +961,7 @@ namespace CamelotEngine
 		case ACT_SPOTLIGHT_WORLDVIEWPROJ_MATRIX:
 		case ACT_SPOTLIGHT_WORLDVIEWPROJ_MATRIX:
 
 
 			// These depend on BOTH lights and objects
 			// These depend on BOTH lights and objects
-			return ((uint16)GPV_PER_OBJECT) | ((uint16)GPV_LIGHTS);
+			return ((UINT16)GPV_PER_OBJECT) | ((UINT16)GPV_LIGHTS);
 
 
 		case ACT_LIGHT_COUNT:
 		case ACT_LIGHT_COUNT:
 		case ACT_LIGHT_DIFFUSE_COLOUR:
 		case ACT_LIGHT_DIFFUSE_COLOUR:
@@ -997,27 +997,27 @@ namespace CamelotEngine
 		case ACT_SPOTLIGHT_VIEWPROJ_MATRIX_ARRAY:
 		case ACT_SPOTLIGHT_VIEWPROJ_MATRIX_ARRAY:
 		case ACT_LIGHT_CUSTOM:
 		case ACT_LIGHT_CUSTOM:
 
 
-			return (uint16)GPV_LIGHTS;
+			return (UINT16)GPV_LIGHTS;
 
 
 		case ACT_DERIVED_LIGHT_DIFFUSE_COLOUR:
 		case ACT_DERIVED_LIGHT_DIFFUSE_COLOUR:
 		case ACT_DERIVED_LIGHT_SPECULAR_COLOUR:
 		case ACT_DERIVED_LIGHT_SPECULAR_COLOUR:
 		case ACT_DERIVED_LIGHT_DIFFUSE_COLOUR_ARRAY:
 		case ACT_DERIVED_LIGHT_DIFFUSE_COLOUR_ARRAY:
 		case ACT_DERIVED_LIGHT_SPECULAR_COLOUR_ARRAY:
 		case ACT_DERIVED_LIGHT_SPECULAR_COLOUR_ARRAY:
 
 
-			return ((uint16)GPV_GLOBAL | (uint16)GPV_LIGHTS);
+			return ((UINT16)GPV_GLOBAL | (UINT16)GPV_LIGHTS);
 
 
 		case ACT_PASS_ITERATION_NUMBER:
 		case ACT_PASS_ITERATION_NUMBER:
 
 
-			return (uint16)GPV_PASS_ITERATION_NUMBER;
+			return (UINT16)GPV_PASS_ITERATION_NUMBER;
 
 
 		default:
 		default:
-			return (uint16)GPV_GLOBAL;
+			return (UINT16)GPV_GLOBAL;
 		};
 		};
 
 
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
 	GpuLogicalIndexUse* GpuProgramParameters::_getFloatConstantLogicalIndexUse(
 	GpuLogicalIndexUse* GpuProgramParameters::_getFloatConstantLogicalIndexUse(
-		size_t logicalIndex, size_t requestedSize, uint16 variability)
+		size_t logicalIndex, size_t requestedSize, UINT16 variability)
 	{
 	{
 		if (mFloatLogicalToPhysical == nullptr)
 		if (mFloatLogicalToPhysical == nullptr)
 			return 0;
 			return 0;
@@ -1122,7 +1122,7 @@ namespace CamelotEngine
 
 
 	}
 	}
 	//---------------------------------------------------------------------()
 	//---------------------------------------------------------------------()
-	GpuLogicalIndexUse* GpuProgramParameters::_getIntConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability)
+	GpuLogicalIndexUse* GpuProgramParameters::_getIntConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, UINT16 variability)
 	{
 	{
 		if (mIntLogicalToPhysical == nullptr)
 		if (mIntLogicalToPhysical == nullptr)
 			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
 			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
@@ -1229,14 +1229,14 @@ namespace CamelotEngine
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
 	size_t GpuProgramParameters::_getFloatConstantPhysicalIndex(
 	size_t GpuProgramParameters::_getFloatConstantPhysicalIndex(
-		size_t logicalIndex, size_t requestedSize, uint16 variability) 
+		size_t logicalIndex, size_t requestedSize, UINT16 variability) 
 	{
 	{
 		GpuLogicalIndexUse* indexUse = _getFloatConstantLogicalIndexUse(logicalIndex, requestedSize, variability);
 		GpuLogicalIndexUse* indexUse = _getFloatConstantLogicalIndexUse(logicalIndex, requestedSize, variability);
 		return indexUse ? indexUse->physicalIndex : 0;
 		return indexUse ? indexUse->physicalIndex : 0;
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
 	size_t GpuProgramParameters::_getIntConstantPhysicalIndex(
 	size_t GpuProgramParameters::_getIntConstantPhysicalIndex(
-		size_t logicalIndex, size_t requestedSize, uint16 variability)
+		size_t logicalIndex, size_t requestedSize, UINT16 variability)
 	{
 	{
 		GpuLogicalIndexUse* indexUse = _getIntConstantLogicalIndexUse(logicalIndex, requestedSize, variability);
 		GpuLogicalIndexUse* indexUse = _getIntConstantLogicalIndexUse(logicalIndex, requestedSize, variability);
 		return indexUse ? indexUse->physicalIndex : 0;
 		return indexUse ? indexUse->physicalIndex : 0;
@@ -1349,7 +1349,7 @@ namespace CamelotEngine
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
 	void GpuProgramParameters::_setRawAutoConstant(size_t physicalIndex, 
 	void GpuProgramParameters::_setRawAutoConstant(size_t physicalIndex, 
-		AutoConstantType acType, size_t extraInfo, uint16 variability, size_t elementSize)
+		AutoConstantType acType, size_t extraInfo, UINT16 variability, size_t elementSize)
 	{
 	{
 		// update existing index if it exists
 		// update existing index if it exists
 		bool found = false;
 		bool found = false;
@@ -1374,7 +1374,7 @@ namespace CamelotEngine
 
 
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
-	void GpuProgramParameters::setAutoConstant(size_t index, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2)
+	void GpuProgramParameters::setAutoConstant(size_t index, AutoConstantType acType, UINT16 extraInfo1, UINT16 extraInfo2)
 	{
 	{
 		size_t extraInfo = (size_t)extraInfo1 | ((size_t)extraInfo2) << 16;
 		size_t extraInfo = (size_t)extraInfo1 | ((size_t)extraInfo2) << 16;
 
 
@@ -1393,7 +1393,7 @@ namespace CamelotEngine
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
 	void GpuProgramParameters::_setRawAutoConstantReal(size_t physicalIndex, 
 	void GpuProgramParameters::_setRawAutoConstantReal(size_t physicalIndex, 
-		AutoConstantType acType, Real rData, uint16 variability, size_t elementSize)
+		AutoConstantType acType, float rData, UINT16 variability, size_t elementSize)
 	{
 	{
 		// update existing index if it exists
 		// update existing index if it exists
 		bool found = false;
 		bool found = false;
@@ -1472,7 +1472,7 @@ namespace CamelotEngine
 		return mAutoConstants.begin();
 		return mAutoConstants.begin();
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
-	void GpuProgramParameters::setAutoConstantReal(size_t index, AutoConstantType acType, Real rData)
+	void GpuProgramParameters::setAutoConstantReal(size_t index, AutoConstantType acType, float rData)
 	{
 	{
 		// Get auto constant definition for sizing
 		// Get auto constant definition for sizing
 		const AutoConstantDefinition* autoDef = getAutoConstantDefinition(acType);
 		const AutoConstantDefinition* autoDef = getAutoConstantDefinition(acType);
@@ -1488,7 +1488,7 @@ namespace CamelotEngine
 		_setRawAutoConstantReal(indexUse->physicalIndex, acType, rData, indexUse->variability, sz);
 		_setRawAutoConstantReal(indexUse->physicalIndex, acType, rData, indexUse->variability, sz);
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
-	void GpuProgramParameters::setNamedConstant(const String& name, Real val)
+	void GpuProgramParameters::setNamedConstant(const String& name, float val)
 	{
 	{
 		// look up, and throw an exception if we're not ignoring missing
 		// look up, and throw an exception if we're not ignoring missing
 		const GpuConstantDefinition* def = 
 		const GpuConstantDefinition* def = 
@@ -1605,7 +1605,7 @@ namespace CamelotEngine
 	}
 	}
 	//---------------------------------------------------------------------------
 	//---------------------------------------------------------------------------
 	void GpuProgramParameters::setNamedAutoConstantReal(const String& name, 
 	void GpuProgramParameters::setNamedAutoConstantReal(const String& name, 
-		AutoConstantType acType, Real rData)
+		AutoConstantType acType, float rData)
 	{
 	{
 		// look up, and throw an exception if we're not ignoring missing
 		// look up, and throw an exception if we're not ignoring missing
 		const GpuConstantDefinition* def = 
 		const GpuConstantDefinition* def = 
@@ -1622,7 +1622,7 @@ namespace CamelotEngine
 	}
 	}
 	//---------------------------------------------------------------------------
 	//---------------------------------------------------------------------------
 	void GpuProgramParameters::setNamedAutoConstant(const String& name, 
 	void GpuProgramParameters::setNamedAutoConstant(const String& name, 
-		AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2)
+		AutoConstantType acType, UINT16 extraInfo1, UINT16 extraInfo2)
 	{
 	{
 		size_t extraInfo = (size_t)extraInfo1 | ((size_t)extraInfo2) << 16;
 		size_t extraInfo = (size_t)extraInfo1 | ((size_t)extraInfo2) << 16;
 
 
@@ -1642,12 +1642,12 @@ namespace CamelotEngine
 
 
 	}
 	}
 	//---------------------------------------------------------------------------
 	//---------------------------------------------------------------------------
-	void GpuProgramParameters::setConstantFromTime(size_t index, Real factor)
+	void GpuProgramParameters::setConstantFromTime(size_t index, float factor)
 	{
 	{
 		setAutoConstantReal(index, ACT_TIME, factor);
 		setAutoConstantReal(index, ACT_TIME, factor);
 	}
 	}
 	//---------------------------------------------------------------------------
 	//---------------------------------------------------------------------------
-	void GpuProgramParameters::setNamedConstantFromTime(const String& name, Real factor)
+	void GpuProgramParameters::setNamedConstantFromTime(const String& name, float factor)
 	{
 	{
 		setNamedAutoConstantReal(name, ACT_TIME, factor);
 		setNamedAutoConstantReal(name, ACT_TIME, factor);
 	}
 	}

+ 27 - 27
CamelotRenderer/OgreGpuProgramParams.h

@@ -111,7 +111,7 @@ namespace CamelotEngine {
 		/// Length of array
 		/// Length of array
 		size_t arraySize;
 		size_t arraySize;
 		/// How this parameter varies (bitwise combination of GpuProgramVariability)
 		/// How this parameter varies (bitwise combination of GpuProgramVariability)
-		mutable uint16 variability;
+		mutable UINT16 variability;
 
 
 		bool isFloat() const
 		bool isFloat() const
 		{
 		{
@@ -314,11 +314,11 @@ namespace CamelotEngine {
 		/// Current physical size allocation
 		/// Current physical size allocation
 		size_t currentSize;
 		size_t currentSize;
 		/// How the contents of this slot vary
 		/// How the contents of this slot vary
-		mutable uint16 variability;
+		mutable UINT16 variability;
 
 
 		GpuLogicalIndexUse() 
 		GpuLogicalIndexUse() 
 			: physicalIndex(99999), currentSize(0), variability(GPV_GLOBAL) {}
 			: physicalIndex(99999), currentSize(0), variability(GPV_GLOBAL) {}
-		GpuLogicalIndexUse(size_t bufIdx, size_t curSz, uint16 v) 
+		GpuLogicalIndexUse(size_t bufIdx, size_t curSz, UINT16 v) 
 			: physicalIndex(bufIdx), currentSize(curSz), variability(v) {}
 			: physicalIndex(bufIdx), currentSize(curSz), variability(v) {}
 	};
 	};
 	typedef map<size_t, GpuLogicalIndexUse>::type GpuLogicalIndexUseMap;
 	typedef map<size_t, GpuLogicalIndexUse>::type GpuLogicalIndexUseMap;
@@ -426,7 +426,7 @@ namespace CamelotEngine {
 		const GpuNamedConstants& getConstantDefinitions() const;
 		const GpuNamedConstants& getConstantDefinitions() const;
 	
 	
 		/** @copydoc GpuProgramParameters::setNamedConstant */
 		/** @copydoc GpuProgramParameters::setNamedConstant */
-		void setNamedConstant(const String& name, Real val);
+		void setNamedConstant(const String& name, float val);
 		/** @copydoc GpuProgramParameters::setNamedConstant */
 		/** @copydoc GpuProgramParameters::setNamedConstant */
 		void setNamedConstant(const String& name, int val);
 		void setNamedConstant(const String& name, int val);
 		/** @copydoc GpuProgramParameters::setNamedConstant */
 		/** @copydoc GpuProgramParameters::setNamedConstant */
@@ -1044,18 +1044,18 @@ namespace CamelotEngine {
 			/// Additional information to go with the parameter
 			/// Additional information to go with the parameter
 			union{
 			union{
 				size_t data;
 				size_t data;
-				Real fData;
+				float fData;
 			};
 			};
 			/// The variability of this parameter (see GpuParamVariability)
 			/// The variability of this parameter (see GpuParamVariability)
-			uint16 variability;
+			UINT16 variability;
 
 
 			AutoConstantEntry(AutoConstantType theType, size_t theIndex, size_t theData, 
 			AutoConstantEntry(AutoConstantType theType, size_t theIndex, size_t theData, 
-				uint16 theVariability, size_t theElemCount = 4)
+				UINT16 theVariability, size_t theElemCount = 4)
 				: paramType(theType), physicalIndex(theIndex), elementCount(theElemCount), 
 				: paramType(theType), physicalIndex(theIndex), elementCount(theElemCount), 
 				data(theData), variability(theVariability) {}
 				data(theData), variability(theVariability) {}
 
 
-			AutoConstantEntry(AutoConstantType theType, size_t theIndex, Real theData, 
-				uint16 theVariability, size_t theElemCount = 4)
+			AutoConstantEntry(AutoConstantType theType, size_t theIndex, float theData, 
+				UINT16 theVariability, size_t theElemCount = 4)
 				: paramType(theType), physicalIndex(theIndex), elementCount(theElemCount), 
 				: paramType(theType), physicalIndex(theIndex), elementCount(theElemCount), 
 				fData(theData), variability(theVariability) {}
 				fData(theData), variability(theVariability) {}
 
 
@@ -1082,7 +1082,7 @@ namespace CamelotEngine {
 		/// List of automatically updated parameters
 		/// List of automatically updated parameters
 		AutoConstantList mAutoConstants;
 		AutoConstantList mAutoConstants;
 		/// The combined variability masks of all parameters
 		/// The combined variability masks of all parameters
-		uint16 mCombinedVariability;
+		UINT16 mCombinedVariability;
 		/// Do we need to transpose matrices?
 		/// Do we need to transpose matrices?
 		bool mTransposeMatrices;
 		bool mTransposeMatrices;
 		/// flag to indicate if names not found will be ignored
 		/// flag to indicate if names not found will be ignored
@@ -1092,13 +1092,13 @@ namespace CamelotEngine {
 
 
 		/** Gets the low-level structure for a logical index. 
 		/** Gets the low-level structure for a logical index. 
 		*/
 		*/
-		GpuLogicalIndexUse* _getFloatConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
+		GpuLogicalIndexUse* _getFloatConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, UINT16 variability);
 		/** Gets the physical buffer index associated with a logical int constant index. 
 		/** Gets the physical buffer index associated with a logical int constant index. 
 		*/
 		*/
-		GpuLogicalIndexUse* _getIntConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
+		GpuLogicalIndexUse* _getIntConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, UINT16 variability);
 
 
 		/// Return the variability for an auto constant
 		/// Return the variability for an auto constant
-		uint16 deriveVariability(AutoConstantType act);
+		UINT16 deriveVariability(AutoConstantType act);
 
 
 		void copySharedParamSetUsage(const GpuSharedParamUsageList& srcList);
 		void copySharedParamSetUsage(const GpuSharedParamUsageList& srcList);
 
 
@@ -1143,7 +1143,7 @@ namespace CamelotEngine {
 		a 4D float)
 		a 4D float)
 		@param val The value to set
 		@param val The value to set
 		*/
 		*/
-		void setConstant(size_t index, Real val);
+		void setConstant(size_t index, float val);
 		/** Sets a 4-element floating-point parameter to the program via Vector3.
 		/** Sets a 4-element floating-point parameter to the program via Vector3.
 		@param index The logical constant index at which to place the parameter (each constant is
 		@param index The logical constant index at which to place the parameter (each constant is
 		a 4D float).
 		a 4D float).
@@ -1259,7 +1259,7 @@ namespace CamelotEngine {
 		@param physicalIndex The physical buffer index at which to place the parameter 
 		@param physicalIndex The physical buffer index at which to place the parameter 
 		@param val The value to set
 		@param val The value to set
 		*/
 		*/
-		void _writeRawConstant(size_t physicalIndex, Real val);
+		void _writeRawConstant(size_t physicalIndex, float val);
 		/** Write a single integer parameter to the program.
 		/** Write a single integer parameter to the program.
 		@note You can use these methods if you have already derived the physical
 		@note You can use these methods if you have already derived the physical
 		constant buffer location, for a slight speed improvement over using
 		constant buffer location, for a slight speed improvement over using
@@ -1380,7 +1380,7 @@ namespace CamelotEngine {
 		@param extraInfo If the constant type needs more information (like a light index) put it here.
 		@param extraInfo If the constant type needs more information (like a light index) put it here.
 		*/
 		*/
 		void setAutoConstant(size_t index, AutoConstantType acType, size_t extraInfo = 0);
 		void setAutoConstant(size_t index, AutoConstantType acType, size_t extraInfo = 0);
-		void setAutoConstantReal(size_t index, AutoConstantType acType, Real rData);
+		void setAutoConstantReal(size_t index, AutoConstantType acType, float rData);
 
 
 		/** Sets up a constant which will automatically be updated by the system.
 		/** Sets up a constant which will automatically be updated by the system.
 		@remarks
 		@remarks
@@ -1396,18 +1396,18 @@ namespace CamelotEngine {
 		@param extraInfo1 The first extra parameter required by the auto constant type
 		@param extraInfo1 The first extra parameter required by the auto constant type
 		@param extraInfo2 The first extra parameter required by the auto constant type
 		@param extraInfo2 The first extra parameter required by the auto constant type
 		*/
 		*/
-		void setAutoConstant(size_t index, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2);
+		void setAutoConstant(size_t index, AutoConstantType acType, UINT16 extraInfo1, UINT16 extraInfo2);
 
 
 		/** As setAutoConstant, but sets up the auto constant directly against a
 		/** As setAutoConstant, but sets up the auto constant directly against a
 		physical buffer index.
 		physical buffer index.
 		*/
 		*/
 		void _setRawAutoConstant(size_t physicalIndex, AutoConstantType acType, size_t extraInfo, 
 		void _setRawAutoConstant(size_t physicalIndex, AutoConstantType acType, size_t extraInfo, 
-			uint16 variability, size_t elementSize = 4);
+			UINT16 variability, size_t elementSize = 4);
 		/** As setAutoConstantReal, but sets up the auto constant directly against a
 		/** As setAutoConstantReal, but sets up the auto constant directly against a
 		physical buffer index.
 		physical buffer index.
 		*/
 		*/
-		void _setRawAutoConstantReal(size_t physicalIndex, AutoConstantType acType, Real rData, 
-			uint16 variability, size_t elementSize = 4);
+		void _setRawAutoConstantReal(size_t physicalIndex, AutoConstantType acType, float rData, 
+			UINT16 variability, size_t elementSize = 4);
 
 
 
 
 		/** Unbind an auto constant so that the constant is manually controlled again. */
 		/** Unbind an auto constant so that the constant is manually controlled again. */
@@ -1417,7 +1417,7 @@ namespace CamelotEngine {
 		@param index The index of the parameter
 		@param index The index of the parameter
 		@param factor The amount by which to scale the time value
 		@param factor The amount by which to scale the time value
 		*/  
 		*/  
-		void setConstantFromTime(size_t index, Real factor);
+		void setConstantFromTime(size_t index, float factor);
 
 
 		/** Clears all the existing automatic constants. */
 		/** Clears all the existing automatic constants. */
 		void clearAutoConstants(void);
 		void clearAutoConstants(void);
@@ -1479,7 +1479,7 @@ namespace CamelotEngine {
 		@param name The name of the parameter
 		@param name The name of the parameter
 		@param val The value to set
 		@param val The value to set
 		*/
 		*/
-		void setNamedConstant(const String& name, Real val);
+		void setNamedConstant(const String& name, float val);
 		/** Sets a single value constant integer parameter to the program.
 		/** Sets a single value constant integer parameter to the program.
 		@remarks
 		@remarks
 		Different types of GPU programs support different types of constant parameters.
 		Different types of GPU programs support different types of constant parameters.
@@ -1607,7 +1607,7 @@ namespace CamelotEngine {
 		@param extraInfo If the constant type needs more information (like a light index) put it here.
 		@param extraInfo If the constant type needs more information (like a light index) put it here.
 		*/
 		*/
 		void setNamedAutoConstant(const String& name, AutoConstantType acType, size_t extraInfo = 0);
 		void setNamedAutoConstant(const String& name, AutoConstantType acType, size_t extraInfo = 0);
-		void setNamedAutoConstantReal(const String& name, AutoConstantType acType, Real rData);
+		void setNamedAutoConstantReal(const String& name, AutoConstantType acType, float rData);
 
 
 		/** Sets up a constant which will automatically be updated by the system.
 		/** Sets up a constant which will automatically be updated by the system.
 		@remarks
 		@remarks
@@ -1624,7 +1624,7 @@ namespace CamelotEngine {
 		@param extraInfo1 The first extra info required by this auto constant type
 		@param extraInfo1 The first extra info required by this auto constant type
 		@param extraInfo2 The first extra info required by this auto constant type
 		@param extraInfo2 The first extra info required by this auto constant type
 		*/
 		*/
-		void setNamedAutoConstant(const String& name, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2);
+		void setNamedAutoConstant(const String& name, AutoConstantType acType, UINT16 extraInfo1, UINT16 extraInfo2);
 
 
 		/** Sets a named parameter up to track a derivation of the current time.
 		/** Sets a named parameter up to track a derivation of the current time.
 		@note
 		@note
@@ -1633,7 +1633,7 @@ namespace CamelotEngine {
 		@param name The name of the parameter
 		@param name The name of the parameter
 		@param factor The amount by which to scale the time value
 		@param factor The amount by which to scale the time value
 		*/  
 		*/  
-		void setNamedConstantFromTime(const String& name, Real factor);
+		void setNamedConstantFromTime(const String& name, float factor);
 
 
 		/** Unbind an auto constant so that the constant is manually controlled again. */
 		/** Unbind an auto constant so that the constant is manually controlled again. */
 		void clearNamedAutoConstant(const String& name);
 		void clearNamedAutoConstant(const String& name);
@@ -1655,14 +1655,14 @@ namespace CamelotEngine {
 		@param requestedSize The requested size - pass 0 to ignore missing entries
 		@param requestedSize The requested size - pass 0 to ignore missing entries
 		and return std::numeric_limits<size_t>::max() 
 		and return std::numeric_limits<size_t>::max() 
 		*/
 		*/
-		size_t _getFloatConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
+		size_t _getFloatConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, UINT16 variability);
 		/** Gets the physical buffer index associated with a logical int constant index. 
 		/** Gets the physical buffer index associated with a logical int constant index. 
 		@note Only applicable to low-level programs.
 		@note Only applicable to low-level programs.
 		@param logicalIndex The logical parameter index
 		@param logicalIndex The logical parameter index
 		@param requestedSize The requested size - pass 0 to ignore missing entries
 		@param requestedSize The requested size - pass 0 to ignore missing entries
 		and return std::numeric_limits<size_t>::max() 
 		and return std::numeric_limits<size_t>::max() 
 		*/
 		*/
-		size_t _getIntConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
+		size_t _getIntConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, UINT16 variability);
 
 
 		/** Sets whether or not we need to transpose the matrices passed in from the rest of OGRE.
 		/** Sets whether or not we need to transpose the matrices passed in from the rest of OGRE.
 		@remarks
 		@remarks

+ 3 - 3
CamelotRenderer/OgreHardwareVertexBuffer.cpp

@@ -206,7 +206,7 @@ namespace CamelotEngine {
 	}
 	}
 	//--------------------------------------------------------------------------
 	//--------------------------------------------------------------------------
 	void VertexElement::convertColourValue(VertexElementType srcType, 
 	void VertexElement::convertColourValue(VertexElementType srcType, 
-		VertexElementType dstType, uint32* ptr)
+		VertexElementType dstType, UINT32* ptr)
 	{
 	{
 		if (srcType == dstType)
 		if (srcType == dstType)
 			return;
 			return;
@@ -216,7 +216,7 @@ namespace CamelotEngine {
 		   ((*ptr&0x00FF0000)>>16)|((*ptr&0x000000FF)<<16)|(*ptr&0xFF00FF00);				
 		   ((*ptr&0x00FF0000)>>16)|((*ptr&0x000000FF)<<16)|(*ptr&0xFF00FF00);				
 	}
 	}
 	//--------------------------------------------------------------------------
 	//--------------------------------------------------------------------------
-	uint32 VertexElement::convertColourValue(const ColourValue& src, 
+	UINT32 VertexElement::convertColourValue(const ColourValue& src, 
 		VertexElementType dst)
 		VertexElementType dst)
 	{
 	{
 		switch(dst)
 		switch(dst)
@@ -582,7 +582,7 @@ namespace CamelotEngine {
         VertexBufferBindingMap newBindingMap;
         VertexBufferBindingMap newBindingMap;
 
 
         VertexBufferBindingMap::const_iterator it;
         VertexBufferBindingMap::const_iterator it;
-        ushort targetIndex = 0;
+        UINT16 targetIndex = 0;
         for (it = mBindingMap.begin(); it != mBindingMap.end(); ++it, ++targetIndex)
         for (it = mBindingMap.begin(); it != mBindingMap.end(); ++it, ++targetIndex)
         {
         {
             bindingIndexMap[it->first] = targetIndex;
             bindingIndexMap[it->first] = targetIndex;

+ 4 - 4
CamelotRenderer/OgreHardwareVertexBuffer.h

@@ -174,14 +174,14 @@ namespace CamelotEngine {
 		@param ptr Read / write value to change
 		@param ptr Read / write value to change
 		*/
 		*/
 		static void convertColourValue(VertexElementType srcType,
 		static void convertColourValue(VertexElementType srcType,
-			VertexElementType dstType, uint32* ptr);
+			VertexElementType dstType, UINT32* ptr);
 
 
 		/** Utility method for converting colour to
 		/** Utility method for converting colour to
 			a packed 32-bit colour type.
 			a packed 32-bit colour type.
 		@param src source colour
 		@param src source colour
 		@param dst The destination type
 		@param dst The destination type
 		*/
 		*/
-		static uint32 convertColourValue(const ColourValue& src,
+		static UINT32 convertColourValue(const ColourValue& src,
 			VertexElementType dst);
 			VertexElementType dst);
 
 
 		/** Utility method to get the most appropriate packed colour vertex element format. */
 		/** Utility method to get the most appropriate packed colour vertex element format. */
@@ -257,7 +257,7 @@ namespace CamelotEngine {
 
 
         /** Adjusts a pointer to the base of a vertex to point at this element.
         /** Adjusts a pointer to the base of a vertex to point at this element.
         @remarks
         @remarks
-        This variant is for ushort pointers, passed as a parameter because we can't
+        This variant is for UINT16 pointers, passed as a parameter because we can't
         rely on covariant return types.
         rely on covariant return types.
         @param pBase Pointer to the start of a vertex in this buffer.
         @param pBase Pointer to the start of a vertex in this buffer.
         @param pElem Pointer to a pointer which will be set to the start of this element.
         @param pElem Pointer to a pointer which will be set to the start of this element.
@@ -506,7 +506,7 @@ namespace CamelotEngine {
         */
         */
         virtual unsigned short getLastBoundIndex(void) const;
         virtual unsigned short getLastBoundIndex(void) const;
 
 
-        typedef map<ushort, ushort>::type BindingIndexMap;
+        typedef map<UINT16, UINT16>::type BindingIndexMap;
 
 
         /** Check whether any gaps in the bindings.
         /** Check whether any gaps in the bindings.
         */
         */

+ 30 - 30
CamelotRenderer/OgreImageResampler.h

@@ -56,28 +56,28 @@ template<unsigned int elemsize> struct NearestResampler {
 		// assert(src.format == dst.format);
 		// assert(src.format == dst.format);
 
 
 		// srcdata stays at beginning, pdst is a moving pointer
 		// srcdata stays at beginning, pdst is a moving pointer
-		uchar* srcdata = (uchar*)src.data;
-		uchar* pdst = (uchar*)dst.data;
+		UINT8* srcdata = (UINT8*)src.data;
+		UINT8* pdst = (UINT8*)dst.data;
 
 
 		// sx_48,sy_48,sz_48 represent current position in source
 		// sx_48,sy_48,sz_48 represent current position in source
 		// using 16/48-bit fixed precision, incremented by steps
 		// using 16/48-bit fixed precision, incremented by steps
-		uint64 stepx = ((uint64)src.getWidth() << 48) / dst.getWidth();
-		uint64 stepy = ((uint64)src.getHeight() << 48) / dst.getHeight();
-		uint64 stepz = ((uint64)src.getDepth() << 48) / dst.getDepth();
+		UINT64 stepx = ((UINT64)src.getWidth() << 48) / dst.getWidth();
+		UINT64 stepy = ((UINT64)src.getHeight() << 48) / dst.getHeight();
+		UINT64 stepz = ((UINT64)src.getDepth() << 48) / dst.getDepth();
 
 
 		// note: ((stepz>>1) - 1) is an extra half-step increment to adjust
 		// note: ((stepz>>1) - 1) is an extra half-step increment to adjust
 		// for the center of the destination pixel, not the top-left corner
 		// for the center of the destination pixel, not the top-left corner
-		uint64 sz_48 = (stepz >> 1) - 1;
+		UINT64 sz_48 = (stepz >> 1) - 1;
 		for (size_t z = dst.front; z < dst.back; z++, sz_48 += stepz) {
 		for (size_t z = dst.front; z < dst.back; z++, sz_48 += stepz) {
 			size_t srczoff = (size_t)(sz_48 >> 48) * src.slicePitch;
 			size_t srczoff = (size_t)(sz_48 >> 48) * src.slicePitch;
 			
 			
-			uint64 sy_48 = (stepy >> 1) - 1;
+			UINT64 sy_48 = (stepy >> 1) - 1;
 			for (size_t y = dst.top; y < dst.bottom; y++, sy_48 += stepy) {
 			for (size_t y = dst.top; y < dst.bottom; y++, sy_48 += stepy) {
 				size_t srcyoff = (size_t)(sy_48 >> 48) * src.rowPitch;
 				size_t srcyoff = (size_t)(sy_48 >> 48) * src.rowPitch;
 			
 			
-				uint64 sx_48 = (stepx >> 1) - 1;
+				UINT64 sx_48 = (stepx >> 1) - 1;
 				for (size_t x = dst.left; x < dst.right; x++, sx_48 += stepx) {
 				for (size_t x = dst.left; x < dst.right; x++, sx_48 += stepx) {
-					uchar* psrc = srcdata +
+					UINT8* psrc = srcdata +
 						elemsize*((size_t)(sx_48 >> 48) + srcyoff + srczoff);
 						elemsize*((size_t)(sx_48 >> 48) + srcyoff + srczoff);
                     memcpy(pdst, psrc, elemsize);
                     memcpy(pdst, psrc, elemsize);
 					pdst += elemsize;
 					pdst += elemsize;
@@ -97,14 +97,14 @@ struct LinearResampler {
 		size_t dstelemsize = PixelUtil::getNumElemBytes(dst.format);
 		size_t dstelemsize = PixelUtil::getNumElemBytes(dst.format);
 
 
 		// srcdata stays at beginning, pdst is a moving pointer
 		// srcdata stays at beginning, pdst is a moving pointer
-		uchar* srcdata = (uchar*)src.data;
-		uchar* pdst = (uchar*)dst.data;
+		UINT8* srcdata = (UINT8*)src.data;
+		UINT8* pdst = (UINT8*)dst.data;
 		
 		
 		// sx_48,sy_48,sz_48 represent current position in source
 		// sx_48,sy_48,sz_48 represent current position in source
 		// using 16/48-bit fixed precision, incremented by steps
 		// using 16/48-bit fixed precision, incremented by steps
-		uint64 stepx = ((uint64)src.getWidth() << 48) / dst.getWidth();
-		uint64 stepy = ((uint64)src.getHeight() << 48) / dst.getHeight();
-		uint64 stepz = ((uint64)src.getDepth() << 48) / dst.getDepth();
+		UINT64 stepx = ((UINT64)src.getWidth() << 48) / dst.getWidth();
+		UINT64 stepy = ((UINT64)src.getHeight() << 48) / dst.getHeight();
+		UINT64 stepz = ((UINT64)src.getDepth() << 48) / dst.getDepth();
 		
 		
 		// temp is 16/16 bit fixed precision, used to adjust a source
 		// temp is 16/16 bit fixed precision, used to adjust a source
 		// coordinate (x, y, or z) backwards by half a pixel so that the
 		// coordinate (x, y, or z) backwards by half a pixel so that the
@@ -114,7 +114,7 @@ struct LinearResampler {
 
 
 		// note: ((stepz>>1) - 1) is an extra half-step increment to adjust
 		// note: ((stepz>>1) - 1) is an extra half-step increment to adjust
 		// for the center of the destination pixel, not the top-left corner
 		// for the center of the destination pixel, not the top-left corner
-		uint64 sz_48 = (stepz >> 1) - 1;
+		UINT64 sz_48 = (stepz >> 1) - 1;
 		for (size_t z = dst.front; z < dst.back; z++, sz_48+=stepz) {
 		for (size_t z = dst.front; z < dst.back; z++, sz_48+=stepz) {
 			temp = static_cast<unsigned int>(sz_48 >> 32);
 			temp = static_cast<unsigned int>(sz_48 >> 32);
 			temp = (temp > 0x8000)? temp - 0x8000 : 0;
 			temp = (temp > 0x8000)? temp - 0x8000 : 0;
@@ -122,7 +122,7 @@ struct LinearResampler {
 			size_t sz2 = std::min(sz1+1,src.getDepth()-1);// src z, sample #2
 			size_t sz2 = std::min(sz1+1,src.getDepth()-1);// src z, sample #2
 			float szf = (temp & 0xFFFF) / 65536.f; // weight of sample #2
 			float szf = (temp & 0xFFFF) / 65536.f; // weight of sample #2
 
 
-			uint64 sy_48 = (stepy >> 1) - 1;
+			UINT64 sy_48 = (stepy >> 1) - 1;
 			for (size_t y = dst.top; y < dst.bottom; y++, sy_48+=stepy) {
 			for (size_t y = dst.top; y < dst.bottom; y++, sy_48+=stepy) {
 				temp = static_cast<unsigned int>(sy_48 >> 32);
 				temp = static_cast<unsigned int>(sy_48 >> 32);
 				temp = (temp > 0x8000)? temp - 0x8000 : 0;
 				temp = (temp > 0x8000)? temp - 0x8000 : 0;
@@ -130,7 +130,7 @@ struct LinearResampler {
 				size_t sy2 = std::min(sy1+1,src.getHeight()-1);// src y #2
 				size_t sy2 = std::min(sy1+1,src.getHeight()-1);// src y #2
 				float syf = (temp & 0xFFFF) / 65536.f; // weight of #2
 				float syf = (temp & 0xFFFF) / 65536.f; // weight of #2
 				
 				
-				uint64 sx_48 = (stepx >> 1) - 1;
+				UINT64 sx_48 = (stepx >> 1) - 1;
 				for (size_t x = dst.left; x < dst.right; x++, sx_48+=stepx) {
 				for (size_t x = dst.left; x < dst.right; x++, sx_48+=stepx) {
 					temp = static_cast<unsigned int>(sx_48 >> 32);
 					temp = static_cast<unsigned int>(sx_48 >> 32);
 					temp = (temp > 0x8000)? temp - 0x8000 : 0;
 					temp = (temp > 0x8000)? temp - 0x8000 : 0;
@@ -187,9 +187,9 @@ struct LinearResampler_Float32 {
 		
 		
 		// sx_48,sy_48,sz_48 represent current position in source
 		// sx_48,sy_48,sz_48 represent current position in source
 		// using 16/48-bit fixed precision, incremented by steps
 		// using 16/48-bit fixed precision, incremented by steps
-		uint64 stepx = ((uint64)src.getWidth() << 48) / dst.getWidth();
-		uint64 stepy = ((uint64)src.getHeight() << 48) / dst.getHeight();
-		uint64 stepz = ((uint64)src.getDepth() << 48) / dst.getDepth();
+		UINT64 stepx = ((UINT64)src.getWidth() << 48) / dst.getWidth();
+		UINT64 stepy = ((UINT64)src.getHeight() << 48) / dst.getHeight();
+		UINT64 stepz = ((UINT64)src.getDepth() << 48) / dst.getDepth();
 		
 		
 		// temp is 16/16 bit fixed precision, used to adjust a source
 		// temp is 16/16 bit fixed precision, used to adjust a source
 		// coordinate (x, y, or z) backwards by half a pixel so that the
 		// coordinate (x, y, or z) backwards by half a pixel so that the
@@ -199,7 +199,7 @@ struct LinearResampler_Float32 {
 
 
 		// note: ((stepz>>1) - 1) is an extra half-step increment to adjust
 		// note: ((stepz>>1) - 1) is an extra half-step increment to adjust
 		// for the center of the destination pixel, not the top-left corner
 		// for the center of the destination pixel, not the top-left corner
-		uint64 sz_48 = (stepz >> 1) - 1;
+		UINT64 sz_48 = (stepz >> 1) - 1;
 		for (size_t z = dst.front; z < dst.back; z++, sz_48+=stepz) {
 		for (size_t z = dst.front; z < dst.back; z++, sz_48+=stepz) {
 			temp = static_cast<unsigned int>(sz_48 >> 32);
 			temp = static_cast<unsigned int>(sz_48 >> 32);
 			temp = (temp > 0x8000)? temp - 0x8000 : 0;
 			temp = (temp > 0x8000)? temp - 0x8000 : 0;
@@ -207,7 +207,7 @@ struct LinearResampler_Float32 {
 			size_t sz2 = std::min(sz1+1,src.getDepth()-1);// src z, sample #2
 			size_t sz2 = std::min(sz1+1,src.getDepth()-1);// src z, sample #2
 			float szf = (temp & 0xFFFF) / 65536.f; // weight of sample #2
 			float szf = (temp & 0xFFFF) / 65536.f; // weight of sample #2
 
 
-			uint64 sy_48 = (stepy >> 1) - 1;
+			UINT64 sy_48 = (stepy >> 1) - 1;
 			for (size_t y = dst.top; y < dst.bottom; y++, sy_48+=stepy) {
 			for (size_t y = dst.top; y < dst.bottom; y++, sy_48+=stepy) {
 				temp = static_cast<unsigned int>(sy_48 >> 32);
 				temp = static_cast<unsigned int>(sy_48 >> 32);
 				temp = (temp > 0x8000)? temp - 0x8000 : 0;
 				temp = (temp > 0x8000)? temp - 0x8000 : 0;
@@ -215,7 +215,7 @@ struct LinearResampler_Float32 {
 				size_t sy2 = std::min(sy1+1,src.getHeight()-1);// src y #2
 				size_t sy2 = std::min(sy1+1,src.getHeight()-1);// src y #2
 				float syf = (temp & 0xFFFF) / 65536.f; // weight of #2
 				float syf = (temp & 0xFFFF) / 65536.f; // weight of #2
 				
 				
-				uint64 sx_48 = (stepx >> 1) - 1;
+				UINT64 sx_48 = (stepx >> 1) - 1;
 				for (size_t x = dst.left; x < dst.right; x++, sx_48+=stepx) {
 				for (size_t x = dst.left; x < dst.right; x++, sx_48+=stepx) {
 					temp = static_cast<unsigned int>(sx_48 >> 32);
 					temp = static_cast<unsigned int>(sx_48 >> 32);
 					temp = (temp > 0x8000)? temp - 0x8000 : 0;
 					temp = (temp > 0x8000)? temp - 0x8000 : 0;
@@ -293,13 +293,13 @@ template<unsigned int channels> struct LinearResampler_Byte {
 		}
 		}
 
 
 		// srcdata stays at beginning of slice, pdst is a moving pointer
 		// srcdata stays at beginning of slice, pdst is a moving pointer
-		uchar* srcdata = (uchar*)src.data;
-		uchar* pdst = (uchar*)dst.data;
+		UINT8* srcdata = (UINT8*)src.data;
+		UINT8* pdst = (UINT8*)dst.data;
 
 
 		// sx_48,sy_48 represent current position in source
 		// sx_48,sy_48 represent current position in source
 		// using 16/48-bit fixed precision, incremented by steps
 		// using 16/48-bit fixed precision, incremented by steps
-		uint64 stepx = ((uint64)src.getWidth() << 48) / dst.getWidth();
-		uint64 stepy = ((uint64)src.getHeight() << 48) / dst.getHeight();
+		UINT64 stepx = ((UINT64)src.getWidth() << 48) / dst.getWidth();
+		UINT64 stepy = ((UINT64)src.getHeight() << 48) / dst.getHeight();
 		
 		
 		// bottom 28 bits of temp are 16/12 bit fixed precision, used to
 		// bottom 28 bits of temp are 16/12 bit fixed precision, used to
 		// adjust a source coordinate backwards by half a pixel so that the
 		// adjust a source coordinate backwards by half a pixel so that the
@@ -307,7 +307,7 @@ template<unsigned int channels> struct LinearResampler_Byte {
 		// fractional bits are the blend weight of the second sample
 		// fractional bits are the blend weight of the second sample
 		unsigned int temp;
 		unsigned int temp;
 		
 		
-		uint64 sy_48 = (stepy >> 1) - 1;
+		UINT64 sy_48 = (stepy >> 1) - 1;
 		for (size_t y = dst.top; y < dst.bottom; y++, sy_48+=stepy) {
 		for (size_t y = dst.top; y < dst.bottom; y++, sy_48+=stepy) {
 			temp = static_cast<unsigned int>(sy_48 >> 36);
 			temp = static_cast<unsigned int>(sy_48 >> 36);
 			temp = (temp > 0x800)? temp - 0x800: 0;
 			temp = (temp > 0x800)? temp - 0x800: 0;
@@ -317,7 +317,7 @@ template<unsigned int channels> struct LinearResampler_Byte {
 			size_t syoff1 = sy1 * src.rowPitch;
 			size_t syoff1 = sy1 * src.rowPitch;
 			size_t syoff2 = sy2 * src.rowPitch;
 			size_t syoff2 = sy2 * src.rowPitch;
 
 
-			uint64 sx_48 = (stepx >> 1) - 1;
+			UINT64 sx_48 = (stepx >> 1) - 1;
 			for (size_t x = dst.left; x < dst.right; x++, sx_48+=stepx) {
 			for (size_t x = dst.left; x < dst.right; x++, sx_48+=stepx) {
 				temp = static_cast<unsigned int>(sx_48 >> 36);
 				temp = static_cast<unsigned int>(sx_48 >> 36);
 				temp = (temp > 0x800)? temp - 0x800 : 0;
 				temp = (temp > 0x800)? temp - 0x800 : 0;
@@ -334,7 +334,7 @@ template<unsigned int channels> struct LinearResampler_Byte {
 						srcdata[(sx2 + syoff2)*channels+k]*sxfsyf;
 						srcdata[(sx2 + syoff2)*channels+k]*sxfsyf;
 					// accum is computed using 8/24-bit fixed-point math
 					// accum is computed using 8/24-bit fixed-point math
 					// (maximum is 0xFF000000; rounding will not cause overflow)
 					// (maximum is 0xFF000000; rounding will not cause overflow)
-					*pdst++ = static_cast<uchar>((accum + 0x800000) >> 24);
+					*pdst++ = static_cast<UINT8>((accum + 0x800000) >> 24);
 				}
 				}
 			}
 			}
 			pdst += channels*dst.getRowSkip();
 			pdst += channels*dst.getRowSkip();

+ 0 - 987
CamelotRenderer/OgreMath.cpp

@@ -1,987 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#include "OgreMath.h"
-#include "asm_math.h"
-#include "OgreVector2.h"
-#include "OgreVector3.h"
-#include "OgreVector4.h"
-#include "OgreRay.h"
-#include "OgreSphere.h"
-#include "OgreAxisAlignedBox.h"
-#include "OgrePlane.h"
-
-
-namespace CamelotEngine
-{
-
-    const Real Math::POS_INFINITY = std::numeric_limits<Real>::infinity();
-    const Real Math::NEG_INFINITY = -std::numeric_limits<Real>::infinity();
-    const Real Math::PI = Real( 4.0 * atan( 1.0 ) );
-    const Real Math::TWO_PI = Real( 2.0 * PI );
-    const Real Math::HALF_PI = Real( 0.5 * PI );
-	const Real Math::fDeg2Rad = PI / Real(180.0);
-	const Real Math::fRad2Deg = Real(180.0) / PI;
-	const Real Math::LOG2 = log(Real(2.0));
-
-    int Math::mTrigTableSize;
-   Math::AngleUnit Math::msAngleUnit;
-
-    Real  Math::mTrigTableFactor;
-    Real *Math::mSinTable = NULL;
-    Real *Math::mTanTable = NULL;
-
-    //-----------------------------------------------------------------------
-    Math::Math( unsigned int trigTableSize )
-    {
-        msAngleUnit = AU_DEGREE;
-
-        mTrigTableSize = trigTableSize;
-        mTrigTableFactor = mTrigTableSize / Math::TWO_PI;
-
-        mSinTable = (Real*)malloc(sizeof(Real) * mTrigTableSize);
-        mTanTable = (Real*)malloc(sizeof(Real) * mTrigTableSize);
-
-        buildTrigTables();
-    }
-
-    //-----------------------------------------------------------------------
-    Math::~Math()
-    {
-        free(mSinTable);
-        free(mTanTable);
-    }
-
-    //-----------------------------------------------------------------------
-    void Math::buildTrigTables(void)
-    {
-        // Build trig lookup tables
-        // Could get away with building only PI sized Sin table but simpler this 
-        // way. Who cares, it'll ony use an extra 8k of memory anyway and I like 
-        // simplicity.
-        Real angle;
-        for (int i = 0; i < mTrigTableSize; ++i)
-        {
-            angle = Math::TWO_PI * i / mTrigTableSize;
-            mSinTable[i] = sin(angle);
-            mTanTable[i] = tan(angle);
-        }
-    }
-	//-----------------------------------------------------------------------	
-	Real Math::SinTable (Real fValue)
-    {
-        // Convert range to index values, wrap if required
-        int idx;
-        if (fValue >= 0)
-        {
-            idx = int(fValue * mTrigTableFactor) % mTrigTableSize;
-        }
-        else
-        {
-            idx = mTrigTableSize - (int(-fValue * mTrigTableFactor) % mTrigTableSize) - 1;
-        }
-
-        return mSinTable[idx];
-    }
-	//-----------------------------------------------------------------------
-	Real Math::TanTable (Real fValue)
-    {
-        // Convert range to index values, wrap if required
-		int idx = int(fValue *= mTrigTableFactor) % mTrigTableSize;
-		return mTanTable[idx];
-    }
-    //-----------------------------------------------------------------------
-    int Math::ISign (int iValue)
-    {
-        return ( iValue > 0 ? +1 : ( iValue < 0 ? -1 : 0 ) );
-    }
-    //-----------------------------------------------------------------------
-    Radian Math::ACos (Real fValue)
-    {
-        if ( -1.0 < fValue )
-        {
-            if ( fValue < 1.0 )
-                return Radian(acos(fValue));
-            else
-                return Radian(0.0);
-        }
-        else
-        {
-            return Radian(PI);
-        }
-    }
-    //-----------------------------------------------------------------------
-    Radian Math::ASin (Real fValue)
-    {
-        if ( -1.0 < fValue )
-        {
-            if ( fValue < 1.0 )
-                return Radian(asin(fValue));
-            else
-                return Radian(HALF_PI);
-        }
-        else
-        {
-            return Radian(-HALF_PI);
-        }
-    }
-    //-----------------------------------------------------------------------
-    Real Math::Sign (Real fValue)
-    {
-        if ( fValue > 0.0 )
-            return 1.0;
-
-        if ( fValue < 0.0 )
-            return -1.0;
-
-        return 0.0;
-    }
-	//-----------------------------------------------------------------------
-	Real Math::InvSqrt(Real fValue)
-	{
-		return Real(asm_rsq(fValue));
-	}
-    //-----------------------------------------------------------------------
-    Real Math::UnitRandom ()
-    {
-        return asm_rand() / asm_rand_max();
-    }
-    
-    //-----------------------------------------------------------------------
-    Real Math::RangeRandom (Real fLow, Real fHigh)
-    {
-        return (fHigh-fLow)*UnitRandom() + fLow;
-    }
-
-    //-----------------------------------------------------------------------
-    Real Math::SymmetricRandom ()
-    {
-		return 2.0f * UnitRandom() - 1.0f;
-    }
-
-   //-----------------------------------------------------------------------
-    void Math::setAngleUnit(Math::AngleUnit unit)
-   {
-       msAngleUnit = unit;
-   }
-   //-----------------------------------------------------------------------
-   Math::AngleUnit Math::getAngleUnit(void)
-   {
-       return msAngleUnit;
-   }
-    //-----------------------------------------------------------------------
-    Real Math::AngleUnitsToRadians(Real angleunits)
-    {
-       if (msAngleUnit == AU_DEGREE)
-           return angleunits * fDeg2Rad;
-       else
-           return angleunits;
-    }
-
-    //-----------------------------------------------------------------------
-    Real Math::RadiansToAngleUnits(Real radians)
-    {
-       if (msAngleUnit == AU_DEGREE)
-           return radians * fRad2Deg;
-       else
-           return radians;
-    }
-
-    //-----------------------------------------------------------------------
-    Real Math::AngleUnitsToDegrees(Real angleunits)
-    {
-       if (msAngleUnit == AU_RADIAN)
-           return angleunits * fRad2Deg;
-       else
-           return angleunits;
-    }
-
-    //-----------------------------------------------------------------------
-    Real Math::DegreesToAngleUnits(Real degrees)
-    {
-       if (msAngleUnit == AU_RADIAN)
-           return degrees * fDeg2Rad;
-       else
-           return degrees;
-    }
-
-    //-----------------------------------------------------------------------
-	bool Math::pointInTri2D(const Vector2& p, const Vector2& a, 
-		const Vector2& b, const Vector2& c)
-    {
-		// Winding must be consistent from all edges for point to be inside
-		Vector2 v1, v2;
-		Real dot[3];
-		bool zeroDot[3];
-
-		v1 = b - a;
-		v2 = p - a;
-
-		// Note we don't care about normalisation here since sign is all we need
-		// It means we don't have to worry about magnitude of cross products either
-		dot[0] = v1.crossProduct(v2);
-		zeroDot[0] = Math::RealEqual(dot[0], 0.0f, 1e-3f);
-
-
-		v1 = c - b;
-		v2 = p - b;
-
-		dot[1] = v1.crossProduct(v2);
-		zeroDot[1] = Math::RealEqual(dot[1], 0.0f, 1e-3f);
-
-		// Compare signs (ignore colinear / coincident points)
-		if(!zeroDot[0] && !zeroDot[1] 
-		&& Math::Sign(dot[0]) != Math::Sign(dot[1]))
-		{
-			return false;
-		}
-
-		v1 = a - c;
-		v2 = p - c;
-
-		dot[2] = v1.crossProduct(v2);
-		zeroDot[2] = Math::RealEqual(dot[2], 0.0f, 1e-3f);
-		// Compare signs (ignore colinear / coincident points)
-		if((!zeroDot[0] && !zeroDot[2] 
-			&& Math::Sign(dot[0]) != Math::Sign(dot[2])) ||
-			(!zeroDot[1] && !zeroDot[2] 
-			&& Math::Sign(dot[1]) != Math::Sign(dot[2])))
-		{
-			return false;
-		}
-
-
-		return true;
-    }
-	//-----------------------------------------------------------------------
-	bool Math::pointInTri3D(const Vector3& p, const Vector3& a, 
-		const Vector3& b, const Vector3& c, const Vector3& normal)
-	{
-        // Winding must be consistent from all edges for point to be inside
-		Vector3 v1, v2;
-		Real dot[3];
-		bool zeroDot[3];
-
-        v1 = b - a;
-        v2 = p - a;
-
-		// Note we don't care about normalisation here since sign is all we need
-		// It means we don't have to worry about magnitude of cross products either
-        dot[0] = v1.crossProduct(v2).dotProduct(normal);
-		zeroDot[0] = Math::RealEqual(dot[0], 0.0f, 1e-3f);
-
-
-        v1 = c - b;
-        v2 = p - b;
-
-		dot[1] = v1.crossProduct(v2).dotProduct(normal);
-		zeroDot[1] = Math::RealEqual(dot[1], 0.0f, 1e-3f);
-
-		// Compare signs (ignore colinear / coincident points)
-		if(!zeroDot[0] && !zeroDot[1] 
-			&& Math::Sign(dot[0]) != Math::Sign(dot[1]))
-		{
-            return false;
-		}
-
-        v1 = a - c;
-        v2 = p - c;
-
-		dot[2] = v1.crossProduct(v2).dotProduct(normal);
-		zeroDot[2] = Math::RealEqual(dot[2], 0.0f, 1e-3f);
-		// Compare signs (ignore colinear / coincident points)
-		if((!zeroDot[0] && !zeroDot[2] 
-			&& Math::Sign(dot[0]) != Math::Sign(dot[2])) ||
-			(!zeroDot[1] && !zeroDot[2] 
-			&& Math::Sign(dot[1]) != Math::Sign(dot[2])))
-		{
-			return false;
-		}
-
-
-        return true;
-	}
-    //-----------------------------------------------------------------------
-    bool Math::RealEqual( Real a, Real b, Real tolerance )
-    {
-        if (fabs(b-a) <= tolerance)
-            return true;
-        else
-            return false;
-    }
-
-    //-----------------------------------------------------------------------
-    std::pair<bool, Real> Math::intersects(const Ray& ray, const Plane& plane)
-    {
-
-        Real denom = plane.normal.dotProduct(ray.getDirection());
-        if (Math::Abs(denom) < std::numeric_limits<Real>::epsilon())
-        {
-            // Parallel
-            return std::pair<bool, Real>(false, 0);
-        }
-        else
-        {
-            Real nom = plane.normal.dotProduct(ray.getOrigin()) + plane.d;
-            Real t = -(nom/denom);
-            return std::pair<bool, Real>(t >= 0, t);
-        }
-        
-    }
-    //-----------------------------------------------------------------------
-    std::pair<bool, Real> Math::intersects(const Ray& ray, 
-        const vector<Plane>::type& planes, bool normalIsOutside)
-    {
-		list<Plane>::type planesList;
-		for (vector<Plane>::type::const_iterator i = planes.begin(); i != planes.end(); ++i)
-		{
-			planesList.push_back(*i);
-		}
-		return intersects(ray, planesList, normalIsOutside);
-    }
-    //-----------------------------------------------------------------------
-    std::pair<bool, Real> Math::intersects(const Ray& ray, 
-        const list<Plane>::type& planes, bool normalIsOutside)
-    {
-		list<Plane>::type::const_iterator planeit, planeitend;
-		planeitend = planes.end();
-		bool allInside = true;
-		std::pair<bool, Real> ret;
-		std::pair<bool, Real> end;
-		ret.first = false;
-		ret.second = 0.0f;
-		end.first = false;
-		end.second = 0;
-
-
-		// derive side
-		// NB we don't pass directly since that would require Plane::Side in 
-		// interface, which results in recursive includes since Math is so fundamental
-		Plane::Side outside = normalIsOutside ? Plane::POSITIVE_SIDE : Plane::NEGATIVE_SIDE;
-
-		for (planeit = planes.begin(); planeit != planeitend; ++planeit)
-		{
-			const Plane& plane = *planeit;
-			// is origin outside?
-			if (plane.getSide(ray.getOrigin()) == outside)
-			{
-				allInside = false;
-				// Test single plane
-				std::pair<bool, Real> planeRes = 
-					ray.intersects(plane);
-				if (planeRes.first)
-				{
-					// Ok, we intersected
-					ret.first = true;
-					// Use the most distant result since convex volume
-					ret.second = std::max(ret.second, planeRes.second);
-				}
-				else
-				{
-					ret.first =false;
-					ret.second=0.0f;
-					return ret;
-				}
-			}
-			else
-			{
-				std::pair<bool, Real> planeRes = 
-					ray.intersects(plane);
-				if (planeRes.first)
-				{
-					if( !end.first )
-					{
-						end.first = true;
-						end.second = planeRes.second;
-					}
-					else
-					{
-						end.second = std::min( planeRes.second, end.second );
-					}
-
-				}
-
-			}
-		}
-
-		if (allInside)
-		{
-			// Intersecting at 0 distance since inside the volume!
-			ret.first = true;
-			ret.second = 0.0f;
-			return ret;
-		}
-
-		if( end.first )
-		{
-			if( end.second < ret.second )
-			{
-				ret.first = false;
-				return ret;
-			}
-		}
-		return ret;
-    }
-    //-----------------------------------------------------------------------
-    std::pair<bool, Real> Math::intersects(const Ray& ray, const Sphere& sphere, 
-        bool discardInside)
-    {
-        const Vector3& raydir = ray.getDirection();
-        // Adjust ray origin relative to sphere center
-        const Vector3& rayorig = ray.getOrigin() - sphere.getCenter();
-        Real radius = sphere.getRadius();
-
-        // Check origin inside first
-        if (rayorig.squaredLength() <= radius*radius && discardInside)
-        {
-            return std::pair<bool, Real>(true, 0);
-        }
-
-        // Mmm, quadratics
-        // Build coeffs which can be used with std quadratic solver
-        // ie t = (-b +/- sqrt(b*b + 4ac)) / 2a
-        Real a = raydir.dotProduct(raydir);
-        Real b = 2 * rayorig.dotProduct(raydir);
-        Real c = rayorig.dotProduct(rayorig) - radius*radius;
-
-        // Calc determinant
-        Real d = (b*b) - (4 * a * c);
-        if (d < 0)
-        {
-            // No intersection
-            return std::pair<bool, Real>(false, 0);
-        }
-        else
-        {
-            // BTW, if d=0 there is one intersection, if d > 0 there are 2
-            // But we only want the closest one, so that's ok, just use the 
-            // '-' version of the solver
-            Real t = ( -b - Math::Sqrt(d) ) / (2 * a);
-            if (t < 0)
-                t = ( -b + Math::Sqrt(d) ) / (2 * a);
-            return std::pair<bool, Real>(true, t);
-        }
-
-
-    }
-    //-----------------------------------------------------------------------
-	std::pair<bool, Real> Math::intersects(const Ray& ray, const AxisAlignedBox& box)
-	{
-		if (box.isNull()) return std::pair<bool, Real>(false, 0);
-		if (box.isInfinite()) return std::pair<bool, Real>(true, 0);
-
-		Real lowt = 0.0f;
-		Real t;
-		bool hit = false;
-		Vector3 hitpoint;
-		const Vector3& min = box.getMinimum();
-		const Vector3& max = box.getMaximum();
-		const Vector3& rayorig = ray.getOrigin();
-		const Vector3& raydir = ray.getDirection();
-
-		// Check origin inside first
-		if ( rayorig > min && rayorig < max )
-		{
-			return std::pair<bool, Real>(true, 0);
-		}
-
-		// Check each face in turn, only check closest 3
-		// Min x
-		if (rayorig.x <= min.x && raydir.x > 0)
-		{
-			t = (min.x - rayorig.x) / raydir.x;
-			if (t >= 0)
-			{
-				// Substitute t back into ray and check bounds and dist
-				hitpoint = rayorig + raydir * t;
-				if (hitpoint.y >= min.y && hitpoint.y <= max.y &&
-					hitpoint.z >= min.z && hitpoint.z <= max.z &&
-					(!hit || t < lowt))
-				{
-					hit = true;
-					lowt = t;
-				}
-			}
-		}
-		// Max x
-		if (rayorig.x >= max.x && raydir.x < 0)
-		{
-			t = (max.x - rayorig.x) / raydir.x;
-			if (t >= 0)
-			{
-				// Substitute t back into ray and check bounds and dist
-				hitpoint = rayorig + raydir * t;
-				if (hitpoint.y >= min.y && hitpoint.y <= max.y &&
-					hitpoint.z >= min.z && hitpoint.z <= max.z &&
-					(!hit || t < lowt))
-				{
-					hit = true;
-					lowt = t;
-				}
-			}
-		}
-		// Min y
-		if (rayorig.y <= min.y && raydir.y > 0)
-		{
-			t = (min.y - rayorig.y) / raydir.y;
-			if (t >= 0)
-			{
-				// Substitute t back into ray and check bounds and dist
-				hitpoint = rayorig + raydir * t;
-				if (hitpoint.x >= min.x && hitpoint.x <= max.x &&
-					hitpoint.z >= min.z && hitpoint.z <= max.z &&
-					(!hit || t < lowt))
-				{
-					hit = true;
-					lowt = t;
-				}
-			}
-		}
-		// Max y
-		if (rayorig.y >= max.y && raydir.y < 0)
-		{
-			t = (max.y - rayorig.y) / raydir.y;
-			if (t >= 0)
-			{
-				// Substitute t back into ray and check bounds and dist
-				hitpoint = rayorig + raydir * t;
-				if (hitpoint.x >= min.x && hitpoint.x <= max.x &&
-					hitpoint.z >= min.z && hitpoint.z <= max.z &&
-					(!hit || t < lowt))
-				{
-					hit = true;
-					lowt = t;
-				}
-			}
-		}
-		// Min z
-		if (rayorig.z <= min.z && raydir.z > 0)
-		{
-			t = (min.z - rayorig.z) / raydir.z;
-			if (t >= 0)
-			{
-				// Substitute t back into ray and check bounds and dist
-				hitpoint = rayorig + raydir * t;
-				if (hitpoint.x >= min.x && hitpoint.x <= max.x &&
-					hitpoint.y >= min.y && hitpoint.y <= max.y &&
-					(!hit || t < lowt))
-				{
-					hit = true;
-					lowt = t;
-				}
-			}
-		}
-		// Max z
-		if (rayorig.z >= max.z && raydir.z < 0)
-		{
-			t = (max.z - rayorig.z) / raydir.z;
-			if (t >= 0)
-			{
-				// Substitute t back into ray and check bounds and dist
-				hitpoint = rayorig + raydir * t;
-				if (hitpoint.x >= min.x && hitpoint.x <= max.x &&
-					hitpoint.y >= min.y && hitpoint.y <= max.y &&
-					(!hit || t < lowt))
-				{
-					hit = true;
-					lowt = t;
-				}
-			}
-		}
-
-		return std::pair<bool, Real>(hit, lowt);
-
-	} 
-    //-----------------------------------------------------------------------
-    bool Math::intersects(const Ray& ray, const AxisAlignedBox& box,
-        Real* d1, Real* d2)
-    {
-        if (box.isNull())
-            return false;
-
-        if (box.isInfinite())
-        {
-            if (d1) *d1 = 0;
-            if (d2) *d2 = Math::POS_INFINITY;
-            return true;
-        }
-
-        const Vector3& min = box.getMinimum();
-        const Vector3& max = box.getMaximum();
-        const Vector3& rayorig = ray.getOrigin();
-        const Vector3& raydir = ray.getDirection();
-
-        Vector3 absDir;
-        absDir[0] = Math::Abs(raydir[0]);
-        absDir[1] = Math::Abs(raydir[1]);
-        absDir[2] = Math::Abs(raydir[2]);
-
-        // Sort the axis, ensure check minimise floating error axis first
-        int imax = 0, imid = 1, imin = 2;
-        if (absDir[0] < absDir[2])
-        {
-            imax = 2;
-            imin = 0;
-        }
-        if (absDir[1] < absDir[imin])
-        {
-            imid = imin;
-            imin = 1;
-        }
-        else if (absDir[1] > absDir[imax])
-        {
-            imid = imax;
-            imax = 1;
-        }
-
-        Real start = 0, end = Math::POS_INFINITY;
-
-#define _CALC_AXIS(i)                                       \
-    do {                                                    \
-        Real denom = 1 / raydir[i];                         \
-        Real newstart = (min[i] - rayorig[i]) * denom;      \
-        Real newend = (max[i] - rayorig[i]) * denom;        \
-        if (newstart > newend) std::swap(newstart, newend); \
-        if (newstart > end || newend < start) return false; \
-        if (newstart > start) start = newstart;             \
-        if (newend < end) end = newend;                     \
-    } while(0)
-
-        // Check each axis in turn
-
-        _CALC_AXIS(imax);
-
-        if (absDir[imid] < std::numeric_limits<Real>::epsilon())
-        {
-            // Parallel with middle and minimise axis, check bounds only
-            if (rayorig[imid] < min[imid] || rayorig[imid] > max[imid] ||
-                rayorig[imin] < min[imin] || rayorig[imin] > max[imin])
-                return false;
-        }
-        else
-        {
-            _CALC_AXIS(imid);
-
-            if (absDir[imin] < std::numeric_limits<Real>::epsilon())
-            {
-                // Parallel with minimise axis, check bounds only
-                if (rayorig[imin] < min[imin] || rayorig[imin] > max[imin])
-                    return false;
-            }
-            else
-            {
-                _CALC_AXIS(imin);
-            }
-        }
-#undef _CALC_AXIS
-
-        if (d1) *d1 = start;
-        if (d2) *d2 = end;
-
-        return true;
-    }
-    //-----------------------------------------------------------------------
-    std::pair<bool, Real> Math::intersects(const Ray& ray, const Vector3& a,
-        const Vector3& b, const Vector3& c, const Vector3& normal,
-        bool positiveSide, bool negativeSide)
-    {
-        //
-        // Calculate intersection with plane.
-        //
-        Real t;
-        {
-            Real denom = normal.dotProduct(ray.getDirection());
-
-            // Check intersect side
-            if (denom > + std::numeric_limits<Real>::epsilon())
-            {
-                if (!negativeSide)
-                    return std::pair<bool, Real>(false, 0);
-            }
-            else if (denom < - std::numeric_limits<Real>::epsilon())
-            {
-                if (!positiveSide)
-                    return std::pair<bool, Real>(false, 0);
-            }
-            else
-            {
-                // Parallel or triangle area is close to zero when
-                // the plane normal not normalised.
-                return std::pair<bool, Real>(false, 0);
-            }
-
-            t = normal.dotProduct(a - ray.getOrigin()) / denom;
-
-            if (t < 0)
-            {
-                // Intersection is behind origin
-                return std::pair<bool, Real>(false, 0);
-            }
-        }
-
-        //
-        // Calculate the largest area projection plane in X, Y or Z.
-        //
-        size_t i0, i1;
-        {
-            Real n0 = Math::Abs(normal[0]);
-            Real n1 = Math::Abs(normal[1]);
-            Real n2 = Math::Abs(normal[2]);
-
-            i0 = 1; i1 = 2;
-            if (n1 > n2)
-            {
-                if (n1 > n0) i0 = 0;
-            }
-            else
-            {
-                if (n2 > n0) i1 = 0;
-            }
-        }
-
-        //
-        // Check the intersection point is inside the triangle.
-        //
-        {
-            Real u1 = b[i0] - a[i0];
-            Real v1 = b[i1] - a[i1];
-            Real u2 = c[i0] - a[i0];
-            Real v2 = c[i1] - a[i1];
-            Real u0 = t * ray.getDirection()[i0] + ray.getOrigin()[i0] - a[i0];
-            Real v0 = t * ray.getDirection()[i1] + ray.getOrigin()[i1] - a[i1];
-
-            Real alpha = u0 * v2 - u2 * v0;
-            Real beta  = u1 * v0 - u0 * v1;
-            Real area  = u1 * v2 - u2 * v1;
-
-            // epsilon to avoid float precision error
-            const Real EPSILON = 1e-6f;
-
-            Real tolerance = - EPSILON * area;
-
-            if (area > 0)
-            {
-                if (alpha < tolerance || beta < tolerance || alpha+beta > area-tolerance)
-                    return std::pair<bool, Real>(false, 0);
-            }
-            else
-            {
-                if (alpha > tolerance || beta > tolerance || alpha+beta < area-tolerance)
-                    return std::pair<bool, Real>(false, 0);
-            }
-        }
-
-        return std::pair<bool, Real>(true, t);
-    }
-    //-----------------------------------------------------------------------
-    std::pair<bool, Real> Math::intersects(const Ray& ray, const Vector3& a,
-        const Vector3& b, const Vector3& c,
-        bool positiveSide, bool negativeSide)
-    {
-        Vector3 normal = calculateBasicFaceNormalWithoutNormalize(a, b, c);
-        return intersects(ray, a, b, c, normal, positiveSide, negativeSide);
-    }
-    //-----------------------------------------------------------------------
-    bool Math::intersects(const Sphere& sphere, const AxisAlignedBox& box)
-    {
-        if (box.isNull()) return false;
-        if (box.isInfinite()) return true;
-
-        // Use splitting planes
-        const Vector3& center = sphere.getCenter();
-        Real radius = sphere.getRadius();
-        const Vector3& min = box.getMinimum();
-        const Vector3& max = box.getMaximum();
-
-		// Arvo's algorithm
-		Real s, d = 0;
-		for (int i = 0; i < 3; ++i)
-		{
-			if (center.ptr()[i] < min.ptr()[i])
-			{
-				s = center.ptr()[i] - min.ptr()[i];
-				d += s * s; 
-			}
-			else if(center.ptr()[i] > max.ptr()[i])
-			{
-				s = center.ptr()[i] - max.ptr()[i];
-				d += s * s; 
-			}
-		}
-		return d <= radius * radius;
-
-    }
-    //-----------------------------------------------------------------------
-    bool Math::intersects(const Plane& plane, const AxisAlignedBox& box)
-    {
-        return (plane.getSide(box) == Plane::BOTH_SIDE);
-    }
-    //-----------------------------------------------------------------------
-    bool Math::intersects(const Sphere& sphere, const Plane& plane)
-    {
-        return (
-            Math::Abs(plane.getDistance(sphere.getCenter()))
-            <= sphere.getRadius() );
-    }
-    //-----------------------------------------------------------------------
-    Vector3 Math::calculateTangentSpaceVector(
-        const Vector3& position1, const Vector3& position2, const Vector3& position3,
-        Real u1, Real v1, Real u2, Real v2, Real u3, Real v3)
-    {
-	    //side0 is the vector along one side of the triangle of vertices passed in, 
-	    //and side1 is the vector along another side. Taking the cross product of these returns the normal.
-	    Vector3 side0 = position1 - position2;
-	    Vector3 side1 = position3 - position1;
-	    //Calculate face normal
-	    Vector3 normal = side1.crossProduct(side0);
-	    normal.normalise();
-	    //Now we use a formula to calculate the tangent. 
-	    Real deltaV0 = v1 - v2;
-	    Real deltaV1 = v3 - v1;
-	    Vector3 tangent = deltaV1 * side0 - deltaV0 * side1;
-	    tangent.normalise();
-	    //Calculate binormal
-	    Real deltaU0 = u1 - u2;
-	    Real deltaU1 = u3 - u1;
-	    Vector3 binormal = deltaU1 * side0 - deltaU0 * side1;
-	    binormal.normalise();
-	    //Now, we take the cross product of the tangents to get a vector which 
-	    //should point in the same direction as our normal calculated above. 
-	    //If it points in the opposite direction (the dot product between the normals is less than zero), 
-	    //then we need to reverse the s and t tangents. 
-	    //This is because the triangle has been mirrored when going from tangent space to object space.
-	    //reverse tangents if necessary
-	    Vector3 tangentCross = tangent.crossProduct(binormal);
-	    if (tangentCross.dotProduct(normal) < 0.0f)
-	    {
-		    tangent = -tangent;
-		    binormal = -binormal;
-	    }
-
-        return tangent;
-
-    }
-    //-----------------------------------------------------------------------
-    Matrix4 Math::buildReflectionMatrix(const Plane& p)
-    {
-        return Matrix4(
-            -2 * p.normal.x * p.normal.x + 1,   -2 * p.normal.x * p.normal.y,       -2 * p.normal.x * p.normal.z,       -2 * p.normal.x * p.d, 
-            -2 * p.normal.y * p.normal.x,       -2 * p.normal.y * p.normal.y + 1,   -2 * p.normal.y * p.normal.z,       -2 * p.normal.y * p.d, 
-            -2 * p.normal.z * p.normal.x,       -2 * p.normal.z * p.normal.y,       -2 * p.normal.z * p.normal.z + 1,   -2 * p.normal.z * p.d, 
-            0,                                  0,                                  0,                                  1);
-    }
-    //-----------------------------------------------------------------------
-    Vector4 Math::calculateFaceNormal(const Vector3& v1, const Vector3& v2, const Vector3& v3)
-    {
-        Vector3 normal = calculateBasicFaceNormal(v1, v2, v3);
-        // Now set up the w (distance of tri from origin
-        return Vector4(normal.x, normal.y, normal.z, -(normal.dotProduct(v1)));
-    }
-    //-----------------------------------------------------------------------
-    Vector3 Math::calculateBasicFaceNormal(const Vector3& v1, const Vector3& v2, const Vector3& v3)
-    {
-        Vector3 normal = (v2 - v1).crossProduct(v3 - v1);
-        normal.normalise();
-        return normal;
-    }
-    //-----------------------------------------------------------------------
-    Vector4 Math::calculateFaceNormalWithoutNormalize(const Vector3& v1, const Vector3& v2, const Vector3& v3)
-    {
-        Vector3 normal = calculateBasicFaceNormalWithoutNormalize(v1, v2, v3);
-        // Now set up the w (distance of tri from origin)
-        return Vector4(normal.x, normal.y, normal.z, -(normal.dotProduct(v1)));
-    }
-    //-----------------------------------------------------------------------
-    Vector3 Math::calculateBasicFaceNormalWithoutNormalize(const Vector3& v1, const Vector3& v2, const Vector3& v3)
-    {
-        Vector3 normal = (v2 - v1).crossProduct(v3 - v1);
-        return normal;
-    }
-	//-----------------------------------------------------------------------
-	Real Math::gaussianDistribution(Real x, Real offset, Real scale)
-	{
-		Real nom = Math::Exp(
-			-Math::Sqr(x - offset) / (2 * Math::Sqr(scale)));
-		Real denom = scale * Math::Sqrt(2 * Math::PI);
-
-		return nom / denom;
-
-	}
-	//---------------------------------------------------------------------
-	Matrix4 Math::makeViewMatrix(const Vector3& position, const Quaternion& orientation, 
-		const Matrix4* reflectMatrix)
-	{
-		Matrix4 viewMatrix;
-
-		// View matrix is:
-		//
-		//  [ Lx  Uy  Dz  Tx  ]
-		//  [ Lx  Uy  Dz  Ty  ]
-		//  [ Lx  Uy  Dz  Tz  ]
-		//  [ 0   0   0   1   ]
-		//
-		// Where T = -(Transposed(Rot) * Pos)
-
-		// This is most efficiently done using 3x3 Matrices
-		Matrix3 rot;
-		orientation.ToRotationMatrix(rot);
-
-		// Make the translation relative to new axes
-		Matrix3 rotT = rot.Transpose();
-		Vector3 trans = -rotT * position;
-
-		// Make final matrix
-		viewMatrix = Matrix4::IDENTITY;
-		viewMatrix = rotT; // fills upper 3x3
-		viewMatrix[0][3] = trans.x;
-		viewMatrix[1][3] = trans.y;
-		viewMatrix[2][3] = trans.z;
-
-		// Deal with reflections
-		if (reflectMatrix)
-		{
-			viewMatrix = viewMatrix * (*reflectMatrix);
-		}
-
-		return viewMatrix;
-
-	}
-	//---------------------------------------------------------------------
-	Real Math::boundingRadiusFromAABB(const AxisAlignedBox& aabb)
-	{
-		Vector3 max = aabb.getMaximum();
-		Vector3 min = aabb.getMinimum();
-
-		Vector3 magnitude = max;
-		magnitude.makeCeil(-max);
-		magnitude.makeCeil(min);
-		magnitude.makeCeil(-min);
-
-		return magnitude.length();
-	}
-
-}

+ 0 - 656
CamelotRenderer/OgreMath.h

@@ -1,656 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __Math_H__
-#define __Math_H__
-
-#include "OgrePrerequisites.h"
-
-namespace CamelotEngine
-{
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Math
-	*  @{
-	*/
-	/** Wrapper class which indicates a given angle value is in Radians.
-    @remarks
-        Radian values are interchangeable with Degree values, and conversions
-        will be done automatically between them.
-    */
-	class Radian
-	{
-		Real mRad;
-
-	public:
-		explicit Radian ( Real r=0 ) : mRad(r) {}
-		Radian ( const Degree& d );
-		Radian& operator = ( const Real& f ) { mRad = f; return *this; }
-		Radian& operator = ( const Radian& r ) { mRad = r.mRad; return *this; }
-		Radian& operator = ( const Degree& d );
-
-		Real valueDegrees() const; // see bottom of this file
-		Real valueRadians() const { return mRad; }
-		Real valueAngleUnits() const;
-
-        const Radian& operator + () const { return *this; }
-		Radian operator + ( const Radian& r ) const { return Radian ( mRad + r.mRad ); }
-		Radian operator + ( const Degree& d ) const;
-		Radian& operator += ( const Radian& r ) { mRad += r.mRad; return *this; }
-		Radian& operator += ( const Degree& d );
-		Radian operator - () const { return Radian(-mRad); }
-		Radian operator - ( const Radian& r ) const { return Radian ( mRad - r.mRad ); }
-		Radian operator - ( const Degree& d ) const;
-		Radian& operator -= ( const Radian& r ) { mRad -= r.mRad; return *this; }
-		Radian& operator -= ( const Degree& d );
-		Radian operator * ( Real f ) const { return Radian ( mRad * f ); }
-        Radian operator * ( const Radian& f ) const { return Radian ( mRad * f.mRad ); }
-		Radian& operator *= ( Real f ) { mRad *= f; return *this; }
-		Radian operator / ( Real f ) const { return Radian ( mRad / f ); }
-		Radian& operator /= ( Real f ) { mRad /= f; return *this; }
-
-		bool operator <  ( const Radian& r ) const { return mRad <  r.mRad; }
-		bool operator <= ( const Radian& r ) const { return mRad <= r.mRad; }
-		bool operator == ( const Radian& r ) const { return mRad == r.mRad; }
-		bool operator != ( const Radian& r ) const { return mRad != r.mRad; }
-		bool operator >= ( const Radian& r ) const { return mRad >= r.mRad; }
-		bool operator >  ( const Radian& r ) const { return mRad >  r.mRad; }
-
-		inline CM_EXPORT friend std::ostream& operator <<
-			( std::ostream& o, const Radian& v )
-		{
-			o << "Radian(" << v.valueRadians() << ")";
-			return o;
-		}
-	};
-
-    /** Wrapper class which indicates a given angle value is in Degrees.
-    @remarks
-        Degree values are interchangeable with Radian values, and conversions
-        will be done automatically between them.
-    */
-	class Degree
-	{
-		Real mDeg; // if you get an error here - make sure to define/typedef 'Real' first
-
-	public:
-		explicit Degree ( Real d=0 ) : mDeg(d) {}
-		Degree ( const Radian& r ) : mDeg(r.valueDegrees()) {}
-		Degree& operator = ( const Real& f ) { mDeg = f; return *this; }
-		Degree& operator = ( const Degree& d ) { mDeg = d.mDeg; return *this; }
-		Degree& operator = ( const Radian& r ) { mDeg = r.valueDegrees(); return *this; }
-
-		Real valueDegrees() const { return mDeg; }
-		Real valueRadians() const; // see bottom of this file
-		Real valueAngleUnits() const;
-
-		const Degree& operator + () const { return *this; }
-		Degree operator + ( const Degree& d ) const { return Degree ( mDeg + d.mDeg ); }
-		Degree operator + ( const Radian& r ) const { return Degree ( mDeg + r.valueDegrees() ); }
-		Degree& operator += ( const Degree& d ) { mDeg += d.mDeg; return *this; }
-		Degree& operator += ( const Radian& r ) { mDeg += r.valueDegrees(); return *this; }
-		Degree operator - () const { return Degree(-mDeg); }
-		Degree operator - ( const Degree& d ) const { return Degree ( mDeg - d.mDeg ); }
-		Degree operator - ( const Radian& r ) const { return Degree ( mDeg - r.valueDegrees() ); }
-		Degree& operator -= ( const Degree& d ) { mDeg -= d.mDeg; return *this; }
-		Degree& operator -= ( const Radian& r ) { mDeg -= r.valueDegrees(); return *this; }
-		Degree operator * ( Real f ) const { return Degree ( mDeg * f ); }
-        Degree operator * ( const Degree& f ) const { return Degree ( mDeg * f.mDeg ); }
-		Degree& operator *= ( Real f ) { mDeg *= f; return *this; }
-		Degree operator / ( Real f ) const { return Degree ( mDeg / f ); }
-		Degree& operator /= ( Real f ) { mDeg /= f; return *this; }
-
-		bool operator <  ( const Degree& d ) const { return mDeg <  d.mDeg; }
-		bool operator <= ( const Degree& d ) const { return mDeg <= d.mDeg; }
-		bool operator == ( const Degree& d ) const { return mDeg == d.mDeg; }
-		bool operator != ( const Degree& d ) const { return mDeg != d.mDeg; }
-		bool operator >= ( const Degree& d ) const { return mDeg >= d.mDeg; }
-		bool operator >  ( const Degree& d ) const { return mDeg >  d.mDeg; }
-
-		inline CM_EXPORT friend std::ostream& operator <<
-			( std::ostream& o, const Degree& v )
-		{
-			o << "Degree(" << v.valueDegrees() << ")";
-			return o;
-		}
-	};
-
-    /** Wrapper class which identifies a value as the currently default angle 
-        type, as defined by Math::setAngleUnit.
-    @remarks
-        Angle values will be automatically converted between radians and degrees,
-        as appropriate.
-    */
-	class Angle
-	{
-		Real mAngle;
-	public:
-		explicit Angle ( Real angle ) : mAngle(angle) {}
-		operator Radian() const;
-		operator Degree() const;
-	};
-
-	// these functions could not be defined within the class definition of class
-	// Radian because they required class Degree to be defined
-	inline Radian::Radian ( const Degree& d ) : mRad(d.valueRadians()) {
-	}
-	inline Radian& Radian::operator = ( const Degree& d ) {
-		mRad = d.valueRadians(); return *this;
-	}
-	inline Radian Radian::operator + ( const Degree& d ) const {
-		return Radian ( mRad + d.valueRadians() );
-	}
-	inline Radian& Radian::operator += ( const Degree& d ) {
-		mRad += d.valueRadians();
-		return *this;
-	}
-	inline Radian Radian::operator - ( const Degree& d ) const {
-		return Radian ( mRad - d.valueRadians() );
-	}
-	inline Radian& Radian::operator -= ( const Degree& d ) {
-		mRad -= d.valueRadians();
-		return *this;
-	}
-
-    /** Class to provide access to common mathematical functions.
-        @remarks
-            Most of the maths functions are aliased versions of the C runtime
-            library functions. They are aliased here to provide future
-            optimisation opportunities, either from faster RTLs or custom
-            math approximations.
-        @note
-            <br>This is based on MgcMath.h from
-            <a href="http://www.geometrictools.com/">Wild Magic</a>.
-    */
-    class CM_EXPORT Math 
-    {
-   public:
-       /** The angular units used by the API. This functionality is now deprecated in favor
-	       of discreet angular unit types ( see Degree and Radian above ). The only place
-		   this functionality is actually still used is when parsing files. Search for
-		   usage of the Angle class for those instances
-       */
-       enum AngleUnit
-       {
-           AU_DEGREE,
-           AU_RADIAN
-       };
-
-    protected:
-       // angle units used by the api
-       static AngleUnit msAngleUnit;
-
-        /// Size of the trig tables as determined by constructor.
-        static int mTrigTableSize;
-
-        /// Radian -> index factor value ( mTrigTableSize / 2 * PI )
-        static Real mTrigTableFactor;
-        static Real* mSinTable;
-        static Real* mTanTable;
-
-        /** Private function to build trig tables.
-        */
-        void buildTrigTables();
-
-		static Real SinTable (Real fValue);
-		static Real TanTable (Real fValue);
-    public:
-        /** Default constructor.
-            @param
-                trigTableSize Optional parameter to set the size of the
-                tables used to implement Sin, Cos, Tan
-        */
-        Math(unsigned int trigTableSize = 4096);
-
-        /** Default destructor.
-        */
-        ~Math();
-
-		static inline int IAbs (int iValue) { return ( iValue >= 0 ? iValue : -iValue ); }
-		static inline int ICeil (float fValue) { return int(ceil(fValue)); }
-		static inline int IFloor (float fValue) { return int(floor(fValue)); }
-        static int ISign (int iValue);
-
-		static inline Real Abs (Real fValue) { return Real(fabs(fValue)); }
-		static inline Degree Abs (const Degree& dValue) { return Degree(fabs(dValue.valueDegrees())); }
-		static inline Radian Abs (const Radian& rValue) { return Radian(fabs(rValue.valueRadians())); }
-		static Radian ACos (Real fValue);
-		static Radian ASin (Real fValue);
-		static inline Radian ATan (Real fValue) { return Radian(atan(fValue)); }
-		static inline Radian ATan2 (Real fY, Real fX) { return Radian(atan2(fY,fX)); }
-		static inline Real Ceil (Real fValue) { return Real(ceil(fValue)); }
-		static inline bool isNaN(Real f)
-		{
-			// std::isnan() is C99, not supported by all compilers
-			// However NaN always fails this next test, no other number does.
-			return f != f;
-		}
-
-        /** Cosine function.
-            @param
-                fValue Angle in radians
-            @param
-                useTables If true, uses lookup tables rather than
-                calculation - faster but less accurate.
-        */
-        static inline Real Cos (const Radian& fValue, bool useTables = false) {
-			return (!useTables) ? Real(cos(fValue.valueRadians())) : SinTable(fValue.valueRadians() + HALF_PI);
-		}
-        /** Cosine function.
-            @param
-                fValue Angle in radians
-            @param
-                useTables If true, uses lookup tables rather than
-                calculation - faster but less accurate.
-        */
-        static inline Real Cos (Real fValue, bool useTables = false) {
-			return (!useTables) ? Real(cos(fValue)) : SinTable(fValue + HALF_PI);
-		}
-
-		static inline Real Exp (Real fValue) { return Real(exp(fValue)); }
-
-		static inline Real Floor (Real fValue) { return Real(floor(fValue)); }
-
-		static inline Real Log (Real fValue) { return Real(log(fValue)); }
-
-		/// Stored value of log(2) for frequent use
-		static const Real LOG2;
-
-		static inline Real Log2 (Real fValue) { return Real(log(fValue)/LOG2); }
-
-		static inline Real LogN (Real base, Real fValue) { return Real(log(fValue)/log(base)); }
-
-		static inline Real Pow (Real fBase, Real fExponent) { return Real(pow(fBase,fExponent)); }
-
-        static Real Sign (Real fValue);
-		static inline Radian Sign ( const Radian& rValue )
-		{
-			return Radian(Sign(rValue.valueRadians()));
-		}
-		static inline Degree Sign ( const Degree& dValue )
-		{
-			return Degree(Sign(dValue.valueDegrees()));
-		}
-
-        /** Sine function.
-            @param
-                fValue Angle in radians
-            @param
-                useTables If true, uses lookup tables rather than
-                calculation - faster but less accurate.
-        */
-        static inline Real Sin (const Radian& fValue, bool useTables = false) {
-			return (!useTables) ? Real(sin(fValue.valueRadians())) : SinTable(fValue.valueRadians());
-		}
-        /** Sine function.
-            @param
-                fValue Angle in radians
-            @param
-                useTables If true, uses lookup tables rather than
-                calculation - faster but less accurate.
-        */
-        static inline Real Sin (Real fValue, bool useTables = false) {
-			return (!useTables) ? Real(sin(fValue)) : SinTable(fValue);
-		}
-
-		static inline Real Sqr (Real fValue) { return fValue*fValue; }
-
-		static inline Real Sqrt (Real fValue) { return Real(sqrt(fValue)); }
-
-        static inline Radian Sqrt (const Radian& fValue) { return Radian(sqrt(fValue.valueRadians())); }
-
-        static inline Degree Sqrt (const Degree& fValue) { return Degree(sqrt(fValue.valueDegrees())); }
-
-        /** Inverse square root i.e. 1 / Sqrt(x), good for vector
-            normalisation.
-        */
-		static Real InvSqrt(Real fValue);
-
-        static Real UnitRandom ();  // in [0,1]
-
-        static Real RangeRandom (Real fLow, Real fHigh);  // in [fLow,fHigh]
-
-        static Real SymmetricRandom ();  // in [-1,1]
-
-        /** Tangent function.
-            @param
-                fValue Angle in radians
-            @param
-                useTables If true, uses lookup tables rather than
-                calculation - faster but less accurate.
-        */
-		static inline Real Tan (const Radian& fValue, bool useTables = false) {
-			return (!useTables) ? Real(tan(fValue.valueRadians())) : TanTable(fValue.valueRadians());
-		}
-        /** Tangent function.
-            @param
-                fValue Angle in radians
-            @param
-                useTables If true, uses lookup tables rather than
-                calculation - faster but less accurate.
-        */
-		static inline Real Tan (Real fValue, bool useTables = false) {
-			return (!useTables) ? Real(tan(fValue)) : TanTable(fValue);
-		}
-
-		static inline Real DegreesToRadians(Real degrees) { return degrees * fDeg2Rad; }
-        static inline Real RadiansToDegrees(Real radians) { return radians * fRad2Deg; }
-
-       /** These functions used to set the assumed angle units (radians or degrees) 
-            expected when using the Angle type.
-       @par
-            You can set this directly after creating a new Root, and also before/after resource creation,
-            depending on whether you want the change to affect resource files.
-       */
-       static void setAngleUnit(AngleUnit unit);
-       /** Get the unit being used for angles. */
-       static AngleUnit getAngleUnit(void);
-
-       /** Convert from the current AngleUnit to radians. */
-       static Real AngleUnitsToRadians(Real units);
-       /** Convert from radians to the current AngleUnit . */
-       static Real RadiansToAngleUnits(Real radians);
-       /** Convert from the current AngleUnit to degrees. */
-       static Real AngleUnitsToDegrees(Real units);
-       /** Convert from degrees to the current AngleUnit. */
-       static Real DegreesToAngleUnits(Real degrees);
-
-       /** Checks whether a given point is inside a triangle, in a
-            2-dimensional (Cartesian) space.
-            @remarks
-                The vertices of the triangle must be given in either
-                trigonometrical (anticlockwise) or inverse trigonometrical
-                (clockwise) order.
-            @param
-                p The point.
-            @param
-                a The triangle's first vertex.
-            @param
-                b The triangle's second vertex.
-            @param
-                c The triangle's third vertex.
-            @returns
-                If the point resides in the triangle, <b>true</b> is
-                returned.
-            @par
-                If the point is outside the triangle, <b>false</b> is
-                returned.
-        */
-        static bool pointInTri2D(const Vector2& p, const Vector2& a, 
-			const Vector2& b, const Vector2& c);
-
-       /** Checks whether a given 3D point is inside a triangle.
-       @remarks
-            The vertices of the triangle must be given in either
-            trigonometrical (anticlockwise) or inverse trigonometrical
-            (clockwise) order, and the point must be guaranteed to be in the
-			same plane as the triangle
-        @param
-            p The point.
-        @param
-            a The triangle's first vertex.
-        @param
-            b The triangle's second vertex.
-        @param
-            c The triangle's third vertex.
-		@param 
-			normal The triangle plane's normal (passed in rather than calculated
-				on demand since the caller may already have it)
-        @returns
-            If the point resides in the triangle, <b>true</b> is
-            returned.
-        @par
-            If the point is outside the triangle, <b>false</b> is
-            returned.
-        */
-        static bool pointInTri3D(const Vector3& p, const Vector3& a, 
-			const Vector3& b, const Vector3& c, const Vector3& normal);
-        /** Ray / plane intersection, returns boolean result and distance. */
-        static std::pair<bool, Real> intersects(const Ray& ray, const Plane& plane);
-
-        /** Ray / sphere intersection, returns boolean result and distance. */
-        static std::pair<bool, Real> intersects(const Ray& ray, const Sphere& sphere, 
-            bool discardInside = true);
-        
-        /** Ray / box intersection, returns boolean result and distance. */
-        static std::pair<bool, Real> intersects(const Ray& ray, const AxisAlignedBox& box);
-
-        /** Ray / box intersection, returns boolean result and two intersection distance.
-        @param
-            ray The ray.
-        @param
-            box The box.
-        @param
-            d1 A real pointer to retrieve the near intersection distance
-                from the ray origin, maybe <b>null</b> which means don't care
-                about the near intersection distance.
-        @param
-            d2 A real pointer to retrieve the far intersection distance
-                from the ray origin, maybe <b>null</b> which means don't care
-                about the far intersection distance.
-        @returns
-            If the ray is intersects the box, <b>true</b> is returned, and
-            the near intersection distance is return by <i>d1</i>, the
-            far intersection distance is return by <i>d2</i>. Guarantee
-            <b>0</b> <= <i>d1</i> <= <i>d2</i>.
-        @par
-            If the ray isn't intersects the box, <b>false</b> is returned, and
-            <i>d1</i> and <i>d2</i> is unmodified.
-        */
-        static bool intersects(const Ray& ray, const AxisAlignedBox& box,
-            Real* d1, Real* d2);
-
-        /** Ray / triangle intersection, returns boolean result and distance.
-        @param
-            ray The ray.
-        @param
-            a The triangle's first vertex.
-        @param
-            b The triangle's second vertex.
-        @param
-            c The triangle's third vertex.
-		@param 
-			normal The triangle plane's normal (passed in rather than calculated
-				on demand since the caller may already have it), doesn't need
-                normalised since we don't care.
-        @param
-            positiveSide Intersect with "positive side" of the triangle
-        @param
-            negativeSide Intersect with "negative side" of the triangle
-        @returns
-            If the ray is intersects the triangle, a pair of <b>true</b> and the
-            distance between intersection point and ray origin returned.
-        @par
-            If the ray isn't intersects the triangle, a pair of <b>false</b> and
-            <b>0</b> returned.
-        */
-        static std::pair<bool, Real> intersects(const Ray& ray, const Vector3& a,
-            const Vector3& b, const Vector3& c, const Vector3& normal,
-            bool positiveSide = true, bool negativeSide = true);
-
-        /** Ray / triangle intersection, returns boolean result and distance.
-        @param
-            ray The ray.
-        @param
-            a The triangle's first vertex.
-        @param
-            b The triangle's second vertex.
-        @param
-            c The triangle's third vertex.
-        @param
-            positiveSide Intersect with "positive side" of the triangle
-        @param
-            negativeSide Intersect with "negative side" of the triangle
-        @returns
-            If the ray is intersects the triangle, a pair of <b>true</b> and the
-            distance between intersection point and ray origin returned.
-        @par
-            If the ray isn't intersects the triangle, a pair of <b>false</b> and
-            <b>0</b> returned.
-        */
-        static std::pair<bool, Real> intersects(const Ray& ray, const Vector3& a,
-            const Vector3& b, const Vector3& c,
-            bool positiveSide = true, bool negativeSide = true);
-
-        /** Sphere / box intersection test. */
-        static bool intersects(const Sphere& sphere, const AxisAlignedBox& box);
-
-        /** Plane / box intersection test. */
-        static bool intersects(const Plane& plane, const AxisAlignedBox& box);
-
-        /** Ray / convex plane list intersection test. 
-        @param ray The ray to test with
-        @param plaeList List of planes which form a convex volume
-        @param normalIsOutside Does the normal point outside the volume
-        */
-        static std::pair<bool, Real> intersects(
-            const Ray& ray, const vector<Plane>::type& planeList, 
-            bool normalIsOutside);
-        /** Ray / convex plane list intersection test. 
-        @param ray The ray to test with
-        @param plaeList List of planes which form a convex volume
-        @param normalIsOutside Does the normal point outside the volume
-        */
-        static std::pair<bool, Real> intersects(
-            const Ray& ray, const list<Plane>::type& planeList, 
-            bool normalIsOutside);
-
-        /** Sphere / plane intersection test. 
-        @remarks NB just do a plane.getDistance(sphere.getCenter()) for more detail!
-        */
-        static bool intersects(const Sphere& sphere, const Plane& plane);
-
-        /** Compare 2 reals, using tolerance for inaccuracies.
-        */
-        static bool RealEqual(Real a, Real b,
-            Real tolerance = std::numeric_limits<Real>::epsilon());
-
-        /** Calculates the tangent space vector for a given set of positions / texture coords. */
-        static Vector3 calculateTangentSpaceVector(
-            const Vector3& position1, const Vector3& position2, const Vector3& position3,
-            Real u1, Real v1, Real u2, Real v2, Real u3, Real v3);
-
-        /** Build a reflection matrix for the passed in plane. */
-        static Matrix4 buildReflectionMatrix(const Plane& p);
-        /** Calculate a face normal, including the w component which is the offset from the origin. */
-        static Vector4 calculateFaceNormal(const Vector3& v1, const Vector3& v2, const Vector3& v3);
-        /** Calculate a face normal, no w-information. */
-        static Vector3 calculateBasicFaceNormal(const Vector3& v1, const Vector3& v2, const Vector3& v3);
-        /** Calculate a face normal without normalize, including the w component which is the offset from the origin. */
-        static Vector4 calculateFaceNormalWithoutNormalize(const Vector3& v1, const Vector3& v2, const Vector3& v3);
-        /** Calculate a face normal without normalize, no w-information. */
-        static Vector3 calculateBasicFaceNormalWithoutNormalize(const Vector3& v1, const Vector3& v2, const Vector3& v3);
-
-		/** Generates a value based on the Gaussian (normal) distribution function
-			with the given offset and scale parameters.
-		*/
-		static Real gaussianDistribution(Real x, Real offset = 0.0f, Real scale = 1.0f);
-
-		/** Clamp a value within an inclusive range. */
-		template <typename T>
-		static T Clamp(T val, T minval, T maxval)
-		{
-			assert (minval < maxval && "Invalid clamp range");
-			return std::max(std::min(val, maxval), minval);
-		}
-
-		static Matrix4 makeViewMatrix(const Vector3& position, const Quaternion& orientation, 
-			const Matrix4* reflectMatrix = 0);
-
-		/** Get a bounding radius value from a bounding box. */
-		static Real boundingRadiusFromAABB(const AxisAlignedBox& aabb);
-
-
-
-        static const Real POS_INFINITY;
-        static const Real NEG_INFINITY;
-        static const Real PI;
-        static const Real TWO_PI;
-        static const Real HALF_PI;
-		static const Real fDeg2Rad;
-		static const Real fRad2Deg;
-
-    };
-
-	// these functions must be defined down here, because they rely on the
-	// angle unit conversion functions in class Math:
-
-	inline Real Radian::valueDegrees() const
-	{
-		return Math::RadiansToDegrees ( mRad );
-	}
-
-	inline Real Radian::valueAngleUnits() const
-	{
-		return Math::RadiansToAngleUnits ( mRad );
-	}
-
-	inline Real Degree::valueRadians() const
-	{
-		return Math::DegreesToRadians ( mDeg );
-	}
-
-	inline Real Degree::valueAngleUnits() const
-	{
-		return Math::DegreesToAngleUnits ( mDeg );
-	}
-
-	inline Angle::operator Radian() const
-	{
-		return Radian(Math::AngleUnitsToRadians(mAngle));
-	}
-
-	inline Angle::operator Degree() const
-	{
-		return Degree(Math::AngleUnitsToDegrees(mAngle));
-	}
-
-	inline Radian operator * ( Real a, const Radian& b )
-	{
-		return Radian ( a * b.valueRadians() );
-	}
-
-	inline Radian operator / ( Real a, const Radian& b )
-	{
-		return Radian ( a / b.valueRadians() );
-	}
-
-	inline Degree operator * ( Real a, const Degree& b )
-	{
-		return Degree ( a * b.valueDegrees() );
-	}
-
-	inline Degree operator / ( Real a, const Degree& b )
-	{
-		return Degree ( a / b.valueDegrees() );
-	}
-	/** @} */
-	/** @} */
-
-}
-#endif

+ 0 - 1510
CamelotRenderer/OgreMatrix3.cpp

@@ -1,1510 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#include "OgreMatrix3.h"
-
-#include "OgreMath.h"
-
-// Adapted from Matrix math by Wild Magic http://www.geometrictools.com/
-
-namespace CamelotEngine
-{
-    const Real Matrix3::EPSILON = 1e-06f;
-    const Matrix3 Matrix3::ZERO(0,0,0,0,0,0,0,0,0);
-    const Matrix3 Matrix3::IDENTITY(1,0,0,0,1,0,0,0,1);
-    const Real Matrix3::ms_fSvdEpsilon = 1e-04f;
-    const unsigned int Matrix3::ms_iSvdMaxIterations = 32;
-
-    //-----------------------------------------------------------------------
-    Vector3 Matrix3::GetColumn (size_t iCol) const
-    {
-        assert( 0 <= iCol && iCol < 3 );
-        return Vector3(m[0][iCol],m[1][iCol],
-            m[2][iCol]);
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::SetColumn(size_t iCol, const Vector3& vec)
-    {
-        assert( 0 <= iCol && iCol < 3 );
-        m[0][iCol] = vec.x;
-        m[1][iCol] = vec.y;
-        m[2][iCol] = vec.z;
-
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::FromAxes(const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis)
-    {
-        SetColumn(0,xAxis);
-        SetColumn(1,yAxis);
-        SetColumn(2,zAxis);
-
-    }
-
-    //-----------------------------------------------------------------------
-    bool Matrix3::operator== (const Matrix3& rkMatrix) const
-    {
-        for (size_t iRow = 0; iRow < 3; iRow++)
-        {
-            for (size_t iCol = 0; iCol < 3; iCol++)
-            {
-                if ( m[iRow][iCol] != rkMatrix.m[iRow][iCol] )
-                    return false;
-            }
-        }
-
-        return true;
-    }
-    //-----------------------------------------------------------------------
-    Matrix3 Matrix3::operator+ (const Matrix3& rkMatrix) const
-    {
-        Matrix3 kSum;
-        for (size_t iRow = 0; iRow < 3; iRow++)
-        {
-            for (size_t iCol = 0; iCol < 3; iCol++)
-            {
-                kSum.m[iRow][iCol] = m[iRow][iCol] +
-                    rkMatrix.m[iRow][iCol];
-            }
-        }
-        return kSum;
-    }
-    //-----------------------------------------------------------------------
-    Matrix3 Matrix3::operator- (const Matrix3& rkMatrix) const
-    {
-        Matrix3 kDiff;
-        for (size_t iRow = 0; iRow < 3; iRow++)
-        {
-            for (size_t iCol = 0; iCol < 3; iCol++)
-            {
-                kDiff.m[iRow][iCol] = m[iRow][iCol] -
-                    rkMatrix.m[iRow][iCol];
-            }
-        }
-        return kDiff;
-    }
-    //-----------------------------------------------------------------------
-    Matrix3 Matrix3::operator* (const Matrix3& rkMatrix) const
-    {
-        Matrix3 kProd;
-        for (size_t iRow = 0; iRow < 3; iRow++)
-        {
-            for (size_t iCol = 0; iCol < 3; iCol++)
-            {
-                kProd.m[iRow][iCol] =
-                    m[iRow][0]*rkMatrix.m[0][iCol] +
-                    m[iRow][1]*rkMatrix.m[1][iCol] +
-                    m[iRow][2]*rkMatrix.m[2][iCol];
-            }
-        }
-        return kProd;
-    }
-    //-----------------------------------------------------------------------
-    Vector3 Matrix3::operator* (const Vector3& rkPoint) const
-    {
-        Vector3 kProd;
-        for (size_t iRow = 0; iRow < 3; iRow++)
-        {
-            kProd[iRow] =
-                m[iRow][0]*rkPoint[0] +
-                m[iRow][1]*rkPoint[1] +
-                m[iRow][2]*rkPoint[2];
-        }
-        return kProd;
-    }
-    //-----------------------------------------------------------------------
-    Vector3 operator* (const Vector3& rkPoint, const Matrix3& rkMatrix)
-    {
-        Vector3 kProd;
-        for (size_t iRow = 0; iRow < 3; iRow++)
-        {
-            kProd[iRow] =
-                rkPoint[0]*rkMatrix.m[0][iRow] +
-                rkPoint[1]*rkMatrix.m[1][iRow] +
-                rkPoint[2]*rkMatrix.m[2][iRow];
-        }
-        return kProd;
-    }
-    //-----------------------------------------------------------------------
-    Matrix3 Matrix3::operator- () const
-    {
-        Matrix3 kNeg;
-        for (size_t iRow = 0; iRow < 3; iRow++)
-        {
-            for (size_t iCol = 0; iCol < 3; iCol++)
-                kNeg[iRow][iCol] = -m[iRow][iCol];
-        }
-        return kNeg;
-    }
-    //-----------------------------------------------------------------------
-    Matrix3 Matrix3::operator* (Real fScalar) const
-    {
-        Matrix3 kProd;
-        for (size_t iRow = 0; iRow < 3; iRow++)
-        {
-            for (size_t iCol = 0; iCol < 3; iCol++)
-                kProd[iRow][iCol] = fScalar*m[iRow][iCol];
-        }
-        return kProd;
-    }
-    //-----------------------------------------------------------------------
-    Matrix3 operator* (Real fScalar, const Matrix3& rkMatrix)
-    {
-        Matrix3 kProd;
-        for (size_t iRow = 0; iRow < 3; iRow++)
-        {
-            for (size_t iCol = 0; iCol < 3; iCol++)
-                kProd[iRow][iCol] = fScalar*rkMatrix.m[iRow][iCol];
-        }
-        return kProd;
-    }
-    //-----------------------------------------------------------------------
-    Matrix3 Matrix3::Transpose () const
-    {
-        Matrix3 kTranspose;
-        for (size_t iRow = 0; iRow < 3; iRow++)
-        {
-            for (size_t iCol = 0; iCol < 3; iCol++)
-                kTranspose[iRow][iCol] = m[iCol][iRow];
-        }
-        return kTranspose;
-    }
-    //-----------------------------------------------------------------------
-    bool Matrix3::Inverse (Matrix3& rkInverse, Real fTolerance) const
-    {
-        // Invert a 3x3 using cofactors.  This is about 8 times faster than
-        // the Numerical Recipes code which uses Gaussian elimination.
-
-        rkInverse[0][0] = m[1][1]*m[2][2] -
-            m[1][2]*m[2][1];
-        rkInverse[0][1] = m[0][2]*m[2][1] -
-            m[0][1]*m[2][2];
-        rkInverse[0][2] = m[0][1]*m[1][2] -
-            m[0][2]*m[1][1];
-        rkInverse[1][0] = m[1][2]*m[2][0] -
-            m[1][0]*m[2][2];
-        rkInverse[1][1] = m[0][0]*m[2][2] -
-            m[0][2]*m[2][0];
-        rkInverse[1][2] = m[0][2]*m[1][0] -
-            m[0][0]*m[1][2];
-        rkInverse[2][0] = m[1][0]*m[2][1] -
-            m[1][1]*m[2][0];
-        rkInverse[2][1] = m[0][1]*m[2][0] -
-            m[0][0]*m[2][1];
-        rkInverse[2][2] = m[0][0]*m[1][1] -
-            m[0][1]*m[1][0];
-
-        Real fDet =
-            m[0][0]*rkInverse[0][0] +
-            m[0][1]*rkInverse[1][0]+
-            m[0][2]*rkInverse[2][0];
-
-        if ( Math::Abs(fDet) <= fTolerance )
-            return false;
-
-        Real fInvDet = 1.0f/fDet;
-        for (size_t iRow = 0; iRow < 3; iRow++)
-        {
-            for (size_t iCol = 0; iCol < 3; iCol++)
-                rkInverse[iRow][iCol] *= fInvDet;
-        }
-
-        return true;
-    }
-    //-----------------------------------------------------------------------
-    Matrix3 Matrix3::Inverse (Real fTolerance) const
-    {
-        Matrix3 kInverse = Matrix3::ZERO;
-        Inverse(kInverse,fTolerance);
-        return kInverse;
-    }
-    //-----------------------------------------------------------------------
-    Real Matrix3::Determinant () const
-    {
-        Real fCofactor00 = m[1][1]*m[2][2] -
-            m[1][2]*m[2][1];
-        Real fCofactor10 = m[1][2]*m[2][0] -
-            m[1][0]*m[2][2];
-        Real fCofactor20 = m[1][0]*m[2][1] -
-            m[1][1]*m[2][0];
-
-        Real fDet =
-            m[0][0]*fCofactor00 +
-            m[0][1]*fCofactor10 +
-            m[0][2]*fCofactor20;
-
-        return fDet;
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::Bidiagonalize (Matrix3& kA, Matrix3& kL,
-        Matrix3& kR)
-    {
-        Real afV[3], afW[3];
-        Real fLength, fSign, fT1, fInvT1, fT2;
-        bool bIdentity;
-
-        // map first column to (*,0,0)
-        fLength = Math::Sqrt(kA[0][0]*kA[0][0] + kA[1][0]*kA[1][0] +
-            kA[2][0]*kA[2][0]);
-        if ( fLength > 0.0 )
-        {
-            fSign = (kA[0][0] > 0.0f ? 1.0f : -1.0f);
-            fT1 = kA[0][0] + fSign*fLength;
-            fInvT1 = 1.0f/fT1;
-            afV[1] = kA[1][0]*fInvT1;
-            afV[2] = kA[2][0]*fInvT1;
-
-            fT2 = -2.0f/(1.0f+afV[1]*afV[1]+afV[2]*afV[2]);
-            afW[0] = fT2*(kA[0][0]+kA[1][0]*afV[1]+kA[2][0]*afV[2]);
-            afW[1] = fT2*(kA[0][1]+kA[1][1]*afV[1]+kA[2][1]*afV[2]);
-            afW[2] = fT2*(kA[0][2]+kA[1][2]*afV[1]+kA[2][2]*afV[2]);
-            kA[0][0] += afW[0];
-            kA[0][1] += afW[1];
-            kA[0][2] += afW[2];
-            kA[1][1] += afV[1]*afW[1];
-            kA[1][2] += afV[1]*afW[2];
-            kA[2][1] += afV[2]*afW[1];
-            kA[2][2] += afV[2]*afW[2];
-
-            kL[0][0] = 1.0f+fT2;
-            kL[0][1] = kL[1][0] = fT2*afV[1];
-            kL[0][2] = kL[2][0] = fT2*afV[2];
-            kL[1][1] = 1.0f+fT2*afV[1]*afV[1];
-            kL[1][2] = kL[2][1] = fT2*afV[1]*afV[2];
-            kL[2][2] = 1.0f+fT2*afV[2]*afV[2];
-            bIdentity = false;
-        }
-        else
-        {
-            kL = Matrix3::IDENTITY;
-            bIdentity = true;
-        }
-
-        // map first row to (*,*,0)
-        fLength = Math::Sqrt(kA[0][1]*kA[0][1]+kA[0][2]*kA[0][2]);
-        if ( fLength > 0.0 )
-        {
-            fSign = (kA[0][1] > 0.0f ? 1.0f : -1.0f);
-            fT1 = kA[0][1] + fSign*fLength;
-            afV[2] = kA[0][2]/fT1;
-
-            fT2 = -2.0f/(1.0f+afV[2]*afV[2]);
-            afW[0] = fT2*(kA[0][1]+kA[0][2]*afV[2]);
-            afW[1] = fT2*(kA[1][1]+kA[1][2]*afV[2]);
-            afW[2] = fT2*(kA[2][1]+kA[2][2]*afV[2]);
-            kA[0][1] += afW[0];
-            kA[1][1] += afW[1];
-            kA[1][2] += afW[1]*afV[2];
-            kA[2][1] += afW[2];
-            kA[2][2] += afW[2]*afV[2];
-
-            kR[0][0] = 1.0;
-            kR[0][1] = kR[1][0] = 0.0;
-            kR[0][2] = kR[2][0] = 0.0;
-            kR[1][1] = 1.0f+fT2;
-            kR[1][2] = kR[2][1] = fT2*afV[2];
-            kR[2][2] = 1.0f+fT2*afV[2]*afV[2];
-        }
-        else
-        {
-            kR = Matrix3::IDENTITY;
-        }
-
-        // map second column to (*,*,0)
-        fLength = Math::Sqrt(kA[1][1]*kA[1][1]+kA[2][1]*kA[2][1]);
-        if ( fLength > 0.0 )
-        {
-            fSign = (kA[1][1] > 0.0f ? 1.0f : -1.0f);
-            fT1 = kA[1][1] + fSign*fLength;
-            afV[2] = kA[2][1]/fT1;
-
-            fT2 = -2.0f/(1.0f+afV[2]*afV[2]);
-            afW[1] = fT2*(kA[1][1]+kA[2][1]*afV[2]);
-            afW[2] = fT2*(kA[1][2]+kA[2][2]*afV[2]);
-            kA[1][1] += afW[1];
-            kA[1][2] += afW[2];
-            kA[2][2] += afV[2]*afW[2];
-
-            Real fA = 1.0f+fT2;
-            Real fB = fT2*afV[2];
-            Real fC = 1.0f+fB*afV[2];
-
-            if ( bIdentity )
-            {
-                kL[0][0] = 1.0;
-                kL[0][1] = kL[1][0] = 0.0;
-                kL[0][2] = kL[2][0] = 0.0;
-                kL[1][1] = fA;
-                kL[1][2] = kL[2][1] = fB;
-                kL[2][2] = fC;
-            }
-            else
-            {
-                for (int iRow = 0; iRow < 3; iRow++)
-                {
-                    Real fTmp0 = kL[iRow][1];
-                    Real fTmp1 = kL[iRow][2];
-                    kL[iRow][1] = fA*fTmp0+fB*fTmp1;
-                    kL[iRow][2] = fB*fTmp0+fC*fTmp1;
-                }
-            }
-        }
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::GolubKahanStep (Matrix3& kA, Matrix3& kL,
-        Matrix3& kR)
-    {
-        Real fT11 = kA[0][1]*kA[0][1]+kA[1][1]*kA[1][1];
-        Real fT22 = kA[1][2]*kA[1][2]+kA[2][2]*kA[2][2];
-        Real fT12 = kA[1][1]*kA[1][2];
-        Real fTrace = fT11+fT22;
-        Real fDiff = fT11-fT22;
-        Real fDiscr = Math::Sqrt(fDiff*fDiff+4.0f*fT12*fT12);
-        Real fRoot1 = 0.5f*(fTrace+fDiscr);
-        Real fRoot2 = 0.5f*(fTrace-fDiscr);
-
-        // adjust right
-        Real fY = kA[0][0] - (Math::Abs(fRoot1-fT22) <=
-            Math::Abs(fRoot2-fT22) ? fRoot1 : fRoot2);
-        Real fZ = kA[0][1];
-		Real fInvLength = Math::InvSqrt(fY*fY+fZ*fZ);
-        Real fSin = fZ*fInvLength;
-        Real fCos = -fY*fInvLength;
-
-        Real fTmp0 = kA[0][0];
-        Real fTmp1 = kA[0][1];
-        kA[0][0] = fCos*fTmp0-fSin*fTmp1;
-        kA[0][1] = fSin*fTmp0+fCos*fTmp1;
-        kA[1][0] = -fSin*kA[1][1];
-        kA[1][1] *= fCos;
-
-        size_t iRow;
-        for (iRow = 0; iRow < 3; iRow++)
-        {
-            fTmp0 = kR[0][iRow];
-            fTmp1 = kR[1][iRow];
-            kR[0][iRow] = fCos*fTmp0-fSin*fTmp1;
-            kR[1][iRow] = fSin*fTmp0+fCos*fTmp1;
-        }
-
-        // adjust left
-        fY = kA[0][0];
-        fZ = kA[1][0];
-        fInvLength = Math::InvSqrt(fY*fY+fZ*fZ);
-        fSin = fZ*fInvLength;
-        fCos = -fY*fInvLength;
-
-        kA[0][0] = fCos*kA[0][0]-fSin*kA[1][0];
-        fTmp0 = kA[0][1];
-        fTmp1 = kA[1][1];
-        kA[0][1] = fCos*fTmp0-fSin*fTmp1;
-        kA[1][1] = fSin*fTmp0+fCos*fTmp1;
-        kA[0][2] = -fSin*kA[1][2];
-        kA[1][2] *= fCos;
-
-        size_t iCol;
-        for (iCol = 0; iCol < 3; iCol++)
-        {
-            fTmp0 = kL[iCol][0];
-            fTmp1 = kL[iCol][1];
-            kL[iCol][0] = fCos*fTmp0-fSin*fTmp1;
-            kL[iCol][1] = fSin*fTmp0+fCos*fTmp1;
-        }
-
-        // adjust right
-        fY = kA[0][1];
-        fZ = kA[0][2];
-        fInvLength = Math::InvSqrt(fY*fY+fZ*fZ);
-        fSin = fZ*fInvLength;
-        fCos = -fY*fInvLength;
-
-        kA[0][1] = fCos*kA[0][1]-fSin*kA[0][2];
-        fTmp0 = kA[1][1];
-        fTmp1 = kA[1][2];
-        kA[1][1] = fCos*fTmp0-fSin*fTmp1;
-        kA[1][2] = fSin*fTmp0+fCos*fTmp1;
-        kA[2][1] = -fSin*kA[2][2];
-        kA[2][2] *= fCos;
-
-        for (iRow = 0; iRow < 3; iRow++)
-        {
-            fTmp0 = kR[1][iRow];
-            fTmp1 = kR[2][iRow];
-            kR[1][iRow] = fCos*fTmp0-fSin*fTmp1;
-            kR[2][iRow] = fSin*fTmp0+fCos*fTmp1;
-        }
-
-        // adjust left
-        fY = kA[1][1];
-        fZ = kA[2][1];
-        fInvLength = Math::InvSqrt(fY*fY+fZ*fZ);
-        fSin = fZ*fInvLength;
-        fCos = -fY*fInvLength;
-
-        kA[1][1] = fCos*kA[1][1]-fSin*kA[2][1];
-        fTmp0 = kA[1][2];
-        fTmp1 = kA[2][2];
-        kA[1][2] = fCos*fTmp0-fSin*fTmp1;
-        kA[2][2] = fSin*fTmp0+fCos*fTmp1;
-
-        for (iCol = 0; iCol < 3; iCol++)
-        {
-            fTmp0 = kL[iCol][1];
-            fTmp1 = kL[iCol][2];
-            kL[iCol][1] = fCos*fTmp0-fSin*fTmp1;
-            kL[iCol][2] = fSin*fTmp0+fCos*fTmp1;
-        }
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::SingularValueDecomposition (Matrix3& kL, Vector3& kS,
-        Matrix3& kR) const
-    {
-        // temas: currently unused
-        //const int iMax = 16;
-		size_t iRow, iCol;
-
-        Matrix3 kA = *this;
-        Bidiagonalize(kA,kL,kR);
-
-        for (unsigned int i = 0; i < ms_iSvdMaxIterations; i++)
-        {
-            Real fTmp, fTmp0, fTmp1;
-            Real fSin0, fCos0, fTan0;
-            Real fSin1, fCos1, fTan1;
-
-            bool bTest1 = (Math::Abs(kA[0][1]) <=
-                ms_fSvdEpsilon*(Math::Abs(kA[0][0])+Math::Abs(kA[1][1])));
-            bool bTest2 = (Math::Abs(kA[1][2]) <=
-                ms_fSvdEpsilon*(Math::Abs(kA[1][1])+Math::Abs(kA[2][2])));
-            if ( bTest1 )
-            {
-                if ( bTest2 )
-                {
-                    kS[0] = kA[0][0];
-                    kS[1] = kA[1][1];
-                    kS[2] = kA[2][2];
-                    break;
-                }
-                else
-                {
-                    // 2x2 closed form factorization
-                    fTmp = (kA[1][1]*kA[1][1] - kA[2][2]*kA[2][2] +
-                        kA[1][2]*kA[1][2])/(kA[1][2]*kA[2][2]);
-                    fTan0 = 0.5f*(fTmp+Math::Sqrt(fTmp*fTmp + 4.0f));
-                    fCos0 = Math::InvSqrt(1.0f+fTan0*fTan0);
-                    fSin0 = fTan0*fCos0;
-
-                    for (iCol = 0; iCol < 3; iCol++)
-                    {
-                        fTmp0 = kL[iCol][1];
-                        fTmp1 = kL[iCol][2];
-                        kL[iCol][1] = fCos0*fTmp0-fSin0*fTmp1;
-                        kL[iCol][2] = fSin0*fTmp0+fCos0*fTmp1;
-                    }
-
-                    fTan1 = (kA[1][2]-kA[2][2]*fTan0)/kA[1][1];
-                    fCos1 = Math::InvSqrt(1.0f+fTan1*fTan1);
-                    fSin1 = -fTan1*fCos1;
-
-                    for (iRow = 0; iRow < 3; iRow++)
-                    {
-                        fTmp0 = kR[1][iRow];
-                        fTmp1 = kR[2][iRow];
-                        kR[1][iRow] = fCos1*fTmp0-fSin1*fTmp1;
-                        kR[2][iRow] = fSin1*fTmp0+fCos1*fTmp1;
-                    }
-
-                    kS[0] = kA[0][0];
-                    kS[1] = fCos0*fCos1*kA[1][1] -
-                        fSin1*(fCos0*kA[1][2]-fSin0*kA[2][2]);
-                    kS[2] = fSin0*fSin1*kA[1][1] +
-                        fCos1*(fSin0*kA[1][2]+fCos0*kA[2][2]);
-                    break;
-                }
-            }
-            else
-            {
-                if ( bTest2 )
-                {
-                    // 2x2 closed form factorization
-                    fTmp = (kA[0][0]*kA[0][0] + kA[1][1]*kA[1][1] -
-                        kA[0][1]*kA[0][1])/(kA[0][1]*kA[1][1]);
-                    fTan0 = 0.5f*(-fTmp+Math::Sqrt(fTmp*fTmp + 4.0f));
-                    fCos0 = Math::InvSqrt(1.0f+fTan0*fTan0);
-                    fSin0 = fTan0*fCos0;
-
-                    for (iCol = 0; iCol < 3; iCol++)
-                    {
-                        fTmp0 = kL[iCol][0];
-                        fTmp1 = kL[iCol][1];
-                        kL[iCol][0] = fCos0*fTmp0-fSin0*fTmp1;
-                        kL[iCol][1] = fSin0*fTmp0+fCos0*fTmp1;
-                    }
-
-                    fTan1 = (kA[0][1]-kA[1][1]*fTan0)/kA[0][0];
-                    fCos1 = Math::InvSqrt(1.0f+fTan1*fTan1);
-                    fSin1 = -fTan1*fCos1;
-
-                    for (iRow = 0; iRow < 3; iRow++)
-                    {
-                        fTmp0 = kR[0][iRow];
-                        fTmp1 = kR[1][iRow];
-                        kR[0][iRow] = fCos1*fTmp0-fSin1*fTmp1;
-                        kR[1][iRow] = fSin1*fTmp0+fCos1*fTmp1;
-                    }
-
-                    kS[0] = fCos0*fCos1*kA[0][0] -
-                        fSin1*(fCos0*kA[0][1]-fSin0*kA[1][1]);
-                    kS[1] = fSin0*fSin1*kA[0][0] +
-                        fCos1*(fSin0*kA[0][1]+fCos0*kA[1][1]);
-                    kS[2] = kA[2][2];
-                    break;
-                }
-                else
-                {
-                    GolubKahanStep(kA,kL,kR);
-                }
-            }
-        }
-
-        // positize diagonal
-        for (iRow = 0; iRow < 3; iRow++)
-        {
-            if ( kS[iRow] < 0.0 )
-            {
-                kS[iRow] = -kS[iRow];
-                for (iCol = 0; iCol < 3; iCol++)
-                    kR[iRow][iCol] = -kR[iRow][iCol];
-            }
-        }
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::SingularValueComposition (const Matrix3& kL,
-        const Vector3& kS, const Matrix3& kR)
-    {
-        size_t iRow, iCol;
-        Matrix3 kTmp;
-
-        // product S*R
-        for (iRow = 0; iRow < 3; iRow++)
-        {
-            for (iCol = 0; iCol < 3; iCol++)
-                kTmp[iRow][iCol] = kS[iRow]*kR[iRow][iCol];
-        }
-
-        // product L*S*R
-        for (iRow = 0; iRow < 3; iRow++)
-        {
-            for (iCol = 0; iCol < 3; iCol++)
-            {
-                m[iRow][iCol] = 0.0;
-                for (int iMid = 0; iMid < 3; iMid++)
-                    m[iRow][iCol] += kL[iRow][iMid]*kTmp[iMid][iCol];
-            }
-        }
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::Orthonormalize ()
-    {
-        // Algorithm uses Gram-Schmidt orthogonalization.  If 'this' matrix is
-        // M = [m0|m1|m2], then orthonormal output matrix is Q = [q0|q1|q2],
-        //
-        //   q0 = m0/|m0|
-        //   q1 = (m1-(q0*m1)q0)/|m1-(q0*m1)q0|
-        //   q2 = (m2-(q0*m2)q0-(q1*m2)q1)/|m2-(q0*m2)q0-(q1*m2)q1|
-        //
-        // where |V| indicates length of vector V and A*B indicates dot
-        // product of vectors A and B.
-
-        // compute q0
-        Real fInvLength = Math::InvSqrt(m[0][0]*m[0][0]
-            + m[1][0]*m[1][0] +
-            m[2][0]*m[2][0]);
-
-        m[0][0] *= fInvLength;
-        m[1][0] *= fInvLength;
-        m[2][0] *= fInvLength;
-
-        // compute q1
-        Real fDot0 =
-            m[0][0]*m[0][1] +
-            m[1][0]*m[1][1] +
-            m[2][0]*m[2][1];
-
-        m[0][1] -= fDot0*m[0][0];
-        m[1][1] -= fDot0*m[1][0];
-        m[2][1] -= fDot0*m[2][0];
-
-        fInvLength = Math::InvSqrt(m[0][1]*m[0][1] +
-            m[1][1]*m[1][1] +
-            m[2][1]*m[2][1]);
-
-        m[0][1] *= fInvLength;
-        m[1][1] *= fInvLength;
-        m[2][1] *= fInvLength;
-
-        // compute q2
-        Real fDot1 =
-            m[0][1]*m[0][2] +
-            m[1][1]*m[1][2] +
-            m[2][1]*m[2][2];
-
-        fDot0 =
-            m[0][0]*m[0][2] +
-            m[1][0]*m[1][2] +
-            m[2][0]*m[2][2];
-
-        m[0][2] -= fDot0*m[0][0] + fDot1*m[0][1];
-        m[1][2] -= fDot0*m[1][0] + fDot1*m[1][1];
-        m[2][2] -= fDot0*m[2][0] + fDot1*m[2][1];
-
-        fInvLength = Math::InvSqrt(m[0][2]*m[0][2] +
-            m[1][2]*m[1][2] +
-            m[2][2]*m[2][2]);
-
-        m[0][2] *= fInvLength;
-        m[1][2] *= fInvLength;
-        m[2][2] *= fInvLength;
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::QDUDecomposition (Matrix3& kQ,
-        Vector3& kD, Vector3& kU) const
-    {
-        // Factor M = QR = QDU where Q is orthogonal, D is diagonal,
-        // and U is upper triangular with ones on its diagonal.  Algorithm uses
-        // Gram-Schmidt orthogonalization (the QR algorithm).
-        //
-        // If M = [ m0 | m1 | m2 ] and Q = [ q0 | q1 | q2 ], then
-        //
-        //   q0 = m0/|m0|
-        //   q1 = (m1-(q0*m1)q0)/|m1-(q0*m1)q0|
-        //   q2 = (m2-(q0*m2)q0-(q1*m2)q1)/|m2-(q0*m2)q0-(q1*m2)q1|
-        //
-        // where |V| indicates length of vector V and A*B indicates dot
-        // product of vectors A and B.  The matrix R has entries
-        //
-        //   r00 = q0*m0  r01 = q0*m1  r02 = q0*m2
-        //   r10 = 0      r11 = q1*m1  r12 = q1*m2
-        //   r20 = 0      r21 = 0      r22 = q2*m2
-        //
-        // so D = diag(r00,r11,r22) and U has entries u01 = r01/r00,
-        // u02 = r02/r00, and u12 = r12/r11.
-
-        // Q = rotation
-        // D = scaling
-        // U = shear
-
-        // D stores the three diagonal entries r00, r11, r22
-        // U stores the entries U[0] = u01, U[1] = u02, U[2] = u12
-
-        // build orthogonal matrix Q
-        Real fInvLength = Math::InvSqrt(m[0][0]*m[0][0]
-            + m[1][0]*m[1][0] +
-            m[2][0]*m[2][0]);
-        kQ[0][0] = m[0][0]*fInvLength;
-        kQ[1][0] = m[1][0]*fInvLength;
-        kQ[2][0] = m[2][0]*fInvLength;
-
-        Real fDot = kQ[0][0]*m[0][1] + kQ[1][0]*m[1][1] +
-            kQ[2][0]*m[2][1];
-        kQ[0][1] = m[0][1]-fDot*kQ[0][0];
-        kQ[1][1] = m[1][1]-fDot*kQ[1][0];
-        kQ[2][1] = m[2][1]-fDot*kQ[2][0];
-        fInvLength = Math::InvSqrt(kQ[0][1]*kQ[0][1] + kQ[1][1]*kQ[1][1] +
-            kQ[2][1]*kQ[2][1]);
-        kQ[0][1] *= fInvLength;
-        kQ[1][1] *= fInvLength;
-        kQ[2][1] *= fInvLength;
-
-        fDot = kQ[0][0]*m[0][2] + kQ[1][0]*m[1][2] +
-            kQ[2][0]*m[2][2];
-        kQ[0][2] = m[0][2]-fDot*kQ[0][0];
-        kQ[1][2] = m[1][2]-fDot*kQ[1][0];
-        kQ[2][2] = m[2][2]-fDot*kQ[2][0];
-        fDot = kQ[0][1]*m[0][2] + kQ[1][1]*m[1][2] +
-            kQ[2][1]*m[2][2];
-        kQ[0][2] -= fDot*kQ[0][1];
-        kQ[1][2] -= fDot*kQ[1][1];
-        kQ[2][2] -= fDot*kQ[2][1];
-        fInvLength = Math::InvSqrt(kQ[0][2]*kQ[0][2] + kQ[1][2]*kQ[1][2] +
-            kQ[2][2]*kQ[2][2]);
-        kQ[0][2] *= fInvLength;
-        kQ[1][2] *= fInvLength;
-        kQ[2][2] *= fInvLength;
-
-        // guarantee that orthogonal matrix has determinant 1 (no reflections)
-        Real fDet = kQ[0][0]*kQ[1][1]*kQ[2][2] + kQ[0][1]*kQ[1][2]*kQ[2][0] +
-            kQ[0][2]*kQ[1][0]*kQ[2][1] - kQ[0][2]*kQ[1][1]*kQ[2][0] -
-            kQ[0][1]*kQ[1][0]*kQ[2][2] - kQ[0][0]*kQ[1][2]*kQ[2][1];
-
-        if ( fDet < 0.0 )
-        {
-            for (size_t iRow = 0; iRow < 3; iRow++)
-                for (size_t iCol = 0; iCol < 3; iCol++)
-                    kQ[iRow][iCol] = -kQ[iRow][iCol];
-        }
-
-        // build "right" matrix R
-        Matrix3 kR;
-        kR[0][0] = kQ[0][0]*m[0][0] + kQ[1][0]*m[1][0] +
-            kQ[2][0]*m[2][0];
-        kR[0][1] = kQ[0][0]*m[0][1] + kQ[1][0]*m[1][1] +
-            kQ[2][0]*m[2][1];
-        kR[1][1] = kQ[0][1]*m[0][1] + kQ[1][1]*m[1][1] +
-            kQ[2][1]*m[2][1];
-        kR[0][2] = kQ[0][0]*m[0][2] + kQ[1][0]*m[1][2] +
-            kQ[2][0]*m[2][2];
-        kR[1][2] = kQ[0][1]*m[0][2] + kQ[1][1]*m[1][2] +
-            kQ[2][1]*m[2][2];
-        kR[2][2] = kQ[0][2]*m[0][2] + kQ[1][2]*m[1][2] +
-            kQ[2][2]*m[2][2];
-
-        // the scaling component
-        kD[0] = kR[0][0];
-        kD[1] = kR[1][1];
-        kD[2] = kR[2][2];
-
-        // the shear component
-        Real fInvD0 = 1.0f/kD[0];
-        kU[0] = kR[0][1]*fInvD0;
-        kU[1] = kR[0][2]*fInvD0;
-        kU[2] = kR[1][2]/kD[1];
-    }
-    //-----------------------------------------------------------------------
-    Real Matrix3::MaxCubicRoot (Real afCoeff[3])
-    {
-        // Spectral norm is for A^T*A, so characteristic polynomial
-        // P(x) = c[0]+c[1]*x+c[2]*x^2+x^3 has three positive real roots.
-        // This yields the assertions c[0] < 0 and c[2]*c[2] >= 3*c[1].
-
-        // quick out for uniform scale (triple root)
-        const Real fOneThird = 1.0f/3.0f;
-        const Real fEpsilon = 1e-06f;
-        Real fDiscr = afCoeff[2]*afCoeff[2] - 3.0f*afCoeff[1];
-        if ( fDiscr <= fEpsilon )
-            return -fOneThird*afCoeff[2];
-
-        // Compute an upper bound on roots of P(x).  This assumes that A^T*A
-        // has been scaled by its largest entry.
-        Real fX = 1.0;
-        Real fPoly = afCoeff[0]+fX*(afCoeff[1]+fX*(afCoeff[2]+fX));
-        if ( fPoly < 0.0 )
-        {
-            // uses a matrix norm to find an upper bound on maximum root
-            fX = Math::Abs(afCoeff[0]);
-            Real fTmp = 1.0f+Math::Abs(afCoeff[1]);
-            if ( fTmp > fX )
-                fX = fTmp;
-            fTmp = 1.0f+Math::Abs(afCoeff[2]);
-            if ( fTmp > fX )
-                fX = fTmp;
-        }
-
-        // Newton's method to find root
-        Real fTwoC2 = 2.0f*afCoeff[2];
-        for (int i = 0; i < 16; i++)
-        {
-            fPoly = afCoeff[0]+fX*(afCoeff[1]+fX*(afCoeff[2]+fX));
-            if ( Math::Abs(fPoly) <= fEpsilon )
-                return fX;
-
-            Real fDeriv = afCoeff[1]+fX*(fTwoC2+3.0f*fX);
-            fX -= fPoly/fDeriv;
-        }
-
-        return fX;
-    }
-    //-----------------------------------------------------------------------
-    Real Matrix3::SpectralNorm () const
-    {
-        Matrix3 kP;
-        size_t iRow, iCol;
-        Real fPmax = 0.0;
-        for (iRow = 0; iRow < 3; iRow++)
-        {
-            for (iCol = 0; iCol < 3; iCol++)
-            {
-                kP[iRow][iCol] = 0.0;
-                for (int iMid = 0; iMid < 3; iMid++)
-                {
-                    kP[iRow][iCol] +=
-                        m[iMid][iRow]*m[iMid][iCol];
-                }
-                if ( kP[iRow][iCol] > fPmax )
-                    fPmax = kP[iRow][iCol];
-            }
-        }
-
-        Real fInvPmax = 1.0f/fPmax;
-        for (iRow = 0; iRow < 3; iRow++)
-        {
-            for (iCol = 0; iCol < 3; iCol++)
-                kP[iRow][iCol] *= fInvPmax;
-        }
-
-        Real afCoeff[3];
-        afCoeff[0] = -(kP[0][0]*(kP[1][1]*kP[2][2]-kP[1][2]*kP[2][1]) +
-            kP[0][1]*(kP[2][0]*kP[1][2]-kP[1][0]*kP[2][2]) +
-            kP[0][2]*(kP[1][0]*kP[2][1]-kP[2][0]*kP[1][1]));
-        afCoeff[1] = kP[0][0]*kP[1][1]-kP[0][1]*kP[1][0] +
-            kP[0][0]*kP[2][2]-kP[0][2]*kP[2][0] +
-            kP[1][1]*kP[2][2]-kP[1][2]*kP[2][1];
-        afCoeff[2] = -(kP[0][0]+kP[1][1]+kP[2][2]);
-
-        Real fRoot = MaxCubicRoot(afCoeff);
-        Real fNorm = Math::Sqrt(fPmax*fRoot);
-        return fNorm;
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::ToAxisAngle (Vector3& rkAxis, Radian& rfRadians) const
-    {
-        // Let (x,y,z) be the unit-length axis and let A be an angle of rotation.
-        // The rotation matrix is R = I + sin(A)*P + (1-cos(A))*P^2 where
-        // I is the identity and
-        //
-        //       +-        -+
-        //   P = |  0 -z +y |
-        //       | +z  0 -x |
-        //       | -y +x  0 |
-        //       +-        -+
-        //
-        // If A > 0, R represents a counterclockwise rotation about the axis in
-        // the sense of looking from the tip of the axis vector towards the
-        // origin.  Some algebra will show that
-        //
-        //   cos(A) = (trace(R)-1)/2  and  R - R^t = 2*sin(A)*P
-        //
-        // In the event that A = pi, R-R^t = 0 which prevents us from extracting
-        // the axis through P.  Instead note that R = I+2*P^2 when A = pi, so
-        // P^2 = (R-I)/2.  The diagonal entries of P^2 are x^2-1, y^2-1, and
-        // z^2-1.  We can solve these for axis (x,y,z).  Because the angle is pi,
-        // it does not matter which sign you choose on the square roots.
-
-        Real fTrace = m[0][0] + m[1][1] + m[2][2];
-        Real fCos = 0.5f*(fTrace-1.0f);
-        rfRadians = Math::ACos(fCos);  // in [0,PI]
-
-        if ( rfRadians > Radian(0.0) )
-        {
-            if ( rfRadians < Radian(Math::PI) )
-            {
-                rkAxis.x = m[2][1]-m[1][2];
-                rkAxis.y = m[0][2]-m[2][0];
-                rkAxis.z = m[1][0]-m[0][1];
-                rkAxis.normalise();
-            }
-            else
-            {
-                // angle is PI
-                float fHalfInverse;
-                if ( m[0][0] >= m[1][1] )
-                {
-                    // r00 >= r11
-                    if ( m[0][0] >= m[2][2] )
-                    {
-                        // r00 is maximum diagonal term
-                        rkAxis.x = 0.5f*Math::Sqrt(m[0][0] -
-                            m[1][1] - m[2][2] + 1.0f);
-                        fHalfInverse = 0.5f/rkAxis.x;
-                        rkAxis.y = fHalfInverse*m[0][1];
-                        rkAxis.z = fHalfInverse*m[0][2];
-                    }
-                    else
-                    {
-                        // r22 is maximum diagonal term
-                        rkAxis.z = 0.5f*Math::Sqrt(m[2][2] -
-                            m[0][0] - m[1][1] + 1.0f);
-                        fHalfInverse = 0.5f/rkAxis.z;
-                        rkAxis.x = fHalfInverse*m[0][2];
-                        rkAxis.y = fHalfInverse*m[1][2];
-                    }
-                }
-                else
-                {
-                    // r11 > r00
-                    if ( m[1][1] >= m[2][2] )
-                    {
-                        // r11 is maximum diagonal term
-                        rkAxis.y = 0.5f*Math::Sqrt(m[1][1] -
-                            m[0][0] - m[2][2] + 1.0f);
-                        fHalfInverse  = 0.5f/rkAxis.y;
-                        rkAxis.x = fHalfInverse*m[0][1];
-                        rkAxis.z = fHalfInverse*m[1][2];
-                    }
-                    else
-                    {
-                        // r22 is maximum diagonal term
-                        rkAxis.z = 0.5f*Math::Sqrt(m[2][2] -
-                            m[0][0] - m[1][1] + 1.0f);
-                        fHalfInverse = 0.5f/rkAxis.z;
-                        rkAxis.x = fHalfInverse*m[0][2];
-                        rkAxis.y = fHalfInverse*m[1][2];
-                    }
-                }
-            }
-        }
-        else
-        {
-            // The angle is 0 and the matrix is the identity.  Any axis will
-            // work, so just use the x-axis.
-            rkAxis.x = 1.0;
-            rkAxis.y = 0.0;
-            rkAxis.z = 0.0;
-        }
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::FromAxisAngle (const Vector3& rkAxis, const Radian& fRadians)
-    {
-        Real fCos = Math::Cos(fRadians);
-        Real fSin = Math::Sin(fRadians);
-        Real fOneMinusCos = 1.0f-fCos;
-        Real fX2 = rkAxis.x*rkAxis.x;
-        Real fY2 = rkAxis.y*rkAxis.y;
-        Real fZ2 = rkAxis.z*rkAxis.z;
-        Real fXYM = rkAxis.x*rkAxis.y*fOneMinusCos;
-        Real fXZM = rkAxis.x*rkAxis.z*fOneMinusCos;
-        Real fYZM = rkAxis.y*rkAxis.z*fOneMinusCos;
-        Real fXSin = rkAxis.x*fSin;
-        Real fYSin = rkAxis.y*fSin;
-        Real fZSin = rkAxis.z*fSin;
-
-        m[0][0] = fX2*fOneMinusCos+fCos;
-        m[0][1] = fXYM-fZSin;
-        m[0][2] = fXZM+fYSin;
-        m[1][0] = fXYM+fZSin;
-        m[1][1] = fY2*fOneMinusCos+fCos;
-        m[1][2] = fYZM-fXSin;
-        m[2][0] = fXZM-fYSin;
-        m[2][1] = fYZM+fXSin;
-        m[2][2] = fZ2*fOneMinusCos+fCos;
-    }
-    //-----------------------------------------------------------------------
-    bool Matrix3::ToEulerAnglesXYZ (Radian& rfYAngle, Radian& rfPAngle,
-        Radian& rfRAngle) const
-    {
-        // rot =  cy*cz          -cy*sz           sy
-        //        cz*sx*sy+cx*sz  cx*cz-sx*sy*sz -cy*sx
-        //       -cx*cz*sy+sx*sz  cz*sx+cx*sy*sz  cx*cy
-
-        rfPAngle = Radian(Math::ASin(m[0][2]));
-        if ( rfPAngle < Radian(Math::HALF_PI) )
-        {
-            if ( rfPAngle > Radian(-Math::HALF_PI) )
-            {
-                rfYAngle = Math::ATan2(-m[1][2],m[2][2]);
-                rfRAngle = Math::ATan2(-m[0][1],m[0][0]);
-                return true;
-            }
-            else
-            {
-                // WARNING.  Not a unique solution.
-                Radian fRmY = Math::ATan2(m[1][0],m[1][1]);
-                rfRAngle = Radian(0.0);  // any angle works
-                rfYAngle = rfRAngle - fRmY;
-                return false;
-            }
-        }
-        else
-        {
-            // WARNING.  Not a unique solution.
-            Radian fRpY = Math::ATan2(m[1][0],m[1][1]);
-            rfRAngle = Radian(0.0);  // any angle works
-            rfYAngle = fRpY - rfRAngle;
-            return false;
-        }
-    }
-    //-----------------------------------------------------------------------
-    bool Matrix3::ToEulerAnglesXZY (Radian& rfYAngle, Radian& rfPAngle,
-        Radian& rfRAngle) const
-    {
-        // rot =  cy*cz          -sz              cz*sy
-        //        sx*sy+cx*cy*sz  cx*cz          -cy*sx+cx*sy*sz
-        //       -cx*sy+cy*sx*sz  cz*sx           cx*cy+sx*sy*sz
-
-        rfPAngle = Math::ASin(-m[0][1]);
-        if ( rfPAngle < Radian(Math::HALF_PI) )
-        {
-            if ( rfPAngle > Radian(-Math::HALF_PI) )
-            {
-                rfYAngle = Math::ATan2(m[2][1],m[1][1]);
-                rfRAngle = Math::ATan2(m[0][2],m[0][0]);
-                return true;
-            }
-            else
-            {
-                // WARNING.  Not a unique solution.
-                Radian fRmY = Math::ATan2(-m[2][0],m[2][2]);
-                rfRAngle = Radian(0.0);  // any angle works
-                rfYAngle = rfRAngle - fRmY;
-                return false;
-            }
-        }
-        else
-        {
-            // WARNING.  Not a unique solution.
-            Radian fRpY = Math::ATan2(-m[2][0],m[2][2]);
-            rfRAngle = Radian(0.0);  // any angle works
-            rfYAngle = fRpY - rfRAngle;
-            return false;
-        }
-    }
-    //-----------------------------------------------------------------------
-    bool Matrix3::ToEulerAnglesYXZ (Radian& rfYAngle, Radian& rfPAngle,
-        Radian& rfRAngle) const
-    {
-        // rot =  cy*cz+sx*sy*sz  cz*sx*sy-cy*sz  cx*sy
-        //        cx*sz           cx*cz          -sx
-        //       -cz*sy+cy*sx*sz  cy*cz*sx+sy*sz  cx*cy
-
-        rfPAngle = Math::ASin(-m[1][2]);
-        if ( rfPAngle < Radian(Math::HALF_PI) )
-        {
-            if ( rfPAngle > Radian(-Math::HALF_PI) )
-            {
-                rfYAngle = Math::ATan2(m[0][2],m[2][2]);
-                rfRAngle = Math::ATan2(m[1][0],m[1][1]);
-                return true;
-            }
-            else
-            {
-                // WARNING.  Not a unique solution.
-                Radian fRmY = Math::ATan2(-m[0][1],m[0][0]);
-                rfRAngle = Radian(0.0);  // any angle works
-                rfYAngle = rfRAngle - fRmY;
-                return false;
-            }
-        }
-        else
-        {
-            // WARNING.  Not a unique solution.
-            Radian fRpY = Math::ATan2(-m[0][1],m[0][0]);
-            rfRAngle = Radian(0.0);  // any angle works
-            rfYAngle = fRpY - rfRAngle;
-            return false;
-        }
-    }
-    //-----------------------------------------------------------------------
-    bool Matrix3::ToEulerAnglesYZX (Radian& rfYAngle, Radian& rfPAngle,
-        Radian& rfRAngle) const
-    {
-        // rot =  cy*cz           sx*sy-cx*cy*sz  cx*sy+cy*sx*sz
-        //        sz              cx*cz          -cz*sx
-        //       -cz*sy           cy*sx+cx*sy*sz  cx*cy-sx*sy*sz
-
-        rfPAngle = Math::ASin(m[1][0]);
-        if ( rfPAngle < Radian(Math::HALF_PI) )
-        {
-            if ( rfPAngle > Radian(-Math::HALF_PI) )
-            {
-                rfYAngle = Math::ATan2(-m[2][0],m[0][0]);
-                rfRAngle = Math::ATan2(-m[1][2],m[1][1]);
-                return true;
-            }
-            else
-            {
-                // WARNING.  Not a unique solution.
-                Radian fRmY = Math::ATan2(m[2][1],m[2][2]);
-                rfRAngle = Radian(0.0);  // any angle works
-                rfYAngle = rfRAngle - fRmY;
-                return false;
-            }
-        }
-        else
-        {
-            // WARNING.  Not a unique solution.
-            Radian fRpY = Math::ATan2(m[2][1],m[2][2]);
-            rfRAngle = Radian(0.0);  // any angle works
-            rfYAngle = fRpY - rfRAngle;
-            return false;
-        }
-    }
-    //-----------------------------------------------------------------------
-    bool Matrix3::ToEulerAnglesZXY (Radian& rfYAngle, Radian& rfPAngle,
-        Radian& rfRAngle) const
-    {
-        // rot =  cy*cz-sx*sy*sz -cx*sz           cz*sy+cy*sx*sz
-        //        cz*sx*sy+cy*sz  cx*cz          -cy*cz*sx+sy*sz
-        //       -cx*sy           sx              cx*cy
-
-        rfPAngle = Math::ASin(m[2][1]);
-        if ( rfPAngle < Radian(Math::HALF_PI) )
-        {
-            if ( rfPAngle > Radian(-Math::HALF_PI) )
-            {
-                rfYAngle = Math::ATan2(-m[0][1],m[1][1]);
-                rfRAngle = Math::ATan2(-m[2][0],m[2][2]);
-                return true;
-            }
-            else
-            {
-                // WARNING.  Not a unique solution.
-                Radian fRmY = Math::ATan2(m[0][2],m[0][0]);
-                rfRAngle = Radian(0.0);  // any angle works
-                rfYAngle = rfRAngle - fRmY;
-                return false;
-            }
-        }
-        else
-        {
-            // WARNING.  Not a unique solution.
-            Radian fRpY = Math::ATan2(m[0][2],m[0][0]);
-            rfRAngle = Radian(0.0);  // any angle works
-            rfYAngle = fRpY - rfRAngle;
-            return false;
-        }
-    }
-    //-----------------------------------------------------------------------
-    bool Matrix3::ToEulerAnglesZYX (Radian& rfYAngle, Radian& rfPAngle,
-        Radian& rfRAngle) const
-    {
-        // rot =  cy*cz           cz*sx*sy-cx*sz  cx*cz*sy+sx*sz
-        //        cy*sz           cx*cz+sx*sy*sz -cz*sx+cx*sy*sz
-        //       -sy              cy*sx           cx*cy
-
-        rfPAngle = Math::ASin(-m[2][0]);
-        if ( rfPAngle < Radian(Math::HALF_PI) )
-        {
-            if ( rfPAngle > Radian(-Math::HALF_PI) )
-            {
-                rfYAngle = Math::ATan2(m[1][0],m[0][0]);
-                rfRAngle = Math::ATan2(m[2][1],m[2][2]);
-                return true;
-            }
-            else
-            {
-                // WARNING.  Not a unique solution.
-                Radian fRmY = Math::ATan2(-m[0][1],m[0][2]);
-                rfRAngle = Radian(0.0);  // any angle works
-                rfYAngle = rfRAngle - fRmY;
-                return false;
-            }
-        }
-        else
-        {
-            // WARNING.  Not a unique solution.
-            Radian fRpY = Math::ATan2(-m[0][1],m[0][2]);
-            rfRAngle = Radian(0.0);  // any angle works
-            rfYAngle = fRpY - rfRAngle;
-            return false;
-        }
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::FromEulerAnglesXYZ (const Radian& fYAngle, const Radian& fPAngle,
-        const Radian& fRAngle)
-    {
-        Real fCos, fSin;
-
-        fCos = Math::Cos(fYAngle);
-        fSin = Math::Sin(fYAngle);
-        Matrix3 kXMat(1.0,0.0,0.0,0.0,fCos,-fSin,0.0,fSin,fCos);
-
-        fCos = Math::Cos(fPAngle);
-        fSin = Math::Sin(fPAngle);
-        Matrix3 kYMat(fCos,0.0,fSin,0.0,1.0,0.0,-fSin,0.0,fCos);
-
-        fCos = Math::Cos(fRAngle);
-        fSin = Math::Sin(fRAngle);
-        Matrix3 kZMat(fCos,-fSin,0.0,fSin,fCos,0.0,0.0,0.0,1.0);
-
-        *this = kXMat*(kYMat*kZMat);
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::FromEulerAnglesXZY (const Radian& fYAngle, const Radian& fPAngle,
-        const Radian& fRAngle)
-    {
-        Real fCos, fSin;
-
-        fCos = Math::Cos(fYAngle);
-        fSin = Math::Sin(fYAngle);
-        Matrix3 kXMat(1.0,0.0,0.0,0.0,fCos,-fSin,0.0,fSin,fCos);
-
-        fCos = Math::Cos(fPAngle);
-        fSin = Math::Sin(fPAngle);
-        Matrix3 kZMat(fCos,-fSin,0.0,fSin,fCos,0.0,0.0,0.0,1.0);
-
-        fCos = Math::Cos(fRAngle);
-        fSin = Math::Sin(fRAngle);
-        Matrix3 kYMat(fCos,0.0,fSin,0.0,1.0,0.0,-fSin,0.0,fCos);
-
-        *this = kXMat*(kZMat*kYMat);
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::FromEulerAnglesYXZ (const Radian& fYAngle, const Radian& fPAngle,
-        const Radian& fRAngle)
-    {
-        Real fCos, fSin;
-
-        fCos = Math::Cos(fYAngle);
-        fSin = Math::Sin(fYAngle);
-        Matrix3 kYMat(fCos,0.0,fSin,0.0,1.0,0.0,-fSin,0.0,fCos);
-
-        fCos = Math::Cos(fPAngle);
-        fSin = Math::Sin(fPAngle);
-        Matrix3 kXMat(1.0,0.0,0.0,0.0,fCos,-fSin,0.0,fSin,fCos);
-
-        fCos = Math::Cos(fRAngle);
-        fSin = Math::Sin(fRAngle);
-        Matrix3 kZMat(fCos,-fSin,0.0,fSin,fCos,0.0,0.0,0.0,1.0);
-
-        *this = kYMat*(kXMat*kZMat);
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::FromEulerAnglesYZX (const Radian& fYAngle, const Radian& fPAngle,
-        const Radian& fRAngle)
-    {
-        Real fCos, fSin;
-
-        fCos = Math::Cos(fYAngle);
-        fSin = Math::Sin(fYAngle);
-        Matrix3 kYMat(fCos,0.0,fSin,0.0,1.0,0.0,-fSin,0.0,fCos);
-
-        fCos = Math::Cos(fPAngle);
-        fSin = Math::Sin(fPAngle);
-        Matrix3 kZMat(fCos,-fSin,0.0,fSin,fCos,0.0,0.0,0.0,1.0);
-
-        fCos = Math::Cos(fRAngle);
-        fSin = Math::Sin(fRAngle);
-        Matrix3 kXMat(1.0,0.0,0.0,0.0,fCos,-fSin,0.0,fSin,fCos);
-
-        *this = kYMat*(kZMat*kXMat);
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::FromEulerAnglesZXY (const Radian& fYAngle, const Radian& fPAngle,
-        const Radian& fRAngle)
-    {
-        Real fCos, fSin;
-
-        fCos = Math::Cos(fYAngle);
-        fSin = Math::Sin(fYAngle);
-        Matrix3 kZMat(fCos,-fSin,0.0,fSin,fCos,0.0,0.0,0.0,1.0);
-
-        fCos = Math::Cos(fPAngle);
-        fSin = Math::Sin(fPAngle);
-        Matrix3 kXMat(1.0,0.0,0.0,0.0,fCos,-fSin,0.0,fSin,fCos);
-
-        fCos = Math::Cos(fRAngle);
-        fSin = Math::Sin(fRAngle);
-        Matrix3 kYMat(fCos,0.0,fSin,0.0,1.0,0.0,-fSin,0.0,fCos);
-
-        *this = kZMat*(kXMat*kYMat);
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::FromEulerAnglesZYX (const Radian& fYAngle, const Radian& fPAngle,
-        const Radian& fRAngle)
-    {
-        Real fCos, fSin;
-
-        fCos = Math::Cos(fYAngle);
-        fSin = Math::Sin(fYAngle);
-        Matrix3 kZMat(fCos,-fSin,0.0,fSin,fCos,0.0,0.0,0.0,1.0);
-
-        fCos = Math::Cos(fPAngle);
-        fSin = Math::Sin(fPAngle);
-        Matrix3 kYMat(fCos,0.0,fSin,0.0,1.0,0.0,-fSin,0.0,fCos);
-
-        fCos = Math::Cos(fRAngle);
-        fSin = Math::Sin(fRAngle);
-        Matrix3 kXMat(1.0,0.0,0.0,0.0,fCos,-fSin,0.0,fSin,fCos);
-
-        *this = kZMat*(kYMat*kXMat);
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::Tridiagonal (Real afDiag[3], Real afSubDiag[3])
-    {
-        // Householder reduction T = Q^t M Q
-        //   Input:
-        //     mat, symmetric 3x3 matrix M
-        //   Output:
-        //     mat, orthogonal matrix Q
-        //     diag, diagonal entries of T
-        //     subd, subdiagonal entries of T (T is symmetric)
-
-        Real fA = m[0][0];
-        Real fB = m[0][1];
-        Real fC = m[0][2];
-        Real fD = m[1][1];
-        Real fE = m[1][2];
-        Real fF = m[2][2];
-
-        afDiag[0] = fA;
-        afSubDiag[2] = 0.0;
-        if ( Math::Abs(fC) >= EPSILON )
-        {
-            Real fLength = Math::Sqrt(fB*fB+fC*fC);
-            Real fInvLength = 1.0f/fLength;
-            fB *= fInvLength;
-            fC *= fInvLength;
-            Real fQ = 2.0f*fB*fE+fC*(fF-fD);
-            afDiag[1] = fD+fC*fQ;
-            afDiag[2] = fF-fC*fQ;
-            afSubDiag[0] = fLength;
-            afSubDiag[1] = fE-fB*fQ;
-            m[0][0] = 1.0;
-            m[0][1] = 0.0;
-            m[0][2] = 0.0;
-            m[1][0] = 0.0;
-            m[1][1] = fB;
-            m[1][2] = fC;
-            m[2][0] = 0.0;
-            m[2][1] = fC;
-            m[2][2] = -fB;
-        }
-        else
-        {
-            afDiag[1] = fD;
-            afDiag[2] = fF;
-            afSubDiag[0] = fB;
-            afSubDiag[1] = fE;
-            m[0][0] = 1.0;
-            m[0][1] = 0.0;
-            m[0][2] = 0.0;
-            m[1][0] = 0.0;
-            m[1][1] = 1.0;
-            m[1][2] = 0.0;
-            m[2][0] = 0.0;
-            m[2][1] = 0.0;
-            m[2][2] = 1.0;
-        }
-    }
-    //-----------------------------------------------------------------------
-    bool Matrix3::QLAlgorithm (Real afDiag[3], Real afSubDiag[3])
-    {
-        // QL iteration with implicit shifting to reduce matrix from tridiagonal
-        // to diagonal
-
-        for (int i0 = 0; i0 < 3; i0++)
-        {
-            const unsigned int iMaxIter = 32;
-            unsigned int iIter;
-            for (iIter = 0; iIter < iMaxIter; iIter++)
-            {
-                int i1;
-                for (i1 = i0; i1 <= 1; i1++)
-                {
-                    Real fSum = Math::Abs(afDiag[i1]) +
-                        Math::Abs(afDiag[i1+1]);
-                    if ( Math::Abs(afSubDiag[i1]) + fSum == fSum )
-                        break;
-                }
-                if ( i1 == i0 )
-                    break;
-
-                Real fTmp0 = (afDiag[i0+1]-afDiag[i0])/(2.0f*afSubDiag[i0]);
-                Real fTmp1 = Math::Sqrt(fTmp0*fTmp0+1.0f);
-                if ( fTmp0 < 0.0 )
-                    fTmp0 = afDiag[i1]-afDiag[i0]+afSubDiag[i0]/(fTmp0-fTmp1);
-                else
-                    fTmp0 = afDiag[i1]-afDiag[i0]+afSubDiag[i0]/(fTmp0+fTmp1);
-                Real fSin = 1.0;
-                Real fCos = 1.0;
-                Real fTmp2 = 0.0;
-                for (int i2 = i1-1; i2 >= i0; i2--)
-                {
-                    Real fTmp3 = fSin*afSubDiag[i2];
-                    Real fTmp4 = fCos*afSubDiag[i2];
-                    if ( Math::Abs(fTmp3) >= Math::Abs(fTmp0) )
-                    {
-                        fCos = fTmp0/fTmp3;
-                        fTmp1 = Math::Sqrt(fCos*fCos+1.0f);
-                        afSubDiag[i2+1] = fTmp3*fTmp1;
-                        fSin = 1.0f/fTmp1;
-                        fCos *= fSin;
-                    }
-                    else
-                    {
-                        fSin = fTmp3/fTmp0;
-                        fTmp1 = Math::Sqrt(fSin*fSin+1.0f);
-                        afSubDiag[i2+1] = fTmp0*fTmp1;
-                        fCos = 1.0f/fTmp1;
-                        fSin *= fCos;
-                    }
-                    fTmp0 = afDiag[i2+1]-fTmp2;
-                    fTmp1 = (afDiag[i2]-fTmp0)*fSin+2.0f*fTmp4*fCos;
-                    fTmp2 = fSin*fTmp1;
-                    afDiag[i2+1] = fTmp0+fTmp2;
-                    fTmp0 = fCos*fTmp1-fTmp4;
-
-                    for (int iRow = 0; iRow < 3; iRow++)
-                    {
-                        fTmp3 = m[iRow][i2+1];
-                        m[iRow][i2+1] = fSin*m[iRow][i2] +
-                            fCos*fTmp3;
-                        m[iRow][i2] = fCos*m[iRow][i2] -
-                            fSin*fTmp3;
-                    }
-                }
-                afDiag[i0] -= fTmp2;
-                afSubDiag[i0] = fTmp0;
-                afSubDiag[i1] = 0.0;
-            }
-
-            if ( iIter == iMaxIter )
-            {
-                // should not get here under normal circumstances
-                return false;
-            }
-        }
-
-        return true;
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::EigenSolveSymmetric (Real afEigenvalue[3],
-        Vector3 akEigenvector[3]) const
-    {
-        Matrix3 kMatrix = *this;
-        Real afSubDiag[3];
-        kMatrix.Tridiagonal(afEigenvalue,afSubDiag);
-        kMatrix.QLAlgorithm(afEigenvalue,afSubDiag);
-
-        for (size_t i = 0; i < 3; i++)
-        {
-            akEigenvector[i][0] = kMatrix[0][i];
-            akEigenvector[i][1] = kMatrix[1][i];
-            akEigenvector[i][2] = kMatrix[2][i];
-        }
-
-        // make eigenvectors form a right--handed system
-        Vector3 kCross = akEigenvector[1].crossProduct(akEigenvector[2]);
-        Real fDet = akEigenvector[0].dotProduct(kCross);
-        if ( fDet < 0.0 )
-        {
-            akEigenvector[2][0] = - akEigenvector[2][0];
-            akEigenvector[2][1] = - akEigenvector[2][1];
-            akEigenvector[2][2] = - akEigenvector[2][2];
-        }
-    }
-    //-----------------------------------------------------------------------
-    void Matrix3::TensorProduct (const Vector3& rkU, const Vector3& rkV,
-        Matrix3& rkProduct)
-    {
-        for (size_t iRow = 0; iRow < 3; iRow++)
-        {
-            for (size_t iCol = 0; iCol < 3; iCol++)
-                rkProduct[iRow][iCol] = rkU[iRow]*rkV[iCol];
-        }
-    }
-    //-----------------------------------------------------------------------
-}

+ 0 - 272
CamelotRenderer/OgreMatrix3.h

@@ -1,272 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __Matrix3_H__
-#define __Matrix3_H__
-
-#include "OgrePrerequisites.h"
-
-#include "OgreVector3.h"
-
-// NB All code adapted from Wild Magic 0.2 Matrix math (free source code)
-// http://www.geometrictools.com/
-
-// NOTE.  The (x,y,z) coordinate system is assumed to be right-handed.
-// Coordinate axis rotation matrices are of the form
-//   RX =    1       0       0
-//           0     cos(t) -sin(t)
-//           0     sin(t)  cos(t)
-// where t > 0 indicates a counterclockwise rotation in the yz-plane
-//   RY =  cos(t)    0     sin(t)
-//           0       1       0
-//        -sin(t)    0     cos(t)
-// where t > 0 indicates a counterclockwise rotation in the zx-plane
-//   RZ =  cos(t) -sin(t)    0
-//         sin(t)  cos(t)    0
-//           0       0       1
-// where t > 0 indicates a counterclockwise rotation in the xy-plane.
-
-namespace CamelotEngine
-{
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Math
-	*  @{
-	*/
-	/** A 3x3 matrix which can represent rotations around axes.
-        @note
-            <b>All the code is adapted from the Wild Magic 0.2 Matrix
-            library (http://www.geometrictools.com/).</b>
-        @par
-            The coordinate system is assumed to be <b>right-handed</b>.
-    */
-    class CM_EXPORT Matrix3
-    {
-    public:
-        /** Default constructor.
-            @note
-                It does <b>NOT</b> initialize the matrix for efficiency.
-        */
-		inline Matrix3 () {}
-        inline explicit Matrix3 (const Real arr[3][3])
-		{
-			memcpy(m,arr,9*sizeof(Real));
-		}
-        inline Matrix3 (const Matrix3& rkMatrix)
-		{
-			memcpy(m,rkMatrix.m,9*sizeof(Real));
-		}
-        Matrix3 (Real fEntry00, Real fEntry01, Real fEntry02,
-                    Real fEntry10, Real fEntry11, Real fEntry12,
-                    Real fEntry20, Real fEntry21, Real fEntry22)
-		{
-			m[0][0] = fEntry00;
-			m[0][1] = fEntry01;
-			m[0][2] = fEntry02;
-			m[1][0] = fEntry10;
-			m[1][1] = fEntry11;
-			m[1][2] = fEntry12;
-			m[2][0] = fEntry20;
-			m[2][1] = fEntry21;
-			m[2][2] = fEntry22;
-		}
-
-		/** Exchange the contents of this matrix with another. 
-		*/
-		inline void swap(Matrix3& other)
-		{
-			std::swap(m[0][0], other.m[0][0]);
-			std::swap(m[0][1], other.m[0][1]);
-			std::swap(m[0][2], other.m[0][2]);
-			std::swap(m[1][0], other.m[1][0]);
-			std::swap(m[1][1], other.m[1][1]);
-			std::swap(m[1][2], other.m[1][2]);
-			std::swap(m[2][0], other.m[2][0]);
-			std::swap(m[2][1], other.m[2][1]);
-			std::swap(m[2][2], other.m[2][2]);
-		}
-
-        // member access, allows use of construct mat[r][c]
-        inline Real* operator[] (size_t iRow) const
-		{
-			return (Real*)m[iRow];
-		}
-        /*inline operator Real* ()
-		{
-			return (Real*)m[0];
-		}*/
-        Vector3 GetColumn (size_t iCol) const;
-        void SetColumn(size_t iCol, const Vector3& vec);
-        void FromAxes(const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis);
-
-        // assignment and comparison
-        inline Matrix3& operator= (const Matrix3& rkMatrix)
-		{
-			memcpy(m,rkMatrix.m,9*sizeof(Real));
-			return *this;
-		}
-        bool operator== (const Matrix3& rkMatrix) const;
-        inline bool operator!= (const Matrix3& rkMatrix) const
-		{
-			return !operator==(rkMatrix);
-		}
-
-        // arithmetic operations
-        Matrix3 operator+ (const Matrix3& rkMatrix) const;
-        Matrix3 operator- (const Matrix3& rkMatrix) const;
-        Matrix3 operator* (const Matrix3& rkMatrix) const;
-        Matrix3 operator- () const;
-
-        // matrix * vector [3x3 * 3x1 = 3x1]
-        Vector3 operator* (const Vector3& rkVector) const;
-
-        // vector * matrix [1x3 * 3x3 = 1x3]
-        CM_EXPORT friend Vector3 operator* (const Vector3& rkVector,
-            const Matrix3& rkMatrix);
-
-        // matrix * scalar
-        Matrix3 operator* (Real fScalar) const;
-
-        // scalar * matrix
-        CM_EXPORT friend Matrix3 operator* (Real fScalar, const Matrix3& rkMatrix);
-
-        // utilities
-        Matrix3 Transpose () const;
-        bool Inverse (Matrix3& rkInverse, Real fTolerance = 1e-06) const;
-        Matrix3 Inverse (Real fTolerance = 1e-06) const;
-        Real Determinant () const;
-
-        // singular value decomposition
-        void SingularValueDecomposition (Matrix3& rkL, Vector3& rkS,
-            Matrix3& rkR) const;
-        void SingularValueComposition (const Matrix3& rkL,
-            const Vector3& rkS, const Matrix3& rkR);
-
-        // Gram-Schmidt orthonormalization (applied to columns of rotation matrix)
-        void Orthonormalize ();
-
-        // orthogonal Q, diagonal D, upper triangular U stored as (u01,u02,u12)
-        void QDUDecomposition (Matrix3& rkQ, Vector3& rkD,
-            Vector3& rkU) const;
-
-        Real SpectralNorm () const;
-
-        // matrix must be orthonormal
-        void ToAxisAngle (Vector3& rkAxis, Radian& rfAngle) const;
-		inline void ToAxisAngle (Vector3& rkAxis, Degree& rfAngle) const {
-			Radian r;
-			ToAxisAngle ( rkAxis, r );
-			rfAngle = r;
-		}
-        void FromAxisAngle (const Vector3& rkAxis, const Radian& fRadians);
-
-        // The matrix must be orthonormal.  The decomposition is yaw*pitch*roll
-        // where yaw is rotation about the Up vector, pitch is rotation about the
-        // Right axis, and roll is rotation about the Direction axis.
-        bool ToEulerAnglesXYZ (Radian& rfYAngle, Radian& rfPAngle,
-            Radian& rfRAngle) const;
-        bool ToEulerAnglesXZY (Radian& rfYAngle, Radian& rfPAngle,
-            Radian& rfRAngle) const;
-        bool ToEulerAnglesYXZ (Radian& rfYAngle, Radian& rfPAngle,
-            Radian& rfRAngle) const;
-        bool ToEulerAnglesYZX (Radian& rfYAngle, Radian& rfPAngle,
-            Radian& rfRAngle) const;
-        bool ToEulerAnglesZXY (Radian& rfYAngle, Radian& rfPAngle,
-            Radian& rfRAngle) const;
-        bool ToEulerAnglesZYX (Radian& rfYAngle, Radian& rfPAngle,
-            Radian& rfRAngle) const;
-        void FromEulerAnglesXYZ (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle);
-        void FromEulerAnglesXZY (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle);
-        void FromEulerAnglesYXZ (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle);
-        void FromEulerAnglesYZX (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle);
-        void FromEulerAnglesZXY (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle);
-        void FromEulerAnglesZYX (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle);
-        // eigensolver, matrix must be symmetric
-        void EigenSolveSymmetric (Real afEigenvalue[3],
-            Vector3 akEigenvector[3]) const;
-
-        static void TensorProduct (const Vector3& rkU, const Vector3& rkV,
-            Matrix3& rkProduct);
-
-		/** Determines if this matrix involves a scaling. */
-		inline bool hasScale() const
-		{
-			// check magnitude of column vectors (==local axes)
-			Real t = m[0][0] * m[0][0] + m[1][0] * m[1][0] + m[2][0] * m[2][0];
-			if (!Math::RealEqual(t, 1.0, (Real)1e-04))
-				return true;
-			t = m[0][1] * m[0][1] + m[1][1] * m[1][1] + m[2][1] * m[2][1];
-			if (!Math::RealEqual(t, 1.0, (Real)1e-04))
-				return true;
-			t = m[0][2] * m[0][2] + m[1][2] * m[1][2] + m[2][2] * m[2][2];
-			if (!Math::RealEqual(t, 1.0, (Real)1e-04))
-				return true;
-
-			return false;
-		}
-
-		/** Function for writing to a stream.
-		*/
-		inline CM_EXPORT friend std::ostream& operator <<
-			( std::ostream& o, const Matrix3& mat )
-		{
-			o << "Matrix3(" << mat[0][0] << ", " << mat[0][1] << ", " << mat[0][2] << ", " 
-                            << mat[1][0] << ", " << mat[1][1] << ", " << mat[1][2] << ", " 
-                            << mat[2][0] << ", " << mat[2][1] << ", " << mat[2][2] << ")";
-			return o;
-		}
-
-        static const Real EPSILON;
-        static const Matrix3 ZERO;
-        static const Matrix3 IDENTITY;
-
-    protected:
-        // support for eigensolver
-        void Tridiagonal (Real afDiag[3], Real afSubDiag[3]);
-        bool QLAlgorithm (Real afDiag[3], Real afSubDiag[3]);
-
-        // support for singular value decomposition
-        static const Real ms_fSvdEpsilon;
-        static const unsigned int ms_iSvdMaxIterations;
-        static void Bidiagonalize (Matrix3& kA, Matrix3& kL,
-            Matrix3& kR);
-        static void GolubKahanStep (Matrix3& kA, Matrix3& kL,
-            Matrix3& kR);
-
-        // support for spectral norm
-        static Real MaxCubicRoot (Real afCoeff[3]);
-
-        Real m[3][3];
-
-        // for faster access
-        friend class Matrix4;
-    };
-	/** @} */
-	/** @} */
-}
-#endif

+ 0 - 260
CamelotRenderer/OgreMatrix4.cpp

@@ -1,260 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-(Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#include "OgreMatrix4.h"
-
-#include "OgreVector3.h"
-#include "OgreMatrix3.h"
-
-namespace CamelotEngine
-{
-
-    const Matrix4 Matrix4::ZERO(
-        0, 0, 0, 0,
-        0, 0, 0, 0,
-        0, 0, 0, 0,
-        0, 0, 0, 0 );
-
-    const Matrix4 Matrix4::IDENTITY(
-        1, 0, 0, 0,
-        0, 1, 0, 0,
-        0, 0, 1, 0,
-        0, 0, 0, 1 );
-
-    const Matrix4 Matrix4::CLIPSPACE2DTOIMAGESPACE(
-        0.5,    0,  0, 0.5, 
-          0, -0.5,  0, 0.5, 
-          0,    0,  1,   0,
-          0,    0,  0,   1);
-
-    //-----------------------------------------------------------------------
-    inline static Real
-        MINOR(const Matrix4& m, const size_t r0, const size_t r1, const size_t r2, 
-								const size_t c0, const size_t c1, const size_t c2)
-    {
-        return m[r0][c0] * (m[r1][c1] * m[r2][c2] - m[r2][c1] * m[r1][c2]) -
-            m[r0][c1] * (m[r1][c0] * m[r2][c2] - m[r2][c0] * m[r1][c2]) +
-            m[r0][c2] * (m[r1][c0] * m[r2][c1] - m[r2][c0] * m[r1][c1]);
-    }
-    //-----------------------------------------------------------------------
-    Matrix4 Matrix4::adjoint() const
-    {
-        return Matrix4( MINOR(*this, 1, 2, 3, 1, 2, 3),
-            -MINOR(*this, 0, 2, 3, 1, 2, 3),
-            MINOR(*this, 0, 1, 3, 1, 2, 3),
-            -MINOR(*this, 0, 1, 2, 1, 2, 3),
-
-            -MINOR(*this, 1, 2, 3, 0, 2, 3),
-            MINOR(*this, 0, 2, 3, 0, 2, 3),
-            -MINOR(*this, 0, 1, 3, 0, 2, 3),
-            MINOR(*this, 0, 1, 2, 0, 2, 3),
-
-            MINOR(*this, 1, 2, 3, 0, 1, 3),
-            -MINOR(*this, 0, 2, 3, 0, 1, 3),
-            MINOR(*this, 0, 1, 3, 0, 1, 3),
-            -MINOR(*this, 0, 1, 2, 0, 1, 3),
-
-            -MINOR(*this, 1, 2, 3, 0, 1, 2),
-            MINOR(*this, 0, 2, 3, 0, 1, 2),
-            -MINOR(*this, 0, 1, 3, 0, 1, 2),
-            MINOR(*this, 0, 1, 2, 0, 1, 2));
-    }
-    //-----------------------------------------------------------------------
-    Real Matrix4::determinant() const
-    {
-        return m[0][0] * MINOR(*this, 1, 2, 3, 1, 2, 3) -
-            m[0][1] * MINOR(*this, 1, 2, 3, 0, 2, 3) +
-            m[0][2] * MINOR(*this, 1, 2, 3, 0, 1, 3) -
-            m[0][3] * MINOR(*this, 1, 2, 3, 0, 1, 2);
-    }
-    //-----------------------------------------------------------------------
-    Matrix4 Matrix4::inverse() const
-    {
-        Real m00 = m[0][0], m01 = m[0][1], m02 = m[0][2], m03 = m[0][3];
-        Real m10 = m[1][0], m11 = m[1][1], m12 = m[1][2], m13 = m[1][3];
-        Real m20 = m[2][0], m21 = m[2][1], m22 = m[2][2], m23 = m[2][3];
-        Real m30 = m[3][0], m31 = m[3][1], m32 = m[3][2], m33 = m[3][3];
-
-        Real v0 = m20 * m31 - m21 * m30;
-        Real v1 = m20 * m32 - m22 * m30;
-        Real v2 = m20 * m33 - m23 * m30;
-        Real v3 = m21 * m32 - m22 * m31;
-        Real v4 = m21 * m33 - m23 * m31;
-        Real v5 = m22 * m33 - m23 * m32;
-
-        Real t00 = + (v5 * m11 - v4 * m12 + v3 * m13);
-        Real t10 = - (v5 * m10 - v2 * m12 + v1 * m13);
-        Real t20 = + (v4 * m10 - v2 * m11 + v0 * m13);
-        Real t30 = - (v3 * m10 - v1 * m11 + v0 * m12);
-
-        Real invDet = 1 / (t00 * m00 + t10 * m01 + t20 * m02 + t30 * m03);
-
-        Real d00 = t00 * invDet;
-        Real d10 = t10 * invDet;
-        Real d20 = t20 * invDet;
-        Real d30 = t30 * invDet;
-
-        Real d01 = - (v5 * m01 - v4 * m02 + v3 * m03) * invDet;
-        Real d11 = + (v5 * m00 - v2 * m02 + v1 * m03) * invDet;
-        Real d21 = - (v4 * m00 - v2 * m01 + v0 * m03) * invDet;
-        Real d31 = + (v3 * m00 - v1 * m01 + v0 * m02) * invDet;
-
-        v0 = m10 * m31 - m11 * m30;
-        v1 = m10 * m32 - m12 * m30;
-        v2 = m10 * m33 - m13 * m30;
-        v3 = m11 * m32 - m12 * m31;
-        v4 = m11 * m33 - m13 * m31;
-        v5 = m12 * m33 - m13 * m32;
-
-        Real d02 = + (v5 * m01 - v4 * m02 + v3 * m03) * invDet;
-        Real d12 = - (v5 * m00 - v2 * m02 + v1 * m03) * invDet;
-        Real d22 = + (v4 * m00 - v2 * m01 + v0 * m03) * invDet;
-        Real d32 = - (v3 * m00 - v1 * m01 + v0 * m02) * invDet;
-
-        v0 = m21 * m10 - m20 * m11;
-        v1 = m22 * m10 - m20 * m12;
-        v2 = m23 * m10 - m20 * m13;
-        v3 = m22 * m11 - m21 * m12;
-        v4 = m23 * m11 - m21 * m13;
-        v5 = m23 * m12 - m22 * m13;
-
-        Real d03 = - (v5 * m01 - v4 * m02 + v3 * m03) * invDet;
-        Real d13 = + (v5 * m00 - v2 * m02 + v1 * m03) * invDet;
-        Real d23 = - (v4 * m00 - v2 * m01 + v0 * m03) * invDet;
-        Real d33 = + (v3 * m00 - v1 * m01 + v0 * m02) * invDet;
-
-        return Matrix4(
-            d00, d01, d02, d03,
-            d10, d11, d12, d13,
-            d20, d21, d22, d23,
-            d30, d31, d32, d33);
-    }
-    //-----------------------------------------------------------------------
-    Matrix4 Matrix4::inverseAffine(void) const
-    {
-        assert(isAffine());
-
-        Real m10 = m[1][0], m11 = m[1][1], m12 = m[1][2];
-        Real m20 = m[2][0], m21 = m[2][1], m22 = m[2][2];
-
-        Real t00 = m22 * m11 - m21 * m12;
-        Real t10 = m20 * m12 - m22 * m10;
-        Real t20 = m21 * m10 - m20 * m11;
-
-        Real m00 = m[0][0], m01 = m[0][1], m02 = m[0][2];
-
-        Real invDet = 1 / (m00 * t00 + m01 * t10 + m02 * t20);
-
-        t00 *= invDet; t10 *= invDet; t20 *= invDet;
-
-        m00 *= invDet; m01 *= invDet; m02 *= invDet;
-
-        Real r00 = t00;
-        Real r01 = m02 * m21 - m01 * m22;
-        Real r02 = m01 * m12 - m02 * m11;
-
-        Real r10 = t10;
-        Real r11 = m00 * m22 - m02 * m20;
-        Real r12 = m02 * m10 - m00 * m12;
-
-        Real r20 = t20;
-        Real r21 = m01 * m20 - m00 * m21;
-        Real r22 = m00 * m11 - m01 * m10;
-
-        Real m03 = m[0][3], m13 = m[1][3], m23 = m[2][3];
-
-        Real r03 = - (r00 * m03 + r01 * m13 + r02 * m23);
-        Real r13 = - (r10 * m03 + r11 * m13 + r12 * m23);
-        Real r23 = - (r20 * m03 + r21 * m13 + r22 * m23);
-
-        return Matrix4(
-            r00, r01, r02, r03,
-            r10, r11, r12, r13,
-            r20, r21, r22, r23,
-              0,   0,   0,   1);
-    }
-    //-----------------------------------------------------------------------
-    void Matrix4::makeTransform(const Vector3& position, const Vector3& scale, const Quaternion& orientation)
-    {
-        // Ordering:
-        //    1. Scale
-        //    2. Rotate
-        //    3. Translate
-
-        Matrix3 rot3x3;
-        orientation.ToRotationMatrix(rot3x3);
-
-        // Set up final matrix with scale, rotation and translation
-        m[0][0] = scale.x * rot3x3[0][0]; m[0][1] = scale.y * rot3x3[0][1]; m[0][2] = scale.z * rot3x3[0][2]; m[0][3] = position.x;
-        m[1][0] = scale.x * rot3x3[1][0]; m[1][1] = scale.y * rot3x3[1][1]; m[1][2] = scale.z * rot3x3[1][2]; m[1][3] = position.y;
-        m[2][0] = scale.x * rot3x3[2][0]; m[2][1] = scale.y * rot3x3[2][1]; m[2][2] = scale.z * rot3x3[2][2]; m[2][3] = position.z;
-
-        // No projection term
-        m[3][0] = 0; m[3][1] = 0; m[3][2] = 0; m[3][3] = 1;
-    }
-    //-----------------------------------------------------------------------
-    void Matrix4::makeInverseTransform(const Vector3& position, const Vector3& scale, const Quaternion& orientation)
-    {
-        // Invert the parameters
-        Vector3 invTranslate = -position;
-        Vector3 invScale(1 / scale.x, 1 / scale.y, 1 / scale.z);
-        Quaternion invRot = orientation.Inverse();
-
-        // Because we're inverting, order is translation, rotation, scale
-        // So make translation relative to scale & rotation
-        invTranslate = invRot * invTranslate; // rotate
-        invTranslate *= invScale; // scale
-
-        // Next, make a 3x3 rotation matrix
-        Matrix3 rot3x3;
-        invRot.ToRotationMatrix(rot3x3);
-
-        // Set up final matrix with scale, rotation and translation
-        m[0][0] = invScale.x * rot3x3[0][0]; m[0][1] = invScale.x * rot3x3[0][1]; m[0][2] = invScale.x * rot3x3[0][2]; m[0][3] = invTranslate.x;
-        m[1][0] = invScale.y * rot3x3[1][0]; m[1][1] = invScale.y * rot3x3[1][1]; m[1][2] = invScale.y * rot3x3[1][2]; m[1][3] = invTranslate.y;
-        m[2][0] = invScale.z * rot3x3[2][0]; m[2][1] = invScale.z * rot3x3[2][1]; m[2][2] = invScale.z * rot3x3[2][2]; m[2][3] = invTranslate.z;		
-
-        // No projection term
-        m[3][0] = 0; m[3][1] = 0; m[3][2] = 0; m[3][3] = 1;
-    }
-    //-----------------------------------------------------------------------
-	void Matrix4::decomposition(Vector3& position, Vector3& scale, Quaternion& orientation) const
-	{
-		assert(isAffine());
-
-		Matrix3 m3x3;
-		extract3x3Matrix(m3x3);
-
-		Matrix3 matQ;
-		Vector3 vecU;
-		m3x3.QDUDecomposition( matQ, scale, vecU ); 
-
-		orientation = Quaternion( matQ );
-		position = Vector3( m[0][3], m[1][3], m[2][3] );
-	}
-
-}

+ 0 - 659
CamelotRenderer/OgreMatrix4.h

@@ -1,659 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __Matrix4__
-#define __Matrix4__
-
-// Precompiler options
-#include "OgrePrerequisites.h"
-
-#include "OgreVector3.h"
-#include "OgreMatrix3.h"
-#include "OgreVector4.h"
-#include "OgrePlane.h"
-namespace CamelotEngine
-{
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Math
-	*  @{
-	*/
-	/** Class encapsulating a standard 4x4 homogeneous matrix.
-        @remarks
-            OGRE uses column vectors when applying matrix multiplications,
-            This means a vector is represented as a single column, 4-row
-            matrix. This has the effect that the transformations implemented
-            by the matrices happens right-to-left e.g. if vector V is to be
-            transformed by M1 then M2 then M3, the calculation would be
-            M3 * M2 * M1 * V. The order that matrices are concatenated is
-            vital since matrix multiplication is not commutative, i.e. you
-            can get a different result if you concatenate in the wrong order.
-        @par
-            The use of column vectors and right-to-left ordering is the
-            standard in most mathematical texts, and is the same as used in
-            OpenGL. It is, however, the opposite of Direct3D, which has
-            inexplicably chosen to differ from the accepted standard and uses
-            row vectors and left-to-right matrix multiplication.
-        @par
-            OGRE deals with the differences between D3D and OpenGL etc.
-            internally when operating through different render systems. OGRE
-            users only need to conform to standard maths conventions, i.e.
-            right-to-left matrix multiplication, (OGRE transposes matrices it
-            passes to D3D to compensate).
-        @par
-            The generic form M * V which shows the layout of the matrix 
-            entries is shown below:
-            <pre>
-                [ m[0][0]  m[0][1]  m[0][2]  m[0][3] ]   {x}
-                | m[1][0]  m[1][1]  m[1][2]  m[1][3] | * {y}
-                | m[2][0]  m[2][1]  m[2][2]  m[2][3] |   {z}
-                [ m[3][0]  m[3][1]  m[3][2]  m[3][3] ]   {1}
-            </pre>
-    */
-    class CM_EXPORT Matrix4
-    {
-    protected:
-        /// The matrix entries, indexed by [row][col].
-        union {
-            Real m[4][4];
-            Real _m[16];
-        };
-    public:
-        /** Default constructor.
-            @note
-                It does <b>NOT</b> initialize the matrix for efficiency.
-        */
-        inline Matrix4()
-        {
-        }
-
-        inline Matrix4(
-            Real m00, Real m01, Real m02, Real m03,
-            Real m10, Real m11, Real m12, Real m13,
-            Real m20, Real m21, Real m22, Real m23,
-            Real m30, Real m31, Real m32, Real m33 )
-        {
-            m[0][0] = m00;
-            m[0][1] = m01;
-            m[0][2] = m02;
-            m[0][3] = m03;
-            m[1][0] = m10;
-            m[1][1] = m11;
-            m[1][2] = m12;
-            m[1][3] = m13;
-            m[2][0] = m20;
-            m[2][1] = m21;
-            m[2][2] = m22;
-            m[2][3] = m23;
-            m[3][0] = m30;
-            m[3][1] = m31;
-            m[3][2] = m32;
-            m[3][3] = m33;
-        }
-
-        /** Creates a standard 4x4 transformation matrix with a zero translation part from a rotation/scaling 3x3 matrix.
-         */
-
-        inline Matrix4(const Matrix3& m3x3)
-        {
-          operator=(IDENTITY);
-          operator=(m3x3);
-        }
-
-        /** Creates a standard 4x4 transformation matrix with a zero translation part from a rotation/scaling Quaternion.
-         */
-        
-        inline Matrix4(const Quaternion& rot)
-        {
-          Matrix3 m3x3;
-          rot.ToRotationMatrix(m3x3);
-          operator=(IDENTITY);
-          operator=(m3x3);
-        }
-        
-
-		/** Exchange the contents of this matrix with another. 
-		*/
-		inline void swap(Matrix4& other)
-		{
-			std::swap(m[0][0], other.m[0][0]);
-			std::swap(m[0][1], other.m[0][1]);
-			std::swap(m[0][2], other.m[0][2]);
-			std::swap(m[0][3], other.m[0][3]);
-			std::swap(m[1][0], other.m[1][0]);
-			std::swap(m[1][1], other.m[1][1]);
-			std::swap(m[1][2], other.m[1][2]);
-			std::swap(m[1][3], other.m[1][3]);
-			std::swap(m[2][0], other.m[2][0]);
-			std::swap(m[2][1], other.m[2][1]);
-			std::swap(m[2][2], other.m[2][2]);
-			std::swap(m[2][3], other.m[2][3]);
-			std::swap(m[3][0], other.m[3][0]);
-			std::swap(m[3][1], other.m[3][1]);
-			std::swap(m[3][2], other.m[3][2]);
-			std::swap(m[3][3], other.m[3][3]);
-		}
-
-		inline Real* operator [] ( size_t iRow )
-        {
-            assert( iRow < 4 );
-            return m[iRow];
-        }
-
-        inline const Real *operator [] ( size_t iRow ) const
-        {
-            assert( iRow < 4 );
-            return m[iRow];
-        }
-
-        inline Matrix4 concatenate(const Matrix4 &m2) const
-        {
-            Matrix4 r;
-            r.m[0][0] = m[0][0] * m2.m[0][0] + m[0][1] * m2.m[1][0] + m[0][2] * m2.m[2][0] + m[0][3] * m2.m[3][0];
-            r.m[0][1] = m[0][0] * m2.m[0][1] + m[0][1] * m2.m[1][1] + m[0][2] * m2.m[2][1] + m[0][3] * m2.m[3][1];
-            r.m[0][2] = m[0][0] * m2.m[0][2] + m[0][1] * m2.m[1][2] + m[0][2] * m2.m[2][2] + m[0][3] * m2.m[3][2];
-            r.m[0][3] = m[0][0] * m2.m[0][3] + m[0][1] * m2.m[1][3] + m[0][2] * m2.m[2][3] + m[0][3] * m2.m[3][3];
-
-            r.m[1][0] = m[1][0] * m2.m[0][0] + m[1][1] * m2.m[1][0] + m[1][2] * m2.m[2][0] + m[1][3] * m2.m[3][0];
-            r.m[1][1] = m[1][0] * m2.m[0][1] + m[1][1] * m2.m[1][1] + m[1][2] * m2.m[2][1] + m[1][3] * m2.m[3][1];
-            r.m[1][2] = m[1][0] * m2.m[0][2] + m[1][1] * m2.m[1][2] + m[1][2] * m2.m[2][2] + m[1][3] * m2.m[3][2];
-            r.m[1][3] = m[1][0] * m2.m[0][3] + m[1][1] * m2.m[1][3] + m[1][2] * m2.m[2][3] + m[1][3] * m2.m[3][3];
-
-            r.m[2][0] = m[2][0] * m2.m[0][0] + m[2][1] * m2.m[1][0] + m[2][2] * m2.m[2][0] + m[2][3] * m2.m[3][0];
-            r.m[2][1] = m[2][0] * m2.m[0][1] + m[2][1] * m2.m[1][1] + m[2][2] * m2.m[2][1] + m[2][3] * m2.m[3][1];
-            r.m[2][2] = m[2][0] * m2.m[0][2] + m[2][1] * m2.m[1][2] + m[2][2] * m2.m[2][2] + m[2][3] * m2.m[3][2];
-            r.m[2][3] = m[2][0] * m2.m[0][3] + m[2][1] * m2.m[1][3] + m[2][2] * m2.m[2][3] + m[2][3] * m2.m[3][3];
-
-            r.m[3][0] = m[3][0] * m2.m[0][0] + m[3][1] * m2.m[1][0] + m[3][2] * m2.m[2][0] + m[3][3] * m2.m[3][0];
-            r.m[3][1] = m[3][0] * m2.m[0][1] + m[3][1] * m2.m[1][1] + m[3][2] * m2.m[2][1] + m[3][3] * m2.m[3][1];
-            r.m[3][2] = m[3][0] * m2.m[0][2] + m[3][1] * m2.m[1][2] + m[3][2] * m2.m[2][2] + m[3][3] * m2.m[3][2];
-            r.m[3][3] = m[3][0] * m2.m[0][3] + m[3][1] * m2.m[1][3] + m[3][2] * m2.m[2][3] + m[3][3] * m2.m[3][3];
-
-            return r;
-        }
-
-        /** Matrix concatenation using '*'.
-        */
-        inline Matrix4 operator * ( const Matrix4 &m2 ) const
-        {
-            return concatenate( m2 );
-        }
-
-        /** Vector transformation using '*'.
-            @remarks
-                Transforms the given 3-D vector by the matrix, projecting the 
-                result back into <i>w</i> = 1.
-            @note
-                This means that the initial <i>w</i> is considered to be 1.0,
-                and then all the tree elements of the resulting 3-D vector are
-                divided by the resulting <i>w</i>.
-        */
-        inline Vector3 operator * ( const Vector3 &v ) const
-        {
-            Vector3 r;
-
-            Real fInvW = 1.0f / ( m[3][0] * v.x + m[3][1] * v.y + m[3][2] * v.z + m[3][3] );
-
-            r.x = ( m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] ) * fInvW;
-            r.y = ( m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] ) * fInvW;
-            r.z = ( m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] ) * fInvW;
-
-            return r;
-        }
-        inline Vector4 operator * (const Vector4& v) const
-        {
-            return Vector4(
-                m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] * v.w, 
-                m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] * v.w,
-                m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] * v.w,
-                m[3][0] * v.x + m[3][1] * v.y + m[3][2] * v.z + m[3][3] * v.w
-                );
-        }
-        inline Plane operator * (const Plane& p) const
-        {
-            Plane ret;
-			Matrix4 invTrans = inverse().transpose();
-			Vector4 v4( p.normal.x, p.normal.y, p.normal.z, p.d );
-			v4 = invTrans * v4;
-			ret.normal.x = v4.x; 
-			ret.normal.y = v4.y; 
-			ret.normal.z = v4.z;
-			ret.d = v4.w / ret.normal.normalise();
-
-            return ret;
-        }
-
-
-        /** Matrix addition.
-        */
-        inline Matrix4 operator + ( const Matrix4 &m2 ) const
-        {
-            Matrix4 r;
-
-            r.m[0][0] = m[0][0] + m2.m[0][0];
-            r.m[0][1] = m[0][1] + m2.m[0][1];
-            r.m[0][2] = m[0][2] + m2.m[0][2];
-            r.m[0][3] = m[0][3] + m2.m[0][3];
-
-            r.m[1][0] = m[1][0] + m2.m[1][0];
-            r.m[1][1] = m[1][1] + m2.m[1][1];
-            r.m[1][2] = m[1][2] + m2.m[1][2];
-            r.m[1][3] = m[1][3] + m2.m[1][3];
-
-            r.m[2][0] = m[2][0] + m2.m[2][0];
-            r.m[2][1] = m[2][1] + m2.m[2][1];
-            r.m[2][2] = m[2][2] + m2.m[2][2];
-            r.m[2][3] = m[2][3] + m2.m[2][3];
-
-            r.m[3][0] = m[3][0] + m2.m[3][0];
-            r.m[3][1] = m[3][1] + m2.m[3][1];
-            r.m[3][2] = m[3][2] + m2.m[3][2];
-            r.m[3][3] = m[3][3] + m2.m[3][3];
-
-            return r;
-        }
-
-        /** Matrix subtraction.
-        */
-        inline Matrix4 operator - ( const Matrix4 &m2 ) const
-        {
-            Matrix4 r;
-            r.m[0][0] = m[0][0] - m2.m[0][0];
-            r.m[0][1] = m[0][1] - m2.m[0][1];
-            r.m[0][2] = m[0][2] - m2.m[0][2];
-            r.m[0][3] = m[0][3] - m2.m[0][3];
-
-            r.m[1][0] = m[1][0] - m2.m[1][0];
-            r.m[1][1] = m[1][1] - m2.m[1][1];
-            r.m[1][2] = m[1][2] - m2.m[1][2];
-            r.m[1][3] = m[1][3] - m2.m[1][3];
-
-            r.m[2][0] = m[2][0] - m2.m[2][0];
-            r.m[2][1] = m[2][1] - m2.m[2][1];
-            r.m[2][2] = m[2][2] - m2.m[2][2];
-            r.m[2][3] = m[2][3] - m2.m[2][3];
-
-            r.m[3][0] = m[3][0] - m2.m[3][0];
-            r.m[3][1] = m[3][1] - m2.m[3][1];
-            r.m[3][2] = m[3][2] - m2.m[3][2];
-            r.m[3][3] = m[3][3] - m2.m[3][3];
-
-            return r;
-        }
-
-        /** Tests 2 matrices for equality.
-        */
-        inline bool operator == ( const Matrix4& m2 ) const
-        {
-            if( 
-                m[0][0] != m2.m[0][0] || m[0][1] != m2.m[0][1] || m[0][2] != m2.m[0][2] || m[0][3] != m2.m[0][3] ||
-                m[1][0] != m2.m[1][0] || m[1][1] != m2.m[1][1] || m[1][2] != m2.m[1][2] || m[1][3] != m2.m[1][3] ||
-                m[2][0] != m2.m[2][0] || m[2][1] != m2.m[2][1] || m[2][2] != m2.m[2][2] || m[2][3] != m2.m[2][3] ||
-                m[3][0] != m2.m[3][0] || m[3][1] != m2.m[3][1] || m[3][2] != m2.m[3][2] || m[3][3] != m2.m[3][3] )
-                return false;
-            return true;
-        }
-
-        /** Tests 2 matrices for inequality.
-        */
-        inline bool operator != ( const Matrix4& m2 ) const
-        {
-            if( 
-                m[0][0] != m2.m[0][0] || m[0][1] != m2.m[0][1] || m[0][2] != m2.m[0][2] || m[0][3] != m2.m[0][3] ||
-                m[1][0] != m2.m[1][0] || m[1][1] != m2.m[1][1] || m[1][2] != m2.m[1][2] || m[1][3] != m2.m[1][3] ||
-                m[2][0] != m2.m[2][0] || m[2][1] != m2.m[2][1] || m[2][2] != m2.m[2][2] || m[2][3] != m2.m[2][3] ||
-                m[3][0] != m2.m[3][0] || m[3][1] != m2.m[3][1] || m[3][2] != m2.m[3][2] || m[3][3] != m2.m[3][3] )
-                return true;
-            return false;
-        }
-
-        /** Assignment from 3x3 matrix.
-        */
-        inline void operator = ( const Matrix3& mat3 )
-        {
-            m[0][0] = mat3.m[0][0]; m[0][1] = mat3.m[0][1]; m[0][2] = mat3.m[0][2];
-            m[1][0] = mat3.m[1][0]; m[1][1] = mat3.m[1][1]; m[1][2] = mat3.m[1][2];
-            m[2][0] = mat3.m[2][0]; m[2][1] = mat3.m[2][1]; m[2][2] = mat3.m[2][2];
-        }
-
-        inline Matrix4 transpose(void) const
-        {
-            return Matrix4(m[0][0], m[1][0], m[2][0], m[3][0],
-                           m[0][1], m[1][1], m[2][1], m[3][1],
-                           m[0][2], m[1][2], m[2][2], m[3][2],
-                           m[0][3], m[1][3], m[2][3], m[3][3]);
-        }
-
-        /*
-        -----------------------------------------------------------------------
-        Translation Transformation
-        -----------------------------------------------------------------------
-        */
-        /** Sets the translation transformation part of the matrix.
-        */
-        inline void setTrans( const Vector3& v )
-        {
-            m[0][3] = v.x;
-            m[1][3] = v.y;
-            m[2][3] = v.z;
-        }
-
-        /** Extracts the translation transformation part of the matrix.
-         */
-        inline Vector3 getTrans() const
-        {
-          return Vector3(m[0][3], m[1][3], m[2][3]);
-        }
-        
-
-        /** Builds a translation matrix
-        */
-        inline void makeTrans( const Vector3& v )
-        {
-            m[0][0] = 1.0; m[0][1] = 0.0; m[0][2] = 0.0; m[0][3] = v.x;
-            m[1][0] = 0.0; m[1][1] = 1.0; m[1][2] = 0.0; m[1][3] = v.y;
-            m[2][0] = 0.0; m[2][1] = 0.0; m[2][2] = 1.0; m[2][3] = v.z;
-            m[3][0] = 0.0; m[3][1] = 0.0; m[3][2] = 0.0; m[3][3] = 1.0;
-        }
-
-        inline void makeTrans( Real tx, Real ty, Real tz )
-        {
-            m[0][0] = 1.0; m[0][1] = 0.0; m[0][2] = 0.0; m[0][3] = tx;
-            m[1][0] = 0.0; m[1][1] = 1.0; m[1][2] = 0.0; m[1][3] = ty;
-            m[2][0] = 0.0; m[2][1] = 0.0; m[2][2] = 1.0; m[2][3] = tz;
-            m[3][0] = 0.0; m[3][1] = 0.0; m[3][2] = 0.0; m[3][3] = 1.0;
-        }
-
-        /** Gets a translation matrix.
-        */
-        inline static Matrix4 getTrans( const Vector3& v )
-        {
-            Matrix4 r;
-
-            r.m[0][0] = 1.0; r.m[0][1] = 0.0; r.m[0][2] = 0.0; r.m[0][3] = v.x;
-            r.m[1][0] = 0.0; r.m[1][1] = 1.0; r.m[1][2] = 0.0; r.m[1][3] = v.y;
-            r.m[2][0] = 0.0; r.m[2][1] = 0.0; r.m[2][2] = 1.0; r.m[2][3] = v.z;
-            r.m[3][0] = 0.0; r.m[3][1] = 0.0; r.m[3][2] = 0.0; r.m[3][3] = 1.0;
-
-            return r;
-        }
-
-        /** Gets a translation matrix - variation for not using a vector.
-        */
-        inline static Matrix4 getTrans( Real t_x, Real t_y, Real t_z )
-        {
-            Matrix4 r;
-
-            r.m[0][0] = 1.0; r.m[0][1] = 0.0; r.m[0][2] = 0.0; r.m[0][3] = t_x;
-            r.m[1][0] = 0.0; r.m[1][1] = 1.0; r.m[1][2] = 0.0; r.m[1][3] = t_y;
-            r.m[2][0] = 0.0; r.m[2][1] = 0.0; r.m[2][2] = 1.0; r.m[2][3] = t_z;
-            r.m[3][0] = 0.0; r.m[3][1] = 0.0; r.m[3][2] = 0.0; r.m[3][3] = 1.0;
-
-            return r;
-        }
-
-        /*
-        -----------------------------------------------------------------------
-        Scale Transformation
-        -----------------------------------------------------------------------
-        */
-        /** Sets the scale part of the matrix.
-        */
-        inline void setScale( const Vector3& v )
-        {
-            m[0][0] = v.x;
-            m[1][1] = v.y;
-            m[2][2] = v.z;
-        }
-
-        /** Gets a scale matrix.
-        */
-        inline static Matrix4 getScale( const Vector3& v )
-        {
-            Matrix4 r;
-            r.m[0][0] = v.x; r.m[0][1] = 0.0; r.m[0][2] = 0.0; r.m[0][3] = 0.0;
-            r.m[1][0] = 0.0; r.m[1][1] = v.y; r.m[1][2] = 0.0; r.m[1][3] = 0.0;
-            r.m[2][0] = 0.0; r.m[2][1] = 0.0; r.m[2][2] = v.z; r.m[2][3] = 0.0;
-            r.m[3][0] = 0.0; r.m[3][1] = 0.0; r.m[3][2] = 0.0; r.m[3][3] = 1.0;
-
-            return r;
-        }
-
-        /** Gets a scale matrix - variation for not using a vector.
-        */
-        inline static Matrix4 getScale( Real s_x, Real s_y, Real s_z )
-        {
-            Matrix4 r;
-            r.m[0][0] = s_x; r.m[0][1] = 0.0; r.m[0][2] = 0.0; r.m[0][3] = 0.0;
-            r.m[1][0] = 0.0; r.m[1][1] = s_y; r.m[1][2] = 0.0; r.m[1][3] = 0.0;
-            r.m[2][0] = 0.0; r.m[2][1] = 0.0; r.m[2][2] = s_z; r.m[2][3] = 0.0;
-            r.m[3][0] = 0.0; r.m[3][1] = 0.0; r.m[3][2] = 0.0; r.m[3][3] = 1.0;
-
-            return r;
-        }
-
-        /** Extracts the rotation / scaling part of the Matrix as a 3x3 matrix. 
-        @param m3x3 Destination Matrix3
-        */
-        inline void extract3x3Matrix(Matrix3& m3x3) const
-        {
-            m3x3.m[0][0] = m[0][0];
-            m3x3.m[0][1] = m[0][1];
-            m3x3.m[0][2] = m[0][2];
-            m3x3.m[1][0] = m[1][0];
-            m3x3.m[1][1] = m[1][1];
-            m3x3.m[1][2] = m[1][2];
-            m3x3.m[2][0] = m[2][0];
-            m3x3.m[2][1] = m[2][1];
-            m3x3.m[2][2] = m[2][2];
-
-        }
-
-		/** Determines if this matrix involves a scaling. */
-		inline bool hasScale() const
-		{
-			// check magnitude of column vectors (==local axes)
-			Real t = m[0][0] * m[0][0] + m[1][0] * m[1][0] + m[2][0] * m[2][0];
-			if (!Math::RealEqual(t, 1.0, (Real)1e-04))
-				return true;
-			t = m[0][1] * m[0][1] + m[1][1] * m[1][1] + m[2][1] * m[2][1];
-			if (!Math::RealEqual(t, 1.0, (Real)1e-04))
-				return true;
-			t = m[0][2] * m[0][2] + m[1][2] * m[1][2] + m[2][2] * m[2][2];
-			if (!Math::RealEqual(t, 1.0, (Real)1e-04))
-				return true;
-
-			return false;
-		}
-
-		/** Determines if this matrix involves a negative scaling. */
-		inline bool hasNegativeScale() const
-		{
-			return determinant() < 0;
-		}
-
-		/** Extracts the rotation / scaling part as a quaternion from the Matrix.
-         */
-        inline Quaternion extractQuaternion() const
-        {
-          Matrix3 m3x3;
-          extract3x3Matrix(m3x3);
-          return Quaternion(m3x3);
-        }
-
-        static const Matrix4 ZERO;
-        static const Matrix4 IDENTITY;
-        /** Useful little matrix which takes 2D clipspace {-1, 1} to {0,1}
-            and inverts the Y. */
-        static const Matrix4 CLIPSPACE2DTOIMAGESPACE;
-
-        inline Matrix4 operator*(Real scalar) const
-        {
-            return Matrix4(
-                scalar*m[0][0], scalar*m[0][1], scalar*m[0][2], scalar*m[0][3],
-                scalar*m[1][0], scalar*m[1][1], scalar*m[1][2], scalar*m[1][3],
-                scalar*m[2][0], scalar*m[2][1], scalar*m[2][2], scalar*m[2][3],
-                scalar*m[3][0], scalar*m[3][1], scalar*m[3][2], scalar*m[3][3]);
-        }
-
-        /** Function for writing to a stream.
-        */
-        inline CM_EXPORT friend std::ostream& operator <<
-            ( std::ostream& o, const Matrix4& mat )
-        {
-            o << "Matrix4(";
-			for (size_t i = 0; i < 4; ++i)
-            {
-                o << " row" << (unsigned)i << "{";
-                for(size_t j = 0; j < 4; ++j)
-                {
-                    o << mat[i][j] << " ";
-                }
-                o << "}";
-            }
-            o << ")";
-            return o;
-        }
-		
-		Matrix4 adjoint() const;
-		Real determinant() const;
-		Matrix4 inverse() const;
-
-        /** Building a Matrix4 from orientation / scale / position.
-        @remarks
-            Transform is performed in the order scale, rotate, translation, i.e. translation is independent
-            of orientation axes, scale does not affect size of translation, rotation and scaling are always
-            centered on the origin.
-        */
-        void makeTransform(const Vector3& position, const Vector3& scale, const Quaternion& orientation);
-
-        /** Building an inverse Matrix4 from orientation / scale / position.
-        @remarks
-            As makeTransform except it build the inverse given the same data as makeTransform, so
-            performing -translation, -rotate, 1/scale in that order.
-        */
-        void makeInverseTransform(const Vector3& position, const Vector3& scale, const Quaternion& orientation);
-
-        /** Decompose a Matrix4 to orientation / scale / position.
-        */
-        void decomposition(Vector3& position, Vector3& scale, Quaternion& orientation) const;
-
-        /** Check whether or not the matrix is affine matrix.
-            @remarks
-                An affine matrix is a 4x4 matrix with row 3 equal to (0, 0, 0, 1),
-                e.g. no projective coefficients.
-        */
-        inline bool isAffine(void) const
-        {
-            return m[3][0] == 0 && m[3][1] == 0 && m[3][2] == 0 && m[3][3] == 1;
-        }
-
-        /** Returns the inverse of the affine matrix.
-            @note
-                The matrix must be an affine matrix. @see Matrix4::isAffine.
-        */
-        Matrix4 inverseAffine(void) const;
-
-        /** Concatenate two affine matrices.
-            @note
-                The matrices must be affine matrix. @see Matrix4::isAffine.
-        */
-        inline Matrix4 concatenateAffine(const Matrix4 &m2) const
-        {
-            assert(isAffine() && m2.isAffine());
-
-            return Matrix4(
-                m[0][0] * m2.m[0][0] + m[0][1] * m2.m[1][0] + m[0][2] * m2.m[2][0],
-                m[0][0] * m2.m[0][1] + m[0][1] * m2.m[1][1] + m[0][2] * m2.m[2][1],
-                m[0][0] * m2.m[0][2] + m[0][1] * m2.m[1][2] + m[0][2] * m2.m[2][2],
-                m[0][0] * m2.m[0][3] + m[0][1] * m2.m[1][3] + m[0][2] * m2.m[2][3] + m[0][3],
-
-                m[1][0] * m2.m[0][0] + m[1][1] * m2.m[1][0] + m[1][2] * m2.m[2][0],
-                m[1][0] * m2.m[0][1] + m[1][1] * m2.m[1][1] + m[1][2] * m2.m[2][1],
-                m[1][0] * m2.m[0][2] + m[1][1] * m2.m[1][2] + m[1][2] * m2.m[2][2],
-                m[1][0] * m2.m[0][3] + m[1][1] * m2.m[1][3] + m[1][2] * m2.m[2][3] + m[1][3],
-
-                m[2][0] * m2.m[0][0] + m[2][1] * m2.m[1][0] + m[2][2] * m2.m[2][0],
-                m[2][0] * m2.m[0][1] + m[2][1] * m2.m[1][1] + m[2][2] * m2.m[2][1],
-                m[2][0] * m2.m[0][2] + m[2][1] * m2.m[1][2] + m[2][2] * m2.m[2][2],
-                m[2][0] * m2.m[0][3] + m[2][1] * m2.m[1][3] + m[2][2] * m2.m[2][3] + m[2][3],
-
-                0, 0, 0, 1);
-        }
-
-        /** 3-D Vector transformation specially for an affine matrix.
-            @remarks
-                Transforms the given 3-D vector by the matrix, projecting the 
-                result back into <i>w</i> = 1.
-            @note
-                The matrix must be an affine matrix. @see Matrix4::isAffine.
-        */
-        inline Vector3 transformAffine(const Vector3& v) const
-        {
-            assert(isAffine());
-
-            return Vector3(
-                    m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3], 
-                    m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3],
-                    m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3]);
-        }
-
-        /** 4-D Vector transformation specially for an affine matrix.
-            @note
-                The matrix must be an affine matrix. @see Matrix4::isAffine.
-        */
-        inline Vector4 transformAffine(const Vector4& v) const
-        {
-            assert(isAffine());
-
-            return Vector4(
-                m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] * v.w, 
-                m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] * v.w,
-                m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] * v.w,
-                v.w);
-        }
-    };
-
-    /* Removed from Vector4 and made a non-member here because otherwise
-       OgreMatrix4.h and OgreVector4.h have to try to include and inline each 
-       other, which frankly doesn't work ;)
-   */
-    inline Vector4 operator * (const Vector4& v, const Matrix4& mat)
-    {
-        return Vector4(
-            v.x*mat[0][0] + v.y*mat[1][0] + v.z*mat[2][0] + v.w*mat[3][0],
-            v.x*mat[0][1] + v.y*mat[1][1] + v.z*mat[2][1] + v.w*mat[3][1],
-            v.x*mat[0][2] + v.y*mat[1][2] + v.z*mat[2][2] + v.w*mat[3][2],
-            v.x*mat[0][3] + v.y*mat[1][3] + v.z*mat[2][3] + v.w*mat[3][3]
-            );
-    }
-	/** @} */
-	/** @} */
-
-}
-#endif

+ 59 - 59
CamelotRenderer/OgrePixelFormat.cpp

@@ -47,7 +47,7 @@ namespace CamelotEngine {
         /* Pixel format flags, see enum PixelFormatFlags for the bit field
         /* Pixel format flags, see enum PixelFormatFlags for the bit field
         * definitions
         * definitions
         */
         */
-        uint32 flags;
+        UINT32 flags;
         /** Component type
         /** Component type
          */
          */
         PixelComponentType componentType;
         PixelComponentType componentType;
@@ -59,7 +59,7 @@ namespace CamelotEngine {
         unsigned char rbits,gbits,bbits,abits; /*, ibits, dbits, ... */
         unsigned char rbits,gbits,bbits,abits; /*, ibits, dbits, ... */
 
 
         /* Masks and shifts as used by packers/unpackers */
         /* Masks and shifts as used by packers/unpackers */
-        uint32 rmask, gmask, bmask, amask;
+        UINT32 rmask, gmask, bmask, amask;
         unsigned char rshift, gshift, bshift, ashift;
         unsigned char rshift, gshift, bshift, ashift;
     };
     };
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
@@ -654,7 +654,7 @@ namespace CamelotEngine {
 		// Notice how we do not propagate left/top/front from the incoming box, since
 		// Notice how we do not propagate left/top/front from the incoming box, since
 		// the returned pointer is already offset
 		// the returned pointer is already offset
 		PixelBox rval(def.getWidth(), def.getHeight(), def.getDepth(), format, 
 		PixelBox rval(def.getWidth(), def.getHeight(), def.getDepth(), format, 
-			((uint8*)data) + ((def.left-left)*elemSize)
+			((UINT8*)data) + ((def.left-left)*elemSize)
 			+ ((def.top-top)*rowPitch*elemSize)
 			+ ((def.top-top)*rowPitch*elemSize)
 			+ ((def.front-front)*slicePitch*elemSize)
 			+ ((def.front-front)*slicePitch*elemSize)
 		);
 		);
@@ -792,7 +792,7 @@ namespace CamelotEngine {
         rgba[3] = des.abits;
         rgba[3] = des.abits;
     }
     }
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	void PixelUtil::getBitMasks(PixelFormat format, uint32 rgba[4])
+	void PixelUtil::getBitMasks(PixelFormat format, UINT32 rgba[4])
     {
     {
         const PixelFormatDescription &des = getDescriptionFor(format);
         const PixelFormatDescription &des = getDescriptionFor(format);
         rgba[0] = des.rmask;
         rgba[0] = des.rmask;
@@ -885,7 +885,7 @@ namespace CamelotEngine {
         return result;
         return result;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    PixelFormat PixelUtil::getFormatForBitDepths(PixelFormat fmt, ushort integerBits, ushort floatBits)
+    PixelFormat PixelUtil::getFormatForBitDepths(PixelFormat fmt, UINT16 integerBits, UINT16 floatBits)
     {
     {
         switch (integerBits)
         switch (integerBits)
         {
         {
@@ -996,7 +996,7 @@ namespace CamelotEngine {
         packColour(colour.r, colour.g, colour.b, colour.a, pf, dest);
         packColour(colour.r, colour.g, colour.b, colour.a, pf, dest);
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void PixelUtil::packColour(const uint8 r, const uint8 g, const uint8 b, const uint8 a, const PixelFormat pf,  void* dest)
+    void PixelUtil::packColour(const UINT8 r, const UINT8 g, const UINT8 b, const UINT8 a, const PixelFormat pf,  void* dest)
     {
     {
         const PixelFormatDescription &des = getDescriptionFor(pf);
         const PixelFormatDescription &des = getDescriptionFor(pf);
         if(des.flags & PFF_NATIVEENDIAN) {
         if(des.flags & PFF_NATIVEENDIAN) {
@@ -1048,37 +1048,37 @@ namespace CamelotEngine {
                 ((float*)dest)[3] = a;
                 ((float*)dest)[3] = a;
                 break;
                 break;
             case PF_FLOAT16_R:
             case PF_FLOAT16_R:
-                ((uint16*)dest)[0] = Bitwise::floatToHalf(r);
+                ((UINT16*)dest)[0] = Bitwise::floatToHalf(r);
                 break;
                 break;
 			case PF_FLOAT16_GR:
 			case PF_FLOAT16_GR:
-				((uint16*)dest)[0] = Bitwise::floatToHalf(g);
-				((uint16*)dest)[1] = Bitwise::floatToHalf(r);
+				((UINT16*)dest)[0] = Bitwise::floatToHalf(g);
+				((UINT16*)dest)[1] = Bitwise::floatToHalf(r);
 				break;
 				break;
             case PF_FLOAT16_RGB:
             case PF_FLOAT16_RGB:
-                ((uint16*)dest)[0] = Bitwise::floatToHalf(r);
-                ((uint16*)dest)[1] = Bitwise::floatToHalf(g);
-                ((uint16*)dest)[2] = Bitwise::floatToHalf(b);
+                ((UINT16*)dest)[0] = Bitwise::floatToHalf(r);
+                ((UINT16*)dest)[1] = Bitwise::floatToHalf(g);
+                ((UINT16*)dest)[2] = Bitwise::floatToHalf(b);
                 break;
                 break;
             case PF_FLOAT16_RGBA:
             case PF_FLOAT16_RGBA:
-                ((uint16*)dest)[0] = Bitwise::floatToHalf(r);
-                ((uint16*)dest)[1] = Bitwise::floatToHalf(g);
-                ((uint16*)dest)[2] = Bitwise::floatToHalf(b);
-                ((uint16*)dest)[3] = Bitwise::floatToHalf(a);
+                ((UINT16*)dest)[0] = Bitwise::floatToHalf(r);
+                ((UINT16*)dest)[1] = Bitwise::floatToHalf(g);
+                ((UINT16*)dest)[2] = Bitwise::floatToHalf(b);
+                ((UINT16*)dest)[3] = Bitwise::floatToHalf(a);
                 break;
                 break;
             case PF_SHORT_RGB:
             case PF_SHORT_RGB:
-				((uint16*)dest)[0] = (uint16)Bitwise::floatToFixed(r, 16);
-                ((uint16*)dest)[1] = (uint16)Bitwise::floatToFixed(g, 16);
-                ((uint16*)dest)[2] = (uint16)Bitwise::floatToFixed(b, 16);
+				((UINT16*)dest)[0] = (UINT16)Bitwise::floatToFixed(r, 16);
+                ((UINT16*)dest)[1] = (UINT16)Bitwise::floatToFixed(g, 16);
+                ((UINT16*)dest)[2] = (UINT16)Bitwise::floatToFixed(b, 16);
                 break;
                 break;
 			case PF_SHORT_RGBA:
 			case PF_SHORT_RGBA:
-				((uint16*)dest)[0] = (uint16)Bitwise::floatToFixed(r, 16);
-                ((uint16*)dest)[1] = (uint16)Bitwise::floatToFixed(g, 16);
-                ((uint16*)dest)[2] = (uint16)Bitwise::floatToFixed(b, 16);
-                ((uint16*)dest)[3] = (uint16)Bitwise::floatToFixed(a, 16);
+				((UINT16*)dest)[0] = (UINT16)Bitwise::floatToFixed(r, 16);
+                ((UINT16*)dest)[1] = (UINT16)Bitwise::floatToFixed(g, 16);
+                ((UINT16*)dest)[2] = (UINT16)Bitwise::floatToFixed(b, 16);
+                ((UINT16*)dest)[3] = (UINT16)Bitwise::floatToFixed(a, 16);
 				break;
 				break;
 			case PF_BYTE_LA:
 			case PF_BYTE_LA:
-				((uint8*)dest)[0] = (uint8)Bitwise::floatToFixed(r, 8);
-                ((uint8*)dest)[1] = (uint8)Bitwise::floatToFixed(a, 8);
+				((UINT8*)dest)[0] = (UINT8)Bitwise::floatToFixed(r, 8);
+                ((UINT8*)dest)[1] = (UINT8)Bitwise::floatToFixed(a, 8);
 				break;
 				break;
             default:
             default:
                 // Not yet supported
                 // Not yet supported
@@ -1096,7 +1096,7 @@ namespace CamelotEngine {
         unpackColour(&colour->r, &colour->g, &colour->b, &colour->a, pf, src);
         unpackColour(&colour->r, &colour->g, &colour->b, &colour->a, pf, src);
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void PixelUtil::unpackColour(uint8 *r, uint8 *g, uint8 *b, uint8 *a, PixelFormat pf,  const void* src)
+    void PixelUtil::unpackColour(UINT8 *r, UINT8 *g, UINT8 *b, UINT8 *a, PixelFormat pf,  const void* src)
     {
     {
         const PixelFormatDescription &des = getDescriptionFor(pf);
         const PixelFormatDescription &des = getDescriptionFor(pf);
         if(des.flags & PFF_NATIVEENDIAN) {
         if(des.flags & PFF_NATIVEENDIAN) {
@@ -1105,18 +1105,18 @@ namespace CamelotEngine {
             if(des.flags & PFF_LUMINANCE)
             if(des.flags & PFF_LUMINANCE)
             {
             {
                 // Luminance format -- only rbits used
                 // Luminance format -- only rbits used
-                *r = *g = *b = (uint8)Bitwise::fixedToFixed(
+                *r = *g = *b = (UINT8)Bitwise::fixedToFixed(
                     (value & des.rmask)>>des.rshift, des.rbits, 8);
                     (value & des.rmask)>>des.rshift, des.rbits, 8);
             }
             }
             else
             else
             {
             {
-                *r = (uint8)Bitwise::fixedToFixed((value & des.rmask)>>des.rshift, des.rbits, 8);
-                *g = (uint8)Bitwise::fixedToFixed((value & des.gmask)>>des.gshift, des.gbits, 8);
-                *b = (uint8)Bitwise::fixedToFixed((value & des.bmask)>>des.bshift, des.bbits, 8);
+                *r = (UINT8)Bitwise::fixedToFixed((value & des.rmask)>>des.rshift, des.rbits, 8);
+                *g = (UINT8)Bitwise::fixedToFixed((value & des.gmask)>>des.gshift, des.gbits, 8);
+                *b = (UINT8)Bitwise::fixedToFixed((value & des.bmask)>>des.bshift, des.bbits, 8);
             }
             }
             if(des.flags & PFF_HASALPHA)
             if(des.flags & PFF_HASALPHA)
             {
             {
-                *a = (uint8)Bitwise::fixedToFixed((value & des.amask)>>des.ashift, des.abits, 8);
+                *a = (UINT8)Bitwise::fixedToFixed((value & des.amask)>>des.ashift, des.abits, 8);
             }
             }
             else
             else
             {
             {
@@ -1126,10 +1126,10 @@ namespace CamelotEngine {
             // Do the operation with the more generic floating point
             // Do the operation with the more generic floating point
             float rr, gg, bb, aa;
             float rr, gg, bb, aa;
             unpackColour(&rr,&gg,&bb,&aa, pf, src);
             unpackColour(&rr,&gg,&bb,&aa, pf, src);
-            *r = (uint8)Bitwise::floatToFixed(rr, 8);
-            *g = (uint8)Bitwise::floatToFixed(gg, 8);
-            *b = (uint8)Bitwise::floatToFixed(bb, 8);
-            *a = (uint8)Bitwise::floatToFixed(aa, 8);
+            *r = (UINT8)Bitwise::floatToFixed(rr, 8);
+            *g = (UINT8)Bitwise::floatToFixed(gg, 8);
+            *b = (UINT8)Bitwise::floatToFixed(bb, 8);
+            *a = (UINT8)Bitwise::floatToFixed(aa, 8);
         }
         }
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
@@ -1185,41 +1185,41 @@ namespace CamelotEngine {
                 *a = ((float*)src)[3];
                 *a = ((float*)src)[3];
                 break;
                 break;
             case PF_FLOAT16_R:
             case PF_FLOAT16_R:
-                *r = *g = *b = Bitwise::halfToFloat(((uint16*)src)[0]);
+                *r = *g = *b = Bitwise::halfToFloat(((UINT16*)src)[0]);
                 *a = 1.0f;
                 *a = 1.0f;
                 break;
                 break;
 			case PF_FLOAT16_GR:
 			case PF_FLOAT16_GR:
-				*g = Bitwise::halfToFloat(((uint16*)src)[0]);
-				*r = *b = Bitwise::halfToFloat(((uint16*)src)[1]);
+				*g = Bitwise::halfToFloat(((UINT16*)src)[0]);
+				*r = *b = Bitwise::halfToFloat(((UINT16*)src)[1]);
 				*a = 1.0f;
 				*a = 1.0f;
 				break;
 				break;
             case PF_FLOAT16_RGB:
             case PF_FLOAT16_RGB:
-                *r = Bitwise::halfToFloat(((uint16*)src)[0]);
-                *g = Bitwise::halfToFloat(((uint16*)src)[1]);
-                *b = Bitwise::halfToFloat(((uint16*)src)[2]);
+                *r = Bitwise::halfToFloat(((UINT16*)src)[0]);
+                *g = Bitwise::halfToFloat(((UINT16*)src)[1]);
+                *b = Bitwise::halfToFloat(((UINT16*)src)[2]);
                 *a = 1.0f;
                 *a = 1.0f;
                 break;
                 break;
             case PF_FLOAT16_RGBA:
             case PF_FLOAT16_RGBA:
-                *r = Bitwise::halfToFloat(((uint16*)src)[0]);
-                *g = Bitwise::halfToFloat(((uint16*)src)[1]);
-                *b = Bitwise::halfToFloat(((uint16*)src)[2]);
-                *a = Bitwise::halfToFloat(((uint16*)src)[3]);
+                *r = Bitwise::halfToFloat(((UINT16*)src)[0]);
+                *g = Bitwise::halfToFloat(((UINT16*)src)[1]);
+                *b = Bitwise::halfToFloat(((UINT16*)src)[2]);
+                *a = Bitwise::halfToFloat(((UINT16*)src)[3]);
                 break;
                 break;
 			case PF_SHORT_RGB:
 			case PF_SHORT_RGB:
-				*r = Bitwise::fixedToFloat(((uint16*)src)[0], 16);
-                *g = Bitwise::fixedToFloat(((uint16*)src)[1], 16);
-				*b = Bitwise::fixedToFloat(((uint16*)src)[2], 16);
+				*r = Bitwise::fixedToFloat(((UINT16*)src)[0], 16);
+                *g = Bitwise::fixedToFloat(((UINT16*)src)[1], 16);
+				*b = Bitwise::fixedToFloat(((UINT16*)src)[2], 16);
 				*a = 1.0f;
 				*a = 1.0f;
 				break;
 				break;
 			case PF_SHORT_RGBA:
 			case PF_SHORT_RGBA:
-				*r = Bitwise::fixedToFloat(((uint16*)src)[0], 16);
-                *g = Bitwise::fixedToFloat(((uint16*)src)[1], 16);
-				*b = Bitwise::fixedToFloat(((uint16*)src)[2], 16);
-				*a = Bitwise::fixedToFloat(((uint16*)src)[3], 16);
+				*r = Bitwise::fixedToFloat(((UINT16*)src)[0], 16);
+                *g = Bitwise::fixedToFloat(((UINT16*)src)[1], 16);
+				*b = Bitwise::fixedToFloat(((UINT16*)src)[2], 16);
+				*a = Bitwise::fixedToFloat(((UINT16*)src)[3], 16);
 				break;
 				break;
 			case PF_BYTE_LA:
 			case PF_BYTE_LA:
-				*r = *g = *b = Bitwise::fixedToFloat(((uint8*)src)[0], 8);
-				*a = Bitwise::fixedToFloat(((uint8*)src)[1], 8);
+				*r = *g = *b = Bitwise::fixedToFloat(((UINT8*)src)[0], 8);
+				*a = Bitwise::fixedToFloat(((UINT8*)src)[1], 8);
 				break;
 				break;
             default:
             default:
                 // Not yet supported
                 // Not yet supported
@@ -1274,9 +1274,9 @@ namespace CamelotEngine {
 
 
             const size_t srcPixelSize = PixelUtil::getNumElemBytes(src.format);
             const size_t srcPixelSize = PixelUtil::getNumElemBytes(src.format);
             const size_t dstPixelSize = PixelUtil::getNumElemBytes(dst.format);
             const size_t dstPixelSize = PixelUtil::getNumElemBytes(dst.format);
-            uint8 *srcptr = static_cast<uint8*>(src.data)
+            UINT8 *srcptr = static_cast<UINT8*>(src.data)
                 + (src.left + src.top * src.rowPitch + src.front * src.slicePitch) * srcPixelSize;
                 + (src.left + src.top * src.rowPitch + src.front * src.slicePitch) * srcPixelSize;
-            uint8 *dstptr = static_cast<uint8*>(dst.data)
+            UINT8 *dstptr = static_cast<UINT8*>(dst.data)
 				+ (dst.left + dst.top * dst.rowPitch + dst.front * dst.slicePitch) * dstPixelSize;
 				+ (dst.left + dst.top * dst.rowPitch + dst.front * dst.slicePitch) * dstPixelSize;
 
 
             // Calculate pitches+skips in bytes
             // Calculate pitches+skips in bytes
@@ -1328,13 +1328,13 @@ namespace CamelotEngine {
 
 
         const size_t srcPixelSize = PixelUtil::getNumElemBytes(src.format);
         const size_t srcPixelSize = PixelUtil::getNumElemBytes(src.format);
         const size_t dstPixelSize = PixelUtil::getNumElemBytes(dst.format);
         const size_t dstPixelSize = PixelUtil::getNumElemBytes(dst.format);
-        uint8 *srcptr = static_cast<uint8*>(src.data)
+        UINT8 *srcptr = static_cast<UINT8*>(src.data)
             + (src.left + src.top * src.rowPitch + src.front * src.slicePitch) * srcPixelSize;
             + (src.left + src.top * src.rowPitch + src.front * src.slicePitch) * srcPixelSize;
-        uint8 *dstptr = static_cast<uint8*>(dst.data)
+        UINT8 *dstptr = static_cast<UINT8*>(dst.data)
             + (dst.left + dst.top * dst.rowPitch + dst.front * dst.slicePitch) * dstPixelSize;
             + (dst.left + dst.top * dst.rowPitch + dst.front * dst.slicePitch) * dstPixelSize;
 		
 		
 		// Old way, not taking into account box dimensions
 		// Old way, not taking into account box dimensions
-		//uint8 *srcptr = static_cast<uint8*>(src.data), *dstptr = static_cast<uint8*>(dst.data);
+		//UINT8 *srcptr = static_cast<UINT8*>(src.data), *dstptr = static_cast<UINT8*>(dst.data);
 
 
         // Calculate pitches+skips in bytes
         // Calculate pitches+skips in bytes
         const size_t srcRowSkipBytes = src.getRowSkip()*srcPixelSize;
         const size_t srcRowSkipBytes = src.getRowSkip()*srcPixelSize;

+ 4 - 4
CamelotRenderer/OgrePixelFormat.h

@@ -379,7 +379,7 @@ namespace CamelotEngine {
 		/** Gives the masks for the R, G, B and A component
 		/** Gives the masks for the R, G, B and A component
 		  @note			Only valid for native endian formats
 		  @note			Only valid for native endian formats
         */
         */
-        static void getBitMasks(PixelFormat format, uint32 rgba[4]);
+        static void getBitMasks(PixelFormat format, UINT32 rgba[4]);
 
 
 		/** Gives the bit shifts for R, G, B and A component
 		/** Gives the bit shifts for R, G, B and A component
 		@note			Only valid for native endian formats
 		@note			Only valid for native endian formats
@@ -437,7 +437,7 @@ namespace CamelotEngine {
             @returns        The format that similar original format with bit depth according
             @returns        The format that similar original format with bit depth according
                             with preferred bit depth, or original format if no convertion occuring.
                             with preferred bit depth, or original format if no convertion occuring.
         */
         */
-        static PixelFormat getFormatForBitDepths(PixelFormat fmt, ushort integerBits, ushort floatBits);
+        static PixelFormat getFormatForBitDepths(PixelFormat fmt, UINT16 integerBits, UINT16 floatBits);
 
 
         /** Pack a colour value to memory
         /** Pack a colour value to memory
         	@param colour	The colour
         	@param colour	The colour
@@ -450,7 +450,7 @@ namespace CamelotEngine {
         	@param pf		Pixelformat in which to write the colour
         	@param pf		Pixelformat in which to write the colour
         	@param dest		Destination memory location
         	@param dest		Destination memory location
         */
         */
-        static void packColour(const uint8 r, const uint8 g, const uint8 b, const uint8 a, const PixelFormat pf,  void* dest);
+        static void packColour(const UINT8 r, const UINT8 g, const UINT8 b, const UINT8 a, const PixelFormat pf,  void* dest);
          /** Pack a colour value to memory
          /** Pack a colour value to memory
         	@param r,g,b,a	The four colour components, range 0.0f to 1.0f
         	@param r,g,b,a	The four colour components, range 0.0f to 1.0f
         					(an exception to this case exists for floating point pixel
         					(an exception to this case exists for floating point pixel
@@ -474,7 +474,7 @@ namespace CamelotEngine {
         		this will lose precision when coming from PF_A2R10G10B10 or floating
         		this will lose precision when coming from PF_A2R10G10B10 or floating
         		point formats.  
         		point formats.  
         */
         */
-        static void unpackColour(uint8 *r, uint8 *g, uint8 *b, uint8 *a, PixelFormat pf,  const void* src);
+        static void unpackColour(UINT8 *r, UINT8 *g, UINT8 *b, UINT8 *a, PixelFormat pf,  const void* src);
         /** Unpack a colour value from memory
         /** Unpack a colour value from memory
         	@param r,g,b,a	The colour is returned here (as float)
         	@param r,g,b,a	The colour is returned here (as float)
         	@param pf		Pixelformat in which to read the colour
         	@param pf		Pixelformat in which to read the colour

+ 0 - 170
CamelotRenderer/OgrePlane.cpp

@@ -1,170 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-(Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-
-#include "OgrePlane.h"
-#include "OgreMatrix3.h"
-#include "OgreAxisAlignedBox.h" 
-
-namespace CamelotEngine {
-	//-----------------------------------------------------------------------
-	Plane::Plane ()
-	{
-		normal = Vector3::ZERO;
-		d = 0.0;
-	}
-	//-----------------------------------------------------------------------
-	Plane::Plane (const Plane& rhs)
-	{
-		normal = rhs.normal;
-		d = rhs.d;
-	}
-	//-----------------------------------------------------------------------
-	Plane::Plane (const Vector3& rkNormal, Real fConstant)
-	{
-		normal = rkNormal;
-		d = -fConstant;
-	}
-	//---------------------------------------------------------------------
-	Plane::Plane (Real a, Real b, Real c, Real _d)
-		: normal(a, b, c), d(_d)
-	{
-	}
-	//-----------------------------------------------------------------------
-	Plane::Plane (const Vector3& rkNormal, const Vector3& rkPoint)
-	{
-		redefine(rkNormal, rkPoint);
-	}
-	//-----------------------------------------------------------------------
-	Plane::Plane (const Vector3& rkPoint0, const Vector3& rkPoint1,
-		const Vector3& rkPoint2)
-	{
-		redefine(rkPoint0, rkPoint1, rkPoint2);
-	}
-	//-----------------------------------------------------------------------
-	Real Plane::getDistance (const Vector3& rkPoint) const
-	{
-		return normal.dotProduct(rkPoint) + d;
-	}
-	//-----------------------------------------------------------------------
-	Plane::Side Plane::getSide (const Vector3& rkPoint) const
-	{
-		Real fDistance = getDistance(rkPoint);
-
-		if ( fDistance < 0.0 )
-			return Plane::NEGATIVE_SIDE;
-
-		if ( fDistance > 0.0 )
-			return Plane::POSITIVE_SIDE;
-
-		return Plane::NO_SIDE;
-	}
-
-
-	//-----------------------------------------------------------------------
-	Plane::Side Plane::getSide (const AxisAlignedBox& box) const
-	{
-		if (box.isNull()) 
-			return NO_SIDE;
-		if (box.isInfinite())
-			return BOTH_SIDE;
-
-        return getSide(box.getCenter(), box.getHalfSize());
-	}
-    //-----------------------------------------------------------------------
-    Plane::Side Plane::getSide (const Vector3& centre, const Vector3& halfSize) const
-    {
-        // Calculate the distance between box centre and the plane
-        Real dist = getDistance(centre);
-
-        // Calculate the maximise allows absolute distance for
-        // the distance between box centre and plane
-        Real maxAbsDist = normal.absDotProduct(halfSize);
-
-        if (dist < -maxAbsDist)
-            return Plane::NEGATIVE_SIDE;
-
-        if (dist > +maxAbsDist)
-            return Plane::POSITIVE_SIDE;
-
-        return Plane::BOTH_SIDE;
-    }
-	//-----------------------------------------------------------------------
-	void Plane::redefine(const Vector3& rkPoint0, const Vector3& rkPoint1,
-		const Vector3& rkPoint2)
-	{
-		Vector3 kEdge1 = rkPoint1 - rkPoint0;
-		Vector3 kEdge2 = rkPoint2 - rkPoint0;
-		normal = kEdge1.crossProduct(kEdge2);
-		normal.normalise();
-		d = -normal.dotProduct(rkPoint0);
-	}
-	//-----------------------------------------------------------------------
-	void Plane::redefine(const Vector3& rkNormal, const Vector3& rkPoint)
-	{
-		normal = rkNormal;
-		d = -rkNormal.dotProduct(rkPoint);
-	}
-	//-----------------------------------------------------------------------
-	Vector3 Plane::projectVector(const Vector3& p) const
-	{
-		// We know plane normal is unit length, so use simple method
-		Matrix3 xform;
-		xform[0][0] = 1.0f - normal.x * normal.x;
-		xform[0][1] = -normal.x * normal.y;
-		xform[0][2] = -normal.x * normal.z;
-		xform[1][0] = -normal.y * normal.x;
-		xform[1][1] = 1.0f - normal.y * normal.y;
-		xform[1][2] = -normal.y * normal.z;
-		xform[2][0] = -normal.z * normal.x;
-		xform[2][1] = -normal.z * normal.y;
-		xform[2][2] = 1.0f - normal.z * normal.z;
-		return xform * p;
-
-	}
-	//-----------------------------------------------------------------------
-    Real Plane::normalise(void)
-    {
-        Real fLength = normal.length();
-
-        // Will also work for zero-sized vectors, but will change nothing
-        if (fLength > 1e-08f)
-        {
-            Real fInvLength = 1.0f / fLength;
-            normal *= fInvLength;
-            d *= fInvLength;
-        }
-
-        return fLength;
-    }
-	//-----------------------------------------------------------------------
-	std::ostream& operator<< (std::ostream& o, const Plane& p)
-	{
-		o << "Plane(normal=" << p.normal << ", d=" << p.d << ")";
-		return o;
-	}
-} // namespace CamelotEngine

+ 0 - 166
CamelotRenderer/OgrePlane.h

@@ -1,166 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-// This file is based on material originally from:
-// Geometric Tools, LLC
-// Copyright (c) 1998-2010
-// Distributed under the Boost Software License, Version 1.0.
-// http://www.boost.org/LICENSE_1_0.txt
-// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
-
-
-#ifndef __Plane_H__
-#define __Plane_H__
-
-#include "OgrePrerequisites.h"
-
-#include "OgreVector3.h"
-
-namespace CamelotEngine {
-
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Math
-	*  @{
-	*/
-	/** Defines a plane in 3D space.
-        @remarks
-            A plane is defined in 3D space by the equation
-            Ax + By + Cz + D = 0
-        @par
-            This equates to a vector (the normal of the plane, whose x, y
-            and z components equate to the coefficients A, B and C
-            respectively), and a constant (D) which is the distance along
-            the normal you have to go to move the plane back to the origin.
-     */
-    class CM_EXPORT Plane
-    {
-    public:
-        /** Default constructor - sets everything to 0.
-        */
-        Plane ();
-        Plane (const Plane& rhs);
-        /** Construct a plane through a normal, and a distance to move the plane along the normal.*/
-        Plane (const Vector3& rkNormal, Real fConstant);
-		/** Construct a plane using the 4 constants directly **/
-		Plane (Real a, Real b, Real c, Real d);
-        Plane (const Vector3& rkNormal, const Vector3& rkPoint);
-        Plane (const Vector3& rkPoint0, const Vector3& rkPoint1,
-            const Vector3& rkPoint2);
-
-        /** The "positive side" of the plane is the half space to which the
-            plane normal points. The "negative side" is the other half
-            space. The flag "no side" indicates the plane itself.
-        */
-        enum Side
-        {
-            NO_SIDE,
-            POSITIVE_SIDE,
-            NEGATIVE_SIDE,
-            BOTH_SIDE
-        };
-
-        Side getSide (const Vector3& rkPoint) const;
-
-        /**
-        Returns the side where the alignedBox is. The flag BOTH_SIDE indicates an intersecting box.
-        One corner ON the plane is sufficient to consider the box and the plane intersecting.
-        */
-        Side getSide (const AxisAlignedBox& rkBox) const;
-
-        /** Returns which side of the plane that the given box lies on.
-            The box is defined as centre/half-size pairs for effectively.
-        @param centre The centre of the box.
-        @param halfSize The half-size of the box.
-        @returns
-            POSITIVE_SIDE if the box complete lies on the "positive side" of the plane,
-            NEGATIVE_SIDE if the box complete lies on the "negative side" of the plane,
-            and BOTH_SIDE if the box intersects the plane.
-        */
-        Side getSide (const Vector3& centre, const Vector3& halfSize) const;
-
-        /** This is a pseudodistance. The sign of the return value is
-            positive if the point is on the positive side of the plane,
-            negative if the point is on the negative side, and zero if the
-            point is on the plane.
-            @par
-            The absolute value of the return value is the true distance only
-            when the plane normal is a unit length vector.
-        */
-        Real getDistance (const Vector3& rkPoint) const;
-
-        /** Redefine this plane based on 3 points. */
-        void redefine(const Vector3& rkPoint0, const Vector3& rkPoint1,
-            const Vector3& rkPoint2);
-
-		/** Redefine this plane based on a normal and a point. */
-		void redefine(const Vector3& rkNormal, const Vector3& rkPoint);
-
-		/** Project a vector onto the plane. 
-		@remarks This gives you the element of the input vector that is perpendicular 
-			to the normal of the plane. You can get the element which is parallel
-			to the normal of the plane by subtracting the result of this method
-			from the original vector, since parallel + perpendicular = original.
-		@param v The input vector
-		*/
-		Vector3 projectVector(const Vector3& v) const;
-
-        /** Normalises the plane.
-            @remarks
-                This method normalises the plane's normal and the length scale of d
-                is as well.
-            @note
-                This function will not crash for zero-sized vectors, but there
-                will be no changes made to their components.
-            @returns The previous length of the plane's normal.
-        */
-        Real normalise(void);
-
-		Vector3 normal;
-        Real d;
-
-        /// Comparison operator
-        bool operator==(const Plane& rhs) const
-        {
-            return (rhs.d == d && rhs.normal == normal);
-        }
-        bool operator!=(const Plane& rhs) const
-        {
-            return (rhs.d != d || rhs.normal != normal);
-        }
-
-        CM_EXPORT friend std::ostream& operator<< (std::ostream& o, const Plane& p);
-    };
-
-    typedef vector<Plane>::type PlaneList;
-	/** @} */
-	/** @} */
-
-} // namespace CamelotEngine
-
-#endif

+ 0 - 16
CamelotRenderer/OgrePlatform.h

@@ -237,22 +237,6 @@ namespace CamelotEngine {
 #    define OGRE_ENDIAN OGRE_ENDIAN_LITTLE
 #    define OGRE_ENDIAN OGRE_ENDIAN_LITTLE
 #endif
 #endif
 
 
-// Integer formats of fixed bit width
-typedef unsigned int uint32;
-typedef unsigned short uint16;
-typedef unsigned char uint8;
-typedef int int32;
-typedef short int16;
-typedef char int8;
-// define uint64 type
-#if CM_COMPILER == CM_COMPILER_MSVC
-	typedef unsigned __int64 uint64;
-	typedef __int64 int64;
-#else
-	typedef unsigned long long uint64;
-	typedef long long int64;
-#endif
-
 /* Initial CPU stuff to set.
 /* Initial CPU stuff to set.
 */
 */
 #define CM_CPU_UNKNOWN    0
 #define CM_CPU_UNKNOWN    0

+ 3 - 133
CamelotRenderer/OgrePrerequisites.h

@@ -26,95 +26,12 @@ THE SOFTWARE
 #ifndef __OgrePrerequisites_H__
 #ifndef __OgrePrerequisites_H__
 #define __OgrePrerequisites_H__
 #define __OgrePrerequisites_H__
 
 
-#include <assert.h>
-
-// Platform-specific stuff
-#include "OgrePlatform.h"
-
-#include "OgrePortMemory.h"
-
-// Needed for OGRE_WCHAR_T_STRINGS below
-#include <string>
-
-
-// configure memory tracking
-#if CM_DEBUG_MODE 
-#	if OGRE_MEMORY_TRACKER_DEBUG_MODE
-#		define OGRE_MEMORY_TRACKER 1
-#	else
-#		define OGRE_MEMORY_TRACKER 0
-#	endif
-#else
-#	if OGRE_MEMORY_TRACKER_RELEASE_MODE
-#		define OGRE_MEMORY_TRACKER 1
-#	else
-#		define OGRE_MEMORY_TRACKER 0
-#	endif
-#endif
-
-
+#include "CmPrerequisitesUtil.h"
 
 
+#define CM_MAX_TEXTURE_LAYERS 16
+#define CM_MAX_MULTIPLE_RENDER_TARGETS 8
 
 
 namespace CamelotEngine {
 namespace CamelotEngine {
-    // Define ogre version
-    #define OGRE_VERSION_MAJOR 1
-    #define OGRE_VERSION_MINOR 7
-    #define OGRE_VERSION_PATCH 4
-	#define OGRE_VERSION_SUFFIX ""
-    #define OGRE_VERSION_NAME "Cthugha"
-
-    #define OGRE_VERSION    ((OGRE_VERSION_MAJOR << 16) | (OGRE_VERSION_MINOR << 8) | OGRE_VERSION_PATCH)
-
-    // define the real number values to be used
-    // default to use 'float' unless precompiler option set
-    #if OGRE_DOUBLE_PRECISION == 1
-		/** Software floating point type.
-		@note Not valid as a pointer to GPU buffers / parameters
-		*/
-        typedef double Real;
-    #else
-		/** Software floating point type.
-		@note Not valid as a pointer to GPU buffers / parameters
-		*/
-        typedef float Real;
-    #endif
-
-    #if CM_COMPILER == CM_COMPILER_GNUC && CM_COMP_VER >= 310 && !defined(STLPORT)
-	#   if CM_COMP_VER >= 430
-	#       define HashMap ::std::tr1::unordered_map
-	#		define HashSet ::std::tr1::unordered_set
-	#    else
-	#       define HashMap ::__gnu_cxx::hash_map
-	#       define HashSet ::__gnu_cxx::hash_set
-	#    endif
-    #else
-    #   if CM_COMPILER == CM_COMPILER_MSVC
-    #       if CM_COMP_VER >= 1600 // VC++ 10.0
-	#			define HashMap ::std::tr1::unordered_map
-	#           define HashSet ::std::tr1::unordered_set
-	#		elif CM_COMP_VER > 1300 && !defined(_STLP_MSVC)
-    #           define HashMap ::stdext::hash_map
-	#           define HashSet ::stdext::hash_set
-    #       else
-    #           define HashMap ::std::hash_map
-	#           define HashSet ::std::hash_set
-    #       endif
-    #   else
-    #       define HashMap ::std::hash_map
-	#       define HashSet ::std::hash_set
-    #   endif
-    #endif
-
-    /** In order to avoid finger-aches :)
-    */
-    typedef unsigned char uchar;
-    typedef unsigned short ushort;
-    typedef unsigned int uint;
-	typedef unsigned long ulong;
-
-
-	// Useful threading defines
-#include "OgreThreadDefines.h"
 
 
 // Pre-declare classes
 // Pre-declare classes
 // Allows use of pointers in header files without including individual .h
 // Allows use of pointers in header files without including individual .h
@@ -166,11 +83,6 @@ namespace CamelotEngine {
     class VertexDeclaration;
     class VertexDeclaration;
 }
 }
 
 
-/* Include all the standard header *after* all the configuration
-settings have been made.
-*/
-#include "OgreStdHeaders.h"
-
 /* Shared pointer typedefs*/
 /* Shared pointer typedefs*/
 namespace CamelotEngine
 namespace CamelotEngine
 {
 {
@@ -200,48 +112,6 @@ namespace CamelotEngine
 
 
 }
 }
 
 
-//for stl containter
-namespace CamelotEngine
-{ 
-
-
-	template <typename T, typename A = char > 
-	struct deque 
-	{ 
-		typedef typename std::deque<T> type;    
-	}; 
-
-	template <typename T, typename A = char > 
-	struct vector 
-	{ 
-		typedef typename std::vector<T> type;    
-	}; 
-
-	template <typename T, typename A = char > 
-	struct list 
-	{ 
-		typedef typename std::list<T> type;    
-	}; 
-
-	template <typename T, typename P = std::less<T>, typename A = char > 
-	struct set 
-	{ 
-		typedef typename std::set<T, P> type;    
-	}; 
-
-	template <typename K, typename V, typename P = std::less<K>, typename A = char > 
-	struct map 
-	{ 
-		typedef typename std::map<K, V, P> type; 
-	}; 
-
-	template <typename K, typename V, typename P = std::less<K>, typename A = char > 
-	struct multimap 
-	{ 
-		typedef typename std::multimap<K, V, P> type; 
-	}; 
-
-} // Ogre
 
 
 #endif // __OgrePrerequisites_H__
 #endif // __OgrePrerequisites_H__
 
 

+ 0 - 608
CamelotRenderer/OgreQuaternion.cpp

@@ -1,608 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-// NOTE THAT THIS FILE IS BASED ON MATERIAL FROM:
-
-// Geometric Tools, LLC
-// Copyright (c) 1998-2010
-// Distributed under the Boost Software License, Version 1.0.
-// http://www.boost.org/LICENSE_1_0.txt
-// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
-
-#include "OgreQuaternion.h"
-
-#include "OgreMath.h"
-#include "OgreMatrix3.h"
-#include "OgreVector3.h"
-
-namespace CamelotEngine {
-
-    const Real Quaternion::ms_fEpsilon = 1e-03f;
-    const Quaternion Quaternion::ZERO(0.0,0.0,0.0,0.0);
-    const Quaternion Quaternion::IDENTITY(1.0,0.0,0.0,0.0);
-
-    //-----------------------------------------------------------------------
-    void Quaternion::FromRotationMatrix (const Matrix3& kRot)
-    {
-        // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes
-        // article "Quaternion Calculus and Fast Animation".
-
-        Real fTrace = kRot[0][0]+kRot[1][1]+kRot[2][2];
-        Real fRoot;
-
-        if ( fTrace > 0.0 )
-        {
-            // |w| > 1/2, may as well choose w > 1/2
-            fRoot = Math::Sqrt(fTrace + 1.0f);  // 2w
-            w = 0.5f*fRoot;
-            fRoot = 0.5f/fRoot;  // 1/(4w)
-            x = (kRot[2][1]-kRot[1][2])*fRoot;
-            y = (kRot[0][2]-kRot[2][0])*fRoot;
-            z = (kRot[1][0]-kRot[0][1])*fRoot;
-        }
-        else
-        {
-            // |w| <= 1/2
-            static size_t s_iNext[3] = { 1, 2, 0 };
-            size_t i = 0;
-            if ( kRot[1][1] > kRot[0][0] )
-                i = 1;
-            if ( kRot[2][2] > kRot[i][i] )
-                i = 2;
-            size_t j = s_iNext[i];
-            size_t k = s_iNext[j];
-
-            fRoot = Math::Sqrt(kRot[i][i]-kRot[j][j]-kRot[k][k] + 1.0f);
-            Real* apkQuat[3] = { &x, &y, &z };
-            *apkQuat[i] = 0.5f*fRoot;
-            fRoot = 0.5f/fRoot;
-            w = (kRot[k][j]-kRot[j][k])*fRoot;
-            *apkQuat[j] = (kRot[j][i]+kRot[i][j])*fRoot;
-            *apkQuat[k] = (kRot[k][i]+kRot[i][k])*fRoot;
-        }
-    }
-    //-----------------------------------------------------------------------
-    void Quaternion::ToRotationMatrix (Matrix3& kRot) const
-    {
-        Real fTx  = x+x;
-        Real fTy  = y+y;
-        Real fTz  = z+z;
-        Real fTwx = fTx*w;
-        Real fTwy = fTy*w;
-        Real fTwz = fTz*w;
-        Real fTxx = fTx*x;
-        Real fTxy = fTy*x;
-        Real fTxz = fTz*x;
-        Real fTyy = fTy*y;
-        Real fTyz = fTz*y;
-        Real fTzz = fTz*z;
-
-        kRot[0][0] = 1.0f-(fTyy+fTzz);
-        kRot[0][1] = fTxy-fTwz;
-        kRot[0][2] = fTxz+fTwy;
-        kRot[1][0] = fTxy+fTwz;
-        kRot[1][1] = 1.0f-(fTxx+fTzz);
-        kRot[1][2] = fTyz-fTwx;
-        kRot[2][0] = fTxz-fTwy;
-        kRot[2][1] = fTyz+fTwx;
-        kRot[2][2] = 1.0f-(fTxx+fTyy);
-    }
-    //-----------------------------------------------------------------------
-    void Quaternion::FromAngleAxis (const Radian& rfAngle,
-        const Vector3& rkAxis)
-    {
-        // assert:  axis[] is unit length
-        //
-        // The quaternion representing the rotation is
-        //   q = cos(A/2)+sin(A/2)*(x*i+y*j+z*k)
-
-        Radian fHalfAngle ( 0.5*rfAngle );
-        Real fSin = Math::Sin(fHalfAngle);
-        w = Math::Cos(fHalfAngle);
-        x = fSin*rkAxis.x;
-        y = fSin*rkAxis.y;
-        z = fSin*rkAxis.z;
-    }
-    //-----------------------------------------------------------------------
-    void Quaternion::ToAngleAxis (Radian& rfAngle, Vector3& rkAxis) const
-    {
-        // The quaternion representing the rotation is
-        //   q = cos(A/2)+sin(A/2)*(x*i+y*j+z*k)
-
-        Real fSqrLength = x*x+y*y+z*z;
-        if ( fSqrLength > 0.0 )
-        {
-            rfAngle = 2.0*Math::ACos(w);
-            Real fInvLength = Math::InvSqrt(fSqrLength);
-            rkAxis.x = x*fInvLength;
-            rkAxis.y = y*fInvLength;
-            rkAxis.z = z*fInvLength;
-        }
-        else
-        {
-            // angle is 0 (mod 2*pi), so any axis will do
-            rfAngle = Radian(0.0);
-            rkAxis.x = 1.0;
-            rkAxis.y = 0.0;
-            rkAxis.z = 0.0;
-        }
-    }
-    //-----------------------------------------------------------------------
-    void Quaternion::FromAxes (const Vector3* akAxis)
-    {
-        Matrix3 kRot;
-
-        for (size_t iCol = 0; iCol < 3; iCol++)
-        {
-            kRot[0][iCol] = akAxis[iCol].x;
-            kRot[1][iCol] = akAxis[iCol].y;
-            kRot[2][iCol] = akAxis[iCol].z;
-        }
-
-        FromRotationMatrix(kRot);
-    }
-    //-----------------------------------------------------------------------
-    void Quaternion::FromAxes (const Vector3& xaxis, const Vector3& yaxis, const Vector3& zaxis)
-    {
-        Matrix3 kRot;
-
-        kRot[0][0] = xaxis.x;
-        kRot[1][0] = xaxis.y;
-        kRot[2][0] = xaxis.z;
-
-        kRot[0][1] = yaxis.x;
-        kRot[1][1] = yaxis.y;
-        kRot[2][1] = yaxis.z;
-
-        kRot[0][2] = zaxis.x;
-        kRot[1][2] = zaxis.y;
-        kRot[2][2] = zaxis.z;
-
-        FromRotationMatrix(kRot);
-
-    }
-    //-----------------------------------------------------------------------
-    void Quaternion::ToAxes (Vector3* akAxis) const
-    {
-        Matrix3 kRot;
-
-        ToRotationMatrix(kRot);
-
-        for (size_t iCol = 0; iCol < 3; iCol++)
-        {
-            akAxis[iCol].x = kRot[0][iCol];
-            akAxis[iCol].y = kRot[1][iCol];
-            akAxis[iCol].z = kRot[2][iCol];
-        }
-    }
-    //-----------------------------------------------------------------------
-    Vector3 Quaternion::xAxis(void) const
-    {
-        //Real fTx  = 2.0*x;
-        Real fTy  = 2.0f*y;
-        Real fTz  = 2.0f*z;
-        Real fTwy = fTy*w;
-        Real fTwz = fTz*w;
-        Real fTxy = fTy*x;
-        Real fTxz = fTz*x;
-        Real fTyy = fTy*y;
-        Real fTzz = fTz*z;
-
-        return Vector3(1.0f-(fTyy+fTzz), fTxy+fTwz, fTxz-fTwy);
-    }
-    //-----------------------------------------------------------------------
-    Vector3 Quaternion::yAxis(void) const
-    {
-        Real fTx  = 2.0f*x;
-        Real fTy  = 2.0f*y;
-        Real fTz  = 2.0f*z;
-        Real fTwx = fTx*w;
-        Real fTwz = fTz*w;
-        Real fTxx = fTx*x;
-        Real fTxy = fTy*x;
-        Real fTyz = fTz*y;
-        Real fTzz = fTz*z;
-
-        return Vector3(fTxy-fTwz, 1.0f-(fTxx+fTzz), fTyz+fTwx);
-    }
-    //-----------------------------------------------------------------------
-    Vector3 Quaternion::zAxis(void) const
-    {
-        Real fTx  = 2.0f*x;
-        Real fTy  = 2.0f*y;
-        Real fTz  = 2.0f*z;
-        Real fTwx = fTx*w;
-        Real fTwy = fTy*w;
-        Real fTxx = fTx*x;
-        Real fTxz = fTz*x;
-        Real fTyy = fTy*y;
-        Real fTyz = fTz*y;
-
-        return Vector3(fTxz+fTwy, fTyz-fTwx, 1.0f-(fTxx+fTyy));
-    }
-    //-----------------------------------------------------------------------
-    void Quaternion::ToAxes (Vector3& xaxis, Vector3& yaxis, Vector3& zaxis) const
-    {
-        Matrix3 kRot;
-
-        ToRotationMatrix(kRot);
-
-        xaxis.x = kRot[0][0];
-        xaxis.y = kRot[1][0];
-        xaxis.z = kRot[2][0];
-
-        yaxis.x = kRot[0][1];
-        yaxis.y = kRot[1][1];
-        yaxis.z = kRot[2][1];
-
-        zaxis.x = kRot[0][2];
-        zaxis.y = kRot[1][2];
-        zaxis.z = kRot[2][2];
-    }
-
-    //-----------------------------------------------------------------------
-    Quaternion Quaternion::operator+ (const Quaternion& rkQ) const
-    {
-        return Quaternion(w+rkQ.w,x+rkQ.x,y+rkQ.y,z+rkQ.z);
-    }
-    //-----------------------------------------------------------------------
-    Quaternion Quaternion::operator- (const Quaternion& rkQ) const
-    {
-        return Quaternion(w-rkQ.w,x-rkQ.x,y-rkQ.y,z-rkQ.z);
-    }
-    //-----------------------------------------------------------------------
-    Quaternion Quaternion::operator* (const Quaternion& rkQ) const
-    {
-        // NOTE:  Multiplication is not generally commutative, so in most
-        // cases p*q != q*p.
-
-        return Quaternion
-        (
-            w * rkQ.w - x * rkQ.x - y * rkQ.y - z * rkQ.z,
-            w * rkQ.x + x * rkQ.w + y * rkQ.z - z * rkQ.y,
-            w * rkQ.y + y * rkQ.w + z * rkQ.x - x * rkQ.z,
-            w * rkQ.z + z * rkQ.w + x * rkQ.y - y * rkQ.x
-        );
-    }
-    //-----------------------------------------------------------------------
-    Quaternion Quaternion::operator* (Real fScalar) const
-    {
-        return Quaternion(fScalar*w,fScalar*x,fScalar*y,fScalar*z);
-    }
-    //-----------------------------------------------------------------------
-    Quaternion operator* (Real fScalar, const Quaternion& rkQ)
-    {
-        return Quaternion(fScalar*rkQ.w,fScalar*rkQ.x,fScalar*rkQ.y,
-            fScalar*rkQ.z);
-    }
-    //-----------------------------------------------------------------------
-    Quaternion Quaternion::operator- () const
-    {
-        return Quaternion(-w,-x,-y,-z);
-    }
-    //-----------------------------------------------------------------------
-    Real Quaternion::Dot (const Quaternion& rkQ) const
-    {
-        return w*rkQ.w+x*rkQ.x+y*rkQ.y+z*rkQ.z;
-    }
-    //-----------------------------------------------------------------------
-    Real Quaternion::Norm () const
-    {
-        return w*w+x*x+y*y+z*z;
-    }
-    //-----------------------------------------------------------------------
-    Quaternion Quaternion::Inverse () const
-    {
-        Real fNorm = w*w+x*x+y*y+z*z;
-        if ( fNorm > 0.0 )
-        {
-            Real fInvNorm = 1.0f/fNorm;
-            return Quaternion(w*fInvNorm,-x*fInvNorm,-y*fInvNorm,-z*fInvNorm);
-        }
-        else
-        {
-            // return an invalid result to flag the error
-            return ZERO;
-        }
-    }
-    //-----------------------------------------------------------------------
-    Quaternion Quaternion::UnitInverse () const
-    {
-        // assert:  'this' is unit length
-        return Quaternion(w,-x,-y,-z);
-    }
-    //-----------------------------------------------------------------------
-    Quaternion Quaternion::Exp () const
-    {
-        // If q = A*(x*i+y*j+z*k) where (x,y,z) is unit length, then
-        // exp(q) = cos(A)+sin(A)*(x*i+y*j+z*k).  If sin(A) is near zero,
-        // use exp(q) = cos(A)+A*(x*i+y*j+z*k) since A/sin(A) has limit 1.
-
-        Radian fAngle ( Math::Sqrt(x*x+y*y+z*z) );
-        Real fSin = Math::Sin(fAngle);
-
-        Quaternion kResult;
-        kResult.w = Math::Cos(fAngle);
-
-        if ( Math::Abs(fSin) >= ms_fEpsilon )
-        {
-            Real fCoeff = fSin/(fAngle.valueRadians());
-            kResult.x = fCoeff*x;
-            kResult.y = fCoeff*y;
-            kResult.z = fCoeff*z;
-        }
-        else
-        {
-            kResult.x = x;
-            kResult.y = y;
-            kResult.z = z;
-        }
-
-        return kResult;
-    }
-    //-----------------------------------------------------------------------
-    Quaternion Quaternion::Log () const
-    {
-        // If q = cos(A)+sin(A)*(x*i+y*j+z*k) where (x,y,z) is unit length, then
-        // log(q) = A*(x*i+y*j+z*k).  If sin(A) is near zero, use log(q) =
-        // sin(A)*(x*i+y*j+z*k) since sin(A)/A has limit 1.
-
-        Quaternion kResult;
-        kResult.w = 0.0;
-
-        if ( Math::Abs(w) < 1.0 )
-        {
-            Radian fAngle ( Math::ACos(w) );
-            Real fSin = Math::Sin(fAngle);
-            if ( Math::Abs(fSin) >= ms_fEpsilon )
-            {
-                Real fCoeff = fAngle.valueRadians()/fSin;
-                kResult.x = fCoeff*x;
-                kResult.y = fCoeff*y;
-                kResult.z = fCoeff*z;
-                return kResult;
-            }
-        }
-
-        kResult.x = x;
-        kResult.y = y;
-        kResult.z = z;
-
-        return kResult;
-    }
-    //-----------------------------------------------------------------------
-    Vector3 Quaternion::operator* (const Vector3& v) const
-    {
-		// nVidia SDK implementation
-		Vector3 uv, uuv;
-		Vector3 qvec(x, y, z);
-		uv = qvec.crossProduct(v);
-		uuv = qvec.crossProduct(uv);
-		uv *= (2.0f * w);
-		uuv *= 2.0f;
-
-		return v + uv + uuv;
-
-    }
-    //-----------------------------------------------------------------------
-	bool Quaternion::equals(const Quaternion& rhs, const Radian& tolerance) const
-	{
-        Real fCos = Dot(rhs);
-        Radian angle = Math::ACos(fCos);
-
-		return (Math::Abs(angle.valueRadians()) <= tolerance.valueRadians())
-            || Math::RealEqual(angle.valueRadians(), Math::PI, tolerance.valueRadians());
-
-
-	}
-    //-----------------------------------------------------------------------
-    Quaternion Quaternion::Slerp (Real fT, const Quaternion& rkP,
-        const Quaternion& rkQ, bool shortestPath)
-    {
-        Real fCos = rkP.Dot(rkQ);
-        Quaternion rkT;
-
-        // Do we need to invert rotation?
-        if (fCos < 0.0f && shortestPath)
-        {
-            fCos = -fCos;
-            rkT = -rkQ;
-        }
-        else
-        {
-            rkT = rkQ;
-        }
-
-        if (Math::Abs(fCos) < 1 - ms_fEpsilon)
-        {
-            // Standard case (slerp)
-            Real fSin = Math::Sqrt(1 - Math::Sqr(fCos));
-            Radian fAngle = Math::ATan2(fSin, fCos);
-            Real fInvSin = 1.0f / fSin;
-            Real fCoeff0 = Math::Sin((1.0f - fT) * fAngle) * fInvSin;
-            Real fCoeff1 = Math::Sin(fT * fAngle) * fInvSin;
-            return fCoeff0 * rkP + fCoeff1 * rkT;
-        }
-        else
-        {
-            // There are two situations:
-            // 1. "rkP" and "rkQ" are very close (fCos ~= +1), so we can do a linear
-            //    interpolation safely.
-            // 2. "rkP" and "rkQ" are almost inverse of each other (fCos ~= -1), there
-            //    are an infinite number of possibilities interpolation. but we haven't
-            //    have method to fix this case, so just use linear interpolation here.
-            Quaternion t = (1.0f - fT) * rkP + fT * rkT;
-            // taking the complement requires renormalisation
-            t.normalise();
-            return t;
-        }
-    }
-    //-----------------------------------------------------------------------
-    Quaternion Quaternion::SlerpExtraSpins (Real fT,
-        const Quaternion& rkP, const Quaternion& rkQ, int iExtraSpins)
-    {
-        Real fCos = rkP.Dot(rkQ);
-        Radian fAngle ( Math::ACos(fCos) );
-
-        if ( Math::Abs(fAngle.valueRadians()) < ms_fEpsilon )
-            return rkP;
-
-        Real fSin = Math::Sin(fAngle);
-        Radian fPhase ( Math::PI*iExtraSpins*fT );
-        Real fInvSin = 1.0f/fSin;
-        Real fCoeff0 = Math::Sin((1.0f-fT)*fAngle - fPhase)*fInvSin;
-        Real fCoeff1 = Math::Sin(fT*fAngle + fPhase)*fInvSin;
-        return fCoeff0*rkP + fCoeff1*rkQ;
-    }
-    //-----------------------------------------------------------------------
-    void Quaternion::Intermediate (const Quaternion& rkQ0,
-        const Quaternion& rkQ1, const Quaternion& rkQ2,
-        Quaternion& rkA, Quaternion& rkB)
-    {
-        // assert:  q0, q1, q2 are unit quaternions
-
-        Quaternion kQ0inv = rkQ0.UnitInverse();
-        Quaternion kQ1inv = rkQ1.UnitInverse();
-        Quaternion rkP0 = kQ0inv*rkQ1;
-        Quaternion rkP1 = kQ1inv*rkQ2;
-        Quaternion kArg = 0.25*(rkP0.Log()-rkP1.Log());
-        Quaternion kMinusArg = -kArg;
-
-        rkA = rkQ1*kArg.Exp();
-        rkB = rkQ1*kMinusArg.Exp();
-    }
-    //-----------------------------------------------------------------------
-    Quaternion Quaternion::Squad (Real fT,
-        const Quaternion& rkP, const Quaternion& rkA,
-        const Quaternion& rkB, const Quaternion& rkQ, bool shortestPath)
-    {
-        Real fSlerpT = 2.0f*fT*(1.0f-fT);
-        Quaternion kSlerpP = Slerp(fT, rkP, rkQ, shortestPath);
-        Quaternion kSlerpQ = Slerp(fT, rkA, rkB);
-        return Slerp(fSlerpT, kSlerpP ,kSlerpQ);
-    }
-    //-----------------------------------------------------------------------
-    Real Quaternion::normalise(void)
-    {
-        Real len = Norm();
-        Real factor = 1.0f / Math::Sqrt(len);
-        *this = *this * factor;
-        return len;
-    }
-    //-----------------------------------------------------------------------
-	Radian Quaternion::getRoll(bool reprojectAxis) const
-	{
-		if (reprojectAxis)
-		{
-			// roll = atan2(localx.y, localx.x)
-			// pick parts of xAxis() implementation that we need
-//			Real fTx  = 2.0*x;
-			Real fTy  = 2.0f*y;
-			Real fTz  = 2.0f*z;
-			Real fTwz = fTz*w;
-			Real fTxy = fTy*x;
-			Real fTyy = fTy*y;
-			Real fTzz = fTz*z;
-
-			// Vector3(1.0-(fTyy+fTzz), fTxy+fTwz, fTxz-fTwy);
-
-			return Radian(Math::ATan2(fTxy+fTwz, 1.0f-(fTyy+fTzz)));
-
-		}
-		else
-		{
-			return Radian(Math::ATan2(2*(x*y + w*z), w*w + x*x - y*y - z*z));
-		}
-	}
-    //-----------------------------------------------------------------------
-	Radian Quaternion::getPitch(bool reprojectAxis) const
-	{
-		if (reprojectAxis)
-		{
-			// pitch = atan2(localy.z, localy.y)
-			// pick parts of yAxis() implementation that we need
-			Real fTx  = 2.0f*x;
-//			Real fTy  = 2.0f*y;
-			Real fTz  = 2.0f*z;
-			Real fTwx = fTx*w;
-			Real fTxx = fTx*x;
-			Real fTyz = fTz*y;
-			Real fTzz = fTz*z;
-
-			// Vector3(fTxy-fTwz, 1.0-(fTxx+fTzz), fTyz+fTwx);
-			return Radian(Math::ATan2(fTyz+fTwx, 1.0f-(fTxx+fTzz)));
-		}
-		else
-		{
-			// internal version
-			return Radian(Math::ATan2(2*(y*z + w*x), w*w - x*x - y*y + z*z));
-		}
-	}
-    //-----------------------------------------------------------------------
-	Radian Quaternion::getYaw(bool reprojectAxis) const
-	{
-		if (reprojectAxis)
-		{
-			// yaw = atan2(localz.x, localz.z)
-			// pick parts of zAxis() implementation that we need
-			Real fTx  = 2.0f*x;
-			Real fTy  = 2.0f*y;
-			Real fTz  = 2.0f*z;
-			Real fTwy = fTy*w;
-			Real fTxx = fTx*x;
-			Real fTxz = fTz*x;
-			Real fTyy = fTy*y;
-
-			// Vector3(fTxz+fTwy, fTyz-fTwx, 1.0-(fTxx+fTyy));
-
-			return Radian(Math::ATan2(fTxz+fTwy, 1.0f-(fTxx+fTyy)));
-
-		}
-		else
-		{
-			// internal version
-			return Radian(Math::ASin(-2*(x*z - w*y)));
-		}
-	}
-    //-----------------------------------------------------------------------
-    Quaternion Quaternion::nlerp(Real fT, const Quaternion& rkP,
-        const Quaternion& rkQ, bool shortestPath)
-    {
-		Quaternion result;
-        Real fCos = rkP.Dot(rkQ);
-		if (fCos < 0.0f && shortestPath)
-		{
-			result = rkP + fT * ((-rkQ) - rkP);
-		}
-		else
-		{
-			result = rkP + fT * (rkQ - rkP);
-		}
-        result.normalise();
-        return result;
-    }
-}

+ 0 - 271
CamelotRenderer/OgreQuaternion.h

@@ -1,271 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-// This file is based on material originally from:
-// Geometric Tools, LLC
-// Copyright (c) 1998-2010
-// Distributed under the Boost Software License, Version 1.0.
-// http://www.boost.org/LICENSE_1_0.txt
-// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
-
-
-#ifndef __Quaternion_H__
-#define __Quaternion_H__
-
-#include "OgrePrerequisites.h"
-#include "OgreMath.h"
-
-namespace CamelotEngine {
-
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Math
-	*  @{
-	*/
-	/** Implementation of a Quaternion, i.e. a rotation around an axis.
-    */
-    class CM_EXPORT Quaternion
-    {
-    public:
-        inline Quaternion (
-            Real fW = 1.0,
-            Real fX = 0.0, Real fY = 0.0, Real fZ = 0.0)
-		{
-			w = fW;
-			x = fX;
-			y = fY;
-			z = fZ;
-		}
-        /// Construct a quaternion from a rotation matrix
-        inline Quaternion(const Matrix3& rot)
-        {
-            this->FromRotationMatrix(rot);
-        }
-        /// Construct a quaternion from an angle/axis
-        inline Quaternion(const Radian& rfAngle, const Vector3& rkAxis)
-        {
-            this->FromAngleAxis(rfAngle, rkAxis);
-        }
-        /// Construct a quaternion from 3 orthonormal local axes
-        inline Quaternion(const Vector3& xaxis, const Vector3& yaxis, const Vector3& zaxis)
-        {
-            this->FromAxes(xaxis, yaxis, zaxis);
-        }
-        /// Construct a quaternion from 3 orthonormal local axes
-        inline Quaternion(const Vector3* akAxis)
-        {
-            this->FromAxes(akAxis);
-        }
-		/// Construct a quaternion from 4 manual w/x/y/z values
-		inline Quaternion(Real* valptr)
-		{
-			memcpy(&w, valptr, sizeof(Real)*4);
-		}
-
-		/** Exchange the contents of this quaternion with another. 
-		*/
-		inline void swap(Quaternion& other)
-		{
-			std::swap(w, other.w);
-			std::swap(x, other.x);
-			std::swap(y, other.y);
-			std::swap(z, other.z);
-		}
-
-		/// Array accessor operator
-		inline Real operator [] ( const size_t i ) const
-		{
-			assert( i < 4 );
-
-			return *(&w+i);
-		}
-
-		/// Array accessor operator
-		inline Real& operator [] ( const size_t i )
-		{
-			assert( i < 4 );
-
-			return *(&w+i);
-		}
-
-		/// Pointer accessor for direct copying
-		inline Real* ptr()
-		{
-			return &w;
-		}
-
-		/// Pointer accessor for direct copying
-		inline const Real* ptr() const
-		{
-			return &w;
-		}
-
-		void FromRotationMatrix (const Matrix3& kRot);
-        void ToRotationMatrix (Matrix3& kRot) const;
-        void FromAngleAxis (const Radian& rfAngle, const Vector3& rkAxis);
-        void ToAngleAxis (Radian& rfAngle, Vector3& rkAxis) const;
-        inline void ToAngleAxis (Degree& dAngle, Vector3& rkAxis) const {
-            Radian rAngle;
-            ToAngleAxis ( rAngle, rkAxis );
-            dAngle = rAngle;
-        }
-        void FromAxes (const Vector3* akAxis);
-        void FromAxes (const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis);
-        void ToAxes (Vector3* akAxis) const;
-        void ToAxes (Vector3& xAxis, Vector3& yAxis, Vector3& zAxis) const;
-        /// Get the local x-axis
-        Vector3 xAxis(void) const;
-        /// Get the local y-axis
-        Vector3 yAxis(void) const;
-        /// Get the local z-axis
-        Vector3 zAxis(void) const;
-
-        inline Quaternion& operator= (const Quaternion& rkQ)
-		{
-			w = rkQ.w;
-			x = rkQ.x;
-			y = rkQ.y;
-			z = rkQ.z;
-			return *this;
-		}
-        Quaternion operator+ (const Quaternion& rkQ) const;
-        Quaternion operator- (const Quaternion& rkQ) const;
-        Quaternion operator* (const Quaternion& rkQ) const;
-        Quaternion operator* (Real fScalar) const;
-        CM_EXPORT friend Quaternion operator* (Real fScalar,
-            const Quaternion& rkQ);
-        Quaternion operator- () const;
-        inline bool operator== (const Quaternion& rhs) const
-		{
-			return (rhs.x == x) && (rhs.y == y) &&
-				(rhs.z == z) && (rhs.w == w);
-		}
-        inline bool operator!= (const Quaternion& rhs) const
-		{
-			return !operator==(rhs);
-		}
-        // functions of a quaternion
-        Real Dot (const Quaternion& rkQ) const;  // dot product
-        Real Norm () const;  // squared-length
-        /// Normalises this quaternion, and returns the previous length
-        Real normalise(void); 
-        Quaternion Inverse () const;  // apply to non-zero quaternion
-        Quaternion UnitInverse () const;  // apply to unit-length quaternion
-        Quaternion Exp () const;
-        Quaternion Log () const;
-
-        // rotation of a vector by a quaternion
-        Vector3 operator* (const Vector3& rkVector) const;
-
-   		/** Calculate the local roll element of this quaternion.
-		@param reprojectAxis By default the method returns the 'intuitive' result
-			that is, if you projected the local Y of the quaternion onto the X and
-			Y axes, the angle between them is returned. If set to false though, the
-			result is the actual yaw that will be used to implement the quaternion,
-			which is the shortest possible path to get to the same orientation and 
-			may involve less axial rotation. 
-		*/
-		Radian getRoll(bool reprojectAxis = true) const;
-   		/** Calculate the local pitch element of this quaternion
-		@param reprojectAxis By default the method returns the 'intuitive' result
-			that is, if you projected the local Z of the quaternion onto the X and
-			Y axes, the angle between them is returned. If set to true though, the
-			result is the actual yaw that will be used to implement the quaternion,
-			which is the shortest possible path to get to the same orientation and 
-			may involve less axial rotation. 
-		*/
-		Radian getPitch(bool reprojectAxis = true) const;
-   		/** Calculate the local yaw element of this quaternion
-		@param reprojectAxis By default the method returns the 'intuitive' result
-			that is, if you projected the local Z of the quaternion onto the X and
-			Z axes, the angle between them is returned. If set to true though, the
-			result is the actual yaw that will be used to implement the quaternion,
-			which is the shortest possible path to get to the same orientation and 
-			may involve less axial rotation. 
-		*/
-		Radian getYaw(bool reprojectAxis = true) const;		
-		/// Equality with tolerance (tolerance is max angle difference)
-		bool equals(const Quaternion& rhs, const Radian& tolerance) const;
-		
-	    // spherical linear interpolation
-        static Quaternion Slerp (Real fT, const Quaternion& rkP,
-            const Quaternion& rkQ, bool shortestPath = false);
-
-        static Quaternion SlerpExtraSpins (Real fT,
-            const Quaternion& rkP, const Quaternion& rkQ,
-            int iExtraSpins);
-
-        // setup for spherical quadratic interpolation
-        static void Intermediate (const Quaternion& rkQ0,
-            const Quaternion& rkQ1, const Quaternion& rkQ2,
-            Quaternion& rka, Quaternion& rkB);
-
-        // spherical quadratic interpolation
-        static Quaternion Squad (Real fT, const Quaternion& rkP,
-            const Quaternion& rkA, const Quaternion& rkB,
-            const Quaternion& rkQ, bool shortestPath = false);
-
-        // normalised linear interpolation - faster but less accurate (non-constant rotation velocity)
-        static Quaternion nlerp(Real fT, const Quaternion& rkP, 
-            const Quaternion& rkQ, bool shortestPath = false);
-
-        // cutoff for sine near zero
-        static const Real ms_fEpsilon;
-
-        // special values
-        static const Quaternion ZERO;
-        static const Quaternion IDENTITY;
-
-		Real w, x, y, z;
-
-		/// Check whether this quaternion contains valid values
-		inline bool isNaN() const
-		{
-			return Math::isNaN(x) || Math::isNaN(y) || Math::isNaN(z) || Math::isNaN(w);
-		}
-
-        /** Function for writing to a stream. Outputs "Quaternion(w, x, y, z)" with w,x,y,z
-            being the member values of the quaternion.
-        */
-        inline CM_EXPORT friend std::ostream& operator <<
-            ( std::ostream& o, const Quaternion& q )
-        {
-            o << "Quaternion(" << q.w << ", " << q.x << ", " << q.y << ", " << q.z << ")";
-            return o;
-        }
-
-    };
-	/** @} */
-	/** @} */
-
-}
-
-
-
-
-#endif 

+ 0 - 111
CamelotRenderer/OgreRay.h

@@ -1,111 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __Ray_H_
-#define __Ray_H_
-
-// Precompiler options
-#include "OgrePrerequisites.h"
-
-#include "OgreVector3.h"
-
-namespace CamelotEngine {
-
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Math
-	*  @{
-	*/
-	/** Representation of a ray in space, i.e. a line with an origin and direction. */
-    class CM_EXPORT Ray
-    {
-    protected:
-        Vector3 mOrigin;
-        Vector3 mDirection;
-    public:
-        Ray():mOrigin(Vector3::ZERO), mDirection(Vector3::UNIT_Z) {}
-        Ray(const Vector3& origin, const Vector3& direction)
-            :mOrigin(origin), mDirection(direction) {}
-
-        /** Sets the origin of the ray. */
-        void setOrigin(const Vector3& origin) {mOrigin = origin;} 
-        /** Gets the origin of the ray. */
-        const Vector3& getOrigin(void) const {return mOrigin;} 
-
-        /** Sets the direction of the ray. */
-        void setDirection(const Vector3& dir) {mDirection = dir;} 
-        /** Gets the direction of the ray. */
-        const Vector3& getDirection(void) const {return mDirection;} 
-
-		/** Gets the position of a point t units along the ray. */
-		Vector3 getPoint(Real t) const { 
-			return Vector3(mOrigin + (mDirection * t));
-		}
-		
-		/** Gets the position of a point t units along the ray. */
-		Vector3 operator*(Real t) const { 
-			return getPoint(t);
-		}
-
-		/** Tests whether this ray intersects the given plane. 
-		@returns A pair structure where the first element indicates whether
-			an intersection occurs, and if true, the second element will
-			indicate the distance along the ray at which it intersects. 
-			This can be converted to a point in space by calling getPoint().
-		*/
-		std::pair<bool, Real> intersects(const Plane& p) const
-		{
-			return Math::intersects(*this, p);
-		}
-		/** Tests whether this ray intersects the given sphere. 
-		@returns A pair structure where the first element indicates whether
-			an intersection occurs, and if true, the second element will
-			indicate the distance along the ray at which it intersects. 
-			This can be converted to a point in space by calling getPoint().
-		*/
-		std::pair<bool, Real> intersects(const Sphere& s) const
-		{
-			return Math::intersects(*this, s);
-		}
-		/** Tests whether this ray intersects the given box. 
-		@returns A pair structure where the first element indicates whether
-			an intersection occurs, and if true, the second element will
-			indicate the distance along the ray at which it intersects. 
-			This can be converted to a point in space by calling getPoint().
-		*/
-		std::pair<bool, Real> intersects(const AxisAlignedBox& box) const
-		{
-			return Math::intersects(*this, box);
-		}
-
-    };
-	/** @} */
-	/** @} */
-
-}
-#endif

+ 3 - 3
CamelotRenderer/OgreRenderSystem.cpp

@@ -345,7 +345,7 @@ namespace CamelotEngine {
     //---------------------------------------------------------------------
     //---------------------------------------------------------------------
     void RenderSystem::_disableTextureUnitsFrom(size_t texUnit)
     void RenderSystem::_disableTextureUnitsFrom(size_t texUnit)
     {
     {
-        size_t disableTo = OGRE_MAX_TEXTURE_LAYERS;
+        size_t disableTo = CM_MAX_TEXTURE_LAYERS;
         if (disableTo > mDisabledTexUnitsFrom)
         if (disableTo > mDisabledTexUnitsFrom)
             disableTo = mDisabledTexUnitsFrom;
             disableTo = mDisabledTexUnitsFrom;
         mDisabledTexUnitsFrom = texUnit;
         mDisabledTexUnitsFrom = texUnit;
@@ -434,7 +434,7 @@ namespace CamelotEngine {
         return static_cast< unsigned int >( mVertexCount );
         return static_cast< unsigned int >( mVertexCount );
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-	void RenderSystem::convertColourValue(const ColourValue& colour, uint32* pDest)
+	void RenderSystem::convertColourValue(const ColourValue& colour, UINT32* pDest)
 	{
 	{
 		*pDest = VertexElement::convertColourValue(colour, getColourVertexElementType());
 		*pDest = VertexElement::convertColourValue(colour, getColourVertexElementType());
 
 
@@ -507,7 +507,7 @@ namespace CamelotEngine {
 		mClipPlanesDirty = true;
 		mClipPlanesDirty = true;
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void RenderSystem::addClipPlane (Real A, Real B, Real C, Real D)
+	void RenderSystem::addClipPlane (float A, float B, float C, float D)
 	{
 	{
 		addClipPlane(Plane(A, B, C, D));
 		addClipPlane(Plane(A, B, C, D));
 	}
 	}

+ 20 - 20
CamelotRenderer/OgreRenderSystem.h

@@ -43,7 +43,7 @@ THE SOFTWARE.
 #include "OgreRenderTarget.h"
 #include "OgreRenderTarget.h"
 #include "OgreRenderTexture.h"
 #include "OgreRenderTexture.h"
 #include "OgreGpuProgram.h"
 #include "OgreGpuProgram.h"
-#include "OgrePlane.h"
+#include "CmPlane.h"
 
 
 namespace CamelotEngine
 namespace CamelotEngine
 {
 {
@@ -55,7 +55,7 @@ namespace CamelotEngine
 	*/
 	*/
 
 
 	typedef map< String, RenderTarget * >::type RenderTargetMap;
 	typedef map< String, RenderTarget * >::type RenderTargetMap;
-	typedef multimap<uchar, RenderTarget * >::type RenderTargetPriorityMap;
+	typedef multimap<UINT8, RenderTarget * >::type RenderTargetPriorityMap;
 
 
 	class TextureManager;
 	class TextureManager;
 	/// Enum describing the ways to generate texture coordinates
 	/// Enum describing the ways to generate texture coordinates
@@ -585,7 +585,7 @@ namespace CamelotEngine
 		*/
 		*/
 		virtual void _setSurfaceParams(const ColourValue &ambient,
 		virtual void _setSurfaceParams(const ColourValue &ambient,
 			const ColourValue &diffuse, const ColourValue &specular,
 			const ColourValue &diffuse, const ColourValue &specular,
-			const ColourValue &emissive, Real shininess,
+			const ColourValue &emissive, float shininess,
 			TrackVertexColourType tracking = TVC_NONE) = 0;
 			TrackVertexColourType tracking = TVC_NONE) = 0;
 
 
 		/** Sets whether or not rendering points using OT_POINT_LIST will 
 		/** Sets whether or not rendering points using OT_POINT_LIST will 
@@ -605,8 +605,8 @@ namespace CamelotEngine
 		you would set constant to 1, and linear and quadratic to 0. A
 		you would set constant to 1, and linear and quadratic to 0. A
 		standard perspective attenuation would be 0, 1, 0 respectively.
 		standard perspective attenuation would be 0, 1, 0 respectively.
 		*/
 		*/
-		virtual void _setPointParameters(Real size, bool attenuationEnabled, 
-			Real constant, Real linear, Real quadratic, Real minSize, Real maxSize) = 0;
+		virtual void _setPointParameters(float size, bool attenuationEnabled, 
+			float constant, float linear, float quadratic, float minSize, float maxSize) = 0;
 
 
 
 
 		/**
 		/**
@@ -872,7 +872,7 @@ namespace CamelotEngine
 		@param linearEnd Distance at which linear fog becomes completely opaque.The distance must be passed
 		@param linearEnd Distance at which linear fog becomes completely opaque.The distance must be passed
 		as a parametric value between 0 and 1, with 0 being the near clipping plane, and 1 being the far clipping plane. Only applicable if mode is FOG_LINEAR.
 		as a parametric value between 0 and 1, with 0 being the near clipping plane, and 1 being the far clipping plane. Only applicable if mode is FOG_LINEAR.
 		*/
 		*/
-		virtual void _setFog(FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White, Real expDensity = 1.0, Real linearStart = 0.0, Real linearEnd = 1.0) = 0;
+		virtual void _setFog(FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White, float expDensity = 1.0, float linearStart = 0.0, float linearEnd = 1.0) = 0;
 
 
 
 
 		/** The RenderSystem will keep a count of tris rendered, this resets the count. */
 		/** The RenderSystem will keep a count of tris rendered, this resets the count. */
@@ -892,7 +892,7 @@ namespace CamelotEngine
 		@param colour The colour to convert
 		@param colour The colour to convert
 		@param pDest Pointer to location to put the result.
 		@param pDest Pointer to location to put the result.
 		*/
 		*/
-		virtual void convertColourValue(const ColourValue& colour, uint32* pDest);
+		virtual void convertColourValue(const ColourValue& colour, UINT32* pDest);
 		/** Get the native VertexElementType for a compact 32-bit colour value
 		/** Get the native VertexElementType for a compact 32-bit colour value
 		for this rendersystem.
 		for this rendersystem.
 		*/
 		*/
@@ -913,7 +913,7 @@ namespace CamelotEngine
 		projection matrix, this method allows each to implement their own correctly and pass
 		projection matrix, this method allows each to implement their own correctly and pass
 		back a generic OGRE matrix for storage in the engine.
 		back a generic OGRE matrix for storage in the engine.
 		*/
 		*/
-		virtual void _makeProjectionMatrix(const Radian& fovy, Real aspect, Real nearPlane, Real farPlane, 
+		virtual void _makeProjectionMatrix(const Radian& fovy, float aspect, float nearPlane, float farPlane, 
 			Matrix4& dest, bool forGpuProgram = false) = 0;
 			Matrix4& dest, bool forGpuProgram = false) = 0;
 
 
 		/** Builds a perspective projection matrix for the case when frustum is
 		/** Builds a perspective projection matrix for the case when frustum is
@@ -922,15 +922,15 @@ namespace CamelotEngine
 		Viewport coordinates are in camera coordinate frame, i.e. camera is 
 		Viewport coordinates are in camera coordinate frame, i.e. camera is 
 		at the origin.
 		at the origin.
 		*/
 		*/
-		virtual void _makeProjectionMatrix(Real left, Real right, Real bottom, Real top, 
-			Real nearPlane, Real farPlane, Matrix4& dest, bool forGpuProgram = false) = 0;
+		virtual void _makeProjectionMatrix(float left, float right, float bottom, float top, 
+			float nearPlane, float farPlane, Matrix4& dest, bool forGpuProgram = false) = 0;
 		/** Builds an orthographic projection matrix suitable for this render system.
 		/** Builds an orthographic projection matrix suitable for this render system.
 		@remarks
 		@remarks
 		Because different APIs have different requirements (some incompatible) for the
 		Because different APIs have different requirements (some incompatible) for the
 		projection matrix, this method allows each to implement their own correctly and pass
 		projection matrix, this method allows each to implement their own correctly and pass
 		back a generic OGRE matrix for storage in the engine.
 		back a generic OGRE matrix for storage in the engine.
 		*/
 		*/
-		virtual void _makeOrthoMatrix(const Radian& fovy, Real aspect, Real nearPlane, Real farPlane, 
+		virtual void _makeOrthoMatrix(const Radian& fovy, float aspect, float nearPlane, float farPlane, 
 			Matrix4& dest, bool forGpuProgram = false) = 0;
 			Matrix4& dest, bool forGpuProgram = false) = 0;
 
 
 		/** Update a perspective projection matrix to use 'oblique depth projection'.
 		/** Update a perspective projection matrix to use 'oblique depth projection'.
@@ -1015,7 +1015,7 @@ namespace CamelotEngine
 		and the inverse of them will happen for back faces (keep remains the same).
 		and the inverse of them will happen for back faces (keep remains the same).
 		*/
 		*/
 		virtual void setStencilBufferParams(CompareFunction func = CMPF_ALWAYS_PASS, 
 		virtual void setStencilBufferParams(CompareFunction func = CMPF_ALWAYS_PASS, 
-			uint32 refValue = 0, uint32 mask = 0xFFFFFFFF, 
+			UINT32 refValue = 0, UINT32 mask = 0xFFFFFFFF, 
 			StencilOperation stencilFailOp = SOP_KEEP, 
 			StencilOperation stencilFailOp = SOP_KEEP, 
 			StencilOperation depthFailOp = SOP_KEEP,
 			StencilOperation depthFailOp = SOP_KEEP,
 			StencilOperation passOp = SOP_KEEP, 
 			StencilOperation passOp = SOP_KEEP, 
@@ -1074,7 +1074,7 @@ namespace CamelotEngine
 		@param variabilityMask A mask of GpuParamVariability identifying which params need binding
 		@param variabilityMask A mask of GpuParamVariability identifying which params need binding
 		*/
 		*/
 		virtual void bindGpuProgramParameters(GpuProgramType gptype, 
 		virtual void bindGpuProgramParameters(GpuProgramType gptype, 
-			GpuProgramParametersSharedPtr params, uint16 variabilityMask) = 0;
+			GpuProgramParametersSharedPtr params, UINT16 variabilityMask) = 0;
 
 
 		/** Only binds Gpu program parameters used for passes that have more than one iteration rendering
 		/** Only binds Gpu program parameters used for passes that have more than one iteration rendering
 		*/
 		*/
@@ -1095,7 +1095,7 @@ namespace CamelotEngine
 		/** Add a user clipping plane. */
 		/** Add a user clipping plane. */
 		virtual void addClipPlane (const Plane &p);
 		virtual void addClipPlane (const Plane &p);
 		/** Add a user clipping plane. */
 		/** Add a user clipping plane. */
-		virtual void addClipPlane (Real A, Real B, Real C, Real D);
+		virtual void addClipPlane (float A, float B, float C, float D);
 
 
 		/** Clears the user clipping region.
 		/** Clears the user clipping region.
 		*/
 		*/
@@ -1147,7 +1147,7 @@ namespace CamelotEngine
 		*/
 		*/
 		virtual void clearFrameBuffer(unsigned int buffers, 
 		virtual void clearFrameBuffer(unsigned int buffers, 
 			const ColourValue& colour = ColourValue::Black, 
 			const ColourValue& colour = ColourValue::Black, 
-			Real depth = 1.0f, unsigned short stencil = 0) = 0;
+			float depth = 1.0f, unsigned short stencil = 0) = 0;
 		/** Returns the horizontal texel offset value required for mapping 
 		/** Returns the horizontal texel offset value required for mapping 
 		texel origins to pixel origins in this rendersystem.
 		texel origins to pixel origins in this rendersystem.
 		@remarks
 		@remarks
@@ -1157,7 +1157,7 @@ namespace CamelotEngine
 		required to map the origin of a texel to the origin of a pixel in
 		required to map the origin of a texel to the origin of a pixel in
 		the horizontal direction.
 		the horizontal direction.
 		*/
 		*/
-		virtual Real getHorizontalTexelOffset(void) = 0;
+		virtual float getHorizontalTexelOffset(void) = 0;
 		/** Returns the vertical texel offset value required for mapping 
 		/** Returns the vertical texel offset value required for mapping 
 		texel origins to pixel origins in this rendersystem.
 		texel origins to pixel origins in this rendersystem.
 		@remarks
 		@remarks
@@ -1167,7 +1167,7 @@ namespace CamelotEngine
 		required to map the origin of a texel to the origin of a pixel in
 		required to map the origin of a texel to the origin of a pixel in
 		the vertical direction.
 		the vertical direction.
 		*/
 		*/
-		virtual Real getVerticalTexelOffset(void) = 0;
+		virtual float getVerticalTexelOffset(void) = 0;
 
 
 		/** Gets the minimum (closest) depth value to be used when rendering
 		/** Gets the minimum (closest) depth value to be used when rendering
 		using identity transforms.
 		using identity transforms.
@@ -1177,7 +1177,7 @@ namespace CamelotEngine
 		rendersystem. This method lets you retrieve the correct value.
 		rendersystem. This method lets you retrieve the correct value.
 		@see Renderable::getUseIdentityView, Renderable::getUseIdentityProjection
 		@see Renderable::getUseIdentityView, Renderable::getUseIdentityProjection
 		*/
 		*/
-		virtual Real getMinimumDepthInputValue(void) = 0;
+		virtual float getMinimumDepthInputValue(void) = 0;
 		/** Gets the maximum (farthest) depth value to be used when rendering
 		/** Gets the maximum (farthest) depth value to be used when rendering
 		using identity transforms.
 		using identity transforms.
 		@remarks
 		@remarks
@@ -1186,7 +1186,7 @@ namespace CamelotEngine
 		rendersystem. This method lets you retrieve the correct value.
 		rendersystem. This method lets you retrieve the correct value.
 		@see Renderable::getUseIdentityView, Renderable::getUseIdentityProjection
 		@see Renderable::getUseIdentityView, Renderable::getUseIdentityProjection
 		*/
 		*/
-		virtual Real getMaximumDepthInputValue(void) = 0;
+		virtual float getMaximumDepthInputValue(void) = 0;
 		/** set the current multi pass count value.  This must be set prior to 
 		/** set the current multi pass count value.  This must be set prior to 
 		calling _render() if multiple renderings of the same pass state are 
 		calling _render() if multiple renderings of the same pass state are 
 		required.
 		required.
@@ -1339,7 +1339,7 @@ namespace CamelotEngine
 		size_t mVertexCount;
 		size_t mVertexCount;
 
 
 		/// Saved manual colour blends
 		/// Saved manual colour blends
-		ColourValue mManualBlendColours[OGRE_MAX_TEXTURE_LAYERS][2];
+		ColourValue mManualBlendColours[CM_MAX_TEXTURE_LAYERS][2];
 
 
 		bool mInvertVertexWinding;
 		bool mInvertVertexWinding;
 
 

+ 48 - 48
CamelotRenderer/OgreRenderSystemCapabilities.h

@@ -246,13 +246,13 @@ namespace CamelotEngine
 		static void initVendorStrings();
 		static void initVendorStrings();
 
 
 		/// The number of world matrices available
 		/// The number of world matrices available
-		ushort mNumWorldMatrices;
+		UINT16 mNumWorldMatrices;
 		/// The number of texture units available
 		/// The number of texture units available
-		ushort mNumTextureUnits;
+		UINT16 mNumTextureUnits;
 		/// The stencil buffer bit depth
 		/// The stencil buffer bit depth
-		ushort mStencilBufferBitDepth;
+		UINT16 mStencilBufferBitDepth;
 		/// The number of matrices available for hardware blending
 		/// The number of matrices available for hardware blending
-		ushort mNumVertexBlendMatrices;
+		UINT16 mNumVertexBlendMatrices;
 		/// Stores the capabilities flags.
 		/// Stores the capabilities flags.
 		int mCapabilities[CAPS_CATEGORY_COUNT];
 		int mCapabilities[CAPS_CATEGORY_COUNT];
 		/// Which categories are relevant
 		/// Which categories are relevant
@@ -263,31 +263,31 @@ namespace CamelotEngine
 		String mRenderSystemName;
 		String mRenderSystemName;
 
 
 		/// The number of floating-point constants vertex programs support
 		/// The number of floating-point constants vertex programs support
-		ushort mVertexProgramConstantFloatCount;           
+		UINT16 mVertexProgramConstantFloatCount;           
 		/// The number of integer constants vertex programs support
 		/// The number of integer constants vertex programs support
-		ushort mVertexProgramConstantIntCount;           
+		UINT16 mVertexProgramConstantIntCount;           
 		/// The number of boolean constants vertex programs support
 		/// The number of boolean constants vertex programs support
-		ushort mVertexProgramConstantBoolCount;           
+		UINT16 mVertexProgramConstantBoolCount;           
 		/// The number of floating-point constants geometry programs support
 		/// The number of floating-point constants geometry programs support
-		ushort mGeometryProgramConstantFloatCount;           
+		UINT16 mGeometryProgramConstantFloatCount;           
 		/// The number of integer constants vertex geometry support
 		/// The number of integer constants vertex geometry support
-		ushort mGeometryProgramConstantIntCount;           
+		UINT16 mGeometryProgramConstantIntCount;           
 		/// The number of boolean constants vertex geometry support
 		/// The number of boolean constants vertex geometry support
-		ushort mGeometryProgramConstantBoolCount;           
+		UINT16 mGeometryProgramConstantBoolCount;           
 		/// The number of floating-point constants fragment programs support
 		/// The number of floating-point constants fragment programs support
-		ushort mFragmentProgramConstantFloatCount;           
+		UINT16 mFragmentProgramConstantFloatCount;           
 		/// The number of integer constants fragment programs support
 		/// The number of integer constants fragment programs support
-		ushort mFragmentProgramConstantIntCount;           
+		UINT16 mFragmentProgramConstantIntCount;           
 		/// The number of boolean constants fragment programs support
 		/// The number of boolean constants fragment programs support
-		ushort mFragmentProgramConstantBoolCount;
+		UINT16 mFragmentProgramConstantBoolCount;
 		/// The number of simultaneous render targets supported
 		/// The number of simultaneous render targets supported
-		ushort mNumMultiRenderTargets;
+		UINT16 mNumMultiRenderTargets;
 		/// The maximum point size
 		/// The maximum point size
-		Real mMaxPointSize;
+		float mMaxPointSize;
 		/// Are non-POW2 textures feature-limited?
 		/// Are non-POW2 textures feature-limited?
 		bool mNonPOW2TexturesLimited;
 		bool mNonPOW2TexturesLimited;
 		/// The number of vertex texture units supported
 		/// The number of vertex texture units supported
-		ushort mNumVertexTextureUnits;
+		UINT16 mNumVertexTextureUnits;
 		/// Are vertex texture units shared with fragment processor?
 		/// Are vertex texture units shared with fragment processor?
 		bool mVertexTextureUnitsShared;
 		bool mVertexTextureUnitsShared;
 		/// The number of vertices a geometry program can emit in a single run
 		/// The number of vertices a geometry program can emit in a single run
@@ -362,33 +362,33 @@ namespace CamelotEngine
 			return false;
 			return false;
 		}
 		}
 
 
-		void setNumWorldMatrices(ushort num)
+		void setNumWorldMatrices(UINT16 num)
 		{
 		{
 			mNumWorldMatrices = num;
 			mNumWorldMatrices = num;
 		}
 		}
 
 
-		void setNumTextureUnits(ushort num)
+		void setNumTextureUnits(UINT16 num)
 		{
 		{
 			mNumTextureUnits = num;
 			mNumTextureUnits = num;
 		}
 		}
 
 
-		void setStencilBufferBitDepth(ushort num)
+		void setStencilBufferBitDepth(UINT16 num)
 		{
 		{
 			mStencilBufferBitDepth = num;
 			mStencilBufferBitDepth = num;
 		}
 		}
 
 
-		void setNumVertexBlendMatrices(ushort num)
+		void setNumVertexBlendMatrices(UINT16 num)
 		{
 		{
 			mNumVertexBlendMatrices = num;
 			mNumVertexBlendMatrices = num;
 		}
 		}
 
 
 		/// The number of simultaneous render targets supported
 		/// The number of simultaneous render targets supported
-		void setNumMultiRenderTargets(ushort num)
+		void setNumMultiRenderTargets(UINT16 num)
 		{
 		{
 			mNumMultiRenderTargets = num;
 			mNumMultiRenderTargets = num;
 		}
 		}
 
 
-		ushort getNumWorldMatrices(void) const
+		UINT16 getNumWorldMatrices(void) const
 		{ 
 		{ 
 			return mNumWorldMatrices;
 			return mNumWorldMatrices;
 		}
 		}
@@ -405,7 +405,7 @@ namespace CamelotEngine
 		to the fixed-function pipeline, the number available to the 
 		to the fixed-function pipeline, the number available to the 
 		programmable pipeline depends on the shader model in use.
 		programmable pipeline depends on the shader model in use.
 		*/
 		*/
-		ushort getNumTextureUnits(void) const
+		UINT16 getNumTextureUnits(void) const
 		{
 		{
 			return mNumTextureUnits;
 			return mNumTextureUnits;
 		}
 		}
@@ -416,20 +416,20 @@ namespace CamelotEngine
 		If hardware stencilling is not supported, the software will
 		If hardware stencilling is not supported, the software will
 		provide an 8-bit software stencil.
 		provide an 8-bit software stencil.
 		*/
 		*/
-		ushort getStencilBufferBitDepth(void) const
+		UINT16 getStencilBufferBitDepth(void) const
 		{
 		{
 			return mStencilBufferBitDepth;
 			return mStencilBufferBitDepth;
 		}
 		}
 
 
 		/** Returns the number of matrices available to hardware vertex 
 		/** Returns the number of matrices available to hardware vertex 
 		blending for this rendering system. */
 		blending for this rendering system. */
-		ushort getNumVertexBlendMatrices(void) const
+		UINT16 getNumVertexBlendMatrices(void) const
 		{
 		{
 			return mNumVertexBlendMatrices;
 			return mNumVertexBlendMatrices;
 		}
 		}
 
 
 		/// The number of simultaneous render targets supported
 		/// The number of simultaneous render targets supported
-		ushort getNumMultiRenderTargets(void) const
+		UINT16 getNumMultiRenderTargets(void) const
 		{
 		{
 			return mNumMultiRenderTargets;
 			return mNumMultiRenderTargets;
 		}
 		}
@@ -510,47 +510,47 @@ namespace CamelotEngine
 
 
 
 
 		/// The number of floating-point constants vertex programs support
 		/// The number of floating-point constants vertex programs support
-		ushort getVertexProgramConstantFloatCount(void) const
+		UINT16 getVertexProgramConstantFloatCount(void) const
 		{
 		{
 			return mVertexProgramConstantFloatCount;           
 			return mVertexProgramConstantFloatCount;           
 		}
 		}
 		/// The number of integer constants vertex programs support
 		/// The number of integer constants vertex programs support
-		ushort getVertexProgramConstantIntCount(void) const
+		UINT16 getVertexProgramConstantIntCount(void) const
 		{
 		{
 			return mVertexProgramConstantIntCount;           
 			return mVertexProgramConstantIntCount;           
 		}
 		}
 		/// The number of boolean constants vertex programs support
 		/// The number of boolean constants vertex programs support
-		ushort getVertexProgramConstantBoolCount(void) const
+		UINT16 getVertexProgramConstantBoolCount(void) const
 		{
 		{
 			return mVertexProgramConstantBoolCount;           
 			return mVertexProgramConstantBoolCount;           
 		}
 		}
 		/// The number of floating-point constants geometry programs support
 		/// The number of floating-point constants geometry programs support
-		ushort getGeometryProgramConstantFloatCount(void) const
+		UINT16 getGeometryProgramConstantFloatCount(void) const
 		{
 		{
 			return mGeometryProgramConstantFloatCount;           
 			return mGeometryProgramConstantFloatCount;           
 		}
 		}
 		/// The number of integer constants geometry programs support
 		/// The number of integer constants geometry programs support
-		ushort getGeometryProgramConstantIntCount(void) const
+		UINT16 getGeometryProgramConstantIntCount(void) const
 		{
 		{
 			return mGeometryProgramConstantIntCount;           
 			return mGeometryProgramConstantIntCount;           
 		}
 		}
 		/// The number of boolean constants geometry programs support
 		/// The number of boolean constants geometry programs support
-		ushort getGeometryProgramConstantBoolCount(void) const
+		UINT16 getGeometryProgramConstantBoolCount(void) const
 		{
 		{
 			return mGeometryProgramConstantBoolCount;           
 			return mGeometryProgramConstantBoolCount;           
 		}
 		}
 		/// The number of floating-point constants fragment programs support
 		/// The number of floating-point constants fragment programs support
-		ushort getFragmentProgramConstantFloatCount(void) const
+		UINT16 getFragmentProgramConstantFloatCount(void) const
 		{
 		{
 			return mFragmentProgramConstantFloatCount;           
 			return mFragmentProgramConstantFloatCount;           
 		}
 		}
 		/// The number of integer constants fragment programs support
 		/// The number of integer constants fragment programs support
-		ushort getFragmentProgramConstantIntCount(void) const
+		UINT16 getFragmentProgramConstantIntCount(void) const
 		{
 		{
 			return mFragmentProgramConstantIntCount;           
 			return mFragmentProgramConstantIntCount;           
 		}
 		}
 		/// The number of boolean constants fragment programs support
 		/// The number of boolean constants fragment programs support
-		ushort getFragmentProgramConstantBoolCount(void) const
+		UINT16 getFragmentProgramConstantBoolCount(void) const
 		{
 		{
 			return mFragmentProgramConstantBoolCount;           
 			return mFragmentProgramConstantBoolCount;           
 		}
 		}
@@ -568,57 +568,57 @@ namespace CamelotEngine
 		}
 		}
 
 
 		/// The number of floating-point constants vertex programs support
 		/// The number of floating-point constants vertex programs support
-		void setVertexProgramConstantFloatCount(ushort c)
+		void setVertexProgramConstantFloatCount(UINT16 c)
 		{
 		{
 			mVertexProgramConstantFloatCount = c;           
 			mVertexProgramConstantFloatCount = c;           
 		}
 		}
 		/// The number of integer constants vertex programs support
 		/// The number of integer constants vertex programs support
-		void setVertexProgramConstantIntCount(ushort c)
+		void setVertexProgramConstantIntCount(UINT16 c)
 		{
 		{
 			mVertexProgramConstantIntCount = c;           
 			mVertexProgramConstantIntCount = c;           
 		}
 		}
 		/// The number of boolean constants vertex programs support
 		/// The number of boolean constants vertex programs support
-		void setVertexProgramConstantBoolCount(ushort c)
+		void setVertexProgramConstantBoolCount(UINT16 c)
 		{
 		{
 			mVertexProgramConstantBoolCount = c;           
 			mVertexProgramConstantBoolCount = c;           
 		}
 		}
 		/// The number of floating-point constants geometry programs support
 		/// The number of floating-point constants geometry programs support
-		void setGeometryProgramConstantFloatCount(ushort c)
+		void setGeometryProgramConstantFloatCount(UINT16 c)
 		{
 		{
 			mGeometryProgramConstantFloatCount = c;           
 			mGeometryProgramConstantFloatCount = c;           
 		}
 		}
 		/// The number of integer constants geometry programs support
 		/// The number of integer constants geometry programs support
-		void setGeometryProgramConstantIntCount(ushort c)
+		void setGeometryProgramConstantIntCount(UINT16 c)
 		{
 		{
 			mGeometryProgramConstantIntCount = c;           
 			mGeometryProgramConstantIntCount = c;           
 		}
 		}
 		/// The number of boolean constants geometry programs support
 		/// The number of boolean constants geometry programs support
-		void setGeometryProgramConstantBoolCount(ushort c)
+		void setGeometryProgramConstantBoolCount(UINT16 c)
 		{
 		{
 			mGeometryProgramConstantBoolCount = c;           
 			mGeometryProgramConstantBoolCount = c;           
 		}
 		}
 		/// The number of floating-point constants fragment programs support
 		/// The number of floating-point constants fragment programs support
-		void setFragmentProgramConstantFloatCount(ushort c)
+		void setFragmentProgramConstantFloatCount(UINT16 c)
 		{
 		{
 			mFragmentProgramConstantFloatCount = c;           
 			mFragmentProgramConstantFloatCount = c;           
 		}
 		}
 		/// The number of integer constants fragment programs support
 		/// The number of integer constants fragment programs support
-		void setFragmentProgramConstantIntCount(ushort c)
+		void setFragmentProgramConstantIntCount(UINT16 c)
 		{
 		{
 			mFragmentProgramConstantIntCount = c;           
 			mFragmentProgramConstantIntCount = c;           
 		}
 		}
 		/// The number of boolean constants fragment programs support
 		/// The number of boolean constants fragment programs support
-		void setFragmentProgramConstantBoolCount(ushort c)
+		void setFragmentProgramConstantBoolCount(UINT16 c)
 		{
 		{
 			mFragmentProgramConstantBoolCount = c;           
 			mFragmentProgramConstantBoolCount = c;           
 		}
 		}
 		/// Maximum point screen size in pixels
 		/// Maximum point screen size in pixels
-		void setMaxPointSize(Real s)
+		void setMaxPointSize(float s)
 		{
 		{
 			mMaxPointSize = s;
 			mMaxPointSize = s;
 		}
 		}
 		/// Maximum point screen size in pixels
 		/// Maximum point screen size in pixels
-		Real getMaxPointSize(void) const
+		float getMaxPointSize(void) const
 		{
 		{
 			return mMaxPointSize;
 			return mMaxPointSize;
 		}
 		}
@@ -641,12 +641,12 @@ namespace CamelotEngine
 		}
 		}
 
 
 		/// Set the number of vertex texture units supported
 		/// Set the number of vertex texture units supported
-		void setNumVertexTextureUnits(ushort n)
+		void setNumVertexTextureUnits(UINT16 n)
 		{
 		{
 			mNumVertexTextureUnits = n;
 			mNumVertexTextureUnits = n;
 		}
 		}
 		/// Get the number of vertex texture units supported
 		/// Get the number of vertex texture units supported
-		ushort getNumVertexTextureUnits(void) const
+		UINT16 getNumVertexTextureUnits(void) const
 		{
 		{
 			return mNumVertexTextureUnits;
 			return mNumVertexTextureUnits;
 		}
 		}

+ 5 - 5
CamelotRenderer/OgreRenderTarget.h

@@ -185,9 +185,9 @@ namespace CamelotEngine {
             at the time the render target is attached to the render system, changes
             at the time the render target is attached to the render system, changes
             afterwards will not affect the ordering.
             afterwards will not affect the ordering.
         */
         */
-        virtual void setPriority( uchar priority ) { mPriority = priority; }
+        virtual void setPriority( UINT8 priority ) { mPriority = priority; }
         /** Gets the priority of a render target. */
         /** Gets the priority of a render target. */
-		virtual uchar getPriority() const { return mPriority; }
+		virtual UINT8 getPriority() const { return mPriority; }
 
 
         /** Used to retrieve or set the active state of the render target.
         /** Used to retrieve or set the active state of the render target.
         */
         */
@@ -230,7 +230,7 @@ namespace CamelotEngine {
 
 
 		/** Indicates whether multisampling is performed on rendering and at what level.
 		/** Indicates whether multisampling is performed on rendering and at what level.
 		*/
 		*/
-		virtual uint getFSAA() const { return mFSAA; }
+		virtual UINT32 getFSAA() const { return mFSAA; }
 
 
 		/** Gets the FSAA hint (@see Root::createRenderWindow)
 		/** Gets the FSAA hint (@see Root::createRenderWindow)
 		*/
 		*/
@@ -309,7 +309,7 @@ namespace CamelotEngine {
         /// The name of this target.
         /// The name of this target.
         String mName;
         String mName;
 		/// The priority of the render target.
 		/// The priority of the render target.
-		uchar mPriority;
+		UINT8 mPriority;
 
 
         unsigned int mWidth;
         unsigned int mWidth;
         unsigned int mHeight;
         unsigned int mHeight;
@@ -321,7 +321,7 @@ namespace CamelotEngine {
 		// Hardware sRGB gamma conversion done on write?
 		// Hardware sRGB gamma conversion done on write?
 		bool mHwGamma;
 		bool mHwGamma;
 		// FSAA performed?
 		// FSAA performed?
-		uint mFSAA;
+		UINT32 mFSAA;
 		String mFSAAHint;
 		String mFSAAHint;
 
 
 		typedef map<int, Viewport*>::type ViewportList;
 		typedef map<int, Viewport*>::type ViewportList;

+ 0 - 108
CamelotRenderer/OgreSphere.h

@@ -1,108 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __Sphere_H_
-#define __Sphere_H_
-
-// Precompiler options
-#include "OgrePrerequisites.h"
-
-#include "OgreVector3.h"
-
-namespace CamelotEngine {
-
-
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Math
-	*  @{
-	*/
-	/** A sphere primitive, mostly used for bounds checking. 
-    @remarks
-        A sphere in math texts is normally represented by the function
-        x^2 + y^2 + z^2 = r^2 (for sphere's centered on the origin). Ogre stores spheres
-        simply as a center point and a radius.
-    */
-    class CM_EXPORT Sphere
-    {
-    protected:
-        Real mRadius;
-        Vector3 mCenter;
-    public:
-        /** Standard constructor - creates a unit sphere around the origin.*/
-        Sphere() : mRadius(1.0), mCenter(Vector3::ZERO) {}
-        /** Constructor allowing arbitrary spheres. 
-            @param center The center point of the sphere.
-            @param radius The radius of the sphere.
-        */
-        Sphere(const Vector3& center, Real radius)
-            : mRadius(radius), mCenter(center) {}
-
-        /** Returns the radius of the sphere. */
-        Real getRadius(void) const { return mRadius; }
-
-        /** Sets the radius of the sphere. */
-        void setRadius(Real radius) { mRadius = radius; }
-
-        /** Returns the center point of the sphere. */
-        const Vector3& getCenter(void) const { return mCenter; }
-
-        /** Sets the center point of the sphere. */
-        void setCenter(const Vector3& center) { mCenter = center; }
-
-		/** Returns whether or not this sphere intersects another sphere. */
-		bool intersects(const Sphere& s) const
-		{
-            return (s.mCenter - mCenter).squaredLength() <=
-                Math::Sqr(s.mRadius + mRadius);
-		}
-		/** Returns whether or not this sphere intersects a box. */
-		bool intersects(const AxisAlignedBox& box) const
-		{
-			return Math::intersects(*this, box);
-		}
-		/** Returns whether or not this sphere intersects a plane. */
-		bool intersects(const Plane& plane) const
-		{
-			return Math::intersects(*this, plane);
-		}
-		/** Returns whether or not this sphere intersects a point. */
-		bool intersects(const Vector3& v) const
-		{
-            return ((v - mCenter).squaredLength() <= Math::Sqr(mRadius));
-		}
-        
-
-    };
-	/** @} */
-	/** @} */
-
-}
-
-#endif
-

+ 3 - 3
CamelotRenderer/OgreStringConverter.cpp

@@ -30,7 +30,7 @@ THE SOFTWARE.
 namespace CamelotEngine {
 namespace CamelotEngine {
 
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    String StringConverter::toString(Real val, unsigned short precision, 
+    String StringConverter::toString(float val, unsigned short precision, 
         unsigned short width, char fill, std::ios::fmtflags flags)
         unsigned short width, char fill, std::ios::fmtflags flags)
     {
     {
         stringstream stream;
         stringstream stream;
@@ -245,11 +245,11 @@ namespace CamelotEngine {
         return stream.str();
         return stream.str();
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    Real StringConverter::parseReal(const String& val, Real defaultValue)
+    float StringConverter::parseReal(const String& val, float defaultValue)
     {
     {
 		// Use istringstream for direct correspondence with toString
 		// Use istringstream for direct correspondence with toString
 		StringStream str(val);
 		StringStream str(val);
-		Real ret = defaultValue;
+		float ret = defaultValue;
 		str >> ret;
 		str >> ret;
 
 
         return ret;
         return ret;

+ 23 - 23
CamelotRenderer/OgreStringConverter.h

@@ -32,13 +32,13 @@ THE SOFTWARE.
 #include "OgrePrerequisites.h"
 #include "OgrePrerequisites.h"
 #include "OgreString.h"
 #include "OgreString.h"
 #include "OgreColourValue.h"
 #include "OgreColourValue.h"
-#include "OgreMath.h"
-#include "OgreMatrix3.h"
-#include "OgreMatrix4.h"
-#include "OgreQuaternion.h"
-#include "OgreVector2.h"
-#include "OgreVector3.h"
-#include "OgreVector4.h"
+#include "CmMath.h"
+#include "CmMatrix3.h"
+#include "CmMatrix4.h"
+#include "CmQuaternion.h"
+#include "CmVector2.h"
+#include "CmVector3.h"
+#include "CmVector4.h"
 
 
 namespace CamelotEngine {
 namespace CamelotEngine {
 
 
@@ -59,7 +59,7 @@ namespace CamelotEngine {
         class.
         class.
     @par
     @par
         The String formats of each of the major types is listed with the methods. The basic types
         The String formats of each of the major types is listed with the methods. The basic types
-        like int and Real just use the underlying C runtime library atof and atoi family methods,
+        like int and float just use the underlying C runtime library atof and atoi family methods,
         however custom types like Vector3, ColourValue and Matrix4 are also supported by this class
         however custom types like Vector3, ColourValue and Matrix4 are also supported by this class
         using custom formats.
         using custom formats.
     @author
     @author
@@ -69,8 +69,8 @@ namespace CamelotEngine {
     {
     {
     public:
     public:
 
 
-        /** Converts a Real to a String. */
-        static String toString(Real val, unsigned short precision = 6, 
+        /** Converts a float to a String. */
+        static String toString(float val, unsigned short precision = 6, 
             unsigned short width = 0, char fill = ' ', 
             unsigned short width = 0, char fill = ' ', 
             std::ios::fmtflags flags = std::ios::fmtflags(0) );
             std::ios::fmtflags flags = std::ios::fmtflags(0) );
         /** Converts a Radian to a String. */
         /** Converts a Radian to a String. */
@@ -127,17 +127,17 @@ namespace CamelotEngine {
         static String toString(bool val, bool yesNo = false);
         static String toString(bool val, bool yesNo = false);
 		/** Converts a Vector2 to a String. 
 		/** Converts a Vector2 to a String. 
         @remarks
         @remarks
-            Format is "x y" (i.e. 2x Real values, space delimited)
+            Format is "x y" (i.e. 2x float values, space delimited)
         */
         */
         static String toString(const Vector2& val);
         static String toString(const Vector2& val);
         /** Converts a Vector3 to a String. 
         /** Converts a Vector3 to a String. 
         @remarks
         @remarks
-            Format is "x y z" (i.e. 3x Real values, space delimited)
+            Format is "x y z" (i.e. 3x float values, space delimited)
         */
         */
         static String toString(const Vector3& val);
         static String toString(const Vector3& val);
 		/** Converts a Vector4 to a String. 
 		/** Converts a Vector4 to a String. 
         @remarks
         @remarks
-            Format is "x y z w" (i.e. 4x Real values, space delimited)
+            Format is "x y z w" (i.e. 4x float values, space delimited)
         */
         */
         static String toString(const Vector4& val);
         static String toString(const Vector4& val);
         /** Converts a Matrix3 to a String. 
         /** Converts a Matrix3 to a String. 
@@ -153,12 +153,12 @@ namespace CamelotEngine {
         static String toString(const Matrix4& val);
         static String toString(const Matrix4& val);
         /** Converts a Quaternion to a String. 
         /** Converts a Quaternion to a String. 
         @remarks
         @remarks
-            Format is "w x y z" (i.e. 4x Real values, space delimited)
+            Format is "w x y z" (i.e. 4x float values, space delimited)
         */
         */
         static String toString(const Quaternion& val);
         static String toString(const Quaternion& val);
         /** Converts a ColourValue to a String. 
         /** Converts a ColourValue to a String. 
         @remarks
         @remarks
-            Format is "r g b a" (i.e. 4x Real values, space delimited). 
+            Format is "r g b a" (i.e. 4x float values, space delimited). 
         */
         */
         static String toString(const ColourValue& val);
         static String toString(const ColourValue& val);
         /** Converts a StringVector to a string.
         /** Converts a StringVector to a string.
@@ -168,11 +168,11 @@ namespace CamelotEngine {
         */
         */
         static String toString(const std::vector<CamelotEngine::String>& val);
         static String toString(const std::vector<CamelotEngine::String>& val);
 
 
-        /** Converts a String to a Real. 
+        /** Converts a String to a float. 
         @returns
         @returns
-            0.0 if the value could not be parsed, otherwise the Real version of the String.
+            0.0 if the value could not be parsed, otherwise the float version of the String.
         */
         */
-        static Real parseReal(const String& val, Real defaultValue = 0);
+        static float parseReal(const String& val, float defaultValue = 0);
         /** Converts a String to a Angle. 
         /** Converts a String to a Angle. 
         @returns
         @returns
             0.0 if the value could not be parsed, otherwise the Angle version of the String.
             0.0 if the value could not be parsed, otherwise the Angle version of the String.
@@ -208,19 +208,19 @@ namespace CamelotEngine {
         static bool parseBool(const String& val, bool defaultValue = 0);
         static bool parseBool(const String& val, bool defaultValue = 0);
 		/** Parses a Vector2 out of a String.
 		/** Parses a Vector2 out of a String.
         @remarks
         @remarks
-            Format is "x y" ie. 2 Real components, space delimited. Failure to parse returns
+            Format is "x y" ie. 2 float components, space delimited. Failure to parse returns
             Vector2::ZERO.
             Vector2::ZERO.
         */
         */
 		static Vector2 parseVector2(const String& val, const Vector2& defaultValue = Vector2::ZERO);
 		static Vector2 parseVector2(const String& val, const Vector2& defaultValue = Vector2::ZERO);
 		/** Parses a Vector3 out of a String.
 		/** Parses a Vector3 out of a String.
         @remarks
         @remarks
-            Format is "x y z" ie. 3 Real components, space delimited. Failure to parse returns
+            Format is "x y z" ie. 3 float components, space delimited. Failure to parse returns
             Vector3::ZERO.
             Vector3::ZERO.
         */
         */
         static Vector3 parseVector3(const String& val, const Vector3& defaultValue = Vector3::ZERO);
         static Vector3 parseVector3(const String& val, const Vector3& defaultValue = Vector3::ZERO);
         /** Parses a Vector4 out of a String.
         /** Parses a Vector4 out of a String.
         @remarks
         @remarks
-            Format is "x y z w" ie. 4 Real components, space delimited. Failure to parse returns
+            Format is "x y z w" ie. 4 float components, space delimited. Failure to parse returns
             Vector4::ZERO.
             Vector4::ZERO.
         */
         */
         static Vector4 parseVector4(const String& val, const Vector4& defaultValue = Vector4::ZERO);
         static Vector4 parseVector4(const String& val, const Vector4& defaultValue = Vector4::ZERO);
@@ -238,13 +238,13 @@ namespace CamelotEngine {
         static Matrix4 parseMatrix4(const String& val, const Matrix4& defaultValue = Matrix4::IDENTITY);
         static Matrix4 parseMatrix4(const String& val, const Matrix4& defaultValue = Matrix4::IDENTITY);
         /** Parses a Quaternion out of a String. 
         /** Parses a Quaternion out of a String. 
         @remarks
         @remarks
-            Format is "w x y z" (i.e. 4x Real values, space delimited). 
+            Format is "w x y z" (i.e. 4x float values, space delimited). 
             Failure to parse returns Quaternion::IDENTITY.
             Failure to parse returns Quaternion::IDENTITY.
         */
         */
         static Quaternion parseQuaternion(const String& val, const Quaternion& defaultValue = Quaternion::IDENTITY);
         static Quaternion parseQuaternion(const String& val, const Quaternion& defaultValue = Quaternion::IDENTITY);
         /** Parses a ColourValue out of a String. 
         /** Parses a ColourValue out of a String. 
         @remarks
         @remarks
-            Format is "r g b a" (i.e. 4x Real values, space delimited), or "r g b" which implies
+            Format is "r g b a" (i.e. 4x float values, space delimited), or "r g b" which implies
             an alpha value of 1.0 (opaque). Failure to parse returns ColourValue::Black.
             an alpha value of 1.0 (opaque). Failure to parse returns ColourValue::Black.
         */
         */
         static ColourValue parseColourValue(const String& val, const ColourValue& defaultValue = ColourValue::Black);
         static ColourValue parseColourValue(const String& val, const ColourValue& defaultValue = ColourValue::Black);

+ 5 - 5
CamelotRenderer/OgreTexture.cpp

@@ -69,27 +69,27 @@ namespace CamelotEngine {
         return PixelUtil::hasAlpha(mFormat);
         return PixelUtil::hasAlpha(mFormat);
     }
     }
     //--------------------------------------------------------------------------
     //--------------------------------------------------------------------------
-    void Texture::setDesiredIntegerBitDepth(ushort bits)
+    void Texture::setDesiredIntegerBitDepth(UINT16 bits)
     {
     {
         mDesiredIntegerBitDepth = bits;
         mDesiredIntegerBitDepth = bits;
     }
     }
     //--------------------------------------------------------------------------
     //--------------------------------------------------------------------------
-    ushort Texture::getDesiredIntegerBitDepth(void) const
+    UINT16 Texture::getDesiredIntegerBitDepth(void) const
     {
     {
         return mDesiredIntegerBitDepth;
         return mDesiredIntegerBitDepth;
     }
     }
     //--------------------------------------------------------------------------
     //--------------------------------------------------------------------------
-    void Texture::setDesiredFloatBitDepth(ushort bits)
+    void Texture::setDesiredFloatBitDepth(UINT16 bits)
     {
     {
         mDesiredFloatBitDepth = bits;
         mDesiredFloatBitDepth = bits;
     }
     }
     //--------------------------------------------------------------------------
     //--------------------------------------------------------------------------
-    ushort Texture::getDesiredFloatBitDepth(void) const
+    UINT16 Texture::getDesiredFloatBitDepth(void) const
     {
     {
         return mDesiredFloatBitDepth;
         return mDesiredFloatBitDepth;
     }
     }
     //--------------------------------------------------------------------------
     //--------------------------------------------------------------------------
-    void Texture::setDesiredBitDepths(ushort integerBits, ushort floatBits)
+    void Texture::setDesiredBitDepths(UINT16 integerBits, UINT16 floatBits)
     {
     {
         mDesiredIntegerBitDepth = integerBits;
         mDesiredIntegerBitDepth = integerBits;
         mDesiredFloatBitDepth = floatBits;
         mDesiredFloatBitDepth = floatBits;

+ 8 - 8
CamelotRenderer/OgreTexture.h

@@ -169,12 +169,12 @@ namespace CamelotEngine {
 		@param fsaa The number of samples
 		@param fsaa The number of samples
 		@param fsaaHint Any hinting text (@see Root::createRenderWindow)
 		@param fsaaHint Any hinting text (@see Root::createRenderWindow)
 		*/
 		*/
-		virtual void setFSAA(uint fsaa, const String& fsaaHint) { mFSAA = fsaa; mFSAAHint = fsaaHint; }
+		virtual void setFSAA(UINT32 fsaa, const String& fsaaHint) { mFSAA = fsaa; mFSAAHint = fsaaHint; }
 
 
 		/** Get the level of multisample AA to be used if this texture is a 
 		/** Get the level of multisample AA to be used if this texture is a 
 		rendertarget.
 		rendertarget.
 		*/
 		*/
-		virtual uint getFSAA() const { return mFSAA; }
+		virtual UINT32 getFSAA() const { return mFSAA; }
 
 
 		/** Get the multisample AA hint if this texture is a rendertarget.
 		/** Get the multisample AA hint if this texture is a rendertarget.
 		*/
 		*/
@@ -285,26 +285,26 @@ namespace CamelotEngine {
             Available values: 0, 16 and 32, where 0 (the default) means keep original format
             Available values: 0, 16 and 32, where 0 (the default) means keep original format
             as it is. This value is number of bits for the pixel.
             as it is. This value is number of bits for the pixel.
         */
         */
-        virtual void setDesiredIntegerBitDepth(ushort bits);
+        virtual void setDesiredIntegerBitDepth(UINT16 bits);
 
 
         /** gets desired bit depth for integer pixel format textures.
         /** gets desired bit depth for integer pixel format textures.
         */
         */
-        virtual ushort getDesiredIntegerBitDepth(void) const;
+        virtual UINT16 getDesiredIntegerBitDepth(void) const;
 
 
         /** Sets desired bit depth for float pixel format textures.
         /** Sets desired bit depth for float pixel format textures.
         @note
         @note
             Available values: 0, 16 and 32, where 0 (the default) means keep original format
             Available values: 0, 16 and 32, where 0 (the default) means keep original format
             as it is. This value is number of bits for a channel of the pixel.
             as it is. This value is number of bits for a channel of the pixel.
         */
         */
-        virtual void setDesiredFloatBitDepth(ushort bits);
+        virtual void setDesiredFloatBitDepth(UINT16 bits);
 
 
         /** gets desired bit depth for float pixel format textures.
         /** gets desired bit depth for float pixel format textures.
         */
         */
-        virtual ushort getDesiredFloatBitDepth(void) const;
+        virtual UINT16 getDesiredFloatBitDepth(void) const;
 
 
         /** Sets desired bit depth for integer and float pixel format.
         /** Sets desired bit depth for integer and float pixel format.
         */
         */
-        virtual void setDesiredBitDepths(ushort integerBits, ushort floatBits);
+        virtual void setDesiredBitDepths(UINT16 integerBits, UINT16 floatBits);
 
 
         /** Return the number of faces this texture has. This will be 6 for a cubemap
         /** Return the number of faces this texture has. This will be 6 for a cubemap
         	texture and 1 for a 1D, 2D or 3D one.
         	texture and 1 for a 1D, 2D or 3D one.
@@ -342,7 +342,7 @@ namespace CamelotEngine {
 		bool mMipmapsHardwareGenerated;
 		bool mMipmapsHardwareGenerated;
         float mGamma;
         float mGamma;
 		bool mHwGamma;
 		bool mHwGamma;
-		uint mFSAA;
+		UINT32 mFSAA;
 		String mFSAAHint;
 		String mFSAAHint;
 
 
         TextureType mTextureType;
         TextureType mTextureType;

+ 7 - 7
CamelotRenderer/OgreTextureManager.cpp

@@ -56,9 +56,9 @@ namespace CamelotEngine {
 
 
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    TexturePtr TextureManager::create(TextureType texType, uint width, uint height, uint depth, int numMipmaps,
+    TexturePtr TextureManager::create(TextureType texType, UINT32 width, UINT32 height, UINT32 depth, int numMipmaps,
         PixelFormat format, int usage, bool hwGamma, 
         PixelFormat format, int usage, bool hwGamma, 
-		uint fsaa, const String& fsaaHint)
+		UINT32 fsaa, const String& fsaaHint)
     {
     {
         TexturePtr ret = TexturePtr(createImpl());
         TexturePtr ret = TexturePtr(createImpl());
         ret->setTextureType(texType);
         ret->setTextureType(texType);
@@ -75,27 +75,27 @@ namespace CamelotEngine {
 		return ret;
 		return ret;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void TextureManager::setPreferredIntegerBitDepth(ushort bits)
+    void TextureManager::setPreferredIntegerBitDepth(UINT16 bits)
     {
     {
         mPreferredIntegerBitDepth = bits;
         mPreferredIntegerBitDepth = bits;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    ushort TextureManager::getPreferredIntegerBitDepth(void) const
+    UINT16 TextureManager::getPreferredIntegerBitDepth(void) const
     {
     {
         return mPreferredIntegerBitDepth;
         return mPreferredIntegerBitDepth;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void TextureManager::setPreferredFloatBitDepth(ushort bits)
+    void TextureManager::setPreferredFloatBitDepth(UINT16 bits)
     {
     {
         mPreferredFloatBitDepth = bits;
         mPreferredFloatBitDepth = bits;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    ushort TextureManager::getPreferredFloatBitDepth(void) const
+    UINT16 TextureManager::getPreferredFloatBitDepth(void) const
     {
     {
         return mPreferredFloatBitDepth;
         return mPreferredFloatBitDepth;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void TextureManager::setPreferredBitDepths(ushort integerBits, ushort floatBits)
+    void TextureManager::setPreferredBitDepths(UINT16 integerBits, UINT16 floatBits)
     {
     {
         mPreferredIntegerBitDepth = integerBits;
         mPreferredIntegerBitDepth = integerBits;
         mPreferredFloatBitDepth = floatBits;
         mPreferredFloatBitDepth = floatBits;

+ 11 - 11
CamelotRenderer/OgreTextureManager.h

@@ -108,9 +108,9 @@ namespace CamelotEngine {
 				if usage does not include TU_RENDERTARGET or if the device does
 				if usage does not include TU_RENDERTARGET or if the device does
 				not support it.
 				not support it.
         */
         */
-        TexturePtr create(TextureType texType, uint width, uint height, uint depth, 
+        TexturePtr create(TextureType texType, UINT32 width, UINT32 height, UINT32 depth, 
 			int num_mips, PixelFormat format, int usage = TU_DEFAULT,
 			int num_mips, PixelFormat format, int usage = TU_DEFAULT,
-			bool hwGammaCorrection = false, uint fsaa = 0, const String& fsaaHint = StringUtil::BLANK);
+			bool hwGammaCorrection = false, UINT32 fsaa = 0, const String& fsaaHint = StringUtil::BLANK);
 			
 			
         /** Create a manual texture with a depth of 1 (not loaded from a file).
         /** Create a manual texture with a depth of 1 (not loaded from a file).
             @param
             @param
@@ -154,9 +154,9 @@ namespace CamelotEngine {
 				if usage does not include TU_RENDERTARGET or if the device does
 				if usage does not include TU_RENDERTARGET or if the device does
 				not support it.
 				not support it.
         */
         */
-        TexturePtr create(TextureType texType, uint width, uint height, int num_mips,
+        TexturePtr create(TextureType texType, UINT32 width, UINT32 height, int num_mips,
             PixelFormat format, int usage = TU_DEFAULT,
             PixelFormat format, int usage = TU_DEFAULT,
-			bool hwGammaCorrection = false, uint fsaa = 0, const String& fsaaHint = StringUtil::BLANK)
+			bool hwGammaCorrection = false, UINT32 fsaa = 0, const String& fsaaHint = StringUtil::BLANK)
 		{
 		{
 			return create(texType, width, height, 1, 
 			return create(texType, width, height, 1, 
 				num_mips, format, usage, hwGammaCorrection, fsaa, fsaaHint);
 				num_mips, format, usage, hwGammaCorrection, fsaa, fsaaHint);
@@ -167,22 +167,22 @@ namespace CamelotEngine {
             bits Number of bits. Available values: 0, 16 and 32, where 0 (the default) means keep
             bits Number of bits. Available values: 0, 16 and 32, where 0 (the default) means keep
             original format as it is. This value is number of bits for the pixel.
             original format as it is. This value is number of bits for the pixel.
         */
         */
-        virtual void setPreferredIntegerBitDepth(ushort bits);
+        virtual void setPreferredIntegerBitDepth(UINT16 bits);
 
 
         /** gets preferred bit depth for integer pixel format textures.
         /** gets preferred bit depth for integer pixel format textures.
         */
         */
-        virtual ushort getPreferredIntegerBitDepth(void) const;
+        virtual UINT16 getPreferredIntegerBitDepth(void) const;
 
 
         /** Sets preferred bit depth for float pixel format textures.
         /** Sets preferred bit depth for float pixel format textures.
         @param
         @param
             bits Number of bits. Available values: 0, 16 and 32, where 0 (the default) means keep
             bits Number of bits. Available values: 0, 16 and 32, where 0 (the default) means keep
             original format as it is. This value is number of bits for a channel of the pixel.
             original format as it is. This value is number of bits for a channel of the pixel.
         */
         */
-        virtual void setPreferredFloatBitDepth(ushort bits);
+        virtual void setPreferredFloatBitDepth(UINT16 bits);
 
 
         /** gets preferred bit depth for float pixel format textures.
         /** gets preferred bit depth for float pixel format textures.
         */
         */
-        virtual ushort getPreferredFloatBitDepth(void) const;
+        virtual UINT16 getPreferredFloatBitDepth(void) const;
 
 
         /** Sets preferred bit depth for integer and float pixel format.
         /** Sets preferred bit depth for integer and float pixel format.
         @param
         @param
@@ -192,7 +192,7 @@ namespace CamelotEngine {
             floatBits Number of bits. Available values: 0, 16 and 32, where 0 (the default) means keep
             floatBits Number of bits. Available values: 0, 16 and 32, where 0 (the default) means keep
             original format as it is. This value is number of bits for a channel of the pixel.
             original format as it is. This value is number of bits for a channel of the pixel.
         */
         */
-        virtual void setPreferredBitDepths(ushort integerBits, ushort floatBits);
+        virtual void setPreferredBitDepths(UINT16 integerBits, UINT16 floatBits);
 
 
 		/** Returns whether this render system can natively support the precise texture 
 		/** Returns whether this render system can natively support the precise texture 
 			format requested with the given usage options.
 			format requested with the given usage options.
@@ -316,8 +316,8 @@ namespace CamelotEngine {
 
 
     protected:
     protected:
 
 
-        ushort mPreferredIntegerBitDepth;
-        ushort mPreferredFloatBitDepth;
+        UINT16 mPreferredIntegerBitDepth;
+        UINT16 mPreferredFloatBitDepth;
         size_t mDefaultNumMipmaps;
         size_t mDefaultNumMipmaps;
     };
     };
 	/** @} */
 	/** @} */

+ 2 - 2
CamelotRenderer/OgreTextureState.h

@@ -31,7 +31,7 @@ THE SOFTWARE.
 #include "OgrePrerequisites.h"
 #include "OgrePrerequisites.h"
 #include "OgreCommon.h"
 #include "OgreCommon.h"
 #include "OgreBlendMode.h"
 #include "OgreBlendMode.h"
-#include "OgreMatrix4.h"
+#include "CmMatrix4.h"
 #include "OgreString.h"
 #include "OgreString.h"
 #include "OgrePixelFormat.h"
 #include "OgrePixelFormat.h"
 #include "OgreTexture.h"
 #include "OgreTexture.h"
@@ -291,7 +291,7 @@ protected:
         FilterOptions mMipFilter;
         FilterOptions mMipFilter;
         ///Texture anisotropy
         ///Texture anisotropy
         unsigned int mMaxAniso;
         unsigned int mMaxAniso;
-		/// Mipmap bias (always float, not Real)
+		/// Mipmap bias (always float, not float)
 		float mMipmapBias;
 		float mMipmapBias;
 
 
         bool mIsDefaultAniso;
         bool mIsDefaultAniso;

+ 0 - 42
CamelotRenderer/OgreVector2.cpp

@@ -1,42 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-
-#include "OgreVector2.h"
-#include "OgreMath.h"
-
-namespace CamelotEngine
-{
-    const Vector2 Vector2::ZERO( 0, 0);
-
-    const Vector2 Vector2::UNIT_X( 1, 0);
-    const Vector2 Vector2::UNIT_Y( 0, 1);
-    const Vector2 Vector2::NEGATIVE_UNIT_X( -1,  0);
-    const Vector2 Vector2::NEGATIVE_UNIT_Y(  0, -1);
-    const Vector2 Vector2::UNIT_SCALE(1, 1);
-
-}

+ 0 - 573
CamelotRenderer/OgreVector2.h

@@ -1,573 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __Vector2_H__
-#define __Vector2_H__
-
-
-#include "OgrePrerequisites.h"
-#include "OgreMath.h"
-
-namespace CamelotEngine
-{
-
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Math
-	*  @{
-	*/
-	/** Standard 2-dimensional vector.
-        @remarks
-            A direction in 2D space represented as distances along the 2
-            orthogonal axes (x, y). Note that positions, directions and
-            scaling factors can be represented by a vector, depending on how
-            you interpret the values.
-    */
-    class CM_EXPORT Vector2
-    {
-    public:
-        Real x, y;
-
-    public:
-        inline Vector2()
-        {
-        }
-
-        inline Vector2(const Real fX, const Real fY )
-            : x( fX ), y( fY )
-        {
-        }
-
-        inline explicit Vector2( const Real scaler )
-            : x( scaler), y( scaler )
-        {
-        }
-
-        inline explicit Vector2( const Real afCoordinate[2] )
-            : x( afCoordinate[0] ),
-              y( afCoordinate[1] )
-        {
-        }
-
-        inline explicit Vector2( const int afCoordinate[2] )
-        {
-            x = (Real)afCoordinate[0];
-            y = (Real)afCoordinate[1];
-        }
-
-        inline explicit Vector2( Real* const r )
-            : x( r[0] ), y( r[1] )
-        {
-        }
-
-		/** Exchange the contents of this vector with another. 
-		*/
-		inline void swap(Vector2& other)
-		{
-			std::swap(x, other.x);
-			std::swap(y, other.y);
-		}
-
-		inline Real operator [] ( const size_t i ) const
-        {
-            assert( i < 2 );
-
-            return *(&x+i);
-        }
-
-		inline Real& operator [] ( const size_t i )
-        {
-            assert( i < 2 );
-
-            return *(&x+i);
-        }
-
-		/// Pointer accessor for direct copying
-		inline Real* ptr()
-		{
-			return &x;
-		}
-		/// Pointer accessor for direct copying
-		inline const Real* ptr() const
-		{
-			return &x;
-		}
-
-        /** Assigns the value of the other vector.
-            @param
-                rkVector The other vector
-        */
-        inline Vector2& operator = ( const Vector2& rkVector )
-        {
-            x = rkVector.x;
-            y = rkVector.y;
-
-            return *this;
-        }
-
-		inline Vector2& operator = ( const Real fScalar)
-		{
-			x = fScalar;
-			y = fScalar;
-
-			return *this;
-		}
-
-        inline bool operator == ( const Vector2& rkVector ) const
-        {
-            return ( x == rkVector.x && y == rkVector.y );
-        }
-
-        inline bool operator != ( const Vector2& rkVector ) const
-        {
-            return ( x != rkVector.x || y != rkVector.y  );
-        }
-
-        // arithmetic operations
-        inline Vector2 operator + ( const Vector2& rkVector ) const
-        {
-            return Vector2(
-                x + rkVector.x,
-                y + rkVector.y);
-        }
-
-        inline Vector2 operator - ( const Vector2& rkVector ) const
-        {
-            return Vector2(
-                x - rkVector.x,
-                y - rkVector.y);
-        }
-
-        inline Vector2 operator * ( const Real fScalar ) const
-        {
-            return Vector2(
-                x * fScalar,
-                y * fScalar);
-        }
-
-        inline Vector2 operator * ( const Vector2& rhs) const
-        {
-            return Vector2(
-                x * rhs.x,
-                y * rhs.y);
-        }
-
-        inline Vector2 operator / ( const Real fScalar ) const
-        {
-            assert( fScalar != 0.0 );
-
-            Real fInv = 1.0f / fScalar;
-
-            return Vector2(
-                x * fInv,
-                y * fInv);
-        }
-
-        inline Vector2 operator / ( const Vector2& rhs) const
-        {
-            return Vector2(
-                x / rhs.x,
-                y / rhs.y);
-        }
-
-        inline const Vector2& operator + () const
-        {
-            return *this;
-        }
-
-        inline Vector2 operator - () const
-        {
-            return Vector2(-x, -y);
-        }
-
-        // overloaded operators to help Vector2
-        inline friend Vector2 operator * ( const Real fScalar, const Vector2& rkVector )
-        {
-            return Vector2(
-                fScalar * rkVector.x,
-                fScalar * rkVector.y);
-        }
-
-        inline friend Vector2 operator / ( const Real fScalar, const Vector2& rkVector )
-        {
-            return Vector2(
-                fScalar / rkVector.x,
-                fScalar / rkVector.y);
-        }
-
-        inline friend Vector2 operator + (const Vector2& lhs, const Real rhs)
-        {
-            return Vector2(
-                lhs.x + rhs,
-                lhs.y + rhs);
-        }
-
-        inline friend Vector2 operator + (const Real lhs, const Vector2& rhs)
-        {
-            return Vector2(
-                lhs + rhs.x,
-                lhs + rhs.y);
-        }
-
-        inline friend Vector2 operator - (const Vector2& lhs, const Real rhs)
-        {
-            return Vector2(
-                lhs.x - rhs,
-                lhs.y - rhs);
-        }
-
-        inline friend Vector2 operator - (const Real lhs, const Vector2& rhs)
-        {
-            return Vector2(
-                lhs - rhs.x,
-                lhs - rhs.y);
-        }
-        // arithmetic updates
-        inline Vector2& operator += ( const Vector2& rkVector )
-        {
-            x += rkVector.x;
-            y += rkVector.y;
-
-            return *this;
-        }
-
-        inline Vector2& operator += ( const Real fScaler )
-        {
-            x += fScaler;
-            y += fScaler;
-
-            return *this;
-        }
-
-        inline Vector2& operator -= ( const Vector2& rkVector )
-        {
-            x -= rkVector.x;
-            y -= rkVector.y;
-
-            return *this;
-        }
-
-        inline Vector2& operator -= ( const Real fScaler )
-        {
-            x -= fScaler;
-            y -= fScaler;
-
-            return *this;
-        }
-
-        inline Vector2& operator *= ( const Real fScalar )
-        {
-            x *= fScalar;
-            y *= fScalar;
-
-            return *this;
-        }
-
-        inline Vector2& operator *= ( const Vector2& rkVector )
-        {
-            x *= rkVector.x;
-            y *= rkVector.y;
-
-            return *this;
-        }
-
-        inline Vector2& operator /= ( const Real fScalar )
-        {
-            assert( fScalar != 0.0 );
-
-            Real fInv = 1.0f / fScalar;
-
-            x *= fInv;
-            y *= fInv;
-
-            return *this;
-        }
-
-        inline Vector2& operator /= ( const Vector2& rkVector )
-        {
-            x /= rkVector.x;
-            y /= rkVector.y;
-
-            return *this;
-        }
-
-        /** Returns the length (magnitude) of the vector.
-            @warning
-                This operation requires a square root and is expensive in
-                terms of CPU operations. If you don't need to know the exact
-                length (e.g. for just comparing lengths) use squaredLength()
-                instead.
-        */
-        inline Real length () const
-        {
-            return Math::Sqrt( x * x + y * y );
-        }
-
-        /** Returns the square of the length(magnitude) of the vector.
-            @remarks
-                This  method is for efficiency - calculating the actual
-                length of a vector requires a square root, which is expensive
-                in terms of the operations required. This method returns the
-                square of the length of the vector, i.e. the same as the
-                length but before the square root is taken. Use this if you
-                want to find the longest / shortest vector without incurring
-                the square root.
-        */
-        inline Real squaredLength () const
-        {
-            return x * x + y * y;
-        }
-        /** Returns the distance to another vector.
-            @warning
-                This operation requires a square root and is expensive in
-                terms of CPU operations. If you don't need to know the exact
-                distance (e.g. for just comparing distances) use squaredDistance()
-                instead.
-        */
-        inline Real distance(const Vector2& rhs) const
-        {
-            return (*this - rhs).length();
-        }
-
-        /** Returns the square of the distance to another vector.
-            @remarks
-                This method is for efficiency - calculating the actual
-                distance to another vector requires a square root, which is
-                expensive in terms of the operations required. This method
-                returns the square of the distance to another vector, i.e.
-                the same as the distance but before the square root is taken.
-                Use this if you want to find the longest / shortest distance
-                without incurring the square root.
-        */
-        inline Real squaredDistance(const Vector2& rhs) const
-        {
-            return (*this - rhs).squaredLength();
-        }
-
-        /** Calculates the dot (scalar) product of this vector with another.
-            @remarks
-                The dot product can be used to calculate the angle between 2
-                vectors. If both are unit vectors, the dot product is the
-                cosine of the angle; otherwise the dot product must be
-                divided by the product of the lengths of both vectors to get
-                the cosine of the angle. This result can further be used to
-                calculate the distance of a point from a plane.
-            @param
-                vec Vector with which to calculate the dot product (together
-                with this one).
-            @returns
-                A float representing the dot product value.
-        */
-        inline Real dotProduct(const Vector2& vec) const
-        {
-            return x * vec.x + y * vec.y;
-        }
-
-        /** Normalises the vector.
-            @remarks
-                This method normalises the vector such that it's
-                length / magnitude is 1. The result is called a unit vector.
-            @note
-                This function will not crash for zero-sized vectors, but there
-                will be no changes made to their components.
-            @returns The previous length of the vector.
-        */
-        inline Real normalise()
-        {
-            Real fLength = Math::Sqrt( x * x + y * y);
-
-            // Will also work for zero-sized vectors, but will change nothing
-            if ( fLength > 1e-08 )
-            {
-                Real fInvLength = 1.0f / fLength;
-                x *= fInvLength;
-                y *= fInvLength;
-            }
-
-            return fLength;
-        }
-
-
-
-        /** Returns a vector at a point half way between this and the passed
-            in vector.
-        */
-        inline Vector2 midPoint( const Vector2& vec ) const
-        {
-            return Vector2(
-                ( x + vec.x ) * 0.5f,
-                ( y + vec.y ) * 0.5f );
-        }
-
-        /** Returns true if the vector's scalar components are all greater
-            that the ones of the vector it is compared against.
-        */
-        inline bool operator < ( const Vector2& rhs ) const
-        {
-            if( x < rhs.x && y < rhs.y )
-                return true;
-            return false;
-        }
-
-        /** Returns true if the vector's scalar components are all smaller
-            that the ones of the vector it is compared against.
-        */
-        inline bool operator > ( const Vector2& rhs ) const
-        {
-            if( x > rhs.x && y > rhs.y )
-                return true;
-            return false;
-        }
-
-        /** Sets this vector's components to the minimum of its own and the
-            ones of the passed in vector.
-            @remarks
-                'Minimum' in this case means the combination of the lowest
-                value of x, y and z from both vectors. Lowest is taken just
-                numerically, not magnitude, so -1 < 0.
-        */
-        inline void makeFloor( const Vector2& cmp )
-        {
-            if( cmp.x < x ) x = cmp.x;
-            if( cmp.y < y ) y = cmp.y;
-        }
-
-        /** Sets this vector's components to the maximum of its own and the
-            ones of the passed in vector.
-            @remarks
-                'Maximum' in this case means the combination of the highest
-                value of x, y and z from both vectors. Highest is taken just
-                numerically, not magnitude, so 1 > -3.
-        */
-        inline void makeCeil( const Vector2& cmp )
-        {
-            if( cmp.x > x ) x = cmp.x;
-            if( cmp.y > y ) y = cmp.y;
-        }
-
-        /** Generates a vector perpendicular to this vector (eg an 'up' vector).
-            @remarks
-                This method will return a vector which is perpendicular to this
-                vector. There are an infinite number of possibilities but this
-                method will guarantee to generate one of them. If you need more
-                control you should use the Quaternion class.
-        */
-        inline Vector2 perpendicular(void) const
-        {
-            return Vector2 (-y, x);
-        }
-        /** Calculates the 2 dimensional cross-product of 2 vectors, which results
-			in a single floating point value which is 2 times the area of the triangle.
-        */
-        inline Real crossProduct( const Vector2& rkVector ) const
-        {
-            return x * rkVector.y - y * rkVector.x;
-        }
-        /** Generates a new random vector which deviates from this vector by a
-            given angle in a random direction.
-            @remarks
-                This method assumes that the random number generator has already
-                been seeded appropriately.
-            @param
-                angle The angle at which to deviate in radians
-            @param
-                up Any vector perpendicular to this one (which could generated
-                by cross-product of this vector and any other non-colinear
-                vector). If you choose not to provide this the function will
-                derive one on it's own, however if you provide one yourself the
-                function will be faster (this allows you to reuse up vectors if
-                you call this method more than once)
-            @returns
-                A random vector which deviates from this vector by angle. This
-                vector will not be normalised, normalise it if you wish
-                afterwards.
-        */
-        inline Vector2 randomDeviant(
-            Real angle) const
-        {
-
-            angle *=  Math::UnitRandom() * Math::TWO_PI;
-            Real cosa = cos(angle);
-            Real sina = sin(angle);
-            return  Vector2(cosa * x - sina * y,
-                            sina * x + cosa * y);
-        }
-
-        /** Returns true if this vector is zero length. */
-        inline bool isZeroLength(void) const
-        {
-            Real sqlen = (x * x) + (y * y);
-            return (sqlen < (1e-06 * 1e-06));
-
-        }
-
-        /** As normalise, except that this vector is unaffected and the
-            normalised vector is returned as a copy. */
-        inline Vector2 normalisedCopy(void) const
-        {
-            Vector2 ret = *this;
-            ret.normalise();
-            return ret;
-        }
-
-        /** Calculates a reflection vector to the plane with the given normal .
-        @remarks NB assumes 'this' is pointing AWAY FROM the plane, invert if it is not.
-        */
-        inline Vector2 reflect(const Vector2& normal) const
-        {
-            return Vector2( *this - ( 2 * this->dotProduct(normal) * normal ) );
-        }
-		/// Check whether this vector contains valid values
-		inline bool isNaN() const
-		{
-			return Math::isNaN(x) || Math::isNaN(y);
-		}
-
-        // special points
-        static const Vector2 ZERO;
-        static const Vector2 UNIT_X;
-        static const Vector2 UNIT_Y;
-        static const Vector2 NEGATIVE_UNIT_X;
-        static const Vector2 NEGATIVE_UNIT_Y;
-        static const Vector2 UNIT_SCALE;
-
-        /** Function for writing to a stream.
-        */
-        inline CM_EXPORT friend std::ostream& operator <<
-            ( std::ostream& o, const Vector2& v )
-        {
-            o << "Vector2(" << v.x << ", " << v.y <<  ")";
-            return o;
-        }
-
-    };
-	/** @} */
-	/** @} */
-
-}
-#endif

+ 0 - 42
CamelotRenderer/OgreVector3.cpp

@@ -1,42 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#include "OgreVector3.h"
-#include "OgreMath.h"
-
-namespace CamelotEngine
-{
-    const Vector3 Vector3::ZERO( 0, 0, 0 );
-
-    const Vector3 Vector3::UNIT_X( 1, 0, 0 );
-    const Vector3 Vector3::UNIT_Y( 0, 1, 0 );
-    const Vector3 Vector3::UNIT_Z( 0, 0, 1 );
-    const Vector3 Vector3::NEGATIVE_UNIT_X( -1,  0,  0 );
-    const Vector3 Vector3::NEGATIVE_UNIT_Y(  0, -1,  0 );
-    const Vector3 Vector3::NEGATIVE_UNIT_Z(  0,  0, -1 );
-    const Vector3 Vector3::UNIT_SCALE(1, 1, 1);
-}

+ 0 - 796
CamelotRenderer/OgreVector3.h

@@ -1,796 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __Vector3_H__
-#define __Vector3_H__
-
-#include "OgrePrerequisites.h"
-#include "OgreMath.h"
-#include "OgreQuaternion.h"
-
-namespace CamelotEngine
-{
-
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Math
-	*  @{
-	*/
-	/** Standard 3-dimensional vector.
-        @remarks
-            A direction in 3D space represented as distances along the 3
-            orthogonal axes (x, y, z). Note that positions, directions and
-            scaling factors can be represented by a vector, depending on how
-            you interpret the values.
-    */
-    class CM_EXPORT Vector3
-    {
-    public:
-		Real x, y, z;
-
-    public:
-        inline Vector3()
-        {
-        }
-
-        inline Vector3( const Real fX, const Real fY, const Real fZ )
-            : x( fX ), y( fY ), z( fZ )
-        {
-        }
-
-        inline explicit Vector3( const Real afCoordinate[3] )
-            : x( afCoordinate[0] ),
-              y( afCoordinate[1] ),
-              z( afCoordinate[2] )
-        {
-        }
-
-        inline explicit Vector3( const int afCoordinate[3] )
-        {
-            x = (Real)afCoordinate[0];
-            y = (Real)afCoordinate[1];
-            z = (Real)afCoordinate[2];
-        }
-
-        inline explicit Vector3( Real* const r )
-            : x( r[0] ), y( r[1] ), z( r[2] )
-        {
-        }
-
-        inline explicit Vector3( const Real scaler )
-            : x( scaler )
-            , y( scaler )
-            , z( scaler )
-        {
-        }
-
-
-		/** Exchange the contents of this vector with another. 
-		*/
-		inline void swap(Vector3& other)
-		{
-			std::swap(x, other.x);
-			std::swap(y, other.y);
-			std::swap(z, other.z);
-		}
-
-		inline Real operator [] ( const size_t i ) const
-        {
-            assert( i < 3 );
-
-            return *(&x+i);
-        }
-
-		inline Real& operator [] ( const size_t i )
-        {
-            assert( i < 3 );
-
-            return *(&x+i);
-        }
-		/// Pointer accessor for direct copying
-		inline Real* ptr()
-		{
-			return &x;
-		}
-		/// Pointer accessor for direct copying
-		inline const Real* ptr() const
-		{
-			return &x;
-		}
-
-        /** Assigns the value of the other vector.
-            @param
-                rkVector The other vector
-        */
-        inline Vector3& operator = ( const Vector3& rkVector )
-        {
-            x = rkVector.x;
-            y = rkVector.y;
-            z = rkVector.z;
-
-            return *this;
-        }
-
-        inline Vector3& operator = ( const Real fScaler )
-        {
-            x = fScaler;
-            y = fScaler;
-            z = fScaler;
-
-            return *this;
-        }
-
-        inline bool operator == ( const Vector3& rkVector ) const
-        {
-            return ( x == rkVector.x && y == rkVector.y && z == rkVector.z );
-        }
-
-        inline bool operator != ( const Vector3& rkVector ) const
-        {
-            return ( x != rkVector.x || y != rkVector.y || z != rkVector.z );
-        }
-
-        // arithmetic operations
-        inline Vector3 operator + ( const Vector3& rkVector ) const
-        {
-            return Vector3(
-                x + rkVector.x,
-                y + rkVector.y,
-                z + rkVector.z);
-        }
-
-        inline Vector3 operator - ( const Vector3& rkVector ) const
-        {
-            return Vector3(
-                x - rkVector.x,
-                y - rkVector.y,
-                z - rkVector.z);
-        }
-
-        inline Vector3 operator * ( const Real fScalar ) const
-        {
-            return Vector3(
-                x * fScalar,
-                y * fScalar,
-                z * fScalar);
-        }
-
-        inline Vector3 operator * ( const Vector3& rhs) const
-        {
-            return Vector3(
-                x * rhs.x,
-                y * rhs.y,
-                z * rhs.z);
-        }
-
-        inline Vector3 operator / ( const Real fScalar ) const
-        {
-            assert( fScalar != 0.0 );
-
-            Real fInv = 1.0f / fScalar;
-
-            return Vector3(
-                x * fInv,
-                y * fInv,
-                z * fInv);
-        }
-
-        inline Vector3 operator / ( const Vector3& rhs) const
-        {
-            return Vector3(
-                x / rhs.x,
-                y / rhs.y,
-                z / rhs.z);
-        }
-
-        inline const Vector3& operator + () const
-        {
-            return *this;
-        }
-
-        inline Vector3 operator - () const
-        {
-            return Vector3(-x, -y, -z);
-        }
-
-        // overloaded operators to help Vector3
-        inline friend Vector3 operator * ( const Real fScalar, const Vector3& rkVector )
-        {
-            return Vector3(
-                fScalar * rkVector.x,
-                fScalar * rkVector.y,
-                fScalar * rkVector.z);
-        }
-
-        inline friend Vector3 operator / ( const Real fScalar, const Vector3& rkVector )
-        {
-            return Vector3(
-                fScalar / rkVector.x,
-                fScalar / rkVector.y,
-                fScalar / rkVector.z);
-        }
-
-        inline friend Vector3 operator + (const Vector3& lhs, const Real rhs)
-        {
-            return Vector3(
-                lhs.x + rhs,
-                lhs.y + rhs,
-                lhs.z + rhs);
-        }
-
-        inline friend Vector3 operator + (const Real lhs, const Vector3& rhs)
-        {
-            return Vector3(
-                lhs + rhs.x,
-                lhs + rhs.y,
-                lhs + rhs.z);
-        }
-
-        inline friend Vector3 operator - (const Vector3& lhs, const Real rhs)
-        {
-            return Vector3(
-                lhs.x - rhs,
-                lhs.y - rhs,
-                lhs.z - rhs);
-        }
-
-        inline friend Vector3 operator - (const Real lhs, const Vector3& rhs)
-        {
-            return Vector3(
-                lhs - rhs.x,
-                lhs - rhs.y,
-                lhs - rhs.z);
-        }
-
-        // arithmetic updates
-        inline Vector3& operator += ( const Vector3& rkVector )
-        {
-            x += rkVector.x;
-            y += rkVector.y;
-            z += rkVector.z;
-
-            return *this;
-        }
-
-        inline Vector3& operator += ( const Real fScalar )
-        {
-            x += fScalar;
-            y += fScalar;
-            z += fScalar;
-            return *this;
-        }
-
-        inline Vector3& operator -= ( const Vector3& rkVector )
-        {
-            x -= rkVector.x;
-            y -= rkVector.y;
-            z -= rkVector.z;
-
-            return *this;
-        }
-
-        inline Vector3& operator -= ( const Real fScalar )
-        {
-            x -= fScalar;
-            y -= fScalar;
-            z -= fScalar;
-            return *this;
-        }
-
-        inline Vector3& operator *= ( const Real fScalar )
-        {
-            x *= fScalar;
-            y *= fScalar;
-            z *= fScalar;
-            return *this;
-        }
-
-        inline Vector3& operator *= ( const Vector3& rkVector )
-        {
-            x *= rkVector.x;
-            y *= rkVector.y;
-            z *= rkVector.z;
-
-            return *this;
-        }
-
-        inline Vector3& operator /= ( const Real fScalar )
-        {
-            assert( fScalar != 0.0 );
-
-            Real fInv = 1.0f / fScalar;
-
-            x *= fInv;
-            y *= fInv;
-            z *= fInv;
-
-            return *this;
-        }
-
-        inline Vector3& operator /= ( const Vector3& rkVector )
-        {
-            x /= rkVector.x;
-            y /= rkVector.y;
-            z /= rkVector.z;
-
-            return *this;
-        }
-
-
-        /** Returns the length (magnitude) of the vector.
-            @warning
-                This operation requires a square root and is expensive in
-                terms of CPU operations. If you don't need to know the exact
-                length (e.g. for just comparing lengths) use squaredLength()
-                instead.
-        */
-        inline Real length () const
-        {
-            return Math::Sqrt( x * x + y * y + z * z );
-        }
-
-        /** Returns the square of the length(magnitude) of the vector.
-            @remarks
-                This  method is for efficiency - calculating the actual
-                length of a vector requires a square root, which is expensive
-                in terms of the operations required. This method returns the
-                square of the length of the vector, i.e. the same as the
-                length but before the square root is taken. Use this if you
-                want to find the longest / shortest vector without incurring
-                the square root.
-        */
-        inline Real squaredLength () const
-        {
-            return x * x + y * y + z * z;
-        }
-
-        /** Returns the distance to another vector.
-            @warning
-                This operation requires a square root and is expensive in
-                terms of CPU operations. If you don't need to know the exact
-                distance (e.g. for just comparing distances) use squaredDistance()
-                instead.
-        */
-        inline Real distance(const Vector3& rhs) const
-        {
-            return (*this - rhs).length();
-        }
-
-        /** Returns the square of the distance to another vector.
-            @remarks
-                This method is for efficiency - calculating the actual
-                distance to another vector requires a square root, which is
-                expensive in terms of the operations required. This method
-                returns the square of the distance to another vector, i.e.
-                the same as the distance but before the square root is taken.
-                Use this if you want to find the longest / shortest distance
-                without incurring the square root.
-        */
-        inline Real squaredDistance(const Vector3& rhs) const
-        {
-            return (*this - rhs).squaredLength();
-        }
-
-        /** Calculates the dot (scalar) product of this vector with another.
-            @remarks
-                The dot product can be used to calculate the angle between 2
-                vectors. If both are unit vectors, the dot product is the
-                cosine of the angle; otherwise the dot product must be
-                divided by the product of the lengths of both vectors to get
-                the cosine of the angle. This result can further be used to
-                calculate the distance of a point from a plane.
-            @param
-                vec Vector with which to calculate the dot product (together
-                with this one).
-            @returns
-                A float representing the dot product value.
-        */
-        inline Real dotProduct(const Vector3& vec) const
-        {
-            return x * vec.x + y * vec.y + z * vec.z;
-        }
-
-        /** Calculates the absolute dot (scalar) product of this vector with another.
-            @remarks
-                This function work similar dotProduct, except it use absolute value
-                of each component of the vector to computing.
-            @param
-                vec Vector with which to calculate the absolute dot product (together
-                with this one).
-            @returns
-                A Real representing the absolute dot product value.
-        */
-        inline Real absDotProduct(const Vector3& vec) const
-        {
-            return Math::Abs(x * vec.x) + Math::Abs(y * vec.y) + Math::Abs(z * vec.z);
-        }
-
-        /** Normalises the vector.
-            @remarks
-                This method normalises the vector such that it's
-                length / magnitude is 1. The result is called a unit vector.
-            @note
-                This function will not crash for zero-sized vectors, but there
-                will be no changes made to their components.
-            @returns The previous length of the vector.
-        */
-        inline Real normalise()
-        {
-            Real fLength = Math::Sqrt( x * x + y * y + z * z );
-
-            // Will also work for zero-sized vectors, but will change nothing
-            if ( fLength > 1e-08 )
-            {
-                Real fInvLength = 1.0f / fLength;
-                x *= fInvLength;
-                y *= fInvLength;
-                z *= fInvLength;
-            }
-
-            return fLength;
-        }
-
-        /** Calculates the cross-product of 2 vectors, i.e. the vector that
-            lies perpendicular to them both.
-            @remarks
-                The cross-product is normally used to calculate the normal
-                vector of a plane, by calculating the cross-product of 2
-                non-equivalent vectors which lie on the plane (e.g. 2 edges
-                of a triangle).
-            @param
-                vec Vector which, together with this one, will be used to
-                calculate the cross-product.
-            @returns
-                A vector which is the result of the cross-product. This
-                vector will <b>NOT</b> be normalised, to maximise efficiency
-                - call Vector3::normalise on the result if you wish this to
-                be done. As for which side the resultant vector will be on, the
-                returned vector will be on the side from which the arc from 'this'
-                to rkVector is anticlockwise, e.g. UNIT_Y.crossProduct(UNIT_Z)
-                = UNIT_X, whilst UNIT_Z.crossProduct(UNIT_Y) = -UNIT_X.
-				This is because OGRE uses a right-handed coordinate system.
-            @par
-                For a clearer explanation, look a the left and the bottom edges
-                of your monitor's screen. Assume that the first vector is the
-                left edge and the second vector is the bottom edge, both of
-                them starting from the lower-left corner of the screen. The
-                resulting vector is going to be perpendicular to both of them
-                and will go <i>inside</i> the screen, towards the cathode tube
-                (assuming you're using a CRT monitor, of course).
-        */
-        inline Vector3 crossProduct( const Vector3& rkVector ) const
-        {
-            return Vector3(
-                y * rkVector.z - z * rkVector.y,
-                z * rkVector.x - x * rkVector.z,
-                x * rkVector.y - y * rkVector.x);
-        }
-
-        /** Returns a vector at a point half way between this and the passed
-            in vector.
-        */
-        inline Vector3 midPoint( const Vector3& vec ) const
-        {
-            return Vector3(
-                ( x + vec.x ) * 0.5f,
-                ( y + vec.y ) * 0.5f,
-                ( z + vec.z ) * 0.5f );
-        }
-
-        /** Returns true if the vector's scalar components are all greater
-            that the ones of the vector it is compared against.
-        */
-        inline bool operator < ( const Vector3& rhs ) const
-        {
-            if( x < rhs.x && y < rhs.y && z < rhs.z )
-                return true;
-            return false;
-        }
-
-        /** Returns true if the vector's scalar components are all smaller
-            that the ones of the vector it is compared against.
-        */
-        inline bool operator > ( const Vector3& rhs ) const
-        {
-            if( x > rhs.x && y > rhs.y && z > rhs.z )
-                return true;
-            return false;
-        }
-
-        /** Sets this vector's components to the minimum of its own and the
-            ones of the passed in vector.
-            @remarks
-                'Minimum' in this case means the combination of the lowest
-                value of x, y and z from both vectors. Lowest is taken just
-                numerically, not magnitude, so -1 < 0.
-        */
-        inline void makeFloor( const Vector3& cmp )
-        {
-            if( cmp.x < x ) x = cmp.x;
-            if( cmp.y < y ) y = cmp.y;
-            if( cmp.z < z ) z = cmp.z;
-        }
-
-        /** Sets this vector's components to the maximum of its own and the
-            ones of the passed in vector.
-            @remarks
-                'Maximum' in this case means the combination of the highest
-                value of x, y and z from both vectors. Highest is taken just
-                numerically, not magnitude, so 1 > -3.
-        */
-        inline void makeCeil( const Vector3& cmp )
-        {
-            if( cmp.x > x ) x = cmp.x;
-            if( cmp.y > y ) y = cmp.y;
-            if( cmp.z > z ) z = cmp.z;
-        }
-
-        /** Generates a vector perpendicular to this vector (eg an 'up' vector).
-            @remarks
-                This method will return a vector which is perpendicular to this
-                vector. There are an infinite number of possibilities but this
-                method will guarantee to generate one of them. If you need more
-                control you should use the Quaternion class.
-        */
-        inline Vector3 perpendicular(void) const
-        {
-            static const Real fSquareZero = (Real)(1e-06 * 1e-06);
-
-            Vector3 perp = this->crossProduct( Vector3::UNIT_X );
-
-            // Check length
-            if( perp.squaredLength() < fSquareZero )
-            {
-                /* This vector is the Y axis multiplied by a scalar, so we have
-                   to use another axis.
-                */
-                perp = this->crossProduct( Vector3::UNIT_Y );
-            }
-			perp.normalise();
-
-            return perp;
-        }
-        /** Generates a new random vector which deviates from this vector by a
-            given angle in a random direction.
-            @remarks
-                This method assumes that the random number generator has already
-                been seeded appropriately.
-            @param
-                angle The angle at which to deviate
-            @param
-                up Any vector perpendicular to this one (which could generated
-                by cross-product of this vector and any other non-colinear
-                vector). If you choose not to provide this the function will
-                derive one on it's own, however if you provide one yourself the
-                function will be faster (this allows you to reuse up vectors if
-                you call this method more than once)
-            @returns
-                A random vector which deviates from this vector by angle. This
-                vector will not be normalised, normalise it if you wish
-                afterwards.
-        */
-        inline Vector3 randomDeviant(
-            const Radian& angle,
-            const Vector3& up = Vector3::ZERO ) const
-        {
-            Vector3 newUp;
-
-            if (up == Vector3::ZERO)
-            {
-                // Generate an up vector
-                newUp = this->perpendicular();
-            }
-            else
-            {
-                newUp = up;
-            }
-
-            // Rotate up vector by random amount around this
-            Quaternion q;
-            q.FromAngleAxis( Radian(Math::UnitRandom() * Math::TWO_PI), *this );
-            newUp = q * newUp;
-
-            // Finally rotate this by given angle around randomised up
-            q.FromAngleAxis( angle, newUp );
-            return q * (*this);
-        }
-
-		/** Gets the angle between 2 vectors.
-		@remarks
-			Vectors do not have to be unit-length but must represent directions.
-		*/
-		inline Radian angleBetween(const Vector3& dest)
-		{
-			Real lenProduct = length() * dest.length();
-
-			// Divide by zero check
-			if(lenProduct < 1e-6f)
-				lenProduct = 1e-6f;
-
-			Real f = dotProduct(dest) / lenProduct;
-
-			f = Math::Clamp(f, (Real)-1.0, (Real)1.0);
-			return Math::ACos(f);
-
-		}
-        /** Gets the shortest arc quaternion to rotate this vector to the destination
-            vector.
-        @remarks
-            If you call this with a dest vector that is close to the inverse
-            of this vector, we will rotate 180 degrees around the 'fallbackAxis'
-			(if specified, or a generated axis if not) since in this case
-			ANY axis of rotation is valid.
-        */
-        Quaternion getRotationTo(const Vector3& dest,
-			const Vector3& fallbackAxis = Vector3::ZERO) const
-        {
-            // Based on Stan Melax's article in Game Programming Gems
-            Quaternion q;
-            // Copy, since cannot modify local
-            Vector3 v0 = *this;
-            Vector3 v1 = dest;
-            v0.normalise();
-            v1.normalise();
-
-            Real d = v0.dotProduct(v1);
-            // If dot == 1, vectors are the same
-            if (d >= 1.0f)
-            {
-                return Quaternion::IDENTITY;
-            }
-			if (d < (1e-6f - 1.0f))
-			{
-				if (fallbackAxis != Vector3::ZERO)
-				{
-					// rotate 180 degrees about the fallback axis
-					q.FromAngleAxis(Radian(Math::PI), fallbackAxis);
-				}
-				else
-				{
-					// Generate an axis
-					Vector3 axis = Vector3::UNIT_X.crossProduct(*this);
-					if (axis.isZeroLength()) // pick another if colinear
-						axis = Vector3::UNIT_Y.crossProduct(*this);
-					axis.normalise();
-					q.FromAngleAxis(Radian(Math::PI), axis);
-				}
-			}
-			else
-			{
-                Real s = Math::Sqrt( (1+d)*2 );
-	            Real invs = 1 / s;
-
-				Vector3 c = v0.crossProduct(v1);
-
-    	        q.x = c.x * invs;
-        	    q.y = c.y * invs;
-            	q.z = c.z * invs;
-            	q.w = s * 0.5f;
-				q.normalise();
-			}
-            return q;
-        }
-
-        /** Returns true if this vector is zero length. */
-        inline bool isZeroLength(void) const
-        {
-            Real sqlen = (x * x) + (y * y) + (z * z);
-            return (sqlen < (1e-06 * 1e-06));
-
-        }
-
-        /** As normalise, except that this vector is unaffected and the
-            normalised vector is returned as a copy. */
-        inline Vector3 normalisedCopy(void) const
-        {
-            Vector3 ret = *this;
-            ret.normalise();
-            return ret;
-        }
-
-        /** Calculates a reflection vector to the plane with the given normal .
-        @remarks NB assumes 'this' is pointing AWAY FROM the plane, invert if it is not.
-        */
-        inline Vector3 reflect(const Vector3& normal) const
-        {
-            return Vector3( *this - ( 2 * this->dotProduct(normal) * normal ) );
-        }
-
-		/** Returns whether this vector is within a positional tolerance
-			of another vector.
-		@param rhs The vector to compare with
-		@param tolerance The amount that each element of the vector may vary by
-			and still be considered equal
-		*/
-		inline bool positionEquals(const Vector3& rhs, Real tolerance = 1e-03) const
-		{
-			return Math::RealEqual(x, rhs.x, tolerance) &&
-				Math::RealEqual(y, rhs.y, tolerance) &&
-				Math::RealEqual(z, rhs.z, tolerance);
-
-		}
-
-		/** Returns whether this vector is within a positional tolerance
-			of another vector, also take scale of the vectors into account.
-		@param rhs The vector to compare with
-		@param tolerance The amount (related to the scale of vectors) that distance
-            of the vector may vary by and still be considered close
-		*/
-		inline bool positionCloses(const Vector3& rhs, Real tolerance = 1e-03f) const
-		{
-			return squaredDistance(rhs) <=
-                (squaredLength() + rhs.squaredLength()) * tolerance;
-		}
-
-		/** Returns whether this vector is within a directional tolerance
-			of another vector.
-		@param rhs The vector to compare with
-		@param tolerance The maximum angle by which the vectors may vary and
-			still be considered equal
-		@note Both vectors should be normalised.
-		*/
-		inline bool directionEquals(const Vector3& rhs,
-			const Radian& tolerance) const
-		{
-			Real dot = dotProduct(rhs);
-			Radian angle = Math::ACos(dot);
-
-			return Math::Abs(angle.valueRadians()) <= tolerance.valueRadians();
-
-		}
-
-		/// Check whether this vector contains valid values
-		inline bool isNaN() const
-		{
-			return Math::isNaN(x) || Math::isNaN(y) || Math::isNaN(z);
-		}
-
-		// special points
-        static const Vector3 ZERO;
-        static const Vector3 UNIT_X;
-        static const Vector3 UNIT_Y;
-        static const Vector3 UNIT_Z;
-        static const Vector3 NEGATIVE_UNIT_X;
-        static const Vector3 NEGATIVE_UNIT_Y;
-        static const Vector3 NEGATIVE_UNIT_Z;
-        static const Vector3 UNIT_SCALE;
-
-        /** Function for writing to a stream.
-        */
-        inline CM_EXPORT friend std::ostream& operator <<
-            ( std::ostream& o, const Vector3& v )
-        {
-            o << "Vector3(" << v.x << ", " << v.y << ", " << v.z << ")";
-            return o;
-        }
-    };
-	/** @} */
-	/** @} */
-
-}
-#endif

+ 0 - 34
CamelotRenderer/OgreVector4.cpp

@@ -1,34 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#include "OgreVector4.h"
-#include "OgreMath.h"
-
-namespace CamelotEngine
-{
-    const Vector4 Vector4::ZERO( 0, 0, 0, 0 );
-}

+ 0 - 414
CamelotRenderer/OgreVector4.h

@@ -1,414 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __Vector4_H__
-#define __Vector4_H__
-
-#include "OgrePrerequisites.h"
-#include "OgreVector3.h"
-
-namespace CamelotEngine
-{
-
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Math
-	*  @{
-	*/
-	/** 4-dimensional homogeneous vector.
-    */
-    class CM_EXPORT Vector4
-    {
-    public:
-        Real x, y, z, w;
-
-    public:
-        inline Vector4()
-        {
-        }
-
-        inline Vector4( const Real fX, const Real fY, const Real fZ, const Real fW )
-            : x( fX ), y( fY ), z( fZ ), w( fW)
-        {
-        }
-
-        inline explicit Vector4( const Real afCoordinate[4] )
-            : x( afCoordinate[0] ),
-              y( afCoordinate[1] ),
-              z( afCoordinate[2] ),
-              w( afCoordinate[3] )
-        {
-        }
-
-        inline explicit Vector4( const int afCoordinate[4] )
-        {
-            x = (Real)afCoordinate[0];
-            y = (Real)afCoordinate[1];
-            z = (Real)afCoordinate[2];
-            w = (Real)afCoordinate[3];
-        }
-
-        inline explicit Vector4( Real* const r )
-            : x( r[0] ), y( r[1] ), z( r[2] ), w( r[3] )
-        {
-        }
-
-        inline explicit Vector4( const Real scaler )
-            : x( scaler )
-            , y( scaler )
-            , z( scaler )
-            , w( scaler )
-        {
-        }
-
-        inline explicit Vector4(const Vector3& rhs)
-            : x(rhs.x), y(rhs.y), z(rhs.z), w(1.0f)
-        {
-        }
-
-		/** Exchange the contents of this vector with another. 
-		*/
-		inline void swap(Vector4& other)
-		{
-			std::swap(x, other.x);
-			std::swap(y, other.y);
-			std::swap(z, other.z);
-			std::swap(w, other.w);
-		}
-	
-		inline Real operator [] ( const size_t i ) const
-        {
-            assert( i < 4 );
-
-            return *(&x+i);
-        }
-
-		inline Real& operator [] ( const size_t i )
-        {
-            assert( i < 4 );
-
-            return *(&x+i);
-        }
-
-		/// Pointer accessor for direct copying
-		inline Real* ptr()
-		{
-			return &x;
-		}
-		/// Pointer accessor for direct copying
-		inline const Real* ptr() const
-		{
-			return &x;
-		}
-
-        /** Assigns the value of the other vector.
-            @param
-                rkVector The other vector
-        */
-        inline Vector4& operator = ( const Vector4& rkVector )
-        {
-            x = rkVector.x;
-            y = rkVector.y;
-            z = rkVector.z;
-            w = rkVector.w;
-
-            return *this;
-        }
-
-		inline Vector4& operator = ( const Real fScalar)
-		{
-			x = fScalar;
-			y = fScalar;
-			z = fScalar;
-			w = fScalar;
-			return *this;
-		}
-
-        inline bool operator == ( const Vector4& rkVector ) const
-        {
-            return ( x == rkVector.x &&
-                y == rkVector.y &&
-                z == rkVector.z &&
-                w == rkVector.w );
-        }
-
-        inline bool operator != ( const Vector4& rkVector ) const
-        {
-            return ( x != rkVector.x ||
-                y != rkVector.y ||
-                z != rkVector.z ||
-                w != rkVector.w );
-        }
-
-        inline Vector4& operator = (const Vector3& rhs)
-        {
-            x = rhs.x;
-            y = rhs.y;
-            z = rhs.z;
-            w = 1.0f;
-            return *this;
-        }
-
-        // arithmetic operations
-        inline Vector4 operator + ( const Vector4& rkVector ) const
-        {
-            return Vector4(
-                x + rkVector.x,
-                y + rkVector.y,
-                z + rkVector.z,
-                w + rkVector.w);
-        }
-
-        inline Vector4 operator - ( const Vector4& rkVector ) const
-        {
-            return Vector4(
-                x - rkVector.x,
-                y - rkVector.y,
-                z - rkVector.z,
-                w - rkVector.w);
-        }
-
-        inline Vector4 operator * ( const Real fScalar ) const
-        {
-            return Vector4(
-                x * fScalar,
-                y * fScalar,
-                z * fScalar,
-                w * fScalar);
-        }
-
-        inline Vector4 operator * ( const Vector4& rhs) const
-        {
-            return Vector4(
-                rhs.x * x,
-                rhs.y * y,
-                rhs.z * z,
-                rhs.w * w);
-        }
-
-        inline Vector4 operator / ( const Real fScalar ) const
-        {
-            assert( fScalar != 0.0 );
-
-            Real fInv = 1.0f / fScalar;
-
-            return Vector4(
-                x * fInv,
-                y * fInv,
-                z * fInv,
-                w * fInv);
-        }
-
-        inline Vector4 operator / ( const Vector4& rhs) const
-        {
-            return Vector4(
-                x / rhs.x,
-                y / rhs.y,
-                z / rhs.z,
-                w / rhs.w);
-        }
-
-        inline const Vector4& operator + () const
-        {
-            return *this;
-        }
-
-        inline Vector4 operator - () const
-        {
-            return Vector4(-x, -y, -z, -w);
-        }
-
-        inline friend Vector4 operator * ( const Real fScalar, const Vector4& rkVector )
-        {
-            return Vector4(
-                fScalar * rkVector.x,
-                fScalar * rkVector.y,
-                fScalar * rkVector.z,
-                fScalar * rkVector.w);
-        }
-
-        inline friend Vector4 operator / ( const Real fScalar, const Vector4& rkVector )
-        {
-            return Vector4(
-                fScalar / rkVector.x,
-                fScalar / rkVector.y,
-                fScalar / rkVector.z,
-                fScalar / rkVector.w);
-        }
-
-        inline friend Vector4 operator + (const Vector4& lhs, const Real rhs)
-        {
-            return Vector4(
-                lhs.x + rhs,
-                lhs.y + rhs,
-                lhs.z + rhs,
-                lhs.w + rhs);
-        }
-
-        inline friend Vector4 operator + (const Real lhs, const Vector4& rhs)
-        {
-            return Vector4(
-                lhs + rhs.x,
-                lhs + rhs.y,
-                lhs + rhs.z,
-                lhs + rhs.w);
-        }
-
-        inline friend Vector4 operator - (const Vector4& lhs, Real rhs)
-        {
-            return Vector4(
-                lhs.x - rhs,
-                lhs.y - rhs,
-                lhs.z - rhs,
-                lhs.w - rhs);
-        }
-
-        inline friend Vector4 operator - (const Real lhs, const Vector4& rhs)
-        {
-            return Vector4(
-                lhs - rhs.x,
-                lhs - rhs.y,
-                lhs - rhs.z,
-                lhs - rhs.w);
-        }
-
-        // arithmetic updates
-        inline Vector4& operator += ( const Vector4& rkVector )
-        {
-            x += rkVector.x;
-            y += rkVector.y;
-            z += rkVector.z;
-            w += rkVector.w;
-
-            return *this;
-        }
-
-        inline Vector4& operator -= ( const Vector4& rkVector )
-        {
-            x -= rkVector.x;
-            y -= rkVector.y;
-            z -= rkVector.z;
-            w -= rkVector.w;
-
-            return *this;
-        }
-
-        inline Vector4& operator *= ( const Real fScalar )
-        {
-            x *= fScalar;
-            y *= fScalar;
-            z *= fScalar;
-            w *= fScalar;
-            return *this;
-        }
-
-        inline Vector4& operator += ( const Real fScalar )
-        {
-            x += fScalar;
-            y += fScalar;
-            z += fScalar;
-            w += fScalar;
-            return *this;
-        }
-
-        inline Vector4& operator -= ( const Real fScalar )
-        {
-            x -= fScalar;
-            y -= fScalar;
-            z -= fScalar;
-            w -= fScalar;
-            return *this;
-        }
-
-        inline Vector4& operator *= ( const Vector4& rkVector )
-        {
-            x *= rkVector.x;
-            y *= rkVector.y;
-            z *= rkVector.z;
-            w *= rkVector.w;
-
-            return *this;
-        }
-
-        inline Vector4& operator /= ( const Real fScalar )
-        {
-            assert( fScalar != 0.0 );
-
-            Real fInv = 1.0f / fScalar;
-
-            x *= fInv;
-            y *= fInv;
-            z *= fInv;
-            w *= fInv;
-
-            return *this;
-        }
-
-        inline Vector4& operator /= ( const Vector4& rkVector )
-        {
-            x /= rkVector.x;
-            y /= rkVector.y;
-            z /= rkVector.z;
-            w /= rkVector.w;
-
-            return *this;
-        }
-
-        /** Calculates the dot (scalar) product of this vector with another.
-            @param
-                vec Vector with which to calculate the dot product (together
-                with this one).
-            @returns
-                A float representing the dot product value.
-        */
-        inline Real dotProduct(const Vector4& vec) const
-        {
-            return x * vec.x + y * vec.y + z * vec.z + w * vec.w;
-        }
-		/// Check whether this vector contains valid values
-		inline bool isNaN() const
-		{
-			return Math::isNaN(x) || Math::isNaN(y) || Math::isNaN(z) || Math::isNaN(w);
-		}
-        /** Function for writing to a stream.
-        */
-        inline CM_EXPORT friend std::ostream& operator <<
-            ( std::ostream& o, const Vector4& v )
-        {
-            o << "Vector4(" << v.x << ", " << v.y << ", " << v.z << ", " << v.w << ")";
-            return o;
-        }
-        // special
-        static const Vector4 ZERO;
-    };
-	/** @} */
-	/** @} */
-
-}
-#endif
-

+ 28 - 28
CamelotRenderer/OgreVertexIndexData.cpp

@@ -30,8 +30,8 @@ THE SOFTWARE.
 #include "OgreHardwareBufferManager.h"
 #include "OgreHardwareBufferManager.h"
 #include "OgreHardwareVertexBuffer.h"
 #include "OgreHardwareVertexBuffer.h"
 #include "OgreHardwareIndexBuffer.h"
 #include "OgreHardwareIndexBuffer.h"
-#include "OgreVector3.h"
-#include "OgreAxisAlignedBox.h"
+#include "CmVector3.h"
+#include "CmAxisAlignedBox.h"
 #include "OgreException.h"
 #include "OgreException.h"
 #include "OgreRenderSystem.h"
 #include "OgreRenderSystem.h"
 #include "CmRenderSystemManager.h"
 #include "CmRenderSystemManager.h"
@@ -534,7 +534,7 @@ namespace CamelotEngine {
             VertexBufferBinding::BindingIndexMap::const_iterator it =
             VertexBufferBinding::BindingIndexMap::const_iterator it =
                 bindingIndexMap.find(elem.getSource());
                 bindingIndexMap.find(elem.getSource());
             assert(it != bindingIndexMap.end());
             assert(it != bindingIndexMap.end());
-            ushort targetSource = it->second;
+            UINT16 targetSource = it->second;
             if (elem.getSource() != targetSource)
             if (elem.getSource() != targetSource)
             {
             {
                 vertexDeclaration->modifyElement(elemIndex, 
                 vertexDeclaration->modifyElement(elemIndex, 
@@ -546,7 +546,7 @@ namespace CamelotEngine {
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
     void VertexData::removeUnusedBuffers(void)
     void VertexData::removeUnusedBuffers(void)
     {
     {
-        set<ushort>::type usedBuffers;
+        set<UINT16>::type usedBuffers;
 
 
         // Collect used buffers
         // Collect used buffers
         const VertexDeclaration::VertexElementList& allelems = 
         const VertexDeclaration::VertexElementList& allelems = 
@@ -559,8 +559,8 @@ namespace CamelotEngine {
         }
         }
 
 
         // Unset unused buffer bindings
         // Unset unused buffer bindings
-        ushort count = vertexBufferBinding->getLastBoundIndex();
-        for (ushort index = 0; index < count; ++index)
+        UINT16 count = vertexBufferBinding->getLastBoundIndex();
+        for (UINT16 index = 0; index < count; ++index)
         {
         {
             if (usedBuffers.find(index) == usedBuffers.end() &&
             if (usedBuffers.find(index) == usedBuffers.end() &&
                 vertexBufferBinding->isBufferBound(index))
                 vertexBufferBinding->isBufferBound(index))
@@ -623,7 +623,7 @@ namespace CamelotEngine {
 							((elem.getType() == VET_COLOUR_ABGR || elem.getType() == VET_COLOUR_ARGB) 
 							((elem.getType() == VET_COLOUR_ABGR || elem.getType() == VET_COLOUR_ARGB) 
 							&& elem.getType() != destType))
 							&& elem.getType() != destType))
 						{
 						{
-							uint32* pRGBA;
+							UINT32* pRGBA;
 							elem.baseVertexPointerToElement(pBase, &pRGBA);
 							elem.baseVertexPointerToElement(pBase, &pRGBA);
 							VertexElement::convertColourValue(currType, destType, pRGBA);
 							VertexElement::convertColourValue(currType, destType, pRGBA);
 						}
 						}
@@ -700,18 +700,18 @@ namespace CamelotEngine {
 			AB, BC, CA, ANY, NONE
 			AB, BC, CA, ANY, NONE
 		};
 		};
 
 
-		uint32 a, b, c;		
+		UINT32 a, b, c;		
 
 
 		inline Triangle()
 		inline Triangle()
 		{
 		{
 		}
 		}
 
 
-		inline Triangle( uint32 ta, uint32 tb, uint32 tc ) 
+		inline Triangle( UINT32 ta, UINT32 tb, UINT32 tc ) 
 			: a( ta ), b( tb ), c( tc )
 			: a( ta ), b( tb ), c( tc )
 		{
 		{
 		}
 		}
 
 
-		inline Triangle( uint32 t[3] )
+		inline Triangle( UINT32 t[3] )
 			: a( t[0] ), b( t[1] ), c( t[2] )
 			: a( t[0] ), b( t[1] ), c( t[2] )
 		{
 		{
 		}
 		}
@@ -734,7 +734,7 @@ namespace CamelotEngine {
 					c == t.c && a == t.b );
 					c == t.c && a == t.b );
 		}
 		}
 
 
-		inline bool sharesEdge(const uint32 ea, const uint32 eb, const Triangle& t) const
+		inline bool sharesEdge(const UINT32 ea, const UINT32 eb, const Triangle& t) const
 		{
 		{
 			return(	ea == t.a && eb == t.c ||
 			return(	ea == t.a && eb == t.c ||
 					ea == t.b && eb == t.a ||
 					ea == t.b && eb == t.a ||
@@ -768,7 +768,7 @@ namespace CamelotEngine {
 
 
 		inline void shiftClockwise()
 		inline void shiftClockwise()
 		{
 		{
-			uint32 t = a;
+			UINT32 t = a;
 			a = c;
 			a = c;
 			c = b;
 			c = b;
 			b = t;
 			b = t;
@@ -776,7 +776,7 @@ namespace CamelotEngine {
 
 
 		inline void shiftCounterClockwise()
 		inline void shiftCounterClockwise()
 		{
 		{
-			uint32 t = a;
+			UINT32 t = a;
 			a = b;
 			a = b;
 			b = c;
 			b = c;
 			c = t;
 			c = t;
@@ -791,30 +791,30 @@ namespace CamelotEngine {
 		void *buffer = indexBuffer->lock(HardwareBuffer::HBL_NORMAL);
 		void *buffer = indexBuffer->lock(HardwareBuffer::HBL_NORMAL);
 
 
 		Triangle* triangles;
 		Triangle* triangles;
-		uint32 *dest;
+		UINT32 *dest;
 
 
 		size_t nIndexes = indexCount;
 		size_t nIndexes = indexCount;
 		size_t nTriangles = nIndexes / 3;
 		size_t nTriangles = nIndexes / 3;
 		size_t i, j;
 		size_t i, j;
-		uint16 *source = 0;
+		UINT16 *source = 0;
 
 
 		if (indexBuffer->getType() == HardwareIndexBuffer::IT_16BIT)
 		if (indexBuffer->getType() == HardwareIndexBuffer::IT_16BIT)
 		{
 		{
 			triangles = (Triangle*) malloc(sizeof(Triangle) * nTriangles);
 			triangles = (Triangle*) malloc(sizeof(Triangle) * nTriangles);
-			source = (uint16 *)buffer;
-			dest = (uint32 *)triangles;
+			source = (UINT16 *)buffer;
+			dest = (UINT32 *)triangles;
 			for (i = 0; i < nIndexes; ++i) dest[i] = source[i];
 			for (i = 0; i < nIndexes; ++i) dest[i] = source[i];
 		}
 		}
 		else
 		else
 			triangles = (Triangle*)buffer;
 			triangles = (Triangle*)buffer;
 
 
 		// sort triangles based on shared edges
 		// sort triangles based on shared edges
-		uint32 *destlist = (uint32*)malloc(sizeof(uint32) * nTriangles);
+		UINT32 *destlist = (UINT32*)malloc(sizeof(UINT32) * nTriangles);
 		unsigned char *visited = (unsigned char*)malloc(sizeof(unsigned char) * nTriangles);
 		unsigned char *visited = (unsigned char*)malloc(sizeof(unsigned char) * nTriangles);
 
 
 		for (i = 0; i < nTriangles; ++i) visited[i] = 0;
 		for (i = 0; i < nTriangles; ++i) visited[i] = 0;
 
 
-		uint32 start = 0, ti = 0, destcount = 0;
+		UINT32 start = 0, ti = 0, destcount = 0;
 
 
 		bool found = false;
 		bool found = false;
 		for (i = 0; i < nTriangles; ++i)
 		for (i = 0; i < nTriangles; ++i)
@@ -837,7 +837,7 @@ namespace CamelotEngine {
 				if (triangles[ti].sharesEdge(triangles[j]))
 				if (triangles[ti].sharesEdge(triangles[j]))
 				{
 				{
 					found = true;
 					found = true;
-					ti = static_cast<uint32>(j);
+					ti = static_cast<UINT32>(j);
 					break;
 					break;
 				}
 				}
 			}
 			}
@@ -850,19 +850,19 @@ namespace CamelotEngine {
 			for (i = 0; i < nTriangles; ++i)
 			for (i = 0; i < nTriangles; ++i)
 			{
 			{
 				Triangle *t = &triangles[destlist[i]];
 				Triangle *t = &triangles[destlist[i]];
-				source[j++] = (uint16)t->a;
-				source[j++] = (uint16)t->b;
-				source[j++] = (uint16)t->c;
+				source[j++] = (UINT16)t->a;
+				source[j++] = (UINT16)t->b;
+				source[j++] = (UINT16)t->c;
 			}
 			}
 			free(triangles);
 			free(triangles);
 		}
 		}
 		else
 		else
 		{
 		{
-			uint32 *reflist = (uint32*)malloc(sizeof(uint32) * nTriangles);
+			UINT32 *reflist = (UINT32*)malloc(sizeof(UINT32) * nTriangles);
 
 
 			// fill the referencebuffer
 			// fill the referencebuffer
 			for (i = 0; i < nTriangles; ++i)
 			for (i = 0; i < nTriangles; ++i)
-				reflist[destlist[i]] = static_cast<uint32>(i);
+				reflist[destlist[i]] = static_cast<UINT32>(i);
 			
 			
 			// reorder the indexbuffer
 			// reorder the indexbuffer
 			for (i = 0; i < nTriangles; ++i)
 			for (i = 0; i < nTriangles; ++i)
@@ -877,7 +877,7 @@ namespace CamelotEngine {
 				triangles[j] = t;
 				triangles[j] = t;
 
 
 				// change reference
 				// change reference
-				destlist[reflist[i]] = static_cast<uint32>(j);
+				destlist[reflist[i]] = static_cast<UINT32>(j);
 				// destlist[i] = i; // not needed, it will not be used
 				// destlist[i] = i; // not needed, it will not be used
 			}
 			}
 
 
@@ -895,14 +895,14 @@ namespace CamelotEngine {
     {
     {
 		if (indexBuffer->isLocked()) return;
 		if (indexBuffer->isLocked()) return;
 
 
-		uint16 *shortbuffer = (uint16 *)indexBuffer->lock(HardwareBuffer::HBL_READ_ONLY);
+		UINT16 *shortbuffer = (UINT16 *)indexBuffer->lock(HardwareBuffer::HBL_READ_ONLY);
 
 
 		if (indexBuffer->getType() == HardwareIndexBuffer::IT_16BIT)
 		if (indexBuffer->getType() == HardwareIndexBuffer::IT_16BIT)
 			for (unsigned int i = 0; i < indexBuffer->getNumIndexes(); ++i)
 			for (unsigned int i = 0; i < indexBuffer->getNumIndexes(); ++i)
 				inCache(shortbuffer[i]);
 				inCache(shortbuffer[i]);
 		else
 		else
 		{
 		{
-			uint32 *buffer = (uint32 *)shortbuffer;
+			UINT32 *buffer = (UINT32 *)shortbuffer;
 			for (unsigned int i = 0; i < indexBuffer->getNumIndexes(); ++i)
 			for (unsigned int i = 0; i < indexBuffer->getNumIndexes(); ++i)
 				inCache(buffer[i]);
 				inCache(buffer[i]);
 		}
 		}

+ 2 - 2
CamelotRenderer/OgreVertexIndexData.h

@@ -257,7 +257,7 @@ namespace CamelotEngine {
 			VertexCacheProfiler(unsigned int cachesize = 16, CacheType cachetype = FIFO )
 			VertexCacheProfiler(unsigned int cachesize = 16, CacheType cachetype = FIFO )
 				: size ( cachesize ), type ( cachetype ), tail (0), buffersize (0), hit (0), miss (0)
 				: size ( cachesize ), type ( cachetype ), tail (0), buffersize (0), hit (0), miss (0)
 			{
 			{
-				cache = (uint32*)malloc(sizeof(uint32) * size);
+				cache = (UINT32*)malloc(sizeof(UINT32) * size);
 			}
 			}
 
 
 			~VertexCacheProfiler()
 			~VertexCacheProfiler()
@@ -274,7 +274,7 @@ namespace CamelotEngine {
 			unsigned int getSize() { return size; }
 			unsigned int getSize() { return size; }
 		private:
 		private:
 			unsigned int size;
 			unsigned int size;
-			uint32 *cache;
+			UINT32 *cache;
 			CacheType type;
 			CacheType type;
 
 
 			unsigned int tail, buffersize;
 			unsigned int tail, buffersize;

+ 10 - 10
CamelotRenderer/OgreViewport.cpp

@@ -29,13 +29,13 @@ THE SOFTWARE.
 
 
 #include "OgreException.h"
 #include "OgreException.h"
 #include "OgreRenderTarget.h"
 #include "OgreRenderTarget.h"
-#include "OgreMath.h"
+#include "CmMath.h"
 #include "OgreRenderSystem.h"
 #include "OgreRenderSystem.h"
 #include "CmRenderSystemManager.h"
 #include "CmRenderSystemManager.h"
 
 
 namespace CamelotEngine {
 namespace CamelotEngine {
     //---------------------------------------------------------------------
     //---------------------------------------------------------------------
-    Viewport::Viewport(RenderTarget* target, Real left, Real top, Real width, Real height, int ZOrder)
+    Viewport::Viewport(RenderTarget* target, float left, float top, float width, float height, int ZOrder)
          :mTarget(target)
          :mTarget(target)
         , mRelLeft(left)
         , mRelLeft(left)
         , mRelTop(top)
         , mRelTop(top)
@@ -58,8 +58,8 @@ namespace CamelotEngine {
     //---------------------------------------------------------------------
     //---------------------------------------------------------------------
     void Viewport::_updateDimensions(void)
     void Viewport::_updateDimensions(void)
     {
     {
-        Real height = (Real) mTarget->getHeight();
-        Real width = (Real) mTarget->getWidth();
+        float height = (float) mTarget->getHeight();
+        float width = (float) mTarget->getWidth();
 
 
         mActLeft = (int) (mRelLeft * width);
         mActLeft = (int) (mRelLeft * width);
         mActTop = (int) (mRelTop * height);
         mActTop = (int) (mRelTop * height);
@@ -77,22 +77,22 @@ namespace CamelotEngine {
         return mTarget;
         return mTarget;
     }
     }
     //---------------------------------------------------------------------
     //---------------------------------------------------------------------
-    Real Viewport::getLeft(void) const
+    float Viewport::getLeft(void) const
     {
     {
         return mRelLeft;
         return mRelLeft;
     }
     }
     //---------------------------------------------------------------------
     //---------------------------------------------------------------------
-    Real Viewport::getTop(void) const
+    float Viewport::getTop(void) const
     {
     {
         return mRelTop;
         return mRelTop;
     }
     }
     //---------------------------------------------------------------------
     //---------------------------------------------------------------------
-    Real Viewport::getWidth(void) const
+    float Viewport::getWidth(void) const
     {
     {
         return mRelWidth;
         return mRelWidth;
     }
     }
     //---------------------------------------------------------------------
     //---------------------------------------------------------------------
-    Real Viewport::getHeight(void) const
+    float Viewport::getHeight(void) const
     {
     {
         return mRelHeight;
         return mRelHeight;
     }
     }
@@ -117,7 +117,7 @@ namespace CamelotEngine {
         return mActHeight;
         return mActHeight;
     }
     }
     //---------------------------------------------------------------------
     //---------------------------------------------------------------------
-    void Viewport::setDimensions(Real left, Real top, Real width, Real height)
+    void Viewport::setDimensions(float left, float top, float width, float height)
     {
     {
         mRelLeft = left;
         mRelLeft = left;
         mRelTop = top;
         mRelTop = top;
@@ -158,7 +158,7 @@ namespace CamelotEngine {
     }
     }
     //---------------------------------------------------------------------
     //---------------------------------------------------------------------
 	void Viewport::clear(unsigned int buffers, const ColourValue& col,  
 	void Viewport::clear(unsigned int buffers, const ColourValue& col,  
-						 Real depth, unsigned short stencil)
+						 float depth, unsigned short stencil)
 	{
 	{
 		RenderSystem* rs = CamelotEngine::RenderSystemManager::getActive();
 		RenderSystem* rs = CamelotEngine::RenderSystemManager::getActive();
 		if (rs)
 		if (rs)

+ 8 - 8
CamelotRenderer/OgreViewport.h

@@ -80,8 +80,8 @@ namespace CamelotEngine {
         */
         */
         Viewport(
         Viewport(
             RenderTarget* target,
             RenderTarget* target,
-            Real left, Real top,
-            Real width, Real height,
+            float left, float top,
+            float width, float height,
             int ZOrder);
             int ZOrder);
 
 
         /** Default destructor.
         /** Default destructor.
@@ -115,7 +115,7 @@ namespace CamelotEngine {
 		*/
 		*/
 		void clear(unsigned int buffers = FBT_COLOUR | FBT_DEPTH,
 		void clear(unsigned int buffers = FBT_COLOUR | FBT_DEPTH,
 				   const ColourValue& colour = ColourValue::Black, 
 				   const ColourValue& colour = ColourValue::Black, 
-				   Real depth = 1.0f, unsigned short stencil = 0);
+				   float depth = 1.0f, unsigned short stencil = 0);
 
 
         /** Retrieves a pointer to the render target for this viewport.
         /** Retrieves a pointer to the render target for this viewport.
         */
         */
@@ -126,23 +126,23 @@ namespace CamelotEngine {
 		/** Gets one of the relative dimensions of the viewport,
 		/** Gets one of the relative dimensions of the viewport,
             a value between 0.0 and 1.0.
             a value between 0.0 and 1.0.
         */
         */
-        Real getLeft(void) const;
+        float getLeft(void) const;
 
 
         /** Gets one of the relative dimensions of the viewport, a value
         /** Gets one of the relative dimensions of the viewport, a value
             between 0.0 and 1.0.
             between 0.0 and 1.0.
         */
         */
-        Real getTop(void) const;
+        float getTop(void) const;
 
 
         /** Gets one of the relative dimensions of the viewport, a value
         /** Gets one of the relative dimensions of the viewport, a value
             between 0.0 and 1.0.
             between 0.0 and 1.0.
         */
         */
 
 
-        Real getWidth(void) const;
+        float getWidth(void) const;
         /** Gets one of the relative dimensions of the viewport, a value
         /** Gets one of the relative dimensions of the viewport, a value
             between 0.0 and 1.0.
             between 0.0 and 1.0.
         */
         */
 
 
-        Real getHeight(void) const;
+        float getHeight(void) const;
         /** Gets one of the actual dimensions of the viewport, a value in
         /** Gets one of the actual dimensions of the viewport, a value in
             pixels.
             pixels.
         */
         */
@@ -175,7 +175,7 @@ namespace CamelotEngine {
                 represented as real values between 0 and 1. i.e. the full
                 represented as real values between 0 and 1. i.e. the full
                 target area is 0, 0, 1, 1.
                 target area is 0, 0, 1, 1.
         */
         */
-        void setDimensions(Real left, Real top, Real width, Real height);
+        void setDimensions(float left, float top, float width, float height);
 
 
         /** Sets the initial background colour of the viewport (before
         /** Sets the initial background colour of the viewport (before
             rendering).
             rendering).

+ 5 - 5
CamelotRenderer/RenderSystemGL/Include/OgreGLFBORenderTexture.h

@@ -44,7 +44,7 @@ namespace CamelotEngine {
     class _OgreGLExport GLFBORenderTexture: public GLRenderTexture
     class _OgreGLExport GLFBORenderTexture: public GLRenderTexture
     {
     {
     public:
     public:
-        GLFBORenderTexture(GLFBOManager *manager, const String &name, const GLSurfaceDesc &target, bool writeGamma, uint fsaa);
+        GLFBORenderTexture(GLFBOManager *manager, const String &name, const GLSurfaceDesc &target, bool writeGamma, UINT32 fsaa);
 
 
         virtual void getCustomAttribute(const String& name, void* pData);
         virtual void getCustomAttribute(const String& name, void* pData);
 
 
@@ -78,7 +78,7 @@ namespace CamelotEngine {
         /** Create a texture rendertarget object
         /** Create a texture rendertarget object
         */
         */
         virtual GLFBORenderTexture *createRenderTexture(const String &name, 
         virtual GLFBORenderTexture *createRenderTexture(const String &name, 
-			const GLSurfaceDesc &target, bool writeGamma, uint fsaa);
+			const GLSurfaceDesc &target, bool writeGamma, UINT32 fsaa);
 
 
 		/** Create a multi render target 
 		/** Create a multi render target 
 		*/
 		*/
@@ -86,7 +86,7 @@ namespace CamelotEngine {
         
         
         /** Request a render buffer. If format is GL_NONE, return a zero buffer.
         /** Request a render buffer. If format is GL_NONE, return a zero buffer.
         */
         */
-        GLSurfaceDesc requestRenderBuffer(GLenum format, size_t width, size_t height, uint fsaa);
+        GLSurfaceDesc requestRenderBuffer(GLenum format, size_t width, size_t height, UINT32 fsaa);
         /** Request the specify render buffer in case shared somewhere. Ignore
         /** Request the specify render buffer in case shared somewhere. Ignore
             silently if surface.buffer is 0.
             silently if surface.buffer is 0.
         */
         */
@@ -129,13 +129,13 @@ namespace CamelotEngine {
         */
         */
         struct RBFormat
         struct RBFormat
         {
         {
-            RBFormat(GLenum inFormat, size_t inWidth, size_t inHeight, uint fsaa):
+            RBFormat(GLenum inFormat, size_t inWidth, size_t inHeight, UINT32 fsaa):
                 format(inFormat), width(inWidth), height(inHeight), samples(fsaa)
                 format(inFormat), width(inWidth), height(inHeight), samples(fsaa)
             {}
             {}
             GLenum format;
             GLenum format;
             size_t width;
             size_t width;
             size_t height;
             size_t height;
-			uint samples;
+			UINT32 samples;
             // Overloaded comparison operator for usage in map
             // Overloaded comparison operator for usage in map
             bool operator < (const RBFormat &other) const
             bool operator < (const RBFormat &other) const
             {
             {

+ 3 - 3
CamelotRenderer/RenderSystemGL/Include/OgreGLFrameBufferObject.h

@@ -38,11 +38,11 @@ namespace CamelotEngine {
     class _OgreGLExport GLFrameBufferObject
     class _OgreGLExport GLFrameBufferObject
     {
     {
     public:
     public:
-        GLFrameBufferObject(GLFBOManager *manager, uint fsaa);
+        GLFrameBufferObject(GLFBOManager *manager, UINT32 fsaa);
         ~GLFrameBufferObject();
         ~GLFrameBufferObject();
         //void bindSurface(size_t attachment, RenderTarget *target);
         //void bindSurface(size_t attachment, RenderTarget *target);
         /** Bind a surface to a certain attachment point.
         /** Bind a surface to a certain attachment point.
-            attachment: 0..OGRE_MAX_MULTIPLE_RENDER_TARGETS-1
+            attachment: 0..CM_MAX_MULTIPLE_RENDER_TARGETS-1
         */
         */
         void bindSurface(size_t attachment, const GLSurfaceDesc &target);
         void bindSurface(size_t attachment, const GLSurfaceDesc &target);
         /** Unbind attachment
         /** Unbind attachment
@@ -78,7 +78,7 @@ namespace CamelotEngine {
         GLSurfaceDesc mDepth;
         GLSurfaceDesc mDepth;
         GLSurfaceDesc mStencil;
         GLSurfaceDesc mStencil;
         // Arbitrary number of texture surfaces
         // Arbitrary number of texture surfaces
-        GLSurfaceDesc mColour[OGRE_MAX_MULTIPLE_RENDER_TARGETS];
+        GLSurfaceDesc mColour[CM_MAX_MULTIPLE_RENDER_TARGETS];
 
 
 
 
 		/** Initialise object (find suitable depth and stencil format).
 		/** Initialise object (find suitable depth and stencil format).

+ 1 - 1
CamelotRenderer/RenderSystemGL/Include/OgreGLGpuNvparseProgram.h

@@ -46,7 +46,7 @@ public:
     /// Execute the unbinding functions for this program
     /// Execute the unbinding functions for this program
     void unbindProgram(void);
     void unbindProgram(void);
     /// Execute the param binding functions for this program
     /// Execute the param binding functions for this program
-	void bindProgramParameters(GpuProgramParametersSharedPtr params, uint16 mask);
+	void bindProgramParameters(GpuProgramParametersSharedPtr params, UINT16 mask);
 
 
     /// Get the assigned GL program id
     /// Get the assigned GL program id
     const GLuint getProgramID(void) const
     const GLuint getProgramID(void) const

+ 5 - 5
CamelotRenderer/RenderSystemGL/Include/OgreGLGpuProgram.h

@@ -48,7 +48,7 @@ namespace CamelotEngine {
         virtual void unbindProgram(void) {}
         virtual void unbindProgram(void) {}
 
 
         /// Execute the param binding functions for this program
         /// Execute the param binding functions for this program
-		virtual void bindProgramParameters(GpuProgramParametersSharedPtr params, uint16 mask) {}
+		virtual void bindProgramParameters(GpuProgramParametersSharedPtr params, UINT16 mask) {}
 		/// Bind just the pass iteration parameters
 		/// Bind just the pass iteration parameters
 		virtual void bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params) {}
 		virtual void bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params) {}
 
 
@@ -62,13 +62,13 @@ namespace CamelotEngine {
 			This can be used to identify the attribute index to bind non-builtin
 			This can be used to identify the attribute index to bind non-builtin
 			attributes like tangent and binormal.
 			attributes like tangent and binormal.
 		*/
 		*/
-		virtual GLuint getAttributeIndex(VertexElementSemantic semantic, uint index);
+		virtual GLuint getAttributeIndex(VertexElementSemantic semantic, UINT32 index);
 		/** Test whether attribute index for a given semantic is valid. 
 		/** Test whether attribute index for a given semantic is valid. 
 		*/
 		*/
-		virtual bool isAttributeValid(VertexElementSemantic semantic, uint index);
+		virtual bool isAttributeValid(VertexElementSemantic semantic, UINT32 index);
 
 
 		/** Get the fixed attribute bindings normally used by GL for a semantic. */
 		/** Get the fixed attribute bindings normally used by GL for a semantic. */
-		static GLuint getFixedAttributeIndex(VertexElementSemantic semantic, uint index);
+		static GLuint getFixedAttributeIndex(VertexElementSemantic semantic, UINT32 index);
 
 
     protected:
     protected:
 		/** Overridden from GpuProgram, do nothing */
 		/** Overridden from GpuProgram, do nothing */
@@ -96,7 +96,7 @@ namespace CamelotEngine {
         /// Execute the unbinding functions for this program
         /// Execute the unbinding functions for this program
         void unbindProgram(void);
         void unbindProgram(void);
         /// Execute the param binding functions for this program
         /// Execute the param binding functions for this program
-		void bindProgramParameters(GpuProgramParametersSharedPtr params, uint16 mask);
+		void bindProgramParameters(GpuProgramParametersSharedPtr params, UINT16 mask);
 		/// Bind just the pass iteration parameters
 		/// Bind just the pass iteration parameters
 		void bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params);
 		void bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params);
 
 

+ 2 - 2
CamelotRenderer/RenderSystemGL/Include/OgreGLHardwareBufferManager.h

@@ -68,7 +68,7 @@ namespace CamelotEngine {
 			memory pool, and use glBufferSubDataARB / glGetBufferSubDataARB
 			memory pool, and use glBufferSubDataARB / glGetBufferSubDataARB
 			instead.
 			instead.
 		*/
 		*/
-		void* allocateScratch(uint32 size);
+		void* allocateScratch(UINT32 size);
 
 
 		/// @see allocateScratch
 		/// @see allocateScratch
 		void deallocateScratch(void* ptr);
 		void deallocateScratch(void* ptr);
@@ -110,7 +110,7 @@ namespace CamelotEngine {
 		memory pool, and use glBufferSubDataARB / glGetBufferSubDataARB
 		memory pool, and use glBufferSubDataARB / glGetBufferSubDataARB
 		instead.
 		instead.
 		*/
 		*/
-		void* allocateScratch(uint32 size)
+		void* allocateScratch(UINT32 size)
 		{
 		{
 			return static_cast<GLHardwareBufferManagerBase*>(mImpl)->allocateScratch(size);
 			return static_cast<GLHardwareBufferManagerBase*>(mImpl)->allocateScratch(size);
 		}
 		}

+ 1 - 1
CamelotRenderer/RenderSystemGL/Include/OgreGLHardwarePixelBuffer.h

@@ -81,7 +81,7 @@ namespace CamelotEngine {
     public:
     public:
         /** Texture constructor */
         /** Texture constructor */
 		GLTextureBuffer(const String &baseName, GLenum target, GLuint id, GLint face, 
 		GLTextureBuffer(const String &baseName, GLenum target, GLuint id, GLint face, 
-			GLint level, Usage usage, bool softwareMipmap, bool writeGamma, uint fsaa);
+			GLint level, Usage usage, bool softwareMipmap, bool writeGamma, UINT32 fsaa);
         ~GLTextureBuffer();
         ~GLTextureBuffer();
         
         
         /// @copydoc HardwarePixelBuffer::bindToFramebuffer
         /// @copydoc HardwarePixelBuffer::bindToFramebuffer

+ 2 - 2
CamelotRenderer/RenderSystemGL/Include/OgreGLPBRenderTexture.h

@@ -39,7 +39,7 @@ namespace CamelotEngine {
     class _OgreGLExport GLPBRenderTexture: public GLRenderTexture
     class _OgreGLExport GLPBRenderTexture: public GLRenderTexture
     {
     {
     public:
     public:
-        GLPBRenderTexture(GLPBRTTManager *manager, const String &name, const GLSurfaceDesc &target, bool writeGamma, uint fsaa);
+        GLPBRenderTexture(GLPBRTTManager *manager, const String &name, const GLSurfaceDesc &target, bool writeGamma, UINT32 fsaa);
         virtual ~GLPBRenderTexture();
         virtual ~GLPBRenderTexture();
         
         
         virtual void getCustomAttribute(const String& name, void* pData);
         virtual void getCustomAttribute(const String& name, void* pData);
@@ -59,7 +59,7 @@ namespace CamelotEngine {
         /** @copydoc GLRTTManager::createRenderTexture
         /** @copydoc GLRTTManager::createRenderTexture
         */
         */
         virtual RenderTexture *createRenderTexture(const String &name, 
         virtual RenderTexture *createRenderTexture(const String &name, 
-			const GLSurfaceDesc &target, bool writeGamma, uint fsaa);
+			const GLSurfaceDesc &target, bool writeGamma, UINT32 fsaa);
         
         
          /** @copydoc GLRTTManager::checkFormat
          /** @copydoc GLRTTManager::checkFormat
         */
         */

+ 22 - 22
CamelotRenderer/RenderSystemGL/Include/OgreGLRenderSystem.h

@@ -35,7 +35,7 @@ THE SOFTWARE.
 #include "OgreGLGpuProgramManager.h"
 #include "OgreGLGpuProgramManager.h"
 #include "OgreGLSLProgramFactory.h"
 #include "OgreGLSLProgramFactory.h"
 #include "OgreConfigOptionMap.h"
 #include "OgreConfigOptionMap.h"
-#include "OgreVector4.h"
+#include "CmVector4.h"
 
 
 namespace CamelotEngine {
 namespace CamelotEngine {
     /**
     /**
@@ -63,10 +63,10 @@ namespace CamelotEngine {
         FilterOptions mMipFilter;
         FilterOptions mMipFilter;
 
 
         /// What texture coord set each texture unit is using
         /// What texture coord set each texture unit is using
-        size_t mTextureCoordIndex[OGRE_MAX_TEXTURE_LAYERS];
+        size_t mTextureCoordIndex[CM_MAX_TEXTURE_LAYERS];
 
 
         /// Holds texture type settings for every stage
         /// Holds texture type settings for every stage
-        GLenum mTextureTypes[OGRE_MAX_TEXTURE_LAYERS];
+        GLenum mTextureTypes[CM_MAX_TEXTURE_LAYERS];
 
 
 		/// Number of fixed-function texture units
 		/// Number of fixed-function texture units
 		unsigned short mFixedFunctionTextureUnits;
 		unsigned short mFixedFunctionTextureUnits;
@@ -86,7 +86,7 @@ namespace CamelotEngine {
         /// Store last depth write state
         /// Store last depth write state
         bool mDepthWrite;
         bool mDepthWrite;
 		/// Store last stencil mask state
 		/// Store last stencil mask state
-		uint32 mStencilMask;
+		UINT32 mStencilMask;
 		/// Store last colour write state
 		/// Store last colour write state
 		bool mColourWrite[4];
 		bool mColourWrite[4];
 
 
@@ -132,7 +132,7 @@ namespace CamelotEngine {
         */
         */
         GLRTTManager *mRTTManager;
         GLRTTManager *mRTTManager;
 
 
-		ushort mActiveTextureUnit;
+		UINT16 mActiveTextureUnit;
 
 
 	protected:
 	protected:
 		void setClipPlanesImpl(const PlaneList& clipPlanes);
 		void setClipPlanesImpl(const PlaneList& clipPlanes);
@@ -253,13 +253,13 @@ namespace CamelotEngine {
          */
          */
         void _setSurfaceParams(const ColourValue &ambient,
         void _setSurfaceParams(const ColourValue &ambient,
             const ColourValue &diffuse, const ColourValue &specular,
             const ColourValue &diffuse, const ColourValue &specular,
-            const ColourValue &emissive, Real shininess,
+            const ColourValue &emissive, float shininess,
             TrackVertexColourType tracking);
             TrackVertexColourType tracking);
         /** See
         /** See
           RenderSystem
           RenderSystem
          */
          */
-		void _setPointParameters(Real size, bool attenuationEnabled, 
-			Real constant, Real linear, Real quadratic, Real minSize, Real maxSize);
+		void _setPointParameters(float size, bool attenuationEnabled, 
+			float constant, float linear, float quadratic, float minSize, float maxSize);
         /** See
         /** See
           RenderSystem
           RenderSystem
          */
          */
@@ -360,7 +360,7 @@ namespace CamelotEngine {
 		/** See
 		/** See
           RenderSystem
           RenderSystem
          */
          */
-        void _setFog(FogMode mode, const ColourValue& colour, Real density, Real start, Real end);
+        void _setFog(FogMode mode, const ColourValue& colour, float density, float start, float end);
         /** See
         /** See
           RenderSystem
           RenderSystem
          */
          */
@@ -369,17 +369,17 @@ namespace CamelotEngine {
         /** See
         /** See
           RenderSystem
           RenderSystem
          */
          */
-        void _makeProjectionMatrix(const Radian& fovy, Real aspect, Real nearPlane, Real farPlane, 
+        void _makeProjectionMatrix(const Radian& fovy, float aspect, float nearPlane, float farPlane, 
             Matrix4& dest, bool forGpuProgram = false);
             Matrix4& dest, bool forGpuProgram = false);
         /** See
         /** See
           RenderSystem
           RenderSystem
          */
          */
-        void _makeProjectionMatrix(Real left, Real right, Real bottom, Real top, 
-            Real nearPlane, Real farPlane, Matrix4& dest, bool forGpuProgram = false);
+        void _makeProjectionMatrix(float left, float right, float bottom, float top, 
+            float nearPlane, float farPlane, Matrix4& dest, bool forGpuProgram = false);
         /** See
         /** See
           RenderSystem
           RenderSystem
          */
          */
-		void _makeOrthoMatrix(const Radian& fovy, Real aspect, Real nearPlane, Real farPlane, 
+		void _makeOrthoMatrix(const Radian& fovy, float aspect, float nearPlane, float farPlane, 
             Matrix4& dest, bool forGpuProgram = false);
             Matrix4& dest, bool forGpuProgram = false);
         /** See
         /** See
         RenderSystem
         RenderSystem
@@ -389,11 +389,11 @@ namespace CamelotEngine {
         /** See
         /** See
           RenderSystem
           RenderSystem
          */
          */
-        void setClipPlane (ushort index, Real A, Real B, Real C, Real D);
+        void setClipPlane (UINT16 index, float A, float B, float C, float D);
         /** See
         /** See
           RenderSystem
           RenderSystem
          */
          */
-        void enableClipPlane (ushort index, bool enable);
+        void enableClipPlane (UINT16 index, bool enable);
         /** See
         /** See
           RenderSystem
           RenderSystem
          */
          */
@@ -406,7 +406,7 @@ namespace CamelotEngine {
           RenderSystem.
           RenderSystem.
          */
          */
         void setStencilBufferParams(CompareFunction func = CMPF_ALWAYS_PASS, 
         void setStencilBufferParams(CompareFunction func = CMPF_ALWAYS_PASS, 
-            uint32 refValue = 0, uint32 mask = 0xFFFFFFFF, 
+            UINT32 refValue = 0, UINT32 mask = 0xFFFFFFFF, 
             StencilOperation stencilFailOp = SOP_KEEP, 
             StencilOperation stencilFailOp = SOP_KEEP, 
             StencilOperation depthFailOp = SOP_KEEP,
             StencilOperation depthFailOp = SOP_KEEP,
             StencilOperation passOp = SOP_KEEP, 
             StencilOperation passOp = SOP_KEEP, 
@@ -443,7 +443,7 @@ namespace CamelotEngine {
           RenderSystem
           RenderSystem
          */
          */
 		void bindGpuProgramParameters(GpuProgramType gptype, 
 		void bindGpuProgramParameters(GpuProgramType gptype, 
-			GpuProgramParametersSharedPtr params, uint16 variabilityMask);
+			GpuProgramParametersSharedPtr params, UINT16 variabilityMask);
 		/** See
 		/** See
 		  RenderSystem
 		  RenderSystem
 		 */
 		 */
@@ -454,12 +454,12 @@ namespace CamelotEngine {
         void setScissorTest(bool enabled, size_t left = 0, size_t top = 0, size_t right = 800, size_t bottom = 600) ;
         void setScissorTest(bool enabled, size_t left = 0, size_t top = 0, size_t right = 800, size_t bottom = 600) ;
         void clearFrameBuffer(unsigned int buffers, 
         void clearFrameBuffer(unsigned int buffers, 
             const ColourValue& colour = ColourValue::Black, 
             const ColourValue& colour = ColourValue::Black, 
-            Real depth = 1.0f, unsigned short stencil = 0);
+            float depth = 1.0f, unsigned short stencil = 0);
         HardwareOcclusionQuery* createHardwareOcclusionQuery(void);
         HardwareOcclusionQuery* createHardwareOcclusionQuery(void);
-        Real getHorizontalTexelOffset(void);
-        Real getVerticalTexelOffset(void);
-        Real getMinimumDepthInputValue(void);
-        Real getMaximumDepthInputValue(void);
+        float getHorizontalTexelOffset(void);
+        float getVerticalTexelOffset(void);
+        float getMinimumDepthInputValue(void);
+        float getMaximumDepthInputValue(void);
 		CM_MUTEX(mThreadInitMutex)
 		CM_MUTEX(mThreadInitMutex)
 		void registerThread();
 		void registerThread();
 		void unregisterThread();
 		void unregisterThread();

+ 5 - 5
CamelotRenderer/RenderSystemGL/Include/OgreGLRenderTexture.h

@@ -39,7 +39,7 @@ namespace CamelotEngine {
     public:
     public:
         GLHardwarePixelBuffer *buffer;
         GLHardwarePixelBuffer *buffer;
         size_t zoffset;
         size_t zoffset;
-		uint numSamples;
+		UINT32 numSamples;
 
 
 		GLSurfaceDesc() :buffer(0), zoffset(0), numSamples(0) {}
 		GLSurfaceDesc() :buffer(0), zoffset(0), numSamples(0) {}
     };
     };
@@ -49,7 +49,7 @@ namespace CamelotEngine {
     class _OgreGLExport GLRenderTexture: public RenderTexture
     class _OgreGLExport GLRenderTexture: public RenderTexture
     {
     {
     public:
     public:
-        GLRenderTexture(const String &name, const GLSurfaceDesc &target, bool writeGamma, uint fsaa);
+        GLRenderTexture(const String &name, const GLSurfaceDesc &target, bool writeGamma, UINT32 fsaa);
         virtual ~GLRenderTexture();
         virtual ~GLRenderTexture();
         
         
         bool requiresTextureFlipping() const { return true; }
         bool requiresTextureFlipping() const { return true; }
@@ -64,7 +64,7 @@ namespace CamelotEngine {
         
         
         /** Create a texture rendertarget object
         /** Create a texture rendertarget object
         */
         */
-        virtual RenderTexture *createRenderTexture(const String &name, const GLSurfaceDesc &target, bool writeGamma, uint fsaa) = 0;
+        virtual RenderTexture *createRenderTexture(const String &name, const GLSurfaceDesc &target, bool writeGamma, UINT32 fsaa) = 0;
         
         
          /** Check if a certain format is usable as rendertexture format
          /** Check if a certain format is usable as rendertexture format
         */
         */
@@ -96,7 +96,7 @@ namespace CamelotEngine {
     {
     {
     public:
     public:
         GLCopyingRenderTexture(GLCopyingRTTManager *manager, const String &name, const GLSurfaceDesc &target, 
         GLCopyingRenderTexture(GLCopyingRTTManager *manager, const String &name, const GLSurfaceDesc &target, 
-			bool writeGamma, uint fsaa);
+			bool writeGamma, UINT32 fsaa);
         
         
         virtual void getCustomAttribute(const String& name, void* pData);
         virtual void getCustomAttribute(const String& name, void* pData);
     };
     };
@@ -112,7 +112,7 @@ namespace CamelotEngine {
         
         
         /** @copydoc GLRTTManager::createRenderTexture
         /** @copydoc GLRTTManager::createRenderTexture
         */
         */
-        virtual RenderTexture *createRenderTexture(const String &name, const GLSurfaceDesc &target, bool writeGamma, uint fsaa);
+        virtual RenderTexture *createRenderTexture(const String &name, const GLSurfaceDesc &target, bool writeGamma, UINT32 fsaa);
         
         
         /** @copydoc GLRTTManager::checkFormat
         /** @copydoc GLRTTManager::checkFormat
         */
         */

+ 3 - 3
CamelotRenderer/RenderSystemGL/Source/GLSL/include/OgreGLSLGpuProgram.h

@@ -68,7 +68,7 @@ namespace CamelotEngine {
 		/// Execute the unbinding functions for this program
 		/// Execute the unbinding functions for this program
 		void unbindProgram(void);
 		void unbindProgram(void);
 		/// Execute the param binding functions for this program
 		/// Execute the param binding functions for this program
-		void bindProgramParameters(GpuProgramParametersSharedPtr params, uint16 mask);
+		void bindProgramParameters(GpuProgramParametersSharedPtr params, UINT16 mask);
 		/// Execute the pass iteration param binding functions for this program
 		/// Execute the pass iteration param binding functions for this program
 		void bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params);
 		void bindProgramPassIterationParameters(GpuProgramParametersSharedPtr params);
 
 
@@ -80,10 +80,10 @@ namespace CamelotEngine {
 		GLSLProgram* getGLSLProgram(void) const { return mGLSLProgram; }
 		GLSLProgram* getGLSLProgram(void) const { return mGLSLProgram; }
 
 
 		/// @copydoc GLGpuProgram::getAttributeIndex
 		/// @copydoc GLGpuProgram::getAttributeIndex
-		GLuint getAttributeIndex(VertexElementSemantic semantic, uint index);
+		GLuint getAttributeIndex(VertexElementSemantic semantic, UINT32 index);
 		
 		
 		/// @copydoc GLGpuProgram::isAttributeValid
 		/// @copydoc GLGpuProgram::isAttributeValid
-		bool isAttributeValid(VertexElementSemantic semantic, uint index);
+		bool isAttributeValid(VertexElementSemantic semantic, UINT32 index);
 		
 		
 
 
     protected:
     protected:

+ 3 - 3
CamelotRenderer/RenderSystemGL/Source/GLSL/include/OgreGLSLLinkProgram.h

@@ -108,7 +108,7 @@ namespace CamelotEngine {
 		/** updates program object uniforms using data from GpuProgramParamters.
 		/** updates program object uniforms using data from GpuProgramParamters.
 		normally called by GLSLGpuProgram::bindParameters() just before rendering occurs.
 		normally called by GLSLGpuProgram::bindParameters() just before rendering occurs.
 		*/
 		*/
-		void updateUniforms(GpuProgramParametersSharedPtr params, uint16 mask, GpuProgramType fromProgType);
+		void updateUniforms(GpuProgramParametersSharedPtr params, UINT16 mask, GpuProgramType fromProgType);
 		/** updates program object uniforms using data from pass iteration GpuProgramParamters.
 		/** updates program object uniforms using data from pass iteration GpuProgramParamters.
 		normally called by GLSLGpuProgram::bindMultiPassParameters() just before multi pass rendering occurs.
 		normally called by GLSLGpuProgram::bindMultiPassParameters() just before multi pass rendering occurs.
 		*/
 		*/
@@ -133,9 +133,9 @@ namespace CamelotEngine {
         bool isSkeletalAnimationIncluded(void) const { return mSkeletalAnimation; }
         bool isSkeletalAnimationIncluded(void) const { return mSkeletalAnimation; }
 
 
 		/// Get the index of a non-standard attribute bound in the linked code
 		/// Get the index of a non-standard attribute bound in the linked code
-		GLuint getAttributeIndex(VertexElementSemantic semantic, uint index);
+		GLuint getAttributeIndex(VertexElementSemantic semantic, UINT32 index);
 		/// Is a non-standard attribute bound in the linked code?
 		/// Is a non-standard attribute bound in the linked code?
-		bool isAttributeValid(VertexElementSemantic semantic, uint index);
+		bool isAttributeValid(VertexElementSemantic semantic, UINT32 index);
 
 
 	};
 	};
 
 

+ 1 - 1
CamelotRenderer/RenderSystemGL/Source/GLSL/include/OgreGLSLLinkProgramManager.h

@@ -54,7 +54,7 @@ namespace CamelotEngine {
 
 
 	private:
 	private:
 	
 	
-		typedef map<uint64, GLSLLinkProgram*>::type LinkProgramMap;
+		typedef map<UINT64, GLSLLinkProgram*>::type LinkProgramMap;
 		typedef LinkProgramMap::iterator LinkProgramIterator;
 		typedef LinkProgramMap::iterator LinkProgramIterator;
 
 
 		/// container holding previously created program objects 
 		/// container holding previously created program objects 

+ 3 - 3
CamelotRenderer/RenderSystemGL/Source/GLSL/src/OgreGLSLGpuProgram.cpp

@@ -121,7 +121,7 @@ namespace CamelotEngine {
 	}
 	}
 
 
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
-	void GLSLGpuProgram::bindProgramParameters(GpuProgramParametersSharedPtr params, uint16 mask)
+	void GLSLGpuProgram::bindProgramParameters(GpuProgramParametersSharedPtr params, UINT16 mask)
 	{
 	{
 		// link can throw exceptions, ignore them at this point
 		// link can throw exceptions, ignore them at this point
 		try
 		try
@@ -148,7 +148,7 @@ namespace CamelotEngine {
 		
 		
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
-	GLuint GLSLGpuProgram::getAttributeIndex(VertexElementSemantic semantic, uint index)
+	GLuint GLSLGpuProgram::getAttributeIndex(VertexElementSemantic semantic, UINT32 index)
 	{
 	{
 		// get link program - only call this in the context of bound program
 		// get link program - only call this in the context of bound program
 		GLSLLinkProgram* linkProgram = GLSLLinkProgramManager::getSingleton().getActiveLinkProgram();
 		GLSLLinkProgram* linkProgram = GLSLLinkProgramManager::getSingleton().getActiveLinkProgram();
@@ -165,7 +165,7 @@ namespace CamelotEngine {
 		
 		
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
-	bool GLSLGpuProgram::isAttributeValid(VertexElementSemantic semantic, uint index)
+	bool GLSLGpuProgram::isAttributeValid(VertexElementSemantic semantic, UINT32 index)
 	{
 	{
 		// get link program - only call this in the context of bound program
 		// get link program - only call this in the context of bound program
 		GLSLLinkProgram* linkProgram = GLSLLinkProgramManager::getSingleton().getActiveLinkProgram();
 		GLSLLinkProgram* linkProgram = GLSLLinkProgramManager::getSingleton().getActiveLinkProgram();

+ 3 - 3
CamelotRenderer/RenderSystemGL/Source/GLSL/src/OgreGLSLLinkProgram.cpp

@@ -263,12 +263,12 @@ namespace CamelotEngine {
 		}
 		}
 	}
 	}
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	GLuint GLSLLinkProgram::getAttributeIndex(VertexElementSemantic semantic, uint index)
+	GLuint GLSLLinkProgram::getAttributeIndex(VertexElementSemantic semantic, UINT32 index)
 	{
 	{
 		return GLGpuProgram::getFixedAttributeIndex(semantic, index);
 		return GLGpuProgram::getFixedAttributeIndex(semantic, index);
 	}
 	}
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	bool GLSLLinkProgram::isAttributeValid(VertexElementSemantic semantic, uint index)
+	bool GLSLLinkProgram::isAttributeValid(VertexElementSemantic semantic, UINT32 index)
 	{
 	{
 		return mValidAttributes.find(getAttributeIndex(semantic, index)) != mValidAttributes.end();
 		return mValidAttributes.find(getAttributeIndex(semantic, index)) != mValidAttributes.end();
 	}
 	}
@@ -302,7 +302,7 @@ namespace CamelotEngine {
 
 
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
 	void GLSLLinkProgram::updateUniforms(GpuProgramParametersSharedPtr params, 
 	void GLSLLinkProgram::updateUniforms(GpuProgramParametersSharedPtr params, 
-		uint16 mask, GpuProgramType fromProgType)
+		UINT16 mask, GpuProgramType fromProgType)
 	{
 	{
 		// iterate through uniform reference list and update uniform values
 		// iterate through uniform reference list and update uniform values
 		GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
 		GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();

+ 4 - 4
CamelotRenderer/RenderSystemGL/Source/GLSL/src/OgreGLSLLinkProgramManager.cpp

@@ -104,19 +104,19 @@ namespace CamelotEngine {
 
 
 		// no active link program so find one or make a new one
 		// no active link program so find one or make a new one
 		// is there an active key?
 		// is there an active key?
-		uint64 activeKey = 0;
+		UINT64 activeKey = 0;
 
 
 		if (mActiveVertexGpuProgram)
 		if (mActiveVertexGpuProgram)
 		{
 		{
-			activeKey = static_cast<uint64>(mActiveVertexGpuProgram->getProgramID()) << 32;
+			activeKey = static_cast<UINT64>(mActiveVertexGpuProgram->getProgramID()) << 32;
 		}
 		}
 		if (mActiveGeometryGpuProgram)
 		if (mActiveGeometryGpuProgram)
 		{
 		{
-			activeKey += static_cast<uint64>(mActiveGeometryGpuProgram->getProgramID()) << 16;
+			activeKey += static_cast<UINT64>(mActiveGeometryGpuProgram->getProgramID()) << 16;
 		}
 		}
 		if (mActiveFragmentGpuProgram)
 		if (mActiveFragmentGpuProgram)
 		{
 		{
-			activeKey += static_cast<uint64>(mActiveFragmentGpuProgram->getProgramID());
+			activeKey += static_cast<UINT64>(mActiveFragmentGpuProgram->getProgramID());
 		}
 		}
 
 
 		// only return a link program object if a vertex, geometry or fragment program exist
 		// only return a link program object if a vertex, geometry or fragment program exist

+ 1 - 1
CamelotRenderer/RenderSystemGL/Source/GLSL/src/OgreGLSLPreprocessor.cpp

@@ -760,7 +760,7 @@ CPreprocessor::Token CPreprocessor::GetArgument (Token &oArg, bool iExpand)
             return Token (Token::TK_ERROR);
             return Token (Token::TK_ERROR);
         }
         }
 
 
-    uint len = oArg.Length;
+    UINT32 len = oArg.Length;
     while (true)
     while (true)
     {
     {
         Token t = GetToken (iExpand);
         Token t = GetToken (iExpand);

+ 3 - 3
CamelotRenderer/RenderSystemGL/Source/OgreGLFBORenderTexture.cpp

@@ -36,7 +36,7 @@ namespace CamelotEngine {
 
 
 //-----------------------------------------------------------------------------    
 //-----------------------------------------------------------------------------    
     GLFBORenderTexture::GLFBORenderTexture(GLFBOManager *manager, const String &name,
     GLFBORenderTexture::GLFBORenderTexture(GLFBOManager *manager, const String &name,
-        const GLSurfaceDesc &target, bool writeGamma, uint fsaa):
+        const GLSurfaceDesc &target, bool writeGamma, UINT32 fsaa):
         GLRenderTexture(name, target, writeGamma, fsaa),
         GLRenderTexture(name, target, writeGamma, fsaa),
         mFB(manager, fsaa)
         mFB(manager, fsaa)
     {
     {
@@ -415,7 +415,7 @@ static const size_t depthBits[] =
     }
     }
 
 
     GLFBORenderTexture *GLFBOManager::createRenderTexture(const String &name, 
     GLFBORenderTexture *GLFBOManager::createRenderTexture(const String &name, 
-		const GLSurfaceDesc &target, bool writeGamma, uint fsaa)
+		const GLSurfaceDesc &target, bool writeGamma, UINT32 fsaa)
     {
     {
         GLFBORenderTexture *retval = new GLFBORenderTexture(this, name, target, writeGamma, fsaa);
         GLFBORenderTexture *retval = new GLFBORenderTexture(this, name, target, writeGamma, fsaa);
         return retval;
         return retval;
@@ -437,7 +437,7 @@ static const size_t depthBits[] =
             glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
             glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
     }
     }
     
     
-    GLSurfaceDesc GLFBOManager::requestRenderBuffer(GLenum format, size_t width, size_t height, uint fsaa)
+    GLSurfaceDesc GLFBOManager::requestRenderBuffer(GLenum format, size_t width, size_t height, UINT32 fsaa)
     {
     {
         GLSurfaceDesc retval;
         GLSurfaceDesc retval;
         retval.buffer = 0; // Return 0 buffer if GL_NONE is requested
         retval.buffer = 0; // Return 0 buffer if GL_NONE is requested

+ 7 - 7
CamelotRenderer/RenderSystemGL/Source/OgreGLFrameBufferObject.cpp

@@ -36,7 +36,7 @@ THE SOFTWARE.
 namespace CamelotEngine {
 namespace CamelotEngine {
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-    GLFrameBufferObject::GLFrameBufferObject(GLFBOManager *manager, uint fsaa):
+    GLFrameBufferObject::GLFrameBufferObject(GLFBOManager *manager, UINT32 fsaa):
         mManager(manager), mNumSamples(fsaa)
         mManager(manager), mNumSamples(fsaa)
     {
     {
         /// Generate framebuffer object
         /// Generate framebuffer object
@@ -67,7 +67,7 @@ namespace CamelotEngine {
         /// Initialise state
         /// Initialise state
         mDepth.buffer=0;
         mDepth.buffer=0;
         mStencil.buffer=0;
         mStencil.buffer=0;
-        for(size_t x=0; x<OGRE_MAX_MULTIPLE_RENDER_TARGETS; ++x)
+        for(size_t x=0; x<CM_MAX_MULTIPLE_RENDER_TARGETS; ++x)
         {
         {
             mColour[x].buffer=0;
             mColour[x].buffer=0;
         }
         }
@@ -85,7 +85,7 @@ namespace CamelotEngine {
     }
     }
     void GLFrameBufferObject::bindSurface(size_t attachment, const GLSurfaceDesc &target)
     void GLFrameBufferObject::bindSurface(size_t attachment, const GLSurfaceDesc &target)
     {
     {
-        assert(attachment < OGRE_MAX_MULTIPLE_RENDER_TARGETS);
+        assert(attachment < CM_MAX_MULTIPLE_RENDER_TARGETS);
         mColour[attachment] = target;
         mColour[attachment] = target;
 		// Re-initialise
 		// Re-initialise
 		if(mColour[0].buffer)
 		if(mColour[0].buffer)
@@ -93,7 +93,7 @@ namespace CamelotEngine {
     }
     }
     void GLFrameBufferObject::unbindSurface(size_t attachment)
     void GLFrameBufferObject::unbindSurface(size_t attachment)
     {
     {
-        assert(attachment < OGRE_MAX_MULTIPLE_RENDER_TARGETS);
+        assert(attachment < CM_MAX_MULTIPLE_RENDER_TARGETS);
         mColour[attachment].buffer = 0;
         mColour[attachment].buffer = 0;
 		// Re-initialise if buffer 0 still bound
 		// Re-initialise if buffer 0 still bound
 		if(mColour[0].buffer)
 		if(mColour[0].buffer)
@@ -125,7 +125,7 @@ namespace CamelotEngine {
         size_t height = mColour[0].buffer->getHeight();
         size_t height = mColour[0].buffer->getHeight();
         GLuint format = mColour[0].buffer->getGLFormat();
         GLuint format = mColour[0].buffer->getGLFormat();
         PixelFormat ogreFormat = mColour[0].buffer->getFormat();
         PixelFormat ogreFormat = mColour[0].buffer->getFormat();
-        ushort maxSupportedMRTs = CamelotEngine::RenderSystemManager::getActive()->getCapabilities()->getNumMultiRenderTargets();
+        UINT16 maxSupportedMRTs = CamelotEngine::RenderSystemManager::getActive()->getCapabilities()->getNumMultiRenderTargets();
 
 
 		// Bind simple buffer to add colour attachments
 		// Bind simple buffer to add colour attachments
 		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFB);
 		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFB);
@@ -220,9 +220,9 @@ namespace CamelotEngine {
         }
         }
 
 
 		/// Do glDrawBuffer calls
 		/// Do glDrawBuffer calls
-		GLenum bufs[OGRE_MAX_MULTIPLE_RENDER_TARGETS];
+		GLenum bufs[CM_MAX_MULTIPLE_RENDER_TARGETS];
 		GLsizei n=0;
 		GLsizei n=0;
-		for(size_t x=0; x<OGRE_MAX_MULTIPLE_RENDER_TARGETS; ++x)
+		for(size_t x=0; x<CM_MAX_MULTIPLE_RENDER_TARGETS; ++x)
 		{
 		{
 			// Fill attached colour buffers
 			// Fill attached colour buffers
 			if(mColour[x].buffer)
 			if(mColour[x].buffer)

+ 1 - 1
CamelotRenderer/RenderSystemGL/Source/OgreGLGpuNvparseProgram.cpp

@@ -63,7 +63,7 @@ void GLGpuNvparseProgram::unbindProgram(void)
     glDisable(GL_PER_STAGE_CONSTANTS_NV);
     glDisable(GL_PER_STAGE_CONSTANTS_NV);
 }
 }
 
 
-void GLGpuNvparseProgram::bindProgramParameters(GpuProgramParametersSharedPtr params, uint16 mask)
+void GLGpuNvparseProgram::bindProgramParameters(GpuProgramParametersSharedPtr params, CamelotEngine::UINT16 mask)
 {
 {
     // NB, register combiners uses 2 constants per texture stage (0 and 1)
     // NB, register combiners uses 2 constants per texture stage (0 and 1)
     // We have stored these as (stage * 2) + const_index in the physical buffer
     // We have stored these as (stage * 2) + const_index in the physical buffer

+ 4 - 4
CamelotRenderer/RenderSystemGL/Source/OgreGLGpuProgram.cpp

@@ -62,12 +62,12 @@ GLGpuProgram::~GLGpuProgram()
     unload(); 
     unload(); 
 }
 }
 
 
-GLuint GLGpuProgram::getAttributeIndex(VertexElementSemantic semantic, uint index)
+GLuint GLGpuProgram::getAttributeIndex(VertexElementSemantic semantic, CamelotEngine::UINT32 index)
 {
 {
 	return getFixedAttributeIndex(semantic, index);
 	return getFixedAttributeIndex(semantic, index);
 }
 }
 
 
-GLuint GLGpuProgram::getFixedAttributeIndex(VertexElementSemantic semantic, uint index)
+GLuint GLGpuProgram::getFixedAttributeIndex(VertexElementSemantic semantic, CamelotEngine::UINT32 index)
 {
 {
 	// Some drivers (e.g. OS X on nvidia) incorrectly determine the attribute binding automatically
 	// Some drivers (e.g. OS X on nvidia) incorrectly determine the attribute binding automatically
 	// and end up aliasing existing built-ins. So avoid! Fixed builtins are: 
 	// and end up aliasing existing built-ins. So avoid! Fixed builtins are: 
@@ -116,7 +116,7 @@ GLuint GLGpuProgram::getFixedAttributeIndex(VertexElementSemantic semantic, uint
 
 
 }
 }
 
 
-bool GLGpuProgram::isAttributeValid(VertexElementSemantic semantic, uint index)
+bool GLGpuProgram::isAttributeValid(VertexElementSemantic semantic, CamelotEngine::UINT32 index)
 {
 {
 	// default implementation
 	// default implementation
 	switch(semantic)
 	switch(semantic)
@@ -168,7 +168,7 @@ void GLArbGpuProgram::unbindProgram(void)
     glDisable(mProgramType);
     glDisable(mProgramType);
 }
 }
 
 
-void GLArbGpuProgram::bindProgramParameters(GpuProgramParametersSharedPtr params, uint16 mask)
+void GLArbGpuProgram::bindProgramParameters(GpuProgramParametersSharedPtr params, CamelotEngine::UINT16 mask)
 {
 {
     GLenum type = getGLShaderType(mType);
     GLenum type = getGLShaderType(mType);
     
     

+ 10 - 10
CamelotRenderer/RenderSystemGL/Source/OgreGLHardwareBufferManager.cpp

@@ -39,9 +39,9 @@ namespace CamelotEngine {
 	struct GLScratchBufferAlloc
 	struct GLScratchBufferAlloc
 	{
 	{
 		/// Size in bytes
 		/// Size in bytes
-		uint32 size: 31;
+		UINT32 size: 31;
 		/// Free? (pack with size)
 		/// Free? (pack with size)
-		uint32 free: 1;
+		UINT32 free: 1;
 	};
 	};
 	#define SCRATCH_POOL_SIZE 1 * 1024 * 1024
 	#define SCRATCH_POOL_SIZE 1 * 1024 * 1024
 	#define SCRATCH_ALIGNMENT 32
 	#define SCRATCH_ALIGNMENT 32
@@ -150,7 +150,7 @@ namespace CamelotEngine {
     }
     }
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void* GLHardwareBufferManagerBase::allocateScratch(uint32 size)
+	void* GLHardwareBufferManagerBase::allocateScratch(UINT32 size)
 	{
 	{
 		// simple forward link search based on alloc sizes
 		// simple forward link search based on alloc sizes
 		// not that fast but the list should never get that long since not many
 		// not that fast but the list should never get that long since not many
@@ -165,7 +165,7 @@ namespace CamelotEngine {
 			size += 4 - (size % 4);
 			size += 4 - (size % 4);
 		}
 		}
 
 
-		uint32 bufferPos = 0;
+		UINT32 bufferPos = 0;
 		while (bufferPos < SCRATCH_POOL_SIZE)
 		while (bufferPos < SCRATCH_POOL_SIZE)
 		{
 		{
 			GLScratchBufferAlloc* pNext = (GLScratchBufferAlloc*)(mScratchBufferPool + bufferPos);
 			GLScratchBufferAlloc* pNext = (GLScratchBufferAlloc*)(mScratchBufferPool + bufferPos);
@@ -175,7 +175,7 @@ namespace CamelotEngine {
 				// split? And enough space for control block
 				// split? And enough space for control block
 				if(pNext->size > size + sizeof(GLScratchBufferAlloc))
 				if(pNext->size > size + sizeof(GLScratchBufferAlloc))
 				{
 				{
-					uint32 offset = (uint32)sizeof(GLScratchBufferAlloc) + size;
+					UINT32 offset = (UINT32)sizeof(GLScratchBufferAlloc) + size;
 
 
 					GLScratchBufferAlloc* pSplitAlloc = (GLScratchBufferAlloc*)
 					GLScratchBufferAlloc* pSplitAlloc = (GLScratchBufferAlloc*)
 						(mScratchBufferPool + bufferPos + offset);
 						(mScratchBufferPool + bufferPos + offset);
@@ -194,7 +194,7 @@ namespace CamelotEngine {
 
 
 			}
 			}
 
 
-			bufferPos += (uint32)sizeof(GLScratchBufferAlloc) + pNext->size;
+			bufferPos += (UINT32)sizeof(GLScratchBufferAlloc) + pNext->size;
 
 
 		}
 		}
 
 
@@ -208,7 +208,7 @@ namespace CamelotEngine {
 		CM_LOCK_MUTEX(mScratchMutex)
 		CM_LOCK_MUTEX(mScratchMutex)
 
 
 		// Simple linear search dealloc
 		// Simple linear search dealloc
-		uint32 bufferPos = 0;
+		UINT32 bufferPos = 0;
 		GLScratchBufferAlloc* pLast = 0;
 		GLScratchBufferAlloc* pLast = 0;
 		while (bufferPos < SCRATCH_POOL_SIZE)
 		while (bufferPos < SCRATCH_POOL_SIZE)
 		{
 		{
@@ -225,14 +225,14 @@ namespace CamelotEngine {
 				if (pLast && pLast->free)
 				if (pLast && pLast->free)
 				{
 				{
 					// adjust buffer pos
 					// adjust buffer pos
-					bufferPos -= (pLast->size + (uint32)sizeof(GLScratchBufferAlloc));
+					bufferPos -= (pLast->size + (UINT32)sizeof(GLScratchBufferAlloc));
 					// merge free space
 					// merge free space
 					pLast->size += pCurrent->size + sizeof(GLScratchBufferAlloc);
 					pLast->size += pCurrent->size + sizeof(GLScratchBufferAlloc);
 					pCurrent = pLast;
 					pCurrent = pLast;
 				}
 				}
 
 
 				// merge with next
 				// merge with next
-				uint32 offset = bufferPos + pCurrent->size + (uint32)sizeof(GLScratchBufferAlloc);
+				UINT32 offset = bufferPos + pCurrent->size + (UINT32)sizeof(GLScratchBufferAlloc);
 				if (offset < SCRATCH_POOL_SIZE)
 				if (offset < SCRATCH_POOL_SIZE)
 				{
 				{
 					GLScratchBufferAlloc* pNext = (GLScratchBufferAlloc*)(
 					GLScratchBufferAlloc* pNext = (GLScratchBufferAlloc*)(
@@ -247,7 +247,7 @@ namespace CamelotEngine {
 				return;
 				return;
 			}
 			}
 
 
-			bufferPos += (uint32)sizeof(GLScratchBufferAlloc) + pCurrent->size;
+			bufferPos += (UINT32)sizeof(GLScratchBufferAlloc) + pCurrent->size;
 			pLast = pCurrent;
 			pLast = pCurrent;
 
 
 		}
 		}

+ 1 - 1
CamelotRenderer/RenderSystemGL/Source/OgreGLHardwareIndexBuffer.cpp

@@ -79,7 +79,7 @@ namespace CamelotEngine {
 		// Try to use scratch buffers for smaller buffers
 		// Try to use scratch buffers for smaller buffers
 		if( length < glBufManager->getGLMapBufferThreshold() )
 		if( length < glBufManager->getGLMapBufferThreshold() )
 		{
 		{
-			retPtr = glBufManager->allocateScratch((uint32)length);
+			retPtr = glBufManager->allocateScratch((UINT32)length);
 			if (retPtr)
 			if (retPtr)
 			{
 			{
 				mLockedToScratch = true;
 				mLockedToScratch = true;

+ 4 - 4
CamelotRenderer/RenderSystemGL/Source/OgreGLHardwarePixelBuffer.cpp

@@ -51,7 +51,7 @@ GLHardwarePixelBuffer::GLHardwarePixelBuffer(size_t inWidth, size_t inHeight, si
 GLHardwarePixelBuffer::~GLHardwarePixelBuffer()
 GLHardwarePixelBuffer::~GLHardwarePixelBuffer()
 {
 {
 	// Force free buffer
 	// Force free buffer
-	delete [] (uint8*)mBuffer.data;
+	delete [] (UINT8*)mBuffer.data;
 }
 }
 //-----------------------------------------------------------------------------  
 //-----------------------------------------------------------------------------  
 void GLHardwarePixelBuffer::allocateBuffer()
 void GLHardwarePixelBuffer::allocateBuffer()
@@ -59,7 +59,7 @@ void GLHardwarePixelBuffer::allocateBuffer()
 	if(mBuffer.data)
 	if(mBuffer.data)
 		// Already allocated
 		// Already allocated
 		return;
 		return;
-	mBuffer.data = new uint8[mSizeInBytes];
+	mBuffer.data = new UINT8[mSizeInBytes];
 	// TODO: use PBO if we're HBU_DYNAMIC
 	// TODO: use PBO if we're HBU_DYNAMIC
 }
 }
 //-----------------------------------------------------------------------------  
 //-----------------------------------------------------------------------------  
@@ -68,7 +68,7 @@ void GLHardwarePixelBuffer::freeBuffer()
 	// Free buffer if we're STATIC to save memory
 	// Free buffer if we're STATIC to save memory
 	if(mUsage & HBU_STATIC)
 	if(mUsage & HBU_STATIC)
 	{
 	{
-		delete [] (uint8*)mBuffer.data;
+		delete [] (UINT8*)mBuffer.data;
 		mBuffer.data = 0;
 		mBuffer.data = 0;
 	}
 	}
 }
 }
@@ -195,7 +195,7 @@ void GLHardwarePixelBuffer::bindToFramebuffer(GLenum attachment, size_t zoffset)
 //********* GLTextureBuffer
 //********* GLTextureBuffer
 GLTextureBuffer::GLTextureBuffer(const String &baseName, GLenum target, GLuint id, 
 GLTextureBuffer::GLTextureBuffer(const String &baseName, GLenum target, GLuint id, 
 								 GLint face, GLint level, Usage usage, bool crappyCard, 
 								 GLint face, GLint level, Usage usage, bool crappyCard, 
-								 bool writeGamma, uint fsaa):
+								 bool writeGamma, UINT32 fsaa):
 	GLHardwarePixelBuffer(0, 0, 0, PF_UNKNOWN, usage),
 	GLHardwarePixelBuffer(0, 0, 0, PF_UNKNOWN, usage),
 	mTarget(target), mFaceTarget(0), mTextureID(id), mFace(face), mLevel(level),
 	mTarget(target), mFaceTarget(0), mTextureID(id), mFace(face), mLevel(level),
     mSoftwareMipmap(crappyCard), mSliceTRT(0)
     mSoftwareMipmap(crappyCard), mSliceTRT(0)

+ 1 - 1
CamelotRenderer/RenderSystemGL/Source/OgreGLHardwareVertexBuffer.cpp

@@ -80,7 +80,7 @@ namespace CamelotEngine {
 		if( length < glBufManager->getGLMapBufferThreshold() )
 		if( length < glBufManager->getGLMapBufferThreshold() )
 		{
 		{
 			// if this fails, we fall back on mapping
 			// if this fails, we fall back on mapping
-			retPtr = glBufManager->allocateScratch((uint32)length);
+			retPtr = glBufManager->allocateScratch((UINT32)length);
 
 
 			if (retPtr)
 			if (retPtr)
 			{
 			{

+ 2 - 2
CamelotRenderer/RenderSystemGL/Source/OgreGLPBRenderTexture.cpp

@@ -45,7 +45,7 @@ namespace CamelotEngine {
 
 
 //-----------------------------------------------------------------------------  
 //-----------------------------------------------------------------------------  
     GLPBRenderTexture::GLPBRenderTexture(GLPBRTTManager *manager, const String &name, 
     GLPBRenderTexture::GLPBRenderTexture(GLPBRTTManager *manager, const String &name, 
-		const GLSurfaceDesc &target, bool writeGamma, uint fsaa):
+		const GLSurfaceDesc &target, bool writeGamma, UINT32 fsaa):
         GLRenderTexture(name, target, writeGamma, fsaa),
         GLRenderTexture(name, target, writeGamma, fsaa),
         mManager(manager)
         mManager(manager)
     {
     {
@@ -90,7 +90,7 @@ namespace CamelotEngine {
     }
     }
 
 
     RenderTexture *GLPBRTTManager::createRenderTexture(const String &name, 
     RenderTexture *GLPBRTTManager::createRenderTexture(const String &name, 
-		const GLSurfaceDesc &target, bool writeGamma, uint fsaa)
+		const GLSurfaceDesc &target, bool writeGamma, UINT32 fsaa)
     {
     {
         return new GLPBRenderTexture(this, name, target, writeGamma, fsaa);
         return new GLPBRenderTexture(this, name, target, writeGamma, fsaa);
     }
     }

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini