Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

set native line endings on all c/c++ source and headers.

  • Loading branch information...
commit 41cb52ec848cc51d2dbe9f631f5c093ed3841530 1 parent ddd7194
@ideasman42 ideasman42 authored
Showing with 17,040 additions and 17,040 deletions.
  1. +35 −35 COLLADABaseUtils/include/COLLADABU.h
  2. +69 −69 COLLADABaseUtils/include/COLLADABUIDList.h
  3. +53 −53 COLLADABaseUtils/include/COLLADABUPlatform.h
  4. +25 −25 COLLADABaseUtils/include/COLLADABUPrerequisites.h
  5. +27 −27 COLLADABaseUtils/include/COLLADABUStableHeaders.h
  6. +198 −198 COLLADABaseUtils/include/COLLADABUStringUtils.h
  7. +175 −175 COLLADABaseUtils/include/COLLADABUUtils.h
  8. +240 −240 COLLADABaseUtils/include/Math/COLLADABUMathMatrix3.h
  9. +640 −640 COLLADABaseUtils/include/Math/COLLADABUMathMatrix4.h
  10. +32 −32 COLLADABaseUtils/include/Math/COLLADABUMathPrerequisites.h
  11. +183 −183 COLLADABaseUtils/include/Math/COLLADABUMathQuaternion.h
  12. +158 −158 COLLADABaseUtils/include/Math/COLLADABUMathUtils.h
  13. +537 −537 COLLADABaseUtils/include/Math/COLLADABUMathVector3.h
  14. +65 −65 COLLADABaseUtils/src/COLLADABUHashFunctions.cpp
  15. +64 −64 COLLADABaseUtils/src/COLLADABUIDList.cpp
  16. +110 −110 COLLADABaseUtils/src/COLLADABUNativeString.cpp
  17. +58 −58 COLLADABaseUtils/src/COLLADABUPcreCompiledPattern.cpp
  18. +347 −347 COLLADABaseUtils/src/COLLADABUStringUtils.cpp
  19. +204 −204 COLLADABaseUtils/src/COLLADABUUtils.cpp
  20. +1,684 −1,684 COLLADABaseUtils/src/Math/COLLADABUMathMatrix3.cpp
  21. +160 −160 COLLADABaseUtils/src/Math/COLLADABUMathMatrix4.cpp
  22. +498 −498 COLLADABaseUtils/src/Math/COLLADABUMathQuaternion.cpp
  23. +56 −56 COLLADABaseUtils/src/Math/COLLADABUMathUtils.cpp
  24. +30 −30 COLLADABaseUtils/src/Math/COLLADABUMathVector3.cpp
  25. +28 −28 COLLADABaseUtils/template/template.cpp
  26. +52 −52 COLLADABaseUtils/template/template.h
  27. +100 −100 COLLADAFramework/include/COLLADAFW.h
  28. +44 −44 COLLADAFramework/include/COLLADAFWAnimatable.h
  29. +53 −53 COLLADAFramework/include/COLLADAFWAnimatableFloat.h
  30. +172 −172 COLLADAFramework/include/COLLADAFWAnimationCurve.h
  31. +107 −107 COLLADAFramework/include/COLLADAFWAnimationList.h
  32. +94 −94 COLLADAFramework/include/COLLADAFWAnnotate.h
  33. +194 −194 COLLADAFramework/include/COLLADAFWArray.h
  34. +266 −266 COLLADAFramework/include/COLLADAFWArrayPrimitiveType.h
  35. +81 −81 COLLADAFramework/include/COLLADAFWAxisInfo.h
  36. +72 −72 COLLADAFramework/include/COLLADAFWCode.h
  37. +94 −94 COLLADAFramework/include/COLLADAFWColor.h
  38. +120 −120 COLLADAFramework/include/COLLADAFWColorOrTexture.h
  39. +211 −211 COLLADAFramework/include/COLLADAFWConstants.h
  40. +76 −76 COLLADAFramework/include/COLLADAFWController.h
  41. +62 −62 COLLADAFramework/include/COLLADAFWException.h
  42. +335 −335 COLLADAFramework/include/COLLADAFWFileInfo.h
  43. +121 −121 COLLADAFramework/include/COLLADAFWFloatOrDoubleArray.h
  44. +93 −93 COLLADAFramework/include/COLLADAFWFloatOrParam.h
  45. +88 −88 COLLADAFramework/include/COLLADAFWFormulaNewParam.h
  46. +48 −48 COLLADAFramework/include/COLLADAFWFormulas.h
  47. +34 −34 COLLADAFramework/include/COLLADAFWHashFunctions.h
  48. +55 −55 COLLADAFramework/include/COLLADAFWILoader.h
  49. +141 −141 COLLADAFramework/include/COLLADAFWIWriter.h
  50. +100 −100 COLLADAFramework/include/COLLADAFWImageSource.h
  51. +67 −67 COLLADAFramework/include/COLLADAFWInclude.h
  52. +80 −80 COLLADAFramework/include/COLLADAFWIndexList.h
  53. +65 −65 COLLADAFramework/include/COLLADAFWInstanceBase.h
  54. +30 −30 COLLADAFramework/include/COLLADAFWInstanceCamera.h
  55. +29 −29 COLLADAFramework/include/COLLADAFWInstanceController.h
  56. +30 −30 COLLADAFramework/include/COLLADAFWInstanceGeometry.h
  57. +97 −97 COLLADAFramework/include/COLLADAFWInstanceKinematicsScene.h
  58. +30 −30 COLLADAFramework/include/COLLADAFWInstanceLight.h
  59. +30 −30 COLLADAFramework/include/COLLADAFWInstanceNode.h
  60. +30 −30 COLLADAFramework/include/COLLADAFWInstanceSceneGraph.h
  61. +27 −27 COLLADAFramework/include/COLLADAFWInstanceVisualScene.h
  62. +120 −120 COLLADAFramework/include/COLLADAFWJointPrimitive.h
  63. +99 −99 COLLADAFramework/include/COLLADAFWKinematicsController.h
  64. +127 −127 COLLADAFramework/include/COLLADAFWKinematicsModel.h
  65. +77 −77 COLLADAFramework/include/COLLADAFWKinematicsScene.h
  66. +54 −54 COLLADAFramework/include/COLLADAFWLibraryNodes.h
  67. +48 −48 COLLADAFramework/include/COLLADAFWLines.h
  68. +47 −47 COLLADAFramework/include/COLLADAFWLoaderUtils.h
  69. +85 −85 COLLADAFramework/include/COLLADAFWLookat.h
  70. +104 −104 COLLADAFramework/include/COLLADAFWMaterialBinding.h
  71. +53 −53 COLLADAFramework/include/COLLADAFWMatrix.h
  72. +310 −310 COLLADAFramework/include/COLLADAFWMesh.h
  73. +171 −171 COLLADAFramework/include/COLLADAFWMeshVertexData.h
  74. +75 −75 COLLADAFramework/include/COLLADAFWModifier.h
  75. +80 −80 COLLADAFramework/include/COLLADAFWMotionProfile.h
  76. +84 −84 COLLADAFramework/include/COLLADAFWNewParam.h
  77. +107 −107 COLLADAFramework/include/COLLADAFWObject.h
  78. +157 −157 COLLADAFramework/include/COLLADAFWParam.h
  79. +107 −107 COLLADAFramework/include/COLLADAFWPass.h
  80. +199 −199 COLLADAFramework/include/COLLADAFWPassClear.h
  81. +74 −74 COLLADAFramework/include/COLLADAFWPassOutput.h
  82. +114 −114 COLLADAFramework/include/COLLADAFWPassTarget.h
  83. +104 −104 COLLADAFramework/include/COLLADAFWPointerArray.h
  84. +55 −55 COLLADAFramework/include/COLLADAFWPolygons.h
  85. +80 −80 COLLADAFramework/include/COLLADAFWRenderDraw.h
  86. +222 −222 COLLADAFramework/include/COLLADAFWRenderState.h
  87. +311 −311 COLLADAFramework/include/COLLADAFWRenderStateStatic.h
  88. +61 −61 COLLADAFramework/include/COLLADAFWRoot.h
  89. +69 −69 COLLADAFramework/include/COLLADAFWRotate.h
  90. +218 −218 COLLADAFramework/include/COLLADAFWSampler.h
  91. +59 −59 COLLADAFramework/include/COLLADAFWScale.h
  92. +74 −74 COLLADAFramework/include/COLLADAFWScene.h
  93. +71 −71 COLLADAFramework/include/COLLADAFWSemantic.h
  94. +44 −44 COLLADAFramework/include/COLLADAFWSetParam.h
  95. +44 −44 COLLADAFramework/include/COLLADAFWShader.h
  96. +73 −73 COLLADAFramework/include/COLLADAFWShaderBlinn.h
  97. +118 −118 COLLADAFramework/include/COLLADAFWShaderConstantFX.h
  98. +64 −64 COLLADAFramework/include/COLLADAFWShaderElement.h
  99. +78 −78 COLLADAFramework/include/COLLADAFWShaderLambert.h
  100. +83 −83 COLLADAFramework/include/COLLADAFWShaderPhong.h
  101. +83 −83 COLLADAFramework/include/COLLADAFWShear.h
  102. +91 −91 COLLADAFramework/include/COLLADAFWSkew.h
  103. +66 −66 COLLADAFramework/include/COLLADAFWSkinController.h
  104. +112 −112 COLLADAFramework/include/COLLADAFWTarget.h
  105. +52 −52 COLLADAFramework/include/COLLADAFWTargetableValue.h
  106. +124 −124 COLLADAFramework/include/COLLADAFWTechnique.h
  107. +74 −74 COLLADAFramework/include/COLLADAFWTexture.h
  108. +86 −86 COLLADAFramework/include/COLLADAFWTextureCoordinateBinding.h
  109. +64 −64 COLLADAFramework/include/COLLADAFWTransformation.h
  110. +65 −65 COLLADAFramework/include/COLLADAFWTranslate.h
  111. +46 −46 COLLADAFramework/include/COLLADAFWTriangles.h
  112. +618 −618 COLLADAFramework/include/COLLADAFWTypes.h
  113. +94 −94 COLLADAFramework/include/COLLADAFWUniqueId.h
  114. +34 −34 COLLADAFramework/include/COLLADAFWValidate.h
  115. +139 −139 COLLADAFramework/include/COLLADAFWValueType.h
  116. +38 −38 COLLADAFramework/src/COLLADAFWAxisInfo.cpp
  117. +36 −36 COLLADAFramework/src/COLLADAFWCamera.cpp
  118. +69 −69 COLLADAFramework/src/COLLADAFWColor.cpp
  119. +197 −197 COLLADAFramework/src/COLLADAFWConstants.cpp
  120. +28 −28 COLLADAFramework/src/COLLADAFWEffect.cpp
  121. +32 −32 COLLADAFramework/src/COLLADAFWEffectCommon.cpp
  122. +157 −157 COLLADAFramework/src/COLLADAFWFileInfo.cpp
  123. +161 −161 COLLADAFramework/src/COLLADAFWFloatOrDoubleArray.cpp
  124. +60 −60 COLLADAFramework/src/COLLADAFWFormula.cpp
  125. +132 −132 COLLADAFramework/src/COLLADAFWFormulas.cpp
  126. +31 −31 COLLADAFramework/src/COLLADAFWGeometry.cpp
  127. +33 −33 COLLADAFramework/src/COLLADAFWImage.cpp
  128. +85 −85 COLLADAFramework/src/COLLADAFWInstanceKinematicsScene.cpp
  129. +54 −54 COLLADAFramework/src/COLLADAFWKinematicsController.cpp
  130. +51 −51 COLLADAFramework/src/COLLADAFWKinematicsModel.cpp
  131. +28 −28 COLLADAFramework/src/COLLADAFWKinematicsScene.cpp
  132. +36 −36 COLLADAFramework/src/COLLADAFWLight.cpp
  133. +41 −41 COLLADAFramework/src/COLLADAFWLoaderUtils.cpp
  134. +29 −29 COLLADAFramework/src/COLLADAFWMaterial.cpp
  135. +36 −36 COLLADAFramework/src/COLLADAFWMatrix.cpp
  136. +230 −230 COLLADAFramework/src/COLLADAFWMesh.cpp
  137. +42 −42 COLLADAFramework/src/COLLADAFWMorphController.cpp
  138. +212 −212 COLLADAFramework/src/COLLADAFWRenderState.cpp
  139. +37 −37 COLLADAFramework/src/COLLADAFWRoot.cpp
  140. +44 −44 COLLADAFramework/src/COLLADAFWRotate.cpp
  141. +40 −40 COLLADAFramework/src/COLLADAFWSampler.cpp
  142. +41 −41 COLLADAFramework/src/COLLADAFWScale.cpp
  143. +40 −40 COLLADAFramework/src/COLLADAFWSkinController.cpp
  144. +32 −32 COLLADAFramework/src/COLLADAFWSkinControllerData.cpp
  145. +49 −49 COLLADAFramework/src/COLLADAFWTexture.cpp
  146. +26 −26 COLLADAFramework/src/COLLADAFWTransformation.cpp
  147. +41 −41 COLLADAFramework/src/COLLADAFWTranslate.cpp
