joybox 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +27 -0
- data/LICENSE +22 -0
- data/README.md +86 -0
- data/Rakefile +14 -0
- data/app/app_delegate.rb +49 -0
- data/app/layers/box2d_layer.rb +109 -0
- data/app/layers/cocos2d_layer.rb +14 -0
- data/app/layers/cocos_motion_layer.rb +145 -0
- data/app/layers/menu_layer.rb +59 -0
- data/joybox.gemspec +25 -0
- data/lib/joybox.rb +47 -0
- data/lib/joybox/box2d/body.rb +106 -0
- data/lib/joybox/box2d/world.rb +79 -0
- data/lib/joybox/cocos2d/actions/actions.rb +7 -0
- data/lib/joybox/cocos2d/actions/move.rb +31 -0
- data/lib/joybox/cocos2d/actions/repeat.rb +24 -0
- data/lib/joybox/cocos2d/actions/rotate.rb +31 -0
- data/lib/joybox/cocos2d/actions/scale.rb +31 -0
- data/lib/joybox/cocos2d/actions/sequence.rb +22 -0
- data/lib/joybox/cocos2d/actions/skew.rb +36 -0
- data/lib/joybox/cocos2d/cocos2d.rb +15 -0
- data/lib/joybox/cocos2d/common/cg_point.rb +37 -0
- data/lib/joybox/cocos2d/common/color.rb +49 -0
- data/lib/joybox/cocos2d/common/gc_size.rb +39 -0
- data/lib/joybox/cocos2d/common/ns_set.rb +5 -0
- data/lib/joybox/cocos2d/common/numeric.rb +14 -0
- data/lib/joybox/cocos2d/common/screen.rb +39 -0
- data/lib/joybox/cocos2d/common/ui_touch.rb +15 -0
- data/lib/joybox/cocos2d/configuration/configuration.rb +68 -0
- data/lib/joybox/cocos2d/configuration/file_utils.rb +33 -0
- data/lib/joybox/cocos2d/configuration/gl_view.rb +44 -0
- data/lib/joybox/cocos2d/configuration/texture_2d.rb +27 -0
- data/lib/joybox/cocos2d/core/layer.rb +87 -0
- data/lib/joybox/cocos2d/core/node.rb +26 -0
- data/lib/joybox/cocos2d/core/physics_sprite.rb +52 -0
- data/lib/joybox/cocos2d/core/scene.rb +24 -0
- data/lib/joybox/cocos2d/core/sprite.rb +43 -0
- data/lib/joybox/cocos2d/core/sprite_batch.rb +24 -0
- data/lib/joybox/cocos2d/director.rb +43 -0
- data/lib/joybox/cocos2d/macros.rb +234 -0
- data/lib/joybox/cocos2d/ui/label.rb +34 -0
- data/lib/joybox/cocos2d/ui/menu.rb +25 -0
- data/lib/joybox/cocos2d/ui/menu_image.rb +22 -0
- data/lib/joybox/cocos2d/ui/menu_label.rb +45 -0
- data/lib/joybox/cocos2d/ui/ui.rb +7 -0
- data/lib/joybox/version.rb +3 -0
- data/resources/box2d/blocks_sprite_sheet.png +0 -0
- data/resources/cocos_motion/dot.png +0 -0
- data/resources/cocos_motion/dot_selected.png +0 -0
- data/resources/cocos_motion/grossini.png +0 -0
- data/resources/cocos_motion/grossinis_sister.png +0 -0
- data/resources/cocos_motion/grossinis_sister_two.png +0 -0
- data/resources/cocos_motion/left_arrow.png +0 -0
- data/resources/cocos_motion/left_arrow_selected.png +0 -0
- data/resources/cocos_motion/right_arrow.png +0 -0
- data/resources/cocos_motion/right_arrow_selected.png +0 -0
- data/resources/fps_images-hd.png +0 -0
- data/resources/fps_images-ipadhd.png +0 -0
- data/resources/fps_images.png +0 -0
- data/spec/lib/joybox/cocos2d/cocos2d_spec.rb +7 -0
- data/spec/lib/joybox/cocos2d/macros_spec.rb +37 -0
- data/spec/main_spec.rb +9 -0
- data/vendor/Box2D.framework/Box2D +0 -0
- data/vendor/Box2D.framework/Box2D.framework.bridgesupport +166 -0
- data/vendor/Box2D.framework/Versions/A/Box2D +0 -0
- data/vendor/Box2D.framework/Versions/A/Headers/Collision/B2DContactListener.h +25 -0
- data/vendor/Box2D.framework/Versions/A/Headers/Collision/Shapes/B2DEdgeShape.h +17 -0
- data/vendor/Box2D.framework/Versions/A/Headers/Collision/Shapes/B2DPolygonShape.h +16 -0
- data/vendor/Box2D.framework/Versions/A/Headers/Collision/Shapes/B2DShape.h +15 -0
- data/vendor/Box2D.framework/Versions/A/Headers/Dynamics/B2DBody.h +43 -0
- data/vendor/Box2D.framework/Versions/A/Headers/Dynamics/B2DWorld.h +41 -0
- data/vendor/Box2D.framework/Versions/A/Resources/Box2DConfig.cmake +3 -0
- data/vendor/Box2D.framework/Versions/A/Resources/CMakeLists.txt +205 -0
- data/vendor/Cocos2D/Cocos2D.bridgesupport +7808 -0
- data/vendor/Cocos2D/include/CCAction.h +195 -0
- data/vendor/Cocos2D/include/CCActionCamera.h +73 -0
- data/vendor/Cocos2D/include/CCActionCatmullRom.h +139 -0
- data/vendor/Cocos2D/include/CCActionEase.h +159 -0
- data/vendor/Cocos2D/include/CCActionGrid.h +165 -0
- data/vendor/Cocos2D/include/CCActionGrid3D.h +205 -0
- data/vendor/Cocos2D/include/CCActionInstant.h +227 -0
- data/vendor/Cocos2D/include/CCActionInterval.h +431 -0
- data/vendor/Cocos2D/include/CCActionManager.h +113 -0
- data/vendor/Cocos2D/include/CCActionPageTurn3D.h +42 -0
- data/vendor/Cocos2D/include/CCActionProgressTimer.h +59 -0
- data/vendor/Cocos2D/include/CCActionTiledGrid.h +211 -0
- data/vendor/Cocos2D/include/CCActionTween.h +62 -0
- data/vendor/Cocos2D/include/CCAnimation.h +150 -0
- data/vendor/Cocos2D/include/CCAnimationCache.h +74 -0
- data/vendor/Cocos2D/include/CCArray.h +119 -0
- data/vendor/Cocos2D/include/CCAtlasNode.h +96 -0
- data/vendor/Cocos2D/include/CCCamera.h +98 -0
- data/vendor/Cocos2D/include/CCConfiguration.h +126 -0
- data/vendor/Cocos2D/include/CCDirector.h +344 -0
- data/vendor/Cocos2D/include/CCDirectorIOS.h +104 -0
- data/vendor/Cocos2D/include/CCDrawingPrimitives.h +139 -0
- data/vendor/Cocos2D/include/CCES2Renderer.h +83 -0
- data/vendor/Cocos2D/include/CCESRenderer.h +54 -0
- data/vendor/Cocos2D/include/CCFileUtils.h +188 -0
- data/vendor/Cocos2D/include/CCGL.h +72 -0
- data/vendor/Cocos2D/include/CCGLProgram.h +150 -0
- data/vendor/Cocos2D/include/CCGLView.h +160 -0
- data/vendor/Cocos2D/include/CCGrabber.h +44 -0
- data/vendor/Cocos2D/include/CCGrid.h +130 -0
- data/vendor/Cocos2D/include/CCLabelAtlas.h +68 -0
- data/vendor/Cocos2D/include/CCLabelBMFont.h +216 -0
- data/vendor/Cocos2D/include/CCLabelTTF.h +132 -0
- data/vendor/Cocos2D/include/CCLayer.h +280 -0
- data/vendor/Cocos2D/include/CCMenu.h +100 -0
- data/vendor/Cocos2D/include/CCMenuItem.h +423 -0
- data/vendor/Cocos2D/include/CCMotionStreak.h +87 -0
- data/vendor/Cocos2D/include/CCNS.h +54 -0
- data/vendor/Cocos2D/include/CCNode+Debug.h +39 -0
- data/vendor/Cocos2D/include/CCNode.h +569 -0
- data/vendor/Cocos2D/include/CCParallaxNode.h +50 -0
- data/vendor/Cocos2D/include/CCParticleBatchNode.h +99 -0
- data/vendor/Cocos2D/include/CCParticleExamples.h +95 -0
- data/vendor/Cocos2D/include/CCParticleSystem.h +453 -0
- data/vendor/Cocos2D/include/CCParticleSystemQuad.h +73 -0
- data/vendor/Cocos2D/include/CCProfiling.h +89 -0
- data/vendor/Cocos2D/include/CCProgressTimer.h +94 -0
- data/vendor/Cocos2D/include/CCProtocols.h +132 -0
- data/vendor/Cocos2D/include/CCRenderTexture.h +139 -0
- data/vendor/Cocos2D/include/CCScene.h +43 -0
- data/vendor/Cocos2D/include/CCScheduler.h +230 -0
- data/vendor/Cocos2D/include/CCShaderCache.h +60 -0
- data/vendor/Cocos2D/include/CCSprite.h +288 -0
- data/vendor/Cocos2D/include/CCSpriteBatchNode.h +138 -0
- data/vendor/Cocos2D/include/CCSpriteFrame.h +126 -0
- data/vendor/Cocos2D/include/CCSpriteFrameCache.h +121 -0
- data/vendor/Cocos2D/include/CCTMXLayer.h +164 -0
- data/vendor/Cocos2D/include/CCTMXObjectGroup.h +67 -0
- data/vendor/Cocos2D/include/CCTMXTiledMap.h +145 -0
- data/vendor/Cocos2D/include/CCTMXXMLParser.h +217 -0
- data/vendor/Cocos2D/include/CCTexture2D.h +357 -0
- data/vendor/Cocos2D/include/CCTextureAtlas.h +188 -0
- data/vendor/Cocos2D/include/CCTextureCache.h +146 -0
- data/vendor/Cocos2D/include/CCTexturePVR.h +129 -0
- data/vendor/Cocos2D/include/CCTileMapAtlas.h +83 -0
- data/vendor/Cocos2D/include/CCTouchDelegateProtocol.h +75 -0
- data/vendor/Cocos2D/include/CCTouchDispatcher.h +120 -0
- data/vendor/Cocos2D/include/CCTouchHandler.h +93 -0
- data/vendor/Cocos2D/include/CCTransition.h +296 -0
- data/vendor/Cocos2D/include/CCTransitionPageTurn.h +60 -0
- data/vendor/Cocos2D/include/CCTransitionProgress.h +62 -0
- data/vendor/Cocos2D/include/CCVertex.h +36 -0
- data/vendor/Cocos2D/include/CGPointExtension.h +344 -0
- data/vendor/Cocos2D/include/CocosDenshion/CDAudioManager.h +243 -0
- data/vendor/Cocos2D/include/CocosDenshion/CDConfig.h +60 -0
- data/vendor/Cocos2D/include/CocosDenshion/CDOpenALSupport.h +77 -0
- data/vendor/Cocos2D/include/CocosDenshion/CDXPropertyModifierAction.h +45 -0
- data/vendor/Cocos2D/include/CocosDenshion/CocosDenshion.h +440 -0
- data/vendor/Cocos2D/include/CocosDenshion/SimpleAudioEngine.h +90 -0
- data/vendor/Cocos2D/include/NSThread+performBlock.h +22 -0
- data/vendor/Cocos2D/include/OpenGL_Internal.h +86 -0
- data/vendor/Cocos2D/include/RubyMotionSchedule.h +7 -0
- data/vendor/Cocos2D/include/TGAlib.h +55 -0
- data/vendor/Cocos2D/include/TransformUtils.h +36 -0
- data/vendor/Cocos2D/include/ZipUtils.h +91 -0
- data/vendor/Cocos2D/include/base64.h +33 -0
- data/vendor/Cocos2D/include/ccCArray.h +229 -0
- data/vendor/Cocos2D/include/ccConfig.h +245 -0
- data/vendor/Cocos2D/include/ccDeprecated.h +300 -0
- data/vendor/Cocos2D/include/ccGLStateCache.h +138 -0
- data/vendor/Cocos2D/include/ccMacros.h +353 -0
- data/vendor/Cocos2D/include/ccShader_PositionColor_frag.h +12 -0
- data/vendor/Cocos2D/include/ccShader_PositionColor_vert.h +17 -0
- data/vendor/Cocos2D/include/ccShader_PositionTextureA8Color_frag.h +16 -0
- data/vendor/Cocos2D/include/ccShader_PositionTextureA8Color_vert.h +21 -0
- data/vendor/Cocos2D/include/ccShader_PositionTextureColorAlphaTest_frag.h +23 -0
- data/vendor/Cocos2D/include/ccShader_PositionTextureColor_frag.h +14 -0
- data/vendor/Cocos2D/include/ccShader_PositionTextureColor_vert.h +22 -0
- data/vendor/Cocos2D/include/ccShader_PositionTexture_frag.h +13 -0
- data/vendor/Cocos2D/include/ccShader_PositionTexture_uColor_frag.h +16 -0
- data/vendor/Cocos2D/include/ccShader_PositionTexture_uColor_vert.h +18 -0
- data/vendor/Cocos2D/include/ccShader_PositionTexture_vert.h +17 -0
- data/vendor/Cocos2D/include/ccShader_Position_uColor_frag.h +12 -0
- data/vendor/Cocos2D/include/ccShader_Position_uColor_vert.h +19 -0
- data/vendor/Cocos2D/include/ccShaders.h +45 -0
- data/vendor/Cocos2D/include/ccTypes.h +374 -0
- data/vendor/Cocos2D/include/ccUtils.h +36 -0
- data/vendor/Cocos2D/include/cocos2d.h +178 -0
- data/vendor/Cocos2D/include/kazmath/GL/mat4stack.h +51 -0
- data/vendor/Cocos2D/include/kazmath/GL/matrix.h +58 -0
- data/vendor/Cocos2D/include/kazmath/aabb.h +53 -0
- data/vendor/Cocos2D/include/kazmath/kazmath.h +39 -0
- data/vendor/Cocos2D/include/kazmath/mat3.h +75 -0
- data/vendor/Cocos2D/include/kazmath/mat4.h +93 -0
- data/vendor/Cocos2D/include/kazmath/neon_matrix_impl.h +41 -0
- data/vendor/Cocos2D/include/kazmath/plane.h +70 -0
- data/vendor/Cocos2D/include/kazmath/quaternion.h +113 -0
- data/vendor/Cocos2D/include/kazmath/ray2.h +50 -0
- data/vendor/Cocos2D/include/kazmath/utility.h +74 -0
- data/vendor/Cocos2D/include/kazmath/vec2.h +64 -0
- data/vendor/Cocos2D/include/kazmath/vec3.h +68 -0
- data/vendor/Cocos2D/include/kazmath/vec4.h +68 -0
- data/vendor/Cocos2D/include/uthash.h +972 -0
- data/vendor/Cocos2D/include/utlist.h +490 -0
- data/vendor/Cocos2D/libCocosDenshion.a +0 -0
- data/vendor/Cocos2D/libcocos2d.a +0 -0
- metadata +277 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2008, Luke Benstead.
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
6
|
+
are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
9
|
+
this list of conditions and the following disclaimer.
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
15
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
16
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
17
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
18
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
19
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
20
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
21
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
22
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
23
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
#ifndef MAT4_H_INCLUDED
|
|
27
|
+
#define MAT4_H_INCLUDED
|
|
28
|
+
|
|
29
|
+
#include "utility.h"
|
|
30
|
+
|
|
31
|
+
struct kmVec3;
|
|
32
|
+
struct kmMat3;
|
|
33
|
+
struct kmQuaternion;
|
|
34
|
+
struct kmPlane;
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
A 4x4 matrix
|
|
38
|
+
|
|
39
|
+
| 0 4 8 12 |
|
|
40
|
+
mat = | 1 5 9 13 |
|
|
41
|
+
| 2 6 10 14 |
|
|
42
|
+
| 3 7 11 15 |
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
#ifdef __cplusplus
|
|
46
|
+
extern "C" {
|
|
47
|
+
#endif
|
|
48
|
+
|
|
49
|
+
typedef struct kmMat4 {
|
|
50
|
+
kmScalar mat[16];
|
|
51
|
+
} kmMat4;
|
|
52
|
+
|
|
53
|
+
kmMat4* const kmMat4Fill(kmMat4* pOut, const kmScalar* pMat);
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
kmMat4* const kmMat4Identity(kmMat4* pOut);
|
|
57
|
+
|
|
58
|
+
kmMat4* const kmMat4Inverse(kmMat4* pOut, const kmMat4* pM);
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
const int kmMat4IsIdentity(const kmMat4* pIn);
|
|
62
|
+
|
|
63
|
+
kmMat4* const kmMat4Transpose(kmMat4* pOut, const kmMat4* pIn);
|
|
64
|
+
kmMat4* const kmMat4Multiply(kmMat4* pOut, const kmMat4* pM1, const kmMat4* pM2);
|
|
65
|
+
|
|
66
|
+
kmMat4* const kmMat4Assign(kmMat4* pOut, const kmMat4* pIn);
|
|
67
|
+
const int kmMat4AreEqual(const kmMat4* pM1, const kmMat4* pM2);
|
|
68
|
+
|
|
69
|
+
kmMat4* const kmMat4RotationX(kmMat4* pOut, const kmScalar radians);
|
|
70
|
+
kmMat4* const kmMat4RotationY(kmMat4* pOut, const kmScalar radians);
|
|
71
|
+
kmMat4* const kmMat4RotationZ(kmMat4* pOut, const kmScalar radians);
|
|
72
|
+
kmMat4* const kmMat4RotationPitchYawRoll(kmMat4* pOut, const kmScalar pitch, const kmScalar yaw, const kmScalar roll);
|
|
73
|
+
kmMat4* const kmMat4RotationQuaternion(kmMat4* pOut, const struct kmQuaternion* pQ);
|
|
74
|
+
kmMat4* const kmMat4RotationTranslation(kmMat4* pOut, const struct kmMat3* rotation, const struct kmVec3* translation);
|
|
75
|
+
kmMat4* const kmMat4Scaling(kmMat4* pOut, const kmScalar x, const kmScalar y, const kmScalar z);
|
|
76
|
+
kmMat4* const kmMat4Translation(kmMat4* pOut, const kmScalar x, const kmScalar y, const kmScalar z);
|
|
77
|
+
|
|
78
|
+
struct kmVec3* const kmMat4GetUpVec3(struct kmVec3* pOut, const kmMat4* pIn);
|
|
79
|
+
struct kmVec3* const kmMat4GetRightVec3(struct kmVec3* pOut, const kmMat4* pIn);
|
|
80
|
+
struct kmVec3* const kmMat4GetForwardVec3(struct kmVec3* pOut, const kmMat4* pIn);
|
|
81
|
+
|
|
82
|
+
kmMat4* const kmMat4PerspectiveProjection(kmMat4* pOut, kmScalar fovY, kmScalar aspect, kmScalar zNear, kmScalar zFar);
|
|
83
|
+
kmMat4* const kmMat4OrthographicProjection(kmMat4* pOut, kmScalar left, kmScalar right, kmScalar bottom, kmScalar top, kmScalar nearVal, kmScalar farVal);
|
|
84
|
+
kmMat4* const kmMat4LookAt(kmMat4* pOut, const struct kmVec3* pEye, const struct kmVec3* pCenter, const struct kmVec3* pUp);
|
|
85
|
+
|
|
86
|
+
kmMat4* const kmMat4RotationAxisAngle(kmMat4* pOut, const struct kmVec3* axis, kmScalar radians);
|
|
87
|
+
struct kmMat3* const kmMat4ExtractRotation(struct kmMat3* pOut, const kmMat4* pIn);
|
|
88
|
+
struct kmPlane* const kmMat4ExtractPlane(struct kmPlane* pOut, const kmMat4* pIn, const kmEnum plane);
|
|
89
|
+
struct kmVec3* const kmMat4RotationToAxisAngle(struct kmVec3* pAxis, kmScalar* radians, const kmMat4* pIn);
|
|
90
|
+
#ifdef __cplusplus
|
|
91
|
+
}
|
|
92
|
+
#endif
|
|
93
|
+
#endif /* MAT4_H_INCLUDED */
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
NEON math library for the iPhone / iPod touch
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2009 Justin Saunders
|
|
5
|
+
|
|
6
|
+
This software is provided 'as-is', without any express or implied warranty.
|
|
7
|
+
In no event will the authors be held liable for any damages arising
|
|
8
|
+
from the use of this software.
|
|
9
|
+
Permission is granted to anyone to use this software for any purpose,
|
|
10
|
+
including commercial applications, and to alter it and redistribute it freely,
|
|
11
|
+
subject to the following restrictions:
|
|
12
|
+
|
|
13
|
+
1. The origin of this software must not be misrepresented; you must
|
|
14
|
+
not claim that you wrote the original software. If you use this
|
|
15
|
+
software in a product, an acknowledgment in the product documentation
|
|
16
|
+
would be appreciated but is not required.
|
|
17
|
+
|
|
18
|
+
2. Altered source versions must be plainly marked as such, and must
|
|
19
|
+
not be misrepresented as being the original software.
|
|
20
|
+
|
|
21
|
+
3. This notice may not be removed or altered from any source distribution.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
#ifndef __NEON_MATRIX_IMPL_H__
|
|
25
|
+
#define __NEON_MATRIX_IMPL_H__
|
|
26
|
+
|
|
27
|
+
#ifdef __arm__
|
|
28
|
+
#include "arm/arch.h"
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Matrixes are assumed to be stored in column major format according to OpenGL
|
|
32
|
+
// specification.
|
|
33
|
+
|
|
34
|
+
// Multiplies two 4x4 matrices (a,b) outputing a 4x4 matrix (output)
|
|
35
|
+
void NEON_Matrix4Mul(const float* a, const float* b, float* output );
|
|
36
|
+
|
|
37
|
+
// Multiplies a 4x4 matrix (m) with a vector 4 (v), outputing a vector 4
|
|
38
|
+
void NEON_Matrix4Vector4Mul(const float* m, const float* v, float* output);
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
#endif // __NEON_MATRIX_IMPL_H__
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2008, Luke Benstead.
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
6
|
+
are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
9
|
+
this list of conditions and the following disclaimer.
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
15
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
16
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
17
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
18
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
19
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
20
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
21
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
22
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
23
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
#ifndef PLANE_H_INCLUDED
|
|
27
|
+
#define PLANE_H_INCLUDED
|
|
28
|
+
|
|
29
|
+
#define KM_PLANE_LEFT 0
|
|
30
|
+
#define KM_PLANE_RIGHT 1
|
|
31
|
+
#define KM_PLANE_BOTTOM 2
|
|
32
|
+
#define KM_PLANE_TOP 3
|
|
33
|
+
#define KM_PLANE_NEAR 4
|
|
34
|
+
#define KM_PLANE_FAR 5
|
|
35
|
+
|
|
36
|
+
#include "utility.h"
|
|
37
|
+
|
|
38
|
+
struct kmVec3;
|
|
39
|
+
struct kmVec4;
|
|
40
|
+
struct kmMat4;
|
|
41
|
+
|
|
42
|
+
typedef struct kmPlane {
|
|
43
|
+
kmScalar a, b, c, d;
|
|
44
|
+
} kmPlane;
|
|
45
|
+
|
|
46
|
+
#ifdef __cplusplus
|
|
47
|
+
extern "C" {
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
typedef enum POINT_CLASSIFICATION {
|
|
51
|
+
POINT_INFRONT_OF_PLANE = 0,
|
|
52
|
+
POINT_BEHIND_PLANE,
|
|
53
|
+
POINT_ON_PLANE,
|
|
54
|
+
} POINT_CLASSIFICATION;
|
|
55
|
+
|
|
56
|
+
const kmScalar kmPlaneDot(const kmPlane* pP, const struct kmVec4* pV);
|
|
57
|
+
const kmScalar kmPlaneDotCoord(const kmPlane* pP, const struct kmVec3* pV);
|
|
58
|
+
const kmScalar kmPlaneDotNormal(const kmPlane* pP, const struct kmVec3* pV);
|
|
59
|
+
kmPlane* const kmPlaneFromPointNormal(kmPlane* pOut, const struct kmVec3* pPoint, const struct kmVec3* pNormal);
|
|
60
|
+
kmPlane* const kmPlaneFromPoints(kmPlane* pOut, const struct kmVec3* p1, const struct kmVec3* p2, const struct kmVec3* p3);
|
|
61
|
+
kmVec3* const kmPlaneIntersectLine(struct kmVec3* pOut, const kmPlane* pP, const struct kmVec3* pV1, const struct kmVec3* pV2);
|
|
62
|
+
kmPlane* const kmPlaneNormalize(kmPlane* pOut, const kmPlane* pP);
|
|
63
|
+
kmPlane* const kmPlaneScale(kmPlane* pOut, const kmPlane* pP, kmScalar s);
|
|
64
|
+
const POINT_CLASSIFICATION kmPlaneClassifyPoint(const kmPlane* pIn, const kmVec3* pP); /** Classifys a point against a plane */
|
|
65
|
+
|
|
66
|
+
#ifdef __cplusplus
|
|
67
|
+
}
|
|
68
|
+
#endif
|
|
69
|
+
|
|
70
|
+
#endif // PLANE_H_INCLUDED
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2008, Luke Benstead.
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
6
|
+
are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
9
|
+
this list of conditions and the following disclaimer.
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
15
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
16
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
17
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
18
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
19
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
20
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
21
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
22
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
23
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
#ifndef QUATERNION_H_INCLUDED
|
|
27
|
+
#define QUATERNION_H_INCLUDED
|
|
28
|
+
|
|
29
|
+
#ifdef __cplusplus
|
|
30
|
+
extern "C" {
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
#include "utility.h"
|
|
34
|
+
|
|
35
|
+
struct kmMat4;
|
|
36
|
+
struct kmMat3;
|
|
37
|
+
struct kmVec3;
|
|
38
|
+
|
|
39
|
+
typedef struct kmQuaternion {
|
|
40
|
+
kmScalar x;
|
|
41
|
+
kmScalar y;
|
|
42
|
+
kmScalar z;
|
|
43
|
+
kmScalar w;
|
|
44
|
+
} kmQuaternion;
|
|
45
|
+
|
|
46
|
+
kmQuaternion* const kmQuaternionConjugate(kmQuaternion* pOut, const kmQuaternion* pIn); ///< Returns pOut, sets pOut to the conjugate of pIn
|
|
47
|
+
|
|
48
|
+
const kmScalar kmQuaternionDot(const kmQuaternion* q1, const kmQuaternion* q2); ///< Returns the dot product of the 2 quaternions
|
|
49
|
+
|
|
50
|
+
kmQuaternion* kmQuaternionExp(kmQuaternion* pOut, const kmQuaternion* pIn); ///< Returns the exponential of the quaternion
|
|
51
|
+
|
|
52
|
+
///< Makes the passed quaternion an identity quaternion
|
|
53
|
+
|
|
54
|
+
kmQuaternion* kmQuaternionIdentity(kmQuaternion* pOut);
|
|
55
|
+
|
|
56
|
+
///< Returns the inverse of the passed Quaternion
|
|
57
|
+
|
|
58
|
+
kmQuaternion* kmQuaternionInverse(kmQuaternion* pOut,
|
|
59
|
+
const kmQuaternion* pIn);
|
|
60
|
+
|
|
61
|
+
///< Returns true if the quaternion is an identity quaternion
|
|
62
|
+
|
|
63
|
+
int kmQuaternionIsIdentity(const kmQuaternion* pIn);
|
|
64
|
+
|
|
65
|
+
///< Returns the length of the quaternion
|
|
66
|
+
|
|
67
|
+
kmScalar kmQuaternionLength(const kmQuaternion* pIn);
|
|
68
|
+
|
|
69
|
+
///< Returns the length of the quaternion squared (prevents a sqrt)
|
|
70
|
+
|
|
71
|
+
kmScalar kmQuaternionLengthSq(const kmQuaternion* pIn);
|
|
72
|
+
|
|
73
|
+
///< Returns the natural logarithm
|
|
74
|
+
|
|
75
|
+
kmQuaternion* kmQuaternionLn(kmQuaternion* pOut, const kmQuaternion* pIn);
|
|
76
|
+
|
|
77
|
+
///< Multiplies 2 quaternions together
|
|
78
|
+
|
|
79
|
+
kmQuaternion* kmQuaternionMultiply(kmQuaternion* pOut, const kmQuaternion* q1, const kmQuaternion* q2);
|
|
80
|
+
|
|
81
|
+
///< Normalizes a quaternion
|
|
82
|
+
|
|
83
|
+
kmQuaternion* kmQuaternionNormalize(kmQuaternion* pOut, const kmQuaternion* pIn);
|
|
84
|
+
|
|
85
|
+
///< Rotates a quaternion around an axis
|
|
86
|
+
|
|
87
|
+
kmQuaternion* kmQuaternionRotationAxis(kmQuaternion* pOut, const struct kmVec3* pV, kmScalar angle);
|
|
88
|
+
|
|
89
|
+
///< Creates a quaternion from a rotation matrix
|
|
90
|
+
|
|
91
|
+
kmQuaternion* kmQuaternionRotationMatrix(kmQuaternion* pOut, const struct kmMat3* pIn);
|
|
92
|
+
|
|
93
|
+
///< Create a quaternion from yaw, pitch and roll
|
|
94
|
+
|
|
95
|
+
kmQuaternion* kmQuaternionRotationYawPitchRoll(kmQuaternion* pOut, kmScalar yaw, kmScalar pitch, kmScalar roll);
|
|
96
|
+
///< Interpolate between 2 quaternions
|
|
97
|
+
kmQuaternion* kmQuaternionSlerp(kmQuaternion* pOut, const kmQuaternion* q1, const kmQuaternion* q2, kmScalar t);
|
|
98
|
+
|
|
99
|
+
///< Get the axis and angle of rotation from a quaternion
|
|
100
|
+
void kmQuaternionToAxisAngle(const kmQuaternion* pIn, struct kmVec3* pVector, kmScalar* pAngle);
|
|
101
|
+
|
|
102
|
+
///< Scale a quaternion
|
|
103
|
+
kmQuaternion* kmQuaternionScale(kmQuaternion* pOut, const kmQuaternion* pIn, kmScalar s);
|
|
104
|
+
kmQuaternion* kmQuaternionAssign(kmQuaternion* pOut, const kmQuaternion* pIn);
|
|
105
|
+
kmQuaternion* kmQuaternionAdd(kmQuaternion* pOut, const kmQuaternion* pQ1, const kmQuaternion* pQ2);
|
|
106
|
+
kmQuaternion* kmQuaternionRotationBetweenVec3(kmQuaternion* pOut, const struct kmVec3* vec1, const struct kmVec3* vec2, const struct kmVec3* fallback);
|
|
107
|
+
struct kmVec3* kmQuaternionMultiplyVec3(struct kmVec3* pOut, const kmQuaternion* q, const struct kmVec3* v);
|
|
108
|
+
|
|
109
|
+
#ifdef __cplusplus
|
|
110
|
+
}
|
|
111
|
+
#endif
|
|
112
|
+
|
|
113
|
+
#endif
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2011, Luke Benstead.
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
6
|
+
are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
9
|
+
this list of conditions and the following disclaimer.
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
15
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
16
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
17
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
18
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
19
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
20
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
21
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
22
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
23
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
#ifndef RAY_2_H
|
|
27
|
+
#define RAY_2_H
|
|
28
|
+
|
|
29
|
+
#include "utility.h"
|
|
30
|
+
#include "vec2.h"
|
|
31
|
+
|
|
32
|
+
#ifdef __cplusplus
|
|
33
|
+
extern "C" {
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
typedef struct kmRay2 {
|
|
37
|
+
kmVec2 start;
|
|
38
|
+
kmVec2 dir;
|
|
39
|
+
} kmRay2;
|
|
40
|
+
|
|
41
|
+
void kmRay2Fill(kmRay2* ray, kmScalar px, kmScalar py, kmScalar vx, kmScalar vy);
|
|
42
|
+
kmBool kmRay2IntersectLineSegment(const kmRay2* ray, const kmVec2* p1, const kmVec2* p2, kmVec2* intersection);
|
|
43
|
+
kmBool kmRay2IntersectTriangle(const kmRay2* ray, const kmVec2* p1, const kmVec2* p2, const kmVec2* p3, kmVec2* intersection, kmVec2* normal_out);
|
|
44
|
+
kmBool kmRay2IntersectCircle(const kmRay2* ray, const kmVec2 centre, const kmScalar radius, kmVec2* intersection);
|
|
45
|
+
|
|
46
|
+
#ifdef __cplusplus
|
|
47
|
+
}
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
#endif
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2008, Luke Benstead.
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
6
|
+
are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
9
|
+
this list of conditions and the following disclaimer.
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
15
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
16
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
17
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
18
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
19
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
20
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
21
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
22
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
23
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
#ifndef UTILITY_H_INCLUDED
|
|
27
|
+
#define UTILITY_H_INCLUDED
|
|
28
|
+
|
|
29
|
+
#include <math.h>
|
|
30
|
+
|
|
31
|
+
#ifndef kmScalar
|
|
32
|
+
#define kmScalar float
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
#ifndef kmBool
|
|
36
|
+
#define kmBool unsigned char
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
#ifndef kmEnum
|
|
40
|
+
#define kmEnum unsigned int
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#ifndef KM_FALSE
|
|
44
|
+
#define KM_FALSE 0
|
|
45
|
+
#endif
|
|
46
|
+
|
|
47
|
+
#ifndef KM_TRUE
|
|
48
|
+
#define KM_TRUE 1
|
|
49
|
+
#endif
|
|
50
|
+
|
|
51
|
+
#define kmPI 3.141592f
|
|
52
|
+
#define kmPIOver180 0.017453f // PI / 180
|
|
53
|
+
#define kmPIUnder180 57.295779f // 180 / PI
|
|
54
|
+
#define kmEpsilon 1.0 / 64.0
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
#ifdef __cplusplus
|
|
59
|
+
extern "C" {
|
|
60
|
+
#endif
|
|
61
|
+
|
|
62
|
+
extern kmScalar kmSQR(kmScalar s);
|
|
63
|
+
extern kmScalar kmDegreesToRadians(kmScalar degrees);
|
|
64
|
+
extern kmScalar kmRadiansToDegrees(kmScalar radians);
|
|
65
|
+
|
|
66
|
+
extern kmScalar min(kmScalar lhs, kmScalar rhs);
|
|
67
|
+
extern kmScalar max(kmScalar lhs, kmScalar rhs);
|
|
68
|
+
extern kmBool kmAlmostEqual(kmScalar lhs, kmScalar rhs);
|
|
69
|
+
|
|
70
|
+
#ifdef __cplusplus
|
|
71
|
+
}
|
|
72
|
+
#endif
|
|
73
|
+
|
|
74
|
+
#endif /* UTILITY_H_INCLUDED */
|