Interim code. Integrating cocos2d.
authorchsieh <chester.developer@hotmail.com>
Thu, 23 Dec 2010 19:10:02 +0000 (11:10 -0800)
committerchsieh <chester.developer@hotmail.com>
Thu, 23 Dec 2010 19:10:02 +0000 (11:10 -0800)
176 files changed:
Classes/Foundation/Common/GlobalDefines.h
Classes/Foundation/GraphicsServices/Geometry/BasicPrimitives.h [new file with mode: 0644]
Classes/Foundation/GraphicsServices/Geometry/BasicPrimitives.mm [new file with mode: 0644]
Classes/Foundation/GraphicsServices/OpenGLServices.h
Classes/Foundation/GraphicsServices/OpenGLServices.mm
Classes/Foundation/Math/MathTypes.h
Classes/Foundation/Math/Matrix.h
Classes/Foundation/Math/Quaternion.h
Classes/Foundation/Math/Vector.h
Classes/cocos2d/CCAction.h [new file with mode: 0644]
Classes/cocos2d/CCAction.m [new file with mode: 0644]
Classes/cocos2d/CCActionCamera.h [new file with mode: 0644]
Classes/cocos2d/CCActionCamera.m [new file with mode: 0644]
Classes/cocos2d/CCActionEase.h [new file with mode: 0644]
Classes/cocos2d/CCActionEase.m [new file with mode: 0644]
Classes/cocos2d/CCActionGrid.h [new file with mode: 0644]
Classes/cocos2d/CCActionGrid.m [new file with mode: 0644]
Classes/cocos2d/CCActionGrid3D.h [new file with mode: 0644]
Classes/cocos2d/CCActionGrid3D.m [new file with mode: 0644]
Classes/cocos2d/CCActionInstant.h [new file with mode: 0644]
Classes/cocos2d/CCActionInstant.m [new file with mode: 0644]
Classes/cocos2d/CCActionInterval.h [new file with mode: 0644]
Classes/cocos2d/CCActionInterval.m [new file with mode: 0644]
Classes/cocos2d/CCActionManager.h [new file with mode: 0644]
Classes/cocos2d/CCActionManager.m [new file with mode: 0644]
Classes/cocos2d/CCActionPageTurn3D.h [new file with mode: 0644]
Classes/cocos2d/CCActionPageTurn3D.m [new file with mode: 0644]
Classes/cocos2d/CCActionProgressTimer.h [new file with mode: 0644]
Classes/cocos2d/CCActionProgressTimer.m [new file with mode: 0644]
Classes/cocos2d/CCActionTiledGrid.h [new file with mode: 0644]
Classes/cocos2d/CCActionTiledGrid.m [new file with mode: 0644]
Classes/cocos2d/CCActionTween.h [new file with mode: 0644]
Classes/cocos2d/CCActionTween.m [new file with mode: 0644]
Classes/cocos2d/CCAnimation.h [new file with mode: 0644]
Classes/cocos2d/CCAnimation.m [new file with mode: 0644]
Classes/cocos2d/CCAnimationCache.h [new file with mode: 0644]
Classes/cocos2d/CCAnimationCache.m [new file with mode: 0644]
Classes/cocos2d/CCAtlasNode.h [new file with mode: 0644]
Classes/cocos2d/CCAtlasNode.m [new file with mode: 0644]
Classes/cocos2d/CCBlockSupport.h [new file with mode: 0644]
Classes/cocos2d/CCBlockSupport.m [new file with mode: 0644]
Classes/cocos2d/CCCamera.h [new file with mode: 0644]
Classes/cocos2d/CCCamera.m [new file with mode: 0644]
Classes/cocos2d/CCCompatibility.h [new file with mode: 0644]
Classes/cocos2d/CCCompatibility.m [new file with mode: 0644]
Classes/cocos2d/CCConfiguration.h [new file with mode: 0644]
Classes/cocos2d/CCConfiguration.m [new file with mode: 0644]
Classes/cocos2d/CCDirector.h [new file with mode: 0644]
Classes/cocos2d/CCDirector.m [new file with mode: 0644]
Classes/cocos2d/CCDrawingPrimitives.h [new file with mode: 0644]
Classes/cocos2d/CCDrawingPrimitives.m [new file with mode: 0644]
Classes/cocos2d/CCGrabber.h [new file with mode: 0644]
Classes/cocos2d/CCGrabber.m [new file with mode: 0644]
Classes/cocos2d/CCGrid.h [new file with mode: 0644]
Classes/cocos2d/CCGrid.m [new file with mode: 0644]
Classes/cocos2d/CCLabelAtlas.h [new file with mode: 0644]
Classes/cocos2d/CCLabelAtlas.m [new file with mode: 0644]
Classes/cocos2d/CCLabelBMFont.h [new file with mode: 0644]
Classes/cocos2d/CCLabelBMFont.m [new file with mode: 0644]
Classes/cocos2d/CCLabelTTF.h [new file with mode: 0644]
Classes/cocos2d/CCLabelTTF.m [new file with mode: 0644]
Classes/cocos2d/CCLayer.h [new file with mode: 0644]
Classes/cocos2d/CCLayer.m [new file with mode: 0644]
Classes/cocos2d/CCMenu.h [new file with mode: 0644]
Classes/cocos2d/CCMenu.m [new file with mode: 0644]
Classes/cocos2d/CCMenuItem.h [new file with mode: 0644]
Classes/cocos2d/CCMenuItem.m [new file with mode: 0644]
Classes/cocos2d/CCMotionStreak.h [new file with mode: 0644]
Classes/cocos2d/CCMotionStreak.m [new file with mode: 0644]
Classes/cocos2d/CCNode.h [new file with mode: 0644]
Classes/cocos2d/CCNode.m [new file with mode: 0644]
Classes/cocos2d/CCParallaxNode.h [new file with mode: 0644]
Classes/cocos2d/CCParallaxNode.m [new file with mode: 0644]
Classes/cocos2d/CCParticleExamples.h [new file with mode: 0644]
Classes/cocos2d/CCParticleExamples.m [new file with mode: 0644]
Classes/cocos2d/CCParticleSystem.h [new file with mode: 0644]
Classes/cocos2d/CCParticleSystem.m [new file with mode: 0644]
Classes/cocos2d/CCParticleSystemPoint.h [new file with mode: 0644]
Classes/cocos2d/CCParticleSystemPoint.m [new file with mode: 0644]
Classes/cocos2d/CCParticleSystemQuad.h [new file with mode: 0644]
Classes/cocos2d/CCParticleSystemQuad.m [new file with mode: 0644]
Classes/cocos2d/CCProgressTimer.h [new file with mode: 0644]
Classes/cocos2d/CCProgressTimer.m [new file with mode: 0644]
Classes/cocos2d/CCProtocols.h [new file with mode: 0644]
Classes/cocos2d/CCRenderTexture.h [new file with mode: 0755]
Classes/cocos2d/CCRenderTexture.m [new file with mode: 0755]
Classes/cocos2d/CCRibbon.h [new file with mode: 0644]
Classes/cocos2d/CCRibbon.m [new file with mode: 0644]
Classes/cocos2d/CCScene.h [new file with mode: 0644]
Classes/cocos2d/CCScene.m [new file with mode: 0644]
Classes/cocos2d/CCScheduler.h [new file with mode: 0644]
Classes/cocos2d/CCScheduler.m [new file with mode: 0644]
Classes/cocos2d/CCSprite.h [new file with mode: 0644]
Classes/cocos2d/CCSprite.m [new file with mode: 0644]
Classes/cocos2d/CCSpriteBatchNode.h [new file with mode: 0644]
Classes/cocos2d/CCSpriteBatchNode.m [new file with mode: 0644]
Classes/cocos2d/CCSpriteFrame.h [new file with mode: 0644]
Classes/cocos2d/CCSpriteFrame.m [new file with mode: 0644]
Classes/cocos2d/CCSpriteFrameCache.h [new file with mode: 0644]
Classes/cocos2d/CCSpriteFrameCache.m [new file with mode: 0644]
Classes/cocos2d/CCSpriteSheet.h [new file with mode: 0644]
Classes/cocos2d/CCSpriteSheet.m [new file with mode: 0644]
Classes/cocos2d/CCTMXLayer.h [new file with mode: 0644]
Classes/cocos2d/CCTMXLayer.m [new file with mode: 0644]
Classes/cocos2d/CCTMXObjectGroup.h [new file with mode: 0644]
Classes/cocos2d/CCTMXObjectGroup.m [new file with mode: 0644]
Classes/cocos2d/CCTMXTiledMap.h [new file with mode: 0644]
Classes/cocos2d/CCTMXTiledMap.m [new file with mode: 0644]
Classes/cocos2d/CCTMXXMLParser.h [new file with mode: 0644]
Classes/cocos2d/CCTMXXMLParser.m [new file with mode: 0644]
Classes/cocos2d/CCTexture2D.h [new file with mode: 0644]
Classes/cocos2d/CCTexture2D.m [new file with mode: 0644]
Classes/cocos2d/CCTextureAtlas.h [new file with mode: 0644]
Classes/cocos2d/CCTextureAtlas.m [new file with mode: 0644]
Classes/cocos2d/CCTextureCache.h [new file with mode: 0644]
Classes/cocos2d/CCTextureCache.m [new file with mode: 0644]
Classes/cocos2d/CCTexturePVR.h [new file with mode: 0644]
Classes/cocos2d/CCTexturePVR.m [new file with mode: 0644]
Classes/cocos2d/CCTileMapAtlas.h [new file with mode: 0644]
Classes/cocos2d/CCTileMapAtlas.m [new file with mode: 0644]
Classes/cocos2d/CCTransition.h [new file with mode: 0644]
Classes/cocos2d/CCTransition.m [new file with mode: 0644]
Classes/cocos2d/CCTransitionPageTurn.h [new file with mode: 0644]
Classes/cocos2d/CCTransitionPageTurn.m [new file with mode: 0644]
Classes/cocos2d/CCTransitionRadial.h [new file with mode: 0644]
Classes/cocos2d/CCTransitionRadial.m [new file with mode: 0644]
Classes/cocos2d/Platforms/CCGL.h [new file with mode: 0644]
Classes/cocos2d/Platforms/CCNS.h [new file with mode: 0644]
Classes/cocos2d/Platforms/Mac/CCDirectorMac.h [new file with mode: 0644]
Classes/cocos2d/Platforms/Mac/CCDirectorMac.m [new file with mode: 0644]
Classes/cocos2d/Platforms/Mac/CCEventDispatcher.h [new file with mode: 0644]
Classes/cocos2d/Platforms/Mac/CCEventDispatcher.m [new file with mode: 0644]
Classes/cocos2d/Platforms/Mac/MacGLView.h [new file with mode: 0644]
Classes/cocos2d/Platforms/Mac/MacGLView.m [new file with mode: 0644]
Classes/cocos2d/Platforms/iOS/CCDirectorIOS.h [new file with mode: 0755]
Classes/cocos2d/Platforms/iOS/CCDirectorIOS.m [new file with mode: 0755]
Classes/cocos2d/Platforms/iOS/CCTouchDelegateProtocol.h [new file with mode: 0644]
Classes/cocos2d/Platforms/iOS/CCTouchDispatcher.h [new file with mode: 0644]
Classes/cocos2d/Platforms/iOS/CCTouchDispatcher.m [new file with mode: 0644]
Classes/cocos2d/Platforms/iOS/CCTouchHandler.h [new file with mode: 0644]
Classes/cocos2d/Platforms/iOS/CCTouchHandler.m [new file with mode: 0644]
Classes/cocos2d/Platforms/iOS/EAGLView.h [new file with mode: 0755]
Classes/cocos2d/Platforms/iOS/EAGLView.m [new file with mode: 0755]
Classes/cocos2d/Platforms/iOS/ES1Renderer.h [new file with mode: 0755]
Classes/cocos2d/Platforms/iOS/ES1Renderer.m [new file with mode: 0755]
Classes/cocos2d/Platforms/iOS/ESRenderer.h [new file with mode: 0755]
Classes/cocos2d/Platforms/iOS/glu.c [new file with mode: 0755]
Classes/cocos2d/Platforms/iOS/glu.h [new file with mode: 0644]
Classes/cocos2d/Support/CCArray.h [new file with mode: 0644]
Classes/cocos2d/Support/CCArray.m [new file with mode: 0644]
Classes/cocos2d/Support/CCFileUtils.h [new file with mode: 0644]
Classes/cocos2d/Support/CCFileUtils.m [new file with mode: 0644]
Classes/cocos2d/Support/CCProfiling.h [new file with mode: 0644]
Classes/cocos2d/Support/CCProfiling.m [new file with mode: 0644]
Classes/cocos2d/Support/CGPointExtension.h [new file with mode: 0644]
Classes/cocos2d/Support/CGPointExtension.m [new file with mode: 0644]
Classes/cocos2d/Support/OpenGL_Internal.h [new file with mode: 0644]
Classes/cocos2d/Support/TGAlib.h [new file with mode: 0644]
Classes/cocos2d/Support/TGAlib.m [new file with mode: 0644]
Classes/cocos2d/Support/TransformUtils.h [new file with mode: 0644]
Classes/cocos2d/Support/TransformUtils.m [new file with mode: 0644]
Classes/cocos2d/Support/ZipUtils.h [new file with mode: 0644]
Classes/cocos2d/Support/ZipUtils.m [new file with mode: 0644]
Classes/cocos2d/Support/base64.c [new file with mode: 0644]
Classes/cocos2d/Support/base64.h [new file with mode: 0644]
Classes/cocos2d/Support/ccCArray.h [new file with mode: 0644]
Classes/cocos2d/Support/ccUtils.c [new file with mode: 0644]
Classes/cocos2d/Support/ccUtils.h [new file with mode: 0644]
Classes/cocos2d/Support/uthash.h [new file with mode: 0644]
Classes/cocos2d/Support/utlist.h [new file with mode: 0644]
Classes/cocos2d/ccConfig.h [new file with mode: 0644]
Classes/cocos2d/ccMacros.h [new file with mode: 0644]
Classes/cocos2d/ccTypes.h [new file with mode: 0644]
Classes/cocos2d/cocos2d.h [new file with mode: 0644]
Classes/cocos2d/cocos2d.m [new file with mode: 0644]
Littlest.xcodeproj/project.pbxproj

index 7dde617..14712b2 100755 (executable)
@@ -70,9 +70,9 @@
 //----------------------------------------------------------------------------------------\r
 // alignment macros\r
 #if defined(__WINDOWS__)\r
-#define ALIGN(N)                  __declspec(align(N))\r
+#define MEM_ALIGN(N)              __declspec(align(N))\r
 #elif defined(__iOS__)\r
-#define ALIGN(N)                  __attribute__((aligned (N)))\r
+#define MEM_ALIGN(N)              __attribute__((aligned (N)))\r
 #endif\r
 \r
 #define IS_POWER_OF_TWO(x)        ( ((x) & -(x)) == (x) )\r
diff --git a/Classes/Foundation/GraphicsServices/Geometry/BasicPrimitives.h b/Classes/Foundation/GraphicsServices/Geometry/BasicPrimitives.h
new file mode 100644 (file)
index 0000000..ba50ba9
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once
+
+#include "Foundation/Common/GlobalInclude.h"
+#include "Foundation/Math/MathInclude.h"
+
+//#include <OpenGLES/ES1/gl.h>
+#include <OpenGLES/ES2/gl.h>
+
+//----------------------------------------------------------------------------------------
+struct Basic2DPrimitive
+{
+protected:
+  Basic2DPrimitive(); // Only the children classes can call this.
+  ~Basic2DPrimitive();
+
+  GLuint    mVertexBuffer;
+  uint16_t  mX, mY;
+};
+
+//----------------------------------------------------------------------------------------
+struct Rectangle : public Basic2DPrimitive
+{
+public:
+  GLuint    mWidth, mHeight;
+  
+  Rectangle( uint16_t width, uint16_t height, uint16_t anchorX, uint16_t anchorY );
+};
diff --git a/Classes/Foundation/GraphicsServices/Geometry/BasicPrimitives.mm b/Classes/Foundation/GraphicsServices/Geometry/BasicPrimitives.mm
new file mode 100644 (file)
index 0000000..4cc9da1
--- /dev/null
@@ -0,0 +1,26 @@
+#include "BasicPrimitives.h"
+
+//----------------------------------------------------------------------------------------
+Basic2DPrimitive::Basic2DPrimitive() : mVertexBuffer(0), mX(0), mY(0)
+{
+  glGenBuffers( 1, &mVertexBuffer );
+}
+
+//----------------------------------------------------------------------------------------
+Basic2DPrimitive::~Basic2DPrimitive()
+{
+  glDeleteBuffers( 1, &mVertexBuffer );
+}
+
+//----------------------------------------------------------------------------------------
+Rectangle::Rectangle( uint16_t width, uint16_t height, uint16_t anchorX, uint16_t anchorY ) : Basic2DPrimitive()
+{
+  Assert( mVertexBuffer );
+  glBindBuffer( GL_ARRAY_BUFFER, mVertexBuffer );
+  
+  mWidth = width;
+  mHeight = height;
+
+  uint16_t values[4 * 2] = {-anchorX, height + anchorY, -anchorX, };
+  glBufferData( GL_ARRAY_BUFFER, 4 * 2 * sizeof(uint16_t), values, GL_STATIC_DRAW );
+}
index 819ba12..deadd57 100644 (file)
@@ -10,8 +10,8 @@
  *  we should never need to set context other than during startup or shutdown.
  *****************************************************************************************/
 