Sorry, we could not display the entire diff because too many files (1,291) changed.
View
70 COLLADABaseUtils/include/COLLADABU.h
@@ -1,35 +1,35 @@
-/*
- Copyright (c) 2008-2009 NetAllied Systems GmbH
-
- This file is part of COLLADABaseUtils.
-
- Licensed under the MIT Open Source License,
- for details please see LICENSE file or the website
- http://www.opensource.org/licenses/mit-license.php
-*/
-
-#ifndef __COLLADABU_H__
-#define __COLLADABU_H__
-
-
-// contains all headers of the COLLADA base utils api
-// might be used in precompiled headers
-#include "COLLADABU.h"
-#include "COLLADABUException.h"
-#include "COLLADABUHashFunctions.h"
-#include "COLLADABUhash_map.h"
-#include "COLLADABUIDList.h"
-#include "COLLADABUNativeString.h"
-#include "COLLADABUPcreCompiledPattern.h"
-#include "COLLADABUPlatform.h"
-#include "COLLADABUStringUtils.h"
-#include "COLLADABUURI.h"
-#include "COLLADABUUtils.h"
-
-#include "Math/COLLADABUMathMatrix3.h"
-#include "Math/COLLADABUMathMatrix4.h"
-#include "Math/COLLADABUMathQuaternion.h"
-#include "Math/COLLADABUMathUtils.h"
-#include "Math/COLLADABUMathVector3.h"
-
-#endif //__COLLADABU_H__
+/*
+ Copyright (c) 2008-2009 NetAllied Systems GmbH
+
+ This file is part of COLLADABaseUtils.
+
+ Licensed under the MIT Open Source License,
+ for details please see LICENSE file or the website
+ http://www.opensource.org/licenses/mit-license.php
+*/
+
+#ifndef __COLLADABU_H__
+#define __COLLADABU_H__
+
+
+// contains all headers of the COLLADA base utils api
+// might be used in precompiled headers
+#include "COLLADABU.h"
+#include "COLLADABUException.h"
+#include "COLLADABUHashFunctions.h"
+#include "COLLADABUhash_map.h"
+#include "COLLADABUIDList.h"
+#include "COLLADABUNativeString.h"
+#include "COLLADABUPcreCompiledPattern.h"
+#include "COLLADABUPlatform.h"
+#include "COLLADABUStringUtils.h"
+#include "COLLADABUURI.h"
+#include "COLLADABUUtils.h"
+
+#include "Math/COLLADABUMathMatrix3.h"
+#include "Math/COLLADABUMathMatrix4.h"
+#include "Math/COLLADABUMathQuaternion.h"
+#include "Math/COLLADABUMathUtils.h"
+#include "Math/COLLADABUMathVector3.h"
+
+#endif //__COLLADABU_H__
View
138 COLLADABaseUtils/include/COLLADABUIDList.h
@@ -1,69 +1,69 @@
-/*
- Copyright (c) 2008-2009 NetAllied Systems GmbH
-
- This file is part of COLLADABaseUtils.
-
- Licensed under the MIT Open Source License,
- for details please see LICENSE file or the website
- http://www.opensource.org/licenses/mit-license.php
-*/
-
-#ifndef __COLLADABU_IDLIST_H__
-#define __COLLADABU_IDLIST_H__
-
-#include "COLLADABUPrerequisites.h"
-#include "COLLADABUUtils.h"
-
-#include <set>
-
-
-namespace COLLADABU
-{
- /** A class to generate and store unique and valid ids.*/
- class IDList
- {
- private:
- typedef std::set<String> IDSet;
-
- typedef String (*StringConversionFunction)(const String&);
-
- private:
- /** Conversion function used to convert added Values*/
- StringConversionFunction mConversionFunction;
-
- /** A map that stores ids that are already managed by this instance of IDList.*/
- IDSet mIdSet;
-
- public:
- /** Constructor*/
- IDList(StringConversionFunction conversionFunction = Utils::checkID);
-
- /** Destructor*/
- virtual ~IDList() {}
-
- /** Takes the string @a newId, checks that it is a valid id, if necessary changes it to
- a valid id and adds it to the list of ids managed by IDList. If the id already exists a number
- is added to make it unique. The resulting string is returned
- @param newId The id / String to add
- @param returnConverted If true, the converted new string is returned, otherwise the original string (@a newId)
- probably with a number appended is returned.
- @param alwaysAddNumberSuffix If true, a number suffix will be append to the given string, also if not necessary.
- @return The unique string, added to List.
- */
- String addId ( const String & newId, bool returnConverted = true, bool alwaysAddNumberSuffix = false );
-
- /**
- * Returns true, if the given id already exists in the current id set.
- */
- bool containsId ( const String& id );
-
- private:
- /** Disable default copy ctor. */
- IDList( const IDList& pre );
- /** Disable default assignment operator. */
- const IDList& operator= ( const IDList& pre );
-
- };
-} // namespace COLLADABU
-
-#endif // __COLLADABU_IDLIST_H__
+/*
+ Copyright (c) 2008-2009 NetAllied Systems GmbH
+
+ This file is part of COLLADABaseUtils.
+
+ Licensed under the MIT Open Source License,
+ for details please see LICENSE file or the website
+ http://www.opensource.org/licenses/mit-license.php
+*/
+
+#ifndef __COLLADABU_IDLIST_H__
+#define __COLLADABU_IDLIST_H__
+
+#include "COLLADABUPrerequisites.h"
+#include "COLLADABUUtils.h"
+
+#include <set>
+
+
+namespace COLLADABU
+{
+ /** A class to generate and store unique and valid ids.*/
+ class IDList
+ {
+ private:
+ typedef std::set<String> IDSet;
+
+ typedef String (*StringConversionFunction)(const String&);
+
+ private:
+ /** Conversion function used to convert added Values*/
+ StringConversionFunction mConversionFunction;
+
+ /** A map that stores ids that are already managed by this instance of IDList.*/
+ IDSet mIdSet;
+
+ public:
+ /** Constructor*/
+ IDList(StringConversionFunction conversionFunction = Utils::checkID);
+
+ /** Destructor*/
+ virtual ~IDList() {}
+
+ /** Takes the string @a newId, checks that it is a valid id, if necessary changes it to
+ a valid id and adds it to the list of ids managed by IDList. If the id already exists a number
+ is added to make it unique. The resulting string is returned
+ @param newId The id / String to add
+ @param returnConverted If true, the converted new string is returned, otherwise the original string (@a newId)
+ probably with a number appended is returned.
+ @param alwaysAddNumberSuffix If true, a number suffix will be append to the given string, also if not necessary.
+ @return The unique string, added to List.
+ */
+ String addId ( const String & newId, bool returnConverted = true, bool alwaysAddNumberSuffix = false );
+
+ /**
+ * Returns true, if the given id already exists in the current id set.
+ */
+ bool containsId ( const String& id );
+
+ private:
+ /** Disable default copy ctor. */
+ IDList( const IDList& pre );
+ /** Disable default assignment operator. */
+ const IDList& operator= ( const IDList& pre );
+
+ };
+} // namespace COLLADABU
+
+#endif // __COLLADABU_IDLIST_H__
View
106 COLLADABaseUtils/include/COLLADABUPlatform.h
@@ -1,53 +1,53 @@
-/*
- Copyright (c) 2008-2009 NetAllied Systems GmbH
-
- This file is part of COLLADABaseUtils.
-
- Licensed under the MIT Open Source License,
- for details please see LICENSE file or the website
- http://www.opensource.org/licenses/mit-license.php
-*/
-
-#ifndef __COLLADABU_PLATTFORM_H__
-#define __COLLADABU_PLATTFORM_H__
-
-
-#if (defined(__APPLE__) || defined(OSMac_)) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) || defined(__APPLE_CC__)
-# define COLLADABU_OS_MAC
-# ifdef __LP64__
-# define COLLADABU_OS_MAC64
-# else
-# define COLLADABU_OS_MAC32
-# endif
-#elif (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
-# define COLLADABU_OS_WIN64
-#elif (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
-# define COLLADABU_OS_WIN32
-#elif defined(__linux__) || defined(__linux)
-# define COLLADABU_OS_LINUX
-#endif
-
-#if defined(COLLADABU_OS_WIN32) || defined(COLLADABU_OS_WIN64)
-# define COLLADABU_OS_WIN
-#endif
-
-// from ogre OgrePlatform.h
-// Win32 compilers use _DEBUG for specifying debug builds.
-// Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
-// specifying a debug build.
-// (??? this is wrong, on Linux debug builds aren't marked in any way unless
-// you mark it yourself any way you like it -- zap ???)
-#if defined(_DEBUG) || defined(DEBUG)
-# define COLLADABU_DEBUG
-#endif
-
-#include <cassert>
-
-#if defined(COLLADABU_DEBUG)
-# define COLLADABU_ASSERT(cond) assert(cond);
-#else
-# define COLLADABU_ASSERT(cond)
-#endif
-
-
-#endif //__COLLADABU_PLATTFORM_H__
+/*
+ Copyright (c) 2008-2009 NetAllied Systems GmbH
+
+ This file is part of COLLADABaseUtils.
+
+ Licensed under the MIT Open Source License,
+ for details please see LICENSE file or the website
+ http://www.opensource.org/licenses/mit-license.php
+*/
+
+#ifndef __COLLADABU_PLATTFORM_H__
+#define __COLLADABU_PLATTFORM_H__
+
+
+#if (defined(__APPLE__) || defined(OSMac_)) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) || defined(__APPLE_CC__)
+# define COLLADABU_OS_MAC
+# ifdef __LP64__
+# define COLLADABU_OS_MAC64
+# else
+# define COLLADABU_OS_MAC32
+# endif
+#elif (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
+# define COLLADABU_OS_WIN64
+#elif (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
+# define COLLADABU_OS_WIN32
+#elif defined(__linux__) || defined(__linux)
+# define COLLADABU_OS_LINUX
+#endif
+
+#if defined(COLLADABU_OS_WIN32) || defined(COLLADABU_OS_WIN64)
+# define COLLADABU_OS_WIN
+#endif
+
+// from ogre OgrePlatform.h
+// Win32 compilers use _DEBUG for specifying debug builds.
+// Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
+// specifying a debug build.
+// (??? this is wrong, on Linux debug builds aren't marked in any way unless
+// you mark it yourself any way you like it -- zap ???)
+#if defined(_DEBUG) || defined(DEBUG)
+# define COLLADABU_DEBUG
+#endif
+
+#include <cassert>
+
+#if defined(COLLADABU_DEBUG)
+# define COLLADABU_ASSERT(cond) assert(cond);
+#else
+# define COLLADABU_ASSERT(cond)
+#endif
+
+
+#endif //__COLLADABU_PLATTFORM_H__
View
50 COLLADABaseUtils/include/COLLADABUPrerequisites.h
@@ -1,25 +1,25 @@
-/*
- Copyright (c) 2008-2009 NetAllied Systems GmbH
-
- This file is part of COLLADAFramework.
-
- Licensed under the MIT Open Source License,
- for details please see LICENSE file or the website
- http://www.opensource.org/licenses/mit-license.php
-*/
-
-#ifndef __COLLADABU_PREREQUISITES_H__
-#define __COLLADABU_PREREQUISITES_H__
-
-#include "COLLADABUPlatform.h"
-
-#include <string>
-#include <string.h>
-
-namespace COLLADABU
-{
- typedef std::string String;
- typedef std::wstring WideString;
-}
-
-#endif //__COLLADABU_PREREQUISITES_H__
+/*
+ Copyright (c) 2008-2009 NetAllied Systems GmbH
+
+ This file is part of COLLADAFramework.
+
+ Licensed under the MIT Open Source License,
+ for details please see LICENSE file or the website
+ http://www.opensource.org/licenses/mit-license.php
+*/
+
+#ifndef __COLLADABU_PREREQUISITES_H__
+#define __COLLADABU_PREREQUISITES_H__
+
+#include "COLLADABUPlatform.h"
+
+#include <string>
+#include <string.h>
+
+namespace COLLADABU
+{
+ typedef std::string String;
+ typedef std::wstring WideString;
+}
+
+#endif //__COLLADABU_PREREQUISITES_H__
View
54 COLLADABaseUtils/include/COLLADABUStableHeaders.h
@@ -1,27 +1,27 @@
-/*
- Copyright (c) 2008-2009 NetAllied Systems GmbH
-
- This file is part of COLLADABaseUtils.
-
- Licensed under the MIT Open Source License,
- for details please see LICENSE file or the website
- http://www.opensource.org/licenses/mit-license.php
-*/
-
-#ifndef __COLLADABU_STABLE_HEADERS_H__
-#define __COLLADABU_STABLE_HEADERS_H__
-
-#include "COLLADABUPrerequisites.h"
-
-//STL
-#include <vector>
-#include <sstream>
-#include <algorithm>
-#include <math.h>
-#include <string>
-#include <iostream>
-
-
-
-
-#endif //__COLLADABU_STABLE_HEADERS_H__
+/*
+ Copyright (c) 2008-2009 NetAllied Systems GmbH
+
+ This file is part of COLLADABaseUtils.
+
+ Licensed under the MIT Open Source License,
+ for details please see LICENSE file or the website
+ http://www.opensource.org/licenses/mit-license.php
+*/
+
+#ifndef __COLLADABU_STABLE_HEADERS_H__
+#define __COLLADABU_STABLE_HEADERS_H__
+
+#include "COLLADABUPrerequisites.h"
+
+//STL
+#include <vector>
+#include <sstream>
+#include <algorithm>
+#include <math.h>
+#include <string>
+#include <iostream>
+
+
+
+
+#endif //__COLLADABU_STABLE_HEADERS_H__
View
396 COLLADABaseUtils/include/COLLADABUStringUtils.h
@@ -1,198 +1,198 @@
-/*
- Copyright (c) 2008-2009 NetAllied Systems GmbH
-
- This file is part of COLLADABaseUtils.
-
- Licensed under the MIT Open Source License,
- for details please see LICENSE file or the website
- http://www.opensource.org/licenses/mit-license.php
-*/
-
-#ifndef __COLLADABU_STRINGUTILS_H__
-#define __COLLADABU_STRINGUTILS_H__
-
-#include "COLLADABUPrerequisites.h"
-#include "COLLADABUNativeString.h"
-
-#include <sstream>
-#include <fstream>
-#include <map>
-
-namespace COLLADABU
-{
-
- /** A class that holds some static COLLADA utility functions*/
- class StringUtils
- {
-
-
- public:
- /**
- * Returns true, if both strings are equal. The comparison is case sensitive.
- */
- template<class StringType>
- static bool equals ( const StringType &str1, const StringType &str2 )
- {
- if ( str1.length() != str2.length() )
- return false;
- return ( strcmp ( str1.c_str(), str2.c_str() ) == 0 );
- }
-
- /**
- * Returns true, if both strings are equal. The comparison is case intensitive.
- */
- static bool equalsIgnoreCase ( const WideString& s1, const WideString& s2 );
-
- /** Checks for a valid xs:NCName.
- 1. replaces all not allowed characters
- 2. forces that the string begins with a letter or an _
- @param ncName The string to convert to a valid xs:NCName.
- @return The checked string
- */
- static WideString checkNCName ( const WideString &ncName );
-// static UTF8String checkNCName ( const UTF8String &ncName ){return UTF8String();};
-
- /** Checks for a valid xs:ID.
- 1. replaces all not allowed characters
- 2. forces that the string begins with a letter or an _
- @param ncName The string to convert to a valid xs:ID.
- @return The checked string
- */
- static WideString checkID ( const WideString &id );
-
-// static UTF8String checkID ( const UTF8String &id ){return UTF8String();};
-
- /** Checks if @a c is name start character according to http://www.w3.org/TR/xml11/#NT-NameStartChar */
- static bool isNameStartChar ( wchar_t c );
-
- /** Checks if @a c is name character according to http://www.w3.org/TR/xml11/#NT-NameChar */
- static bool isNameChar ( wchar_t c );
-
- /** Checks if @a c is an upper ASCII character*/
- static bool isUpperAsciiChar ( char c )
- {
- return ( c >= 'A' ) && ( c <= 'Z' ) ;
- }
-
- /** Checks if @a c is a lower ASCII character*/
- static bool isLowerAsciiChar ( char c )
- {
- return ( c >= 'a' ) && ( c <= 'z' ) ;
- }
-
- /** Checks if @a c is an ASCII character*/
- static bool isAsciiAlphaChar ( char c )
- {
- return isLowerAsciiChar ( c ) || isUpperAsciiChar ( c ) ;
- }
-
- /** Checks if @a c is a digit*/
- static bool isDigit ( char c )
- {
- return ( c >= '0' ) && ( c <= '9' ) ;
- }
-
- /** Checks if @a c is an xs:id character, but not alpha numeric*/
- static bool isIDExtraChar ( char c )
- {
- return ( c == '.' ) || ( c == '-' ) || ( c == '_' ) ;
- }
-
- /** Checks if @a c is an xs:id character, but not alpha numeric*/
- static bool isIDChar ( char c )
- {
- return isAsciiAlphaChar ( c ) || isDigit ( c ) || isIDExtraChar ( c ) ;
- }
-
- /** If @a c is a lower case ascii character, the corresponding upper character is returned.*/
- static char toUpperASCIIChar( char c );
-
- static String uriEncode ( const String & sSrc );
-
- /** Escapes all the characters not allowed in xml text elements.
- @param srcString The string to translate.
- @return The translated string.*/
- static String translateToXML ( const String &srcString );
-
- /** Escapes all the characters not allowed in xml text elements.
- @param srcString The string to translate.
- @return The translated string.*/
- static WideString translateToXML ( const WideString &srcString );
-
-
- /** Returns @a text with all dots replaced by underlines*/
- static String replaceDot ( const String &text );
-
- /** Converts @a value to a NativeString.
- @param T The type of the value to convert.
- @param value The value of type @a T to convert to a NativeString.
- */
- template<class T>
- static NativeString toNativeString ( const T & value )
- {
- std::stringstream stream;
- stream << value;
- return NativeString(stream.str());
- }
-
-
- /** Converts @a value to a UTF8String.
- @param T The type of the value to convert.
- @param value The value of type @a T to convert to a UTF8String.
- */
- template<class T>
- static String toUTF8String( const T & value )
- {
- std::stringstream stream;
- stream << value;
- return String(stream.str());
- }
-
-
- /** Converts @a value to a String.
- @param T The type of the value to convert.
- @param value The value of type @a T to convert to a string.
- */
- template<class T>
- static WideString toWideString ( const T & value )
- {
- std::wstringstream stream;
- stream << value;
- return WideString(stream.str());
- }
-
-
- /**
- * Searches all search strings in the source string and replace it with the replaceString.
- * @param source Reference to the source string.
- * @param searchString The search string.
- * @param replaceString The replace string.
- */
- template<class StringType>
- static void stringFindAndReplace ( StringType &source, const StringType searchString, const StringType replaceString )
- {
- size_t found = source.find ( searchString );
- if ( found != StringType::npos )
- {
- size_t searchStrLength = searchString.length();
- size_t replaceStrLength = replaceString.length();
- do
- {
- source.replace ( found, searchStrLength, replaceString );
- found = source.find (searchString, found + replaceStrLength );
- } while ( found != StringType::npos );
- }
-
- }
-
-
- /** Converts the utf8 encoded string @a utf8String to a unicode encoded widestring.*/
- static WideString utf8String2WideString( const String& utf8String );
-
- /** Converts the unicode encoded string @a wideString to a UTF encoded string.*/
- static String wideString2utf8String( const WideString& wideString );
-
- };
-}
-
-#endif // __COLLADABU_STRINGUTILS_H__
+/*
+ Copyright (c) 2008-2009 NetAllied Systems GmbH
+
+ This file is part of COLLADABaseUtils.
+
+ Licensed under the MIT Open Source License,
+ for details please see LICENSE file or the website
+ http://www.opensource.org/licenses/mit-license.php
+*/
+
+#ifndef __COLLADABU_STRINGUTILS_H__
+#define __COLLADABU_STRINGUTILS_H__
+
+#include "COLLADABUPrerequisites.h"
+#include "COLLADABUNativeString.h"
+
+#include <sstream>
+#include <fstream>
+#include <map>
+
+namespace COLLADABU
+{
+
+ /** A class that holds some static COLLADA utility functions*/
+ class StringUtils
+ {
+
+
+ public:
+ /**
+ * Returns true, if both strings are equal. The comparison is case sensitive.
+ */
+ template<class StringType>
+ static bool equals ( const StringType &str1, const StringType &str2 )
+ {
+ if ( str1.length() != str2.length() )
+ return false;
+ return ( strcmp ( str1.c_str(), str2.c_str() ) == 0 );
+ }
+
+ /**
+ * Returns true, if both strings are equal. The comparison is case intensitive.
+ */
+ static bool equalsIgnoreCase ( const WideString& s1, const WideString& s2 );
+
+ /** Checks for a valid xs:NCName.
+ 1. replaces all not allowed characters
+ 2. forces that the string begins with a letter or an _
+ @param ncName The string to convert to a valid xs:NCName.
+ @return The checked string
+ */
+ static WideString checkNCName ( const WideString &ncName );
+// static UTF8String checkNCName ( const UTF8String &ncName ){return UTF8String();};
+
+ /** Checks for a valid xs:ID.
+ 1. replaces all not allowed characters
+ 2. forces that the string begins with a letter or an _
+ @param ncName The string to convert to a valid xs:ID.
+ @return The checked string
+ */
+ static WideString checkID ( const WideString &id );
+
+// static UTF8String checkID ( const UTF8String &id ){return UTF8String();};
+
+ /** Checks if @a c is name start character according to http://www.w3.org/TR/xml11/#NT-NameStartChar */
+ static bool isNameStartChar ( wchar_t c );
+
+ /** Checks if @a c is name character according to http://www.w3.org/TR/xml11/#NT-NameChar */
+ static bool isNameChar ( wchar_t c );
+
+ /** Checks if @a c is an upper ASCII character*/
+ static bool isUpperAsciiChar ( char c )
+ {
+ return ( c >= 'A' ) && ( c <= 'Z' ) ;
+ }
+
+ /** Checks if @a c is a lower ASCII character*/
+ static bool isLowerAsciiChar ( char c )
+ {
+ return ( c >= 'a' ) && ( c <= 'z' ) ;
+ }
+
+ /** Checks if @a c is an ASCII character*/
+ static bool isAsciiAlphaChar ( char c )
+ {
+ return isLowerAsciiChar ( c ) || isUpperAsciiChar ( c ) ;
+ }
+
+ /** Checks if @a c is a digit*/
+ static bool isDigit ( char c )
+ {
+ return ( c >= '0' ) && ( c <= '9' ) ;
+ }
+
+ /** Checks if @a c is an xs:id character, but not alpha numeric*/
+ static bool isIDExtraChar ( char c )
+ {
+ return ( c == '.' ) || ( c == '-' ) || ( c == '_' ) ;
+ }
+
+ /** Checks if @a c is an xs:id character, but not alpha numeric*/
+ static bool isIDChar ( char c )
+ {
+ return isAsciiAlphaChar ( c ) || isDigit ( c ) || isIDExtraChar ( c ) ;
+ }
+
+ /** If @a c is a lower case ascii character, the corresponding upper character is returned.*/
+ static char toUpperASCIIChar( char c );
+
+ static String uriEncode ( const String & sSrc );
+
+ /** Escapes all the characters not allowed in xml text elements.
+ @param srcString The string to translate.
+ @return The translated string.*/
+ static String translateToXML ( const String &srcString );
+
+ /** Escapes all the characters not allowed in xml text elements.
+ @param srcString The string to translate.
+ @return The translated string.*/
+ static WideString translateToXML ( const WideString &srcString );
+
+
+ /** Returns @a text with all dots replaced by underlines*/
+ static String replaceDot ( const String &text );
+
+ /** Converts @a value to a NativeString.
+ @param T The type of the value to convert.
+ @param value The value of type @a T to convert to a NativeString.
+ */
+ template<class T>
+ static NativeString toNativeString ( const T & value )
+ {
+ std::stringstream stream;
+ stream << value;
+ return NativeString(stream.str());
+ }
+
+
+ /** Converts @a value to a UTF8String.
+ @param T The type of the value to convert.
+ @param value The value of type @a T to convert to a UTF8String.
+ */
+ template<class T>
+ static String toUTF8String( const T & value )
+ {
+ std::stringstream stream;
+ stream << value;
+ return String(stream.str());
+ }
+
+
+ /** Converts @a value to a String.
+ @param T The type of the value to convert.
+ @param value The value of type @a T to convert to a string.
+ */
+ template<class T>
+ static WideString toWideString ( const T & value )
+ {
+ std::wstringstream stream;
+ stream << value;
+ return WideString(stream.str());
+ }
+
+
+ /**
+ * Searches all search strings in the source string and replace it with the replaceString.
+ * @param source Reference to the source string.
+ * @param searchString The search string.
+ * @param replaceString The replace string.
+ */
+ template<class StringType>
+ static void stringFindAndReplace ( StringType &source, const StringType searchString, const StringType replaceString )
+ {
+ size_t found = source.find ( searchString );
+ if ( found != StringType::npos )
+ {
+ size_t searchStrLength = searchString.length();
+ size_t replaceStrLength = replaceString.length();
+ do
+ {
+ source.replace ( found, searchStrLength, replaceString );
+ found = source.find (searchString, found + replaceStrLength );
+ } while ( found != StringType::npos );
+ }
+
+ }
+
+
+ /** Converts the utf8 encoded string @a utf8String to a unicode encoded widestring.*/
+ static WideString utf8String2WideString( const String& utf8String );
+
+ /** Converts the unicode encoded string @a wideString to a UTF encoded string.*/
+ static String wideString2utf8String( const WideString& wideString );
+
+ };
+}
+
+#endif // __COLLADABU_STRINGUTILS_H__
View
350 COLLADABaseUtils/include/COLLADABUUtils.h
@@ -1,175 +1,175 @@
-/*
- Copyright (c) 2008-2009 NetAllied Systems GmbH
-
- This file is part of COLLADABaseUtils.
-
- Licensed under the MIT Open Source License,
- for details please see LICENSE file or the website
- http://www.opensource.org/licenses/mit-license.php
-*/
-
-#ifndef __COLLADABU_UTILS_H__
-#define __COLLADABU_UTILS_H__
-
-#include "COLLADABUPrerequisites.h"
-
-#include <sstream>
-#include <fstream>
-#include <map>
-#include <vector>
-
-
-namespace COLLADABU
-{
-
- /** A class that holds some static COLLADASW utility functions*/
- class Utils
- {
-
- public:
-
- // System type info. We only need to distinguish between Posix and Winodws for now.
- enum SystemType
- {
- POSIX,
- WINDOWS
- };
-
- typedef std::map<String, unsigned int> EntityNameMap;
- typedef std::pair<String, unsigned int> EntityNamePair;
- static EntityNameMap entityNames;
-
-
- public:
-
-
- static const String FILE_PROTOCOL;
- static const String FILE_DELIMITER;
- static const char FILE_DELIMITER_CHAR;
-
- static const String EMPTY_STRING;
-
-
- // Get the system type at runtime.
- static SystemType getSystemType();
-
-
- /**
- * Returns true, if both strings are equal. The comparison is case sensitive.
- */
- static bool equals ( const String &str1, const String &str2 );
-
- /**
- * Returns true, if both strings are equal. The comparison is case intensitive.
- */
- static bool equalsIgnoreCase ( const String& s1, const String& s2 );
-
- /** Checks for a valid xs:NCName.
- 1. replaces all not allowed characters
- 2. forces that the string begins with a letter or an _
- @param ncName The string to convert to a valid xs:NCName.
- @return The checked string
- */
- static String checkNCName ( const String &ncName );
-
- /** Checks for a valid xs:ID.
- 1. replaces all not allowed characters
- 2. forces that the string begins with a letter or an _
- @param ncName The string to convert to a valid xs:ID.
- @return The checked string
- */
- static String checkID ( const String &id );
-
-
- /** Checks if @a c is an upper ASCII character*/
- static bool isUpperAsciiChar ( char c )
- {
- return ( c >= 'A' ) && ( c <= 'Z' ) ;
- }
-
- /** Checks if @a c is a lower ASCII character*/
- static bool isLowerAsciiChar ( char c )
- {
- return ( c >= 'a' ) && ( c <= 'z' ) ;
- }
-
- /** Checks if @a c is an ASCII character*/
- static bool isAsciiAlphaChar ( char c )
- {
- return isLowerAsciiChar ( c ) || isUpperAsciiChar ( c ) ;
- }
-
- /** Checks if @a c is a digit*/
- static bool isDigit ( char c )
- {
- return ( c >= '0' ) && ( c <= '9' ) ;
- }
-
- /** Checks if @a c is an xs:id character, but not alpha numeric*/
- static bool isIDExtraChar ( char c )
- {
- return ( c == '.' ) || ( c == '-' ) || ( c == '_' ) ;
- }
-
- /** Checks if @a c is an xs:id character, but not alpha numeric*/
- static bool isIDChar ( char c )
- {
- return isAsciiAlphaChar ( c ) || isDigit ( c ) || isIDExtraChar ( c ) ;
- }
-
- /** Encodes the current URI (replace the special characters with %hexadecimal value). */
- // static String uriEncode ( const String & sSrc );
-
-
-
- static String translateToXML ( const String &srcString );
-
- /** Returns @a text with all dots replaced by underlines*/
- static String replaceDot ( const String &text );
-
- /** Converts @a value to a string.
- @param T The type of the value to convert.
- @param value The value of type @a T to convert to a string.
- */
- template<class T>
- static String toString ( const T & value )
- {
- std::stringstream stream;
- stream << value;
- return stream.str();
- }
-
- /**
- * Given the absolute current directory and an absolute file name,
- * returns a relative file name.
- * For example, if the current directory is C:\foo\bar and the
- * filename C:\foo\whee\text.txt is given, getRelativeFilename will
- * return ..\whee\text.txt.
- * @param currentDirectory The current directory.
- * @param absoluteFilename The absolute filename.
- * @return char* The relative path of the file.
- */
- static String getRelativeFilename(const String currentDirectory, const String absoluteFilename);
-
- /**
- * Searches all search strings in the source string and replace it with the replaceString.
- * @param source Reference to the source string.
- * @param searchString The search string.
- * @param replaceString The replace string.
- */
- static void stringFindAndReplace ( String& source, const String searchString, const String replaceString );
-
- /**
- * Splits a string by the given seperator string and push the
- * parts in a vector.
- * @param String & text
- * @param String & separators
- * @param std::vector<String> & words
- */
- static void split ( const String& text, const String& separators, std::vector<String>& words );
-
-
- };
-}
-
-#endif // #define __COLLADABU_UTILS_H__
+/*
+ Copyright (c) 2008-2009 NetAllied Systems GmbH
+
+ This file is part of COLLADABaseUtils.
+
+ Licensed under the MIT Open Source License,
+ for details please see LICENSE file or the website
+ http://www.opensource.org/licenses/mit-license.php
+*/
+
+#ifndef __COLLADABU_UTILS_H__
+#define __COLLADABU_UTILS_H__
+
+#include "COLLADABUPrerequisites.h"
+
+#include <sstream>
+#include <fstream>
+#include <map>
+#include <vector>
+
+
+namespace COLLADABU
+{
+
+ /** A class that holds some static COLLADASW utility functions*/
+ class Utils
+ {
+
+ public:
+
+ // System type info. We only need to distinguish between Posix and Winodws for now.
+ enum SystemType
+ {
+ POSIX,
+ WINDOWS
+ };
+
+ typedef std::map<String, unsigned int> EntityNameMap;
+ typedef std::pair<String, unsigned int> EntityNamePair;
+ static EntityNameMap entityNames;
+
+
+ public:
+
+
+ static const String FILE_PROTOCOL;
+ static const String FILE_DELIMITER;
+ static const char FILE_DELIMITER_CHAR;
+
+ static const String EMPTY_STRING;
+
+
+ // Get the system type at runtime.
+ static SystemType getSystemType();
+
+
+ /**
+ * Returns true, if both strings are equal. The comparison is case sensitive.
+ */
+ static bool equals ( const String &str1, const String &str2 );
+
+ /**
+ * Returns true, if both strings are equal. The comparison is case intensitive.
+ */
+ static bool equalsIgnoreCase ( const String& s1, const String& s2 );
+
+ /** Checks for a valid xs:NCName.
+ 1. replaces all not allowed characters
+ 2. forces that the string begins with a letter or an _
+ @param ncName The string to convert to a valid xs:NCName.
+ @return The checked string
+ */
+ static String checkNCName ( const String &ncName );
+
+ /** Checks for a valid xs:ID.
+ 1. replaces all not allowed characters
+ 2. forces that the string begins with a letter or an _
+ @param ncName The string to convert to a valid xs:ID.
+ @return The checked string
+ */
+ static String checkID ( const String &id );
+
+
+ /** Checks if @a c is an upper ASCII character*/
+ static bool isUpperAsciiChar ( char c )
+ {
+ return ( c >= 'A' ) && ( c <= 'Z' ) ;
+ }
+
+ /** Checks if @a c is a lower ASCII character*/
+ static bool isLowerAsciiChar ( char c )
+ {
+ return ( c >= 'a' ) && ( c <= 'z' ) ;
+ }
+
+ /** Checks if @a c is an ASCII character*/
+ static bool isAsciiAlphaChar ( char c )
+ {
+ return isLowerAsciiChar ( c ) || isUpperAsciiChar ( c ) ;
+ }
+
+ /** Checks if @a c is a digit*/
+ static bool isDigit ( char c )
+ {
+ return ( c >= '0' ) && ( c <= '9' ) ;
+ }
+
+ /** Checks if @a c is an xs:id character, but not alpha numeric*/
+ static bool isIDExtraChar ( char c )
+ {
+ return ( c == '.' ) || ( c == '-' ) || ( c == '_' ) ;
+ }
+
+ /** Checks if @a c is an xs:id character, but not alpha numeric*/
+ static bool isIDChar ( char c )
+ {
+ return isAsciiAlphaChar ( c ) || isDigit ( c ) || isIDExtraChar ( c ) ;
+ }
+
+ /** Encodes the current URI (replace the special characters with %hexadecimal value). */
+ // static String uriEncode ( const String & sSrc );
+
+
+
+ static String translateToXML ( const String &srcString );
+
+ /** Returns @a text with all dots replaced by underlines*/
+ static String replaceDot ( const String &text );
+
+ /** Converts @a value to a string.
+ @param T The type of the value to convert.
+ @param value The value of type @a T to convert to a string.
+ */
+ template<class T>
+ static String toString ( const T & value )
+ {
+ std::stringstream stream;
+ stream << value;
+ return stream.str();
+ }
+
+ /**
+ * Given the absolute current directory and an absolute file name,
+ * returns a relative file name.
+ * For example, if the current directory is C:\foo\bar and the
+ * filename C:\foo\whee\text.txt is given, getRelativeFilename will
+ * return ..\whee\text.txt.
+ * @param currentDirectory The current directory.
+ * @param absoluteFilename The absolute filename.
+ * @return char* The relative path of the file.
+ */
+ static String getRelativeFilename(const String currentDirectory, const String absoluteFilename);
+
+ /**
+ * Searches all search strings in the source string and replace it with the replaceString.
+ * @param source Reference to the source string.
+ * @param searchString The search string.
+ * @param replaceString The replace string.
+ */
+ static void stringFindAndReplace ( String& source, const String searchString, const String replaceString );
+
+ /**
+ * Splits a string by the given seperator string and push the
+ * parts in a vector.
+ * @param String & text
+ * @param String & separators
+ * @param std::vector<String> & words
+ */
+ static void split ( const String& text, const String& separators, std::vector<String>& words );
+
+
+ };
+}
+
+#endif // #define __COLLADABU_UTILS_H__
View
480 COLLADABaseUtils/include/Math/COLLADABUMathMatrix3.h
@@ -1,240 +1,240 @@
-/*
- Copyright (c) 2008-2009 NetAllied Systems GmbH
-
- This file is part of COLLADABaseUtils.
-
- Licensed under the MIT Open Source License,
- for details please see LICENSE file or the website
- http://www.opensource.org/licenses/mit-license.php
-*/
-
-#ifndef __COMMONBU_MATH_MATRIX3_H__
-#define __COMMONBU_MATH_MATRIX3_H__
-
-#include "COLLADABUMathPrerequisites.h"
-#include "COLLADABUMathVector3.h"
-#include <memory>
-#include <string.h>
-
-// 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 COLLADABU
-{
- namespace Math
- {
- class Vector3;
- /** 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.magic-software.com).</b>
- @par
- The coordinate system is assumed to be <b>right-handed</b>.
- */
-
- class 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;
- }
-
- inline void setAllElements(
- 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;
- }
-
-
-
- // 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]
- friend Vector3 operator* ( const Vector3& rkVector,
- const Matrix3& rkMatrix );
-
- // matrix * scalar
- Matrix3 operator* ( Real fScalar ) const;
-
- // scalar * matrix
- 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, Real& rfAngle_radian ) const;
-
- void fromAxisAngle ( const Vector3& rkAxis, const Real& fRadians_radian );
-
- // 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 ( Real& rfYAngle_radian, Real& rfPAngle_radian,
- Real& rfRAngle_radian ) const;
- bool toEulerAnglesXZY ( Real& rfYAngle_radian, Real& rfPAngle_radian,
- Real& rfRAngle_radian ) const;
- bool toEulerAnglesYXZ ( Real& rfYAngle_radian, Real& rfPAngle_radian,
- Real& rfRAngle_radian ) const;
- bool toEulerAnglesYZX ( Real& rfYAngle_radian, Real& rfPAngle_radian,
- Real& rfRAngle_radian ) const;
- bool toEulerAnglesZXY ( Real& rfYAngle_radian, Real& rfPAngle_radian,
- Real& rfRAngle_radian ) const;
- bool toEulerAnglesZYX ( Real& rfYAngle_radian, Real& rfPAngle_radian,
- Real& rfRAngle_radian ) const;
- void fromEulerAnglesXYZ ( const Real& fYAngle_radian, const Real& fPAngle_radian, const Real& fRAngle_radian );
- void fromEulerAnglesXZY ( const Real& fYAngle_radian, const Real& fPAngle_radian, const Real& fRAngle_radian );
- void fromEulerAnglesYXZ ( const Real& fYAngle_radian, const Real& fPAngle_radian, const Real& fRAngle_radian );
- void fromEulerAnglesYZX ( const Real& fYAngle_radian, const Real& fPAngle_radian, const Real& fRAngle_radian );
- void fromEulerAnglesZXY ( const Real& fYAngle_radian, const Real& fPAngle_radian, const Real& fRAngle_radian );
- void fromEulerAnglesZYX ( const Real& fYAngle_radian, const Real& fPAngle_radian, const Real& fRAngle_radian );
-
- // 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 );
-
- 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;
-
- public:
- /* Returns a vector which represents the scale of the current matrix.
- see http://www.ogre3d.org/phpBB2/viewtopic.php?t=18978
- */
- inline Vector3 getScale();
- };
- }
-}
-
-#endif //__COMMONBU_MATH_MATRIX3_H__
+/*
+ Copyright (c) 2008-2009 NetAllied Systems GmbH
+
+ This file is part of COLLADABaseUtils.
+
+ Licensed under the MIT Open Source License,
+ for details please see LICENSE file or the website
+ http://www.opensource.org/licenses/mit-license.php
+*/
+
+#ifndef __COMMONBU_MATH_MATRIX3_H__
+#define __COMMONBU_MATH_MATRIX3_H__
+
+#include "COLLADABUMathPrerequisites.h"
+#include "COLLADABUMathVector3.h"
+#include <memory>
+#include <string.h>
+
+// 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 COLLADABU
+{
+ namespace Math
+ {
+ class Vector3;
+ /** 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.magic-software.com).</b>
+ @par
+ The coordinate system is assumed to be <b>right-handed</b>.
+ */
+
+ class 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;
+ }
+
+ inline void setAllElements(
+ 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;
+ }
+
+
+
+ // 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]
+ friend Vector3 operator* ( const Vector3& rkVector,
+ const Matrix3& rkMatrix );
+
+ // matrix * scalar
+ Matrix3 operator* ( Real fScalar ) const;
+
+ // scalar * matrix
+ 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, Real& rfAngle_radian ) const;
+
+ void fromAxisAngle ( const Vector3& rkAxis, const Real& fRadians_radian );
+
+ // 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 ( Real& rfYAngle_radian, Real& rfPAngle_radian,
+ Real& rfRAngle_radian ) const;
+ bool toEulerAnglesXZY ( Real& rfYAngle_radian, Real& rfPAngle_radian,
+ Real& rfRAngle_radian ) const;
+ bool toEulerAnglesYXZ ( Real& rfYAngle_radian, Real& rfPAngle_radian,
+ Real& rfRAngle_radian ) const;
+ bool toEulerAnglesYZX ( Real& rfYAngle_radian, Real& rfPAngle_radian,
+ Real& rfRAngle_radian ) const;
+ bool toEulerAnglesZXY ( Real& rfYAngle_radian, Real& rfPAngle_radian,
+ Real& rfRAngle_radian ) const;
+ bool toEulerAnglesZYX ( Real& rfYAngle_radian, Real& rfPAngle_radian,
+ Real& rfRAngle_radian ) const;
+ void fromEulerAnglesXYZ ( const Real& fYAngle_radian, const Real& fPAngle_radian, const Real& fRAngle_radian );
+ void fromEulerAnglesXZY ( const Real& fYAngle_radian, const Real& fPAngle_radian, const Real& fRAngle_radian );
+ void fromEulerAnglesYXZ ( const Real& fYAngle_radian, const Real& fPAngle_radian, const Real& fRAngle_radian );
+ void fromEulerAnglesYZX ( const Real& fYAngle_radian, const Real& fPAngle_radian, const Real& fRAngle_radian );
+ void fromEulerAnglesZXY ( const Real& fYAngle_radian, const Real& fPAngle_radian, const Real& fRAngle_radian );
+ void fromEulerAnglesZYX ( const Real& fYAngle_radian, const Real& fPAngle_radian, const Real& fRAngle_radian );
+
+ // 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 );
+
+ 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;
+
+ public:
+ /* Returns a vector which represents the scale of the current matrix.
+ see http://www.ogre3d.org/phpBB2/viewtopic.php?t=18978
+ */
+ inline Vector3 getScale();
+ };
+ }
+}
+
+#endif //__COMMONBU_MATH_MATRIX3_H__
View
1,280 COLLADABaseUtils/include/Math/COLLADABUMathMatrix4.h
@@ -1,640 +1,640 @@
-/*
- Copyright (c) 2008-2009 NetAllied Systems GmbH
-
- This file is part of COLLADABaseUtils.
-
- Licensed under the MIT Open Source License,
- for details please see LICENSE file or the website
- http://www.opensource.org/licenses/mit-license.php
-*/
-
-#ifndef __COLLADABU_MATH_MATRIX4_H__
-#define __COLLADABU_MATH_MATRIX4_H__
-
-#include "COLLADABUMathVector3.h"
-#include "COLLADABUMathMatrix3.h"
-#include "COLLADABUMathUtils.h"
-
-namespace COLLADABU
-{
-
- namespace Math
- {
- /** Class encapsulating a standard 4x4 homogenous matrix.
- @remarks
- Math 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 tranformations 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 cummatative, 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 id 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
- Math deals with the differences between D3D and OpenGL etc.
- internally when operating through different render systems. Math
- users only need to conform to standard maths conventions, i.e.
- right-to-left matrix multiplication, (Math 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 Matrix4
- {
-
-
- public:
- /** Default constructor.
- @note
- It does <b>NOT</b> initialize the matrix for efficiency.
- */
- inline Matrix4()
- : mState( UNKNOWN )
- {}
-
- 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 )
- {
- setAllElements(
- m00, m01, m02, m03,
- m10, m11, m12, m13,
- m20, m21, m22, m23,
- m30, m31, m32, m33 );
- }
-
- inline Matrix4 ( const Real m[4][4] )
- {
- setAllElements(
- m[0][0], m[0][1], m[0][2], m[0][3],
- m[1][0], m[1][1], m[1][2], m[1][3],
- m[2][0], m[2][1], m[2][2], m[2][3],
- m[3][0], m[3][1], m[3][2], m[3][3] );
- }
-
-
- // matrix from delmia
- inline Matrix4( double* dblMatrix )
- : mState( UNKNOWN )
- {
- m[ 0 ][ 0 ] = dblMatrix[ 0 ];
- m[ 1 ][ 0 ] = dblMatrix[ 1 ];
- m[ 2 ][ 0 ] = dblMatrix[ 2 ];
- m[ 3 ][ 0 ] = dblMatrix[ 3 ];
- m[ 0 ][ 1 ] = dblMatrix[ 4 ];
- m[ 1 ][ 1 ] = dblMatrix[ 5 ];
- m[ 2 ][ 1 ] = dblMatrix[ 6 ];
- m[ 3 ][ 1 ] = dblMatrix[ 7 ];
- m[ 0 ][ 2 ] = dblMatrix[ 8 ];
- m[ 1 ][ 2 ] = dblMatrix[ 9 ];
- m[ 2 ][ 2 ] = dblMatrix[ 10 ];
- m[ 3 ][ 2 ] = dblMatrix[ 11 ];
- m[ 0 ][ 3 ] = dblMatrix[ 12 ];
- m[ 1 ][ 3 ] = dblMatrix[ 13 ];
- m[ 2 ][ 3 ] = dblMatrix[ 14 ];
- m[ 3 ][ 3 ] = dblMatrix[ 15 ];
- }
-
- inline const Real & getElement( int index ) const
- {
- return _m[ index ];
- }
-
- inline const Real & getElement( int i, int j ) const
- {
- return m[ i ][ j ];
- }
-
-
- inline void setElement( int i, int j, Real value )
- {
- mState = UNKNOWN;
- m[ i ][ j ] = value;
- }
-
- inline void setElement( size_t i, size_t j, Real value )
- {
- mState = UNKNOWN;
- m[ i ][ j ] = value;
- }
-
- inline void setElement( int i, Real value )
- {
- mState = UNKNOWN;
- _m[ i ] = value;
- }
-
- inline void setElement( size_t i, Real value )
- {
- mState = UNKNOWN;
- _m[ i ] = value;
- }
-
- /** Creates a standard 4x4 transformation matrix with a zero translation part from a rotation/scaling 3x3 matrix.
- */
-
- inline Matrix4( const Matrix3& m3x3 )
- : mState( UNKNOWN )
- {
- 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 )
- : mState( UNKNOWN )
- {
- Matrix3 m3x3;
- rot.toRotationMatrix( m3x3 );
- operator=( IDENTITY );
- operator=( m3x3 );
- }
-
-
- inline void setAllElements(
- 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 )
- {
- mState = UNKNOWN;
- 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;
- }
-
-
-
- /* inline Real* operator [] ( size_t iRow )
- {
- assert( iRow < 4 );
- mState = UNKNOWN;
- return m[ iRow ];
- }
- */
- inline const Real *const operator [] ( size_t iRow ) const
- {
- COLLADABU_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
- {
- if ( mState == ISIDENTITY )
- return m2;
-
- if ( m2.mState == ISIDENTITY )
- return * this;
-
- 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
- {
- if ( mState == ISIDENTITY )
- return v;
-
- Vector3 r;
-
- Real fInvW = 1.0 / ( 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;
- }
-
-
-
- /** 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 ( mState == ISIDENTITY && m2.mState == ISIDENTITY )
- return true;
-
- return isEqualTo( m2 );
- }
-
- /** Tests 2 matrices for inequality.
- */
- inline bool operator != ( const Matrix4& m2 ) const
- {
- if ( ( mState != UNKNOWN ) && ( m2.mState != UNKNOWN ) && ( mState != m2.mState ) )
- return true;
-
- return !isEqualTo( m2 );
- }
-
- /** Tests if the matrix is the identity matrix. This is the prefered method to check for identity*/
- inline bool isIdentiy() const
- {
- if ( mState == UNKNOWN )
- mState = isEqualTo( IDENTITY ) ? ISIDENTITY : ISNOTIDENTITY;
-
- return mState == ISIDENTITY;
- }
-
- /** Assignment from 3x3 matrix.
- */
- inline void operator = ( const Matrix3& mat3 )
- {
- mState = UNKNOWN;
- 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 )
- {
- mState = UNKNOWN;
- 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 )
- {
- makeTrans( v.x, v.y, v.z );
- }
-
- inline void makeTrans( Real tx, Real ty, Real tz )
- {
- setAllElements(
- 1.0, 0.0, 0.0, tx,
- 0.0, 1.0, 0.0, ty,
- 0.0, 0.0, 1.0, tz,
- 0.0, 0.0, 0.0, 1.0 );
- }
-
-
- /** Builds a scale matrix
- */
- inline void makeScale( const Vector3& v )
- {
- makeScale( v.x, v.y, v.z );
- }
-
- /** Builds a scale matrix
- */
- inline void makeScale( Real sx, Real sy, Real sz )
- {
- setAllElements(
- sx, 0.0, 0.0, 0.0,
- 0.0, sy, 0.0, 0.0,
- 0.0, 0.0, sz, 0.0,
- 0.0, 0.0, 0.0, 1.0 );
- }
-
- /** Gets a translation matrix.
- */
- inline static Matrix4 getTrans( const Vector3& v )
- {
- return getTrans( v.x, v.y, v.z );
- }
-
- /** 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(
- 1.0, 0.0, 0.0, t_x,
- 0.0, 1.0, 0.0, t_y,
- 0.0, 0.0, 1.0, t_z,
- 0.0, 0.0, 0.0, 1.0 );
- return r;
- }
-
- /** Scales the translation Part my @a scaleFactor*/
- inline void scaleTrans( Real scaleFactor )
- {
- m[ 0 ][ 3 ] = m[ 0 ][ 3 ] * scaleFactor;
- m[ 1 ][ 3 ] = m[ 1 ][ 3 ] * scaleFactor;
- m[ 2 ][ 3 ] = m[ 2 ][ 3 ] * scaleFactor;
-
- }
-
- /*
- -----------------------------------------------------------------------
- Scale Transformation
- -----------------------------------------------------------------------
- */
- /** Sets the scale part of the matrix.
- */
- inline void setScale( const Vector3& v )
- {
- mState = UNKNOWN;
- 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 )
- {
- return getScale( v.x, v.y, v.z );
- }
-
- /** 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(
- s_x, 0.0, 0.0, 0.0,
- 0.0, s_y, 0.0, 0.0,
- 0.0, 0.0, s_z, 0.0,
- 0.0, 0.0, 0.0, 1.0 );
- return r;
- }
-
- /* Returns a vector which represents the scale of the current matrix.
- see http://www.ogre3d.org/phpBB2/viewtopic.php?t=18978
- */
- inline Vector3 getScale() const
- {
- Vector3 col1( m[ 0 ][ 0 ], m[ 1 ][ 0 ], m[ 2 ][ 0 ] );
- Vector3 col2( m[ 0 ][ 1 ], m[ 1 ][ 1 ], m[ 2 ][ 1 ] );
- Vector3 col3( m[ 0 ][ 2 ], m[ 1 ][ 2 ], m[ 2 ][ 2 ] );
-
- Real scaleX = col1.length();
- Real scaleY = col2.length();
- Real scaleZ = col3.length();
- return Vector3( scaleX, scaleY, scaleZ );
- }
-
- /** 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 ];
-
- }