-#include <OpenGLES/ES1/gl.h>
-#include <OpenGLES/ES1/glext.h>
+//#include <OpenGLES/ES1/gl.h>
+//#include <OpenGLES/ES1/glext.h>
 #include <OpenGLES/ES2/gl.h>
 #include <OpenGLES/ES2/glext.h>
 
index 236059e..9c1f7a2 100644 (file)
@@ -22,16 +22,21 @@ bool OpenGLServices::init( EAGLContext* mainContext )
   
   initScratchMem();
   
-  // Enable some common states.
+  // Enable some common states and set their parameters.
   glEnable( GL_TEXTURE_2D );
-
   glEnable( GL_BLEND );
-
   // We will premultiply alpha into the color channels of all textures (so no alpha animation).
   // This is basically the A over B alpha scheme.
   glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
-
   glEnable( GL_DEPTH_TEST );
+  glDepthFunc( GL_LEQUAL );
+  glFrontFace( GL_CCW );
+  glCullFace( GL_BACK );
+
+  // Disable unused stuff.
+  glDisable( GL_STENCIL_TEST );
+  glDisable( GL_SCISSOR_TEST );
+  glDisable( GL_DITHER );
   
   return true;
 }
index c16a44e..379bf16 100755 (executable)
@@ -4,16 +4,16 @@
 #include "Foundation/Math/MathOperations.h"\r
 \r
 //----------------------------------------------------------------------------------------\r
-struct Vector2\r
+struct Vec2\r
 {\r
   float x;\r
   float y;\r
 \r
-  slInline explicit Vector2() {}\r
-  slInline explicit Vector2(const float xy) {x = xy; y = xy;}\r
-  slInline explicit Vector2(const float ix, const float iy) {x = ix; y = iy;}\r
+  slInline explicit Vec2() {}\r
+  slInline explicit Vec2(const float xy) {x = xy; y = xy;}\r
+  slInline explicit Vec2(const float ix, const float iy) {x = ix; y = iy;}\r
 \r
-  slInline Vector2(const Vector2& v) {x = v.x; y = v.y;} // copy constructor\r
+  slInline Vec2(const Vec2& v) {x = v.x; y = v.y;} // copy constructor\r
 \r
   slInline float* AsFloatArray() {return &x;}\r
   slInline const float* AsFloatArray() const {return &x;}\r
@@ -23,21 +23,21 @@ struct Vector2
 \r
 \r
 //----------------------------------------------------------------------------------------\r
-struct Vector3\r
+struct Vec3\r
 {\r
   float x;\r
   float y;\r
   float z;\r
 \r
-  slInline explicit Vector3() {}\r
-  slInline explicit Vector3(const float xyz) {x = xyz; y = xyz; z = xyz;}\r
-  slInline explicit Vector3(const float ix, const float iy, const float iz) {x = ix; y = iy; z = iz;}\r
+  slInline explicit Vec3() {}\r
+  slInline explicit Vec3(const float xyz) {x = xyz; y = xyz; z = xyz;}\r
+  slInline explicit Vec3(const float ix, const float iy, const float iz) {x = ix; y = iy; z = iz;}\r
 \r
-  slInline explicit Vector3(const Vector2& v, const float iz) {x = v.x; y = v.y; z = iz;}\r
+  slInline explicit Vec3(const Vec2& v, const float iz) {x = v.x; y = v.y; z = iz;}\r
 \r
-  slInline Vector3(const Vector3& v) {x = v.x; y = v.y; z = v.z;} // copy constructor\r
+  slInline Vec3(const Vec3& v) {x = v.x; y = v.y; z = v.z;} // copy constructor\r
 \r
-  slInline Vector2 AsVector2() const {return Vector2(x, y);}\r
+  slInline Vec2 AsVec2() const {return Vec2(x, y);}\r
 \r
   slInline float* AsFloatArray() {return &x;}\r
   slInline const float* AsFloatArray() const {return &x;}\r
@@ -47,27 +47,27 @@ struct Vector3
 \r
 \r
 //----------------------------------------------------------------------------------------\r
-struct Vector4\r
+struct Vec4\r
 {\r
   float x;\r
   float y;\r
   float z;\r
   float w;\r
 \r
-  slInline explicit Vector4() {}\r
-  slInline explicit Vector4(const float xyzw) {x = xyzw; y = xyzw; z = xyzw; w = xyzw;}\r
-  slInline explicit Vector4(const float xyz, const float iw) {x = xyz; y = xyz; z = xyz; w = iw;}\r
-  slInline explicit Vector4(const float ix, const float iy, const float iz, const float iw) {x = ix; y = iy; z = iz; w = iw;}\r
+  slInline explicit Vec4() {}\r
+  slInline explicit Vec4(const float xyzw) {x = xyzw; y = xyzw; z = xyzw; w = xyzw;}\r
+  slInline explicit Vec4(const float xyz, const float iw) {x = xyz; y = xyz; z = xyz; w = iw;}\r
+  slInline explicit Vec4(const float ix, const float iy, const float iz, const float iw) {x = ix; y = iy; z = iz; w = iw;}\r
 \r
-  slInline explicit Vector4(const Vector2& u, const Vector2& v) {x = u.x; y = u.y; z = v.x; w = v.y;}\r
-  slInline explicit Vector4(const Vector2& v, const float iz, const float iw) {x = v.x; y = v.y; z = iz; w = iw;}\r
+  slInline explicit Vec4(const Vec2& u, const Vec2& v) {x = u.x; y = u.y; z = v.x; w = v.y;}\r
+  slInline explicit Vec4(const Vec2& v, const float iz, const float iw) {x = v.x; y = v.y; z = iz; w = iw;}\r
 \r
-  slInline explicit Vector4(const Vector3& v, const float iw) {x = v.x; y = v.y; z = v.z; w = iw;}\r
+  slInline explicit Vec4(const Vec3& v, const float iw) {x = v.x; y = v.y; z = v.z; w = iw;}\r
 \r
-  slInline Vector4(const Vector4& v) {x = v.x; y = v.y; z = v.z; w = v.w;} // copy constructor\r
+  slInline Vec4(const Vec4& v) {x = v.x; y = v.y; z = v.z; w = v.w;} // copy constructor\r
 \r
-  slInline Vector2 AsVector2() const {return Vector2(x, y);}\r
-  slInline Vector3 AsVector3() const {return Vector3(x, y, z);}\r
+  slInline Vec2 AsVec2() const {return Vec2(x, y);}\r
+  slInline Vec3 AsVec3() const {return Vec3(x, y, z);}\r
 \r
   slInline float* AsFloatArray() {return &x;}\r
   slInline const float* AsFloatArray() const {return &x;}\r
@@ -85,43 +85,43 @@ struct Quaternion
   float s;\r
 \r
   slInline explicit Quaternion() {}\r
-  explicit Quaternion(const float angle, const Vector3& normalized_axis);\r
+  explicit Quaternion(const float angle, const Vec3& normalized_axis);\r
   explicit Quaternion(const float angle, const float x, const float y, const float z);\r
 \r
   slInline Quaternion(const Quaternion& q) {i = q.i; j = q.j; k = q.k; s = q.s;}\r
 \r
-  Vector4 AsVector4();\r
+  Vec4 AsVec4();\r
   slInline float* AsFloatArray() {return &i;}\r
 \r
-  Vector3 GetImaginary();\r
+  Vec3 GetImaginary();\r
   slInline float GetReal() {return s;}\r
 };\r
 \r
-slInline Quaternion::Quaternion(const float angle, const Vector3& normalized_axis)\r
+slInline Quaternion::Quaternion(const float angle, const Vec3& normalized_axis)\r
 {\r
-  Assert( EpsilonEquals(LengthVector3(normalized_axis), 1.0f, kEpsilon) );\r
+  Assert( EpsilonEquals(normalized_axis.x * normalized_axis.x + normalized_axis.y * normalized_axis.y + normalized_axis.z * normalized_axis.z, 1.0f, kSqrtEpsilon) );\r
   float half_angle = angle * 0.5f;\r
-  float sin_half_angle = Sinf(half_angle);\r
+  float sin_half_angle = (float)Sinf(half_angle);\r
   i = normalized_axis.x * sin_half_angle;\r
   j = normalized_axis.y * sin_half_angle;\r
   k = normalized_axis.z * sin_half_angle;\r
-  s = Cosf(half_angle);\r
+  s = (float)Cosf(half_angle);\r
 }\r
 \r
 slInline Quaternion::Quaternion(const float angle, const float x, const float y, const float z)\r
 {\r
   Assert( EpsilonEquals(x * x + y * y + z * z, 1.0f, kSqrtEpsilon) );\r
   float half_angle = angle * 0.5f;\r
-  float sin_half_angle = Sinf(half_angle);\r
+  float sin_half_angle = (float)Sinf(half_angle);\r
   i = x * sin_half_angle;\r
   j = y * sin_half_angle;\r
   k = z * sin_half_angle;\r
-  s = Cosf(half_angle);\r
+  s = (float)Cosf(half_angle);\r
 }\r
 \r
-Vector4 Quaternion::AsVector4()\r
+Vec4 Quaternion::AsVec4()\r
 {\r
-  Vector4 r;\r
+  Vec4 r;\r
   r.x = i;\r
   r.y = j;\r
   r.z = k;\r
@@ -129,9 +129,9 @@ Vector4 Quaternion::AsVector4()
   return r;\r
 }\r
 \r
-Vector3 Quaternion::GetImaginary()\r
+Vec3 Quaternion::GetImaginary()\r
 {\r
-  Vector3 r;\r
+  Vec3 r;\r
   r.x = i;\r
   r.y = j;\r
   r.z = k;\r
@@ -140,35 +140,35 @@ Vector3 Quaternion::GetImaginary()
 \r
 \r
 //----------------------------------------------------------------------------------------\r
-struct Matrix3\r
+struct Mat3\r
 {\r
-  Vector3 v[3];\r
+  Vec3 v[3];\r
 \r
-  slInline explicit Matrix3() {}\r
-  explicit Matrix3(const Vector3& v0, const Vector3& v1, const Vector3& v2);\r
-  explicit Matrix3(const float v00, const float v01, const float v02,\r
-                   const float v10, const float v11, const float v12,\r
-                   const float v20, const float v21, const float v22);\r
-  Matrix3(Matrix3& m); // copy constructor\r
+  slInline explicit Mat3() {}\r
+  explicit Mat3(const Vec3& v0, const Vec3& v1, const Vec3& v2);\r
+  explicit Mat3(const float v00, const float v01, const float v02,\r
+                const float v10, const float v11, const float v12,\r
+                const float v20, const float v21, const float v22);\r
+  Mat3(const Mat3& m); // copy constructor\r
 \r
   float* AsFloatArray() {return &v[0].x;}\r
 };\r
 \r
-slInline Matrix3::Matrix3(const Vector3& v0, const Vector3& v1, const Vector3& v2)\r
+slInline Mat3::Mat3(const Vec3& v0, const Vec3& v1, const Vec3& v2)\r
 {\r
   v[0] = v0;\r
   v[1] = v1;\r
   v[2] = v2;\r
 }\r
 \r
-slInline Matrix3::Matrix3(const float v00, const float v01, const float v02, const float v10, const float v11, const float v12, const float v20, const float v21, const float v22)\r
+slInline Mat3::Mat3(const float v00, const float v01, const float v02, const float v10, const float v11, const float v12, const float v20, const float v21, const float v22)\r
 {\r
   v[0].x = v00; v[0].y = v01; v[0].z = v02;\r
   v[1].x = v10; v[1].y = v11; v[1].z = v12;\r
   v[2].x = v20; v[2].y = v21; v[2].z = v22;\r
 }\r
 \r
-slInline Matrix3::Matrix3(Matrix3& m)\r
+slInline Mat3::Mat3(const Mat3& m)\r
 {\r
   v[0] = m.v[0];\r
   v[1] = m.v[1];\r
@@ -177,23 +177,23 @@ slInline Matrix3::Matrix3(Matrix3& m)
 \r
 \r
 //----------------------------------------------------------------------------------------\r
-struct Matrix4\r
+struct Mat4\r
 {\r
-  Vector4 v[4];\r
+  Vec4 v[4];\r
 \r
-  slInline explicit Matrix4() {}\r
-  explicit Matrix4(const Vector4& v0, const Vector4& v1, const Vector4& v2, const Vector4& v3);\r
-  explicit Matrix4(const float v00, const float v01, const float v02, const float v03,\r
-                   const float v10, const float v11, const float v12, const float v13,\r
-                   const float v20, const float v21, const float v22, const float v23,\r
-                   const float v30, const float v31, const float v32, const float v33);\r
-  explicit Matrix4(const Matrix3& m);\r
-  Matrix4(const Matrix4& m); // copy constructor\r
+  slInline explicit Mat4() {}\r
+  explicit Mat4(const Vec4& v0, const Vec4& v1, const Vec4& v2, const Vec4& v3);\r
+  explicit Mat4(const float v00, const float v01, const float v02, const float v03,\r
+                const float v10, const float v11, const float v12, const float v13,\r
+                const float v20, const float v21, const float v22, const float v23,\r
+                const float v30, const float v31, const float v32, const float v33);\r
+  explicit Mat4(const Mat3& m);\r
+  Mat4(const Mat4& m); // copy constructor\r
 \r
   float* AsFloatArray() {return &v[0].x;}\r
 };\r
 \r
-slInline Matrix4::Matrix4(const Vector4& v0, const Vector4& v1, const Vector4& v2, const Vector4& v3)\r
+slInline Mat4::Mat4(const Vec4& v0, const Vec4& v1, const Vec4& v2, const Vec4& v3)\r
 {\r
   v[0] = v0;\r
   v[1] = v1;\r
@@ -201,7 +201,7 @@ slInline Matrix4::Matrix4(const Vector4& v0, const Vector4& v1, const Vector4& v
   v[3] = v3;\r
 }\r
 \r
-slInline Matrix4::Matrix4(const float v00, const float v01, const float v02, const float v03, const float v10, const float v11, const float v12, const float v13, const float v20, const float v21, const float v22, const float v23, const float v30, const float v31, const float v32, const float v33)\r
+slInline Mat4::Mat4(const float v00, const float v01, const float v02, const float v03, const float v10, const float v11, const float v12, const float v13, const float v20, const float v21, const float v22, const float v23, const float v30, const float v31, const float v32, const float v33)\r
 {\r
   v[0].x = v00; v[0].y = v01; v[0].z = v02; v[0].w = v03;\r
   v[1].x = v10; v[1].y = v11; v[1].z = v12; v[1].w = v13;\r
@@ -209,7 +209,7 @@ slInline Matrix4::Matrix4(const float v00, const float v01, const float v02, con
   v[3].x = v30; v[3].y = v31; v[3].z = v32; v[3].w = v33;\r
 }\r
 \r
-slInline Matrix4::Matrix4(const Matrix3& m)\r
+slInline Mat4::Mat4(const Mat3& m)\r
 {\r
   v[0].x = m.v[0].x; v[0].y = m.v[0].y; v[0].z = m.v[0].z; v[0].w = 0.0f;\r
   v[1].x = m.v[1].x; v[1].y = m.v[1].y; v[1].z = m.v[1].z; v[1].w = 0.0f;\r
@@ -217,7 +217,7 @@ slInline Matrix4::Matrix4(const Matrix3& m)
   v[3].x = 0.0f;     v[3].y = 0.0f;     v[3].z = 0.0f;     v[3].w = 1.0f;\r
 }\r
 \r
-slInline Matrix4::Matrix4(const Matrix4& m)\r
+slInline Mat4::Mat4(const Mat4& m)\r
 {\r
   v[0] = m.v[0];\r
   v[1] = m.v[1];\r
@@ -227,18 +227,18 @@ slInline Matrix4::Matrix4(const Matrix4& m)
 \r
 \r
 //----------------------------------------------------------------------------------------\r
-typedef ALIGN(8)  Vector2  AlignedVector2;\r
-typedef ALIGN(16) Vector3  AlignedVector3;\r
-typedef ALIGN(16) Vector4  AlignedVector4;\r
+typedef MEM_ALIGN(8)  Vec2  AlignedVec2;\r
+typedef MEM_ALIGN(16) Vec3  AlignedVec3;\r
+typedef MEM_ALIGN(16) Vec4  AlignedVec4;\r
 \r
-typedef ALIGN(64) Matrix3  AlignedMatrix3;\r
-typedef ALIGN(64) Matrix4  AlignedMatrix4;\r
+typedef MEM_ALIGN(64) Mat3  AlignedMat3;\r
+typedef MEM_ALIGN(64) Mat4  AlignedMat4;\r
 \r
 \r
 //----------------------------------------------------------------------------------------\r
 // SIMD Structures\r
 //----------------------------------------------------------------------------------------\r
-struct Vector2SOA\r
+struct Vec2SOA\r
 {\r
   uint32_t m_Count;\r
   uint32_t m_MaxCount;\r
@@ -246,13 +246,13 @@ struct Vector2SOA
   float* m_X;\r
   float* m_Y;\r
 \r
-  slInline explicit Vector2SOA() {m_Count = 0; m_MaxCount = 0; m_X = NULL; m_Y = NULL;}\r
-  bool InitVector2SOA(float* buffer, uint32_t buffer_size);\r
+  slInline explicit Vec2SOA() {m_Count = 0; m_MaxCount = 0; m_X = NULL; m_Y = NULL;}\r
+  bool InitVec2SOA(float* buffer, uint32_t buffer_size);\r
 \r
-  void GetVector2AtIndex(Vector2& v, uint32_t index) {Assert(index < m_Count); v.x = m_X[index]; v.y = m_Y[index];}\r
+  void GetVec2AtIndex(Vec2& v, uint32_t index) {Assert(index < m_Count); v.x = m_X[index]; v.y = m_Y[index];}\r
 };\r
 \r
-slInline bool Vector2SOA::InitVector2SOA(float* buffer, uint32_t max_count)\r
+slInline bool Vec2SOA::InitVec2SOA(float* buffer, uint32_t max_count)\r
 {\r
   m_Count = 0;\r
 \r
@@ -280,17 +280,17 @@ slInline bool Vector2SOA::InitVector2SOA(float* buffer, uint32_t max_count)
 \r
 \r
 //----------------------------------------------------------------------------------------\r
-struct Vector3SOA : public Vector2SOA\r
+struct Vec3SOA : public Vec2SOA\r
 {\r
   float* m_Z;\r
 \r
-  slInline explicit Vector3SOA() {m_Count = 0; m_MaxCount = 0; m_X = NULL; m_Y = NULL; m_Z = NULL;}\r
-  bool InitVector3SOA(float* buffer, uint32_t buffer_size);\r
+  slInline explicit Vec3SOA() {m_Count = 0; m_MaxCount = 0; m_X = NULL; m_Y = NULL; m_Z = NULL;}\r
+  bool InitVec3SOA(float* buffer, uint32_t buffer_size);\r
 \r
-  void GetVector3AtIndex(Vector3& v, uint32_t index) {Assert(index < m_Count); v.x = m_X[index]; v.y = m_Y[index]; v.z = m_Z[index];}\r
+  void GetVec3AtIndex(Vec3& v, uint32_t index) {Assert(index < m_Count); v.x = m_X[index]; v.y = m_Y[index]; v.z = m_Z[index];}\r
 };\r
 \r
-slInline bool Vector3SOA::InitVector3SOA(float* buffer, uint32_t max_count)\r
+slInline bool Vec3SOA::InitVec3SOA(float* buffer, uint32_t max_count)\r
 {\r
   m_Count = 0;\r
 \r
@@ -321,17 +321,17 @@ slInline bool Vector3SOA::InitVector3SOA(float* buffer, uint32_t max_count)
 \r
 \r
 //----------------------------------------------------------------------------------------\r
-struct Vector4SOA : public Vector3SOA\r
+struct Vec4SOA : public Vec3SOA\r
 {\r
   float* m_W;\r
 \r
-  slInline explicit Vector4SOA() {m_Count = 0; m_MaxCount = 0; m_X = NULL; m_Y = NULL; m_Z = NULL; m_W = NULL;}\r
-  bool InitVector4SOA(float* buffer, uint32_t buffer_size);\r
+  slInline explicit Vec4SOA() {m_Count = 0; m_MaxCount = 0; m_X = NULL; m_Y = NULL; m_Z = NULL; m_W = NULL;}\r
+  bool InitVec4SOA(float* buffer, uint32_t buffer_size);\r
 \r
-  void GetVector4AtIndex(Vector4& v, uint32_t index) {Assert(index < m_Count); v.x = m_X[index]; v.y = m_Y[index]; v.z = m_Z[index]; v.w = m_W[index];}\r
+  void GetVec4AtIndex(Vec4& v, uint32_t index) {Assert(index < m_Count); v.x = m_X[index]; v.y = m_Y[index]; v.z = m_Z[index]; v.w = m_W[index];}\r
 };\r
 \r
-slInline bool Vector4SOA::InitVector4SOA(float* buffer, uint32_t max_count)\r
+slInline bool Vec4SOA::InitVec4SOA(float* buffer, uint32_t max_count)\r
 {\r
   m_Count = 0;\r
 \r
index 37e5362..40e2a70 100755 (executable)
 //----------------------------------------------------------------------------------------\r
 \r
 //----------------------------------------------------------------------------------------\r
-// Matrix3\r
+// Mat3\r
 //----------------------------------------------------------------------------------------\r
-void SetMatrix3(Matrix3& r, const Matrix3& a);\r
-void SetMatrix3(Matrix3& r, const Vector3& v0, const Vector3& v1, const Vector3& v2);\r
+void SetMat3(Mat3& r, const Mat3& a);\r
+void SetMat3(Mat3& r, const Vec3& v0, const Vec3& v1, const Vec3& v2);\r
 \r
-void ScaleMatrix3(Matrix3& r, const float s, const Matrix3& a);\r
-Matrix3 ScaleMatrix3(const float s, const Matrix3& a);\r
+void ScaleMat3(Mat3& r, const float s, const Mat3& a);\r
+Mat3 ScaleMat3(const float s, const Mat3& a);\r
 \r
-float DeterminantOfMatrix3(const Matrix3& a);\r
+float DeterminantOfMat3(const Mat3& a);\r
 \r
-void TransposeMatrix3(Matrix3& r, const Matrix3& a);\r
-Matrix3 TransposeMatrix3(const Matrix3& a);\r
+void TransposeMat3(Mat3& r, const Mat3& a);\r
+Mat3 TransposeMat3(const Mat3& a);\r
 \r
-void InvertAffineMatrix3(Matrix3& r, const Matrix3& a);\r
-Matrix3 InvertAffineMatrix3(const Matrix3& a);\r
+void InvertAffineMat3(Mat3& r, const Mat3& a);\r
+Mat3 InvertAffineMat3(const Mat3& a);\r
 \r
-void InvertGeneralMatrix3(Matrix3& r, const Matrix3& a);\r
-Matrix3 InvertGeneralMatrix3(const Matrix3& a);\r
+void InvertGeneralMat3(Mat3& r, const Mat3& a);\r
+Mat3 InvertGeneralMat3(const Mat3& a);\r
 \r
-void MulMatrix3(Matrix3& r, const Matrix3& a, const Matrix3& b);\r
-Matrix3 MulMatrix3(const Matrix3& a, const Matrix3& b);\r
+void MulMat3(Mat3& r, const Mat3& a, const Mat3& b);\r
+Mat3 MulMat3(const Mat3& a, const Mat3& b);\r
 \r
-void MulMatrix3ByTransposedMatrix3(Matrix3& r, const Matrix3& a, const Matrix3& b);\r
-Matrix3 MulMatrix3ByTransposedMatrix3(const Matrix3& a, const Matrix3& b);\r
+void MulMat3ByTransposedMat3(Mat3& r, const Mat3& a, const Mat3& b);\r
+Mat3 MulMat3ByTransposedMat3(const Mat3& a, const Mat3& b);\r
 \r
-void MulVector3ByMatrix3(Vector3& r, const Vector3& v, const Matrix3& a);\r
-Vector3 MulVector3ByMatrix3(const Vector3& v, const Matrix3& a);\r
+void MulVec3ByMat3(Vec3& r, const Vec3& v, const Mat3& a);\r
+Vec3 MulVec3ByMat3(const Vec3& v, const Mat3& a);\r
 \r
 //----------------------------------------------------------------------------------------\r
-slInline void SetMatrix3(Matrix3& r, const Matrix3& a)\r
+slInline void SetMat3(Mat3& r, const Mat3& a)\r
 {\r
   r.v[0] = a.v[0];\r
   r.v[1] = a.v[1];\r
@@ -58,7 +58,7 @@ slInline void SetMatrix3(Matrix3& r, const Matrix3& a)
 }\r
 \r
 //----------------------------------------------------------------------------------------\r
-slInline void SetMatrix3(Matrix3& r, const Vector3& v0, const Vector3& v1, const Vector3& v2)\r
+slInline void SetMat3(Mat3& r, const Vec3& v0, const Vec3& v1, const Vec3& v2)\r
 {\r
   r.v[0] = v0;\r
   r.v[1] = v1;\r