mirror of https://github.com/axmolengine/axmol.git
Updated some files.
This commit is contained in:
parent
2b17a7276c
commit
931c42a621
|
@ -87,10 +87,10 @@ bool CCAtlasNode::initWithTileFile(const char *tile, unsigned int tileWidth, uns
|
|||
m_tBlendFunc.src = CC_BLEND_SRC;
|
||||
m_tBlendFunc.dst = CC_BLEND_DST;
|
||||
|
||||
// double retain to avoid the autorelease pool
|
||||
// also, using: self.textureAtlas supports re-initialization without leaking
|
||||
this->m_pTextureAtlas = new CCTextureAtlas();
|
||||
m_pTextureAtlas->initWithFile(tile, itemsToRender);
|
||||
CCTextureAtlas* pNewAtlas= new CCTextureAtlas();
|
||||
pNewAtlas->initWithFile(tile, itemsToRender);
|
||||
setTextureAtlas(pNewAtlas);
|
||||
pNewAtlas->release();
|
||||
|
||||
if (! m_pTextureAtlas)
|
||||
{
|
||||
|
@ -234,6 +234,7 @@ void CCAtlasNode::setTextureAtlas(CCTextureAtlas* var)
|
|||
CC_SAFE_RELEASE(m_pTextureAtlas);
|
||||
m_pTextureAtlas = var;
|
||||
}
|
||||
|
||||
CCTextureAtlas * CCAtlasNode::getTextureAtlas()
|
||||
{
|
||||
return m_pTextureAtlas;
|
||||
|
|
|
@ -839,8 +839,8 @@ void CCNode::setActionManager(CCActionManager* actionManager)
|
|||
{
|
||||
if( actionManager != m_pActionManager ) {
|
||||
this->stopAllActions();
|
||||
CC_SAFE_RELEASE(m_pActionManager);
|
||||
CC_SAFE_RETAIN(actionManager);
|
||||
CC_SAFE_RELEASE(m_pActionManager);
|
||||
m_pActionManager = actionManager;
|
||||
}
|
||||
}
|
||||
|
@ -890,8 +890,8 @@ void CCNode::setScheduler(CCScheduler* scheduler)
|
|||
{
|
||||
if( scheduler != m_pScheduler ) {
|
||||
this->unscheduleAllSelectors();
|
||||
CC_SAFE_RELEASE(m_pScheduler);
|
||||
CC_SAFE_RETAIN(scheduler);
|
||||
CC_SAFE_RELEASE(m_pScheduler);
|
||||
m_pScheduler = scheduler;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef KAZMATH_AABB_H_INCLUDED
|
||||
#define KAZMATH_AABB_H_INCLUDED
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "vec3.h"
|
||||
#include "utility.h"
|
||||
|
||||
|
@ -42,9 +43,9 @@ typedef struct kmAABB {
|
|||
kmVec3 max; /** The min corner of the box */
|
||||
} kmAABB;
|
||||
|
||||
const int kmAABBContainsPoint(const kmVec3* pPoint, const kmAABB* pBox);
|
||||
kmAABB* const kmAABBAssign(kmAABB* pOut, const kmAABB* pIn);
|
||||
kmAABB* const kmAABBScale(kmAABB* pOut, const kmAABB* pIn, kmScalar s);
|
||||
CC_DLL const int kmAABBContainsPoint(const kmVec3* pPoint, const kmAABB* pBox);
|
||||
CC_DLL kmAABB* const kmAABBAssign(kmAABB* pOut, const kmAABB* pIn);
|
||||
CC_DLL kmAABB* const kmAABBScale(kmAABB* pOut, const kmAABB* pIn, kmScalar s);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef MAT3_H_INCLUDED
|
||||
#define MAT3_H_INCLUDED
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "utility.h"
|
||||
|
||||
struct kmVec3;
|
||||
|
@ -40,33 +41,33 @@ typedef struct kmMat3{
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
kmMat3* const kmMat3Fill(kmMat3* pOut, const kmScalar* pMat);
|
||||
kmMat3* const kmMat3Adjugate(kmMat3* pOut, const kmMat3* pIn);
|
||||
kmMat3* const kmMat3Identity(kmMat3* pOut);
|
||||
kmMat3* const kmMat3Inverse(kmMat3* pOut, const kmScalar pDeterminate, const kmMat3* pM);
|
||||
const int kmMat3IsIdentity(const kmMat3* pIn);
|
||||
kmMat3* const kmMat3Transpose(kmMat3* pOut, const kmMat3* pIn);
|
||||
const kmScalar kmMat3Determinant(const kmMat3* pIn);
|
||||
kmMat3* const kmMat3Multiply(kmMat3* pOut, const kmMat3* pM1, const kmMat3* pM2);
|
||||
kmMat3* const kmMat3ScalarMultiply(kmMat3* pOut, const kmMat3* pM, const kmScalar pFactor);
|
||||
CC_DLL kmMat3* const kmMat3Fill(kmMat3* pOut, const kmScalar* pMat);
|
||||
CC_DLL kmMat3* const kmMat3Adjugate(kmMat3* pOut, const kmMat3* pIn);
|
||||
CC_DLL kmMat3* const kmMat3Identity(kmMat3* pOut);
|
||||
CC_DLL kmMat3* const kmMat3Inverse(kmMat3* pOut, const kmScalar pDeterminate, const kmMat3* pM);
|
||||
CC_DLL const int kmMat3IsIdentity(const kmMat3* pIn);
|
||||
CC_DLL kmMat3* const kmMat3Transpose(kmMat3* pOut, const kmMat3* pIn);
|
||||
CC_DLL const kmScalar kmMat3Determinant(const kmMat3* pIn);
|
||||
CC_DLL kmMat3* const kmMat3Multiply(kmMat3* pOut, const kmMat3* pM1, const kmMat3* pM2);
|
||||
CC_DLL kmMat3* const kmMat3ScalarMultiply(kmMat3* pOut, const kmMat3* pM, const kmScalar pFactor);
|
||||
|
||||
kmMat3* const kmMat3RotationAxisAngle(kmMat3* pOut, const struct kmVec3* axis, kmScalar radians);
|
||||
struct kmVec3* const kmMat3RotationToAxisAngle(struct kmVec3* pAxis, kmScalar* radians, const kmMat3* pIn);
|
||||
CC_DLL kmMat3* const kmMat3RotationAxisAngle(kmMat3* pOut, const struct kmVec3* axis, kmScalar radians);
|
||||
CC_DLL struct kmVec3* const kmMat3RotationToAxisAngle(struct kmVec3* pAxis, kmScalar* radians, const kmMat3* pIn);
|
||||
|
||||
kmMat3* const kmMat3Assign(kmMat3* pOut, const kmMat3* pIn);
|
||||
const int kmMat3AreEqual(const kmMat3* pM1, const kmMat3* pM2);
|
||||
CC_DLL kmMat3* const kmMat3Assign(kmMat3* pOut, const kmMat3* pIn);
|
||||
CC_DLL const int kmMat3AreEqual(const kmMat3* pM1, const kmMat3* pM2);
|
||||
|
||||
kmMat3* const kmMat3RotationX(kmMat3* pOut, const kmScalar radians);
|
||||
kmMat3* const kmMat3RotationY(kmMat3* pOut, const kmScalar radians);
|
||||
kmMat3* const kmMat3RotationZ(kmMat3* pOut, const kmScalar radians);
|
||||
CC_DLL kmMat3* const kmMat3RotationX(kmMat3* pOut, const kmScalar radians);
|
||||
CC_DLL kmMat3* const kmMat3RotationY(kmMat3* pOut, const kmScalar radians);
|
||||
CC_DLL kmMat3* const kmMat3RotationZ(kmMat3* pOut, const kmScalar radians);
|
||||
|
||||
kmMat3* const kmMat3Rotation(kmMat3* pOut, const kmScalar radians);
|
||||
kmMat3* const kmMat3Scaling(kmMat3* pOut, const kmScalar x, const kmScalar y);
|
||||
kmMat3* const kmMat3Translation(kmMat3* pOut, const kmScalar x, const kmScalar y);
|
||||
CC_DLL kmMat3* const kmMat3Rotation(kmMat3* pOut, const kmScalar radians);
|
||||
CC_DLL kmMat3* const kmMat3Scaling(kmMat3* pOut, const kmScalar x, const kmScalar y);
|
||||
CC_DLL kmMat3* const kmMat3Translation(kmMat3* pOut, const kmScalar x, const kmScalar y);
|
||||
|
||||
kmMat3* const kmMat3RotationQuaternion(kmMat3* pOut, const struct kmQuaternion* pIn);
|
||||
kmMat3* const kmMat3RotationAxisAngle(kmMat3* pOut, const struct kmVec3* axis, kmScalar radians);
|
||||
struct kmVec3* const kmMat3RotationToAxisAngle(struct kmVec3* pAxis, kmScalar* radians, const kmMat3* pIn);
|
||||
CC_DLL kmMat3* const kmMat3RotationQuaternion(kmMat3* pOut, const struct kmQuaternion* pIn);
|
||||
CC_DLL kmMat3* const kmMat3RotationAxisAngle(kmMat3* pOut, const struct kmVec3* axis, kmScalar radians);
|
||||
CC_DLL struct kmVec3* const kmMat3RotationToAxisAngle(struct kmVec3* pAxis, kmScalar* radians, const kmMat3* pIn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef MAT4_H_INCLUDED
|
||||
#define MAT4_H_INCLUDED
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "utility.h"
|
||||
|
||||
struct kmVec3;
|
||||
|
@ -50,43 +51,43 @@ typedef struct kmMat4 {
|
|||
kmScalar mat[16];
|
||||
} kmMat4;
|
||||
|
||||
kmMat4* const kmMat4Fill(kmMat4* pOut, const kmScalar* pMat);
|
||||
CC_DLL kmMat4* const kmMat4Fill(kmMat4* pOut, const kmScalar* pMat);
|
||||
|
||||
|
||||
kmMat4* const kmMat4Identity(kmMat4* pOut);
|
||||
CC_DLL kmMat4* const kmMat4Identity(kmMat4* pOut);
|
||||
|
||||
kmMat4* const kmMat4Inverse(kmMat4* pOut, const kmMat4* pM);
|
||||
CC_DLL kmMat4* const kmMat4Inverse(kmMat4* pOut, const kmMat4* pM);
|
||||
|
||||
|
||||
const int kmMat4IsIdentity(const kmMat4* pIn);
|
||||
CC_DLL const int kmMat4IsIdentity(const kmMat4* pIn);
|
||||
|
||||
kmMat4* const kmMat4Transpose(kmMat4* pOut, const kmMat4* pIn);
|
||||
kmMat4* const kmMat4Multiply(kmMat4* pOut, const kmMat4* pM1, const kmMat4* pM2);
|
||||
CC_DLL kmMat4* const kmMat4Transpose(kmMat4* pOut, const kmMat4* pIn);
|
||||
CC_DLL kmMat4* const kmMat4Multiply(kmMat4* pOut, const kmMat4* pM1, const kmMat4* pM2);
|
||||
|
||||
kmMat4* const kmMat4Assign(kmMat4* pOut, const kmMat4* pIn);
|
||||
const int kmMat4AreEqual(const kmMat4* pM1, const kmMat4* pM2);
|
||||
CC_DLL kmMat4* const kmMat4Assign(kmMat4* pOut, const kmMat4* pIn);
|
||||
CC_DLL const int kmMat4AreEqual(const kmMat4* pM1, const kmMat4* pM2);
|
||||
|
||||
kmMat4* const kmMat4RotationX(kmMat4* pOut, const kmScalar radians);
|
||||
kmMat4* const kmMat4RotationY(kmMat4* pOut, const kmScalar radians);
|
||||
kmMat4* const kmMat4RotationZ(kmMat4* pOut, const kmScalar radians);
|
||||
kmMat4* const kmMat4RotationPitchYawRoll(kmMat4* pOut, const kmScalar pitch, const kmScalar yaw, const kmScalar roll);
|
||||
kmMat4* const kmMat4RotationQuaternion(kmMat4* pOut, const struct kmQuaternion* pQ);
|
||||
kmMat4* const kmMat4RotationTranslation(kmMat4* pOut, const struct kmMat3* rotation, const struct kmVec3* translation);
|
||||
kmMat4* const kmMat4Scaling(kmMat4* pOut, const kmScalar x, const kmScalar y, const kmScalar z);
|
||||
kmMat4* const kmMat4Translation(kmMat4* pOut, const kmScalar x, const kmScalar y, const kmScalar z);
|
||||
CC_DLL kmMat4* const kmMat4RotationX(kmMat4* pOut, const kmScalar radians);
|
||||
CC_DLL kmMat4* const kmMat4RotationY(kmMat4* pOut, const kmScalar radians);
|
||||
CC_DLL kmMat4* const kmMat4RotationZ(kmMat4* pOut, const kmScalar radians);
|
||||
CC_DLL kmMat4* const kmMat4RotationPitchYawRoll(kmMat4* pOut, const kmScalar pitch, const kmScalar yaw, const kmScalar roll);
|
||||
CC_DLL kmMat4* const kmMat4RotationQuaternion(kmMat4* pOut, const struct kmQuaternion* pQ);
|
||||
CC_DLL kmMat4* const kmMat4RotationTranslation(kmMat4* pOut, const struct kmMat3* rotation, const struct kmVec3* translation);
|
||||
CC_DLL kmMat4* const kmMat4Scaling(kmMat4* pOut, const kmScalar x, const kmScalar y, const kmScalar z);
|
||||
CC_DLL kmMat4* const kmMat4Translation(kmMat4* pOut, const kmScalar x, const kmScalar y, const kmScalar z);
|
||||
|
||||
struct kmVec3* const kmMat4GetUpVec3(struct kmVec3* pOut, const kmMat4* pIn);
|
||||
struct kmVec3* const kmMat4GetRightVec3(struct kmVec3* pOut, const kmMat4* pIn);
|
||||
struct kmVec3* const kmMat4GetForwardVec3(struct kmVec3* pOut, const kmMat4* pIn);
|
||||
CC_DLL struct kmVec3* const kmMat4GetUpVec3(struct kmVec3* pOut, const kmMat4* pIn);
|
||||
CC_DLL struct kmVec3* const kmMat4GetRightVec3(struct kmVec3* pOut, const kmMat4* pIn);
|
||||
CC_DLL struct kmVec3* const kmMat4GetForwardVec3(struct kmVec3* pOut, const kmMat4* pIn);
|
||||
|
||||
kmMat4* const kmMat4PerspectiveProjection(kmMat4* pOut, kmScalar fovY, kmScalar aspect, kmScalar zNear, kmScalar zFar);
|
||||
kmMat4* const kmMat4OrthographicProjection(kmMat4* pOut, kmScalar left, kmScalar right, kmScalar bottom, kmScalar top, kmScalar nearVal, kmScalar farVal);
|
||||
kmMat4* const kmMat4LookAt(kmMat4* pOut, const struct kmVec3* pEye, const struct kmVec3* pCenter, const struct kmVec3* pUp);
|
||||
CC_DLL kmMat4* const kmMat4PerspectiveProjection(kmMat4* pOut, kmScalar fovY, kmScalar aspect, kmScalar zNear, kmScalar zFar);
|
||||
CC_DLL kmMat4* const kmMat4OrthographicProjection(kmMat4* pOut, kmScalar left, kmScalar right, kmScalar bottom, kmScalar top, kmScalar nearVal, kmScalar farVal);
|
||||
CC_DLL kmMat4* const kmMat4LookAt(kmMat4* pOut, const struct kmVec3* pEye, const struct kmVec3* pCenter, const struct kmVec3* pUp);
|
||||
|
||||
kmMat4* const kmMat4RotationAxisAngle(kmMat4* pOut, const struct kmVec3* axis, kmScalar radians);
|
||||
struct kmMat3* const kmMat4ExtractRotation(struct kmMat3* pOut, const kmMat4* pIn);
|
||||
struct kmPlane* const kmMat4ExtractPlane(struct kmPlane* pOut, const kmMat4* pIn, const kmEnum plane);
|
||||
struct kmVec3* const kmMat4RotationToAxisAngle(struct kmVec3* pAxis, kmScalar* radians, const kmMat4* pIn);
|
||||
CC_DLL kmMat4* const kmMat4RotationAxisAngle(kmMat4* pOut, const struct kmVec3* axis, kmScalar radians);
|
||||
CC_DLL struct kmMat3* const kmMat4ExtractRotation(struct kmMat3* pOut, const kmMat4* pIn);
|
||||
CC_DLL struct kmPlane* const kmMat4ExtractPlane(struct kmPlane* pOut, const kmMat4* pIn, const kmEnum plane);
|
||||
CC_DLL struct kmVec3* const kmMat4RotationToAxisAngle(struct kmVec3* pAxis, kmScalar* radians, const kmMat4* pIn);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#define KM_PLANE_NEAR 4
|
||||
#define KM_PLANE_FAR 5
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "utility.h"
|
||||
|
||||
struct kmVec3;
|
||||
|
@ -53,15 +54,15 @@ typedef enum POINT_CLASSIFICATION {
|
|||
POINT_ON_PLANE,
|
||||
} POINT_CLASSIFICATION;
|
||||
|
||||
const kmScalar kmPlaneDot(const kmPlane* pP, const struct kmVec4* pV);
|
||||
const kmScalar kmPlaneDotCoord(const kmPlane* pP, const struct kmVec3* pV);
|
||||
const kmScalar kmPlaneDotNormal(const kmPlane* pP, const struct kmVec3* pV);
|
||||
kmPlane* const kmPlaneFromPointNormal(kmPlane* pOut, const struct kmVec3* pPoint, const struct kmVec3* pNormal);
|
||||
kmPlane* const kmPlaneFromPoints(kmPlane* pOut, const struct kmVec3* p1, const struct kmVec3* p2, const struct kmVec3* p3);
|
||||
kmVec3* const kmPlaneIntersectLine(struct kmVec3* pOut, const kmPlane* pP, const struct kmVec3* pV1, const struct kmVec3* pV2);
|
||||
kmPlane* const kmPlaneNormalize(kmPlane* pOut, const kmPlane* pP);
|
||||
kmPlane* const kmPlaneScale(kmPlane* pOut, const kmPlane* pP, kmScalar s);
|
||||
const POINT_CLASSIFICATION kmPlaneClassifyPoint(const kmPlane* pIn, const kmVec3* pP); /** Classifys a point against a plane */
|
||||
CC_DLL const kmScalar kmPlaneDot(const kmPlane* pP, const struct kmVec4* pV);
|
||||
CC_DLL const kmScalar kmPlaneDotCoord(const kmPlane* pP, const struct kmVec3* pV);
|
||||
CC_DLL const kmScalar kmPlaneDotNormal(const kmPlane* pP, const struct kmVec3* pV);
|
||||
CC_DLL kmPlane* const kmPlaneFromPointNormal(kmPlane* pOut, const struct kmVec3* pPoint, const struct kmVec3* pNormal);
|
||||
CC_DLL kmPlane* const kmPlaneFromPoints(kmPlane* pOut, const struct kmVec3* p1, const struct kmVec3* p2, const struct kmVec3* p3);
|
||||
CC_DLL kmVec3* const kmPlaneIntersectLine(struct kmVec3* pOut, const kmPlane* pP, const struct kmVec3* pV1, const struct kmVec3* pV2);
|
||||
CC_DLL kmPlane* const kmPlaneNormalize(kmPlane* pOut, const kmPlane* pP);
|
||||
CC_DLL kmPlane* const kmPlaneScale(kmPlane* pOut, const kmPlane* pP, kmScalar s);
|
||||
CC_DLL const POINT_CLASSIFICATION kmPlaneClassifyPoint(const kmPlane* pIn, const kmVec3* pP); /** Classifys a point against a plane */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "utility.h"
|
||||
|
||||
struct kmMat4;
|
||||
|
@ -43,68 +44,68 @@ typedef struct kmQuaternion {
|
|||
kmScalar w;
|
||||
} kmQuaternion;
|
||||
|
||||
kmQuaternion* const kmQuaternionConjugate(kmQuaternion* pOut, const kmQuaternion* pIn); ///< Returns pOut, sets pOut to the conjugate of pIn
|
||||
CC_DLL kmQuaternion* const kmQuaternionConjugate(kmQuaternion* pOut, const kmQuaternion* pIn); ///< Returns pOut, sets pOut to the conjugate of pIn
|
||||
|
||||
const kmScalar kmQuaternionDot(const kmQuaternion* q1, const kmQuaternion* q2); ///< Returns the dot product of the 2 quaternions
|
||||
CC_DLL const kmScalar kmQuaternionDot(const kmQuaternion* q1, const kmQuaternion* q2); ///< Returns the dot product of the 2 quaternions
|
||||
|
||||
kmQuaternion* kmQuaternionExp(kmQuaternion* pOut, const kmQuaternion* pIn); ///< Returns the exponential of the quaternion
|
||||
CC_DLL kmQuaternion* kmQuaternionExp(kmQuaternion* pOut, const kmQuaternion* pIn); ///< Returns the exponential of the quaternion
|
||||
|
||||
///< Makes the passed quaternion an identity quaternion
|
||||
|
||||
kmQuaternion* kmQuaternionIdentity(kmQuaternion* pOut);
|
||||
CC_DLL kmQuaternion* kmQuaternionIdentity(kmQuaternion* pOut);
|
||||
|
||||
///< Returns the inverse of the passed Quaternion
|
||||
|
||||
kmQuaternion* kmQuaternionInverse(kmQuaternion* pOut,
|
||||
CC_DLL kmQuaternion* kmQuaternionInverse(kmQuaternion* pOut,
|
||||
const kmQuaternion* pIn);
|
||||
|
||||
///< Returns true if the quaternion is an identity quaternion
|
||||
|
||||
int kmQuaternionIsIdentity(const kmQuaternion* pIn);
|
||||
CC_DLL int kmQuaternionIsIdentity(const kmQuaternion* pIn);
|
||||
|
||||
///< Returns the length of the quaternion
|
||||
|
||||
kmScalar kmQuaternionLength(const kmQuaternion* pIn);
|
||||
CC_DLL kmScalar kmQuaternionLength(const kmQuaternion* pIn);
|
||||
|
||||
///< Returns the length of the quaternion squared (prevents a sqrt)
|
||||
|
||||
kmScalar kmQuaternionLengthSq(const kmQuaternion* pIn);
|
||||
CC_DLL kmScalar kmQuaternionLengthSq(const kmQuaternion* pIn);
|
||||
|
||||
///< Returns the natural logarithm
|
||||
|
||||
kmQuaternion* kmQuaternionLn(kmQuaternion* pOut, const kmQuaternion* pIn);
|
||||
CC_DLL kmQuaternion* kmQuaternionLn(kmQuaternion* pOut, const kmQuaternion* pIn);
|
||||
|
||||
///< Multiplies 2 quaternions together
|
||||
|
||||
kmQuaternion* kmQuaternionMultiply(kmQuaternion* pOut, const kmQuaternion* q1, const kmQuaternion* q2);
|
||||
CC_DLL kmQuaternion* kmQuaternionMultiply(kmQuaternion* pOut, const kmQuaternion* q1, const kmQuaternion* q2);
|
||||
|
||||
///< Normalizes a quaternion
|
||||
|
||||
kmQuaternion* kmQuaternionNormalize(kmQuaternion* pOut, const kmQuaternion* pIn);
|
||||
CC_DLL kmQuaternion* kmQuaternionNormalize(kmQuaternion* pOut, const kmQuaternion* pIn);
|
||||
|
||||
///< Rotates a quaternion around an axis
|
||||
|
||||
kmQuaternion* kmQuaternionRotationAxis(kmQuaternion* pOut, const struct kmVec3* pV, kmScalar angle);
|
||||
CC_DLL kmQuaternion* kmQuaternionRotationAxis(kmQuaternion* pOut, const struct kmVec3* pV, kmScalar angle);
|
||||
|
||||
///< Creates a quaternion from a rotation matrix
|
||||
|
||||
kmQuaternion* kmQuaternionRotationMatrix(kmQuaternion* pOut, const struct kmMat3* pIn);
|
||||
CC_DLL kmQuaternion* kmQuaternionRotationMatrix(kmQuaternion* pOut, const struct kmMat3* pIn);
|
||||
|
||||
///< Create a quaternion from yaw, pitch and roll
|
||||
|
||||
kmQuaternion* kmQuaternionRotationYawPitchRoll(kmQuaternion* pOut, kmScalar yaw, kmScalar pitch, kmScalar roll);
|
||||
CC_DLL kmQuaternion* kmQuaternionRotationYawPitchRoll(kmQuaternion* pOut, kmScalar yaw, kmScalar pitch, kmScalar roll);
|
||||
///< Interpolate between 2 quaternions
|
||||
kmQuaternion* kmQuaternionSlerp(kmQuaternion* pOut, const kmQuaternion* q1, const kmQuaternion* q2, kmScalar t);
|
||||
CC_DLL kmQuaternion* kmQuaternionSlerp(kmQuaternion* pOut, const kmQuaternion* q1, const kmQuaternion* q2, kmScalar t);
|
||||
|
||||
///< Get the axis and angle of rotation from a quaternion
|
||||
void kmQuaternionToAxisAngle(const kmQuaternion* pIn, struct kmVec3* pVector, kmScalar* pAngle);
|
||||
CC_DLL void kmQuaternionToAxisAngle(const kmQuaternion* pIn, struct kmVec3* pVector, kmScalar* pAngle);
|
||||
|
||||
///< Scale a quaternion
|
||||
kmQuaternion* kmQuaternionScale(kmQuaternion* pOut, const kmQuaternion* pIn, kmScalar s);
|
||||
kmQuaternion* kmQuaternionAssign(kmQuaternion* pOut, const kmQuaternion* pIn);
|
||||
kmQuaternion* kmQuaternionAdd(kmQuaternion* pOut, const kmQuaternion* pQ1, const kmQuaternion* pQ2);
|
||||
kmQuaternion* kmQuaternionRotationBetweenVec3(kmQuaternion* pOut, const struct kmVec3* vec1, const struct kmVec3* vec2, const struct kmVec3* fallback);
|
||||
struct kmVec3* kmQuaternionMultiplyVec3(struct kmVec3* pOut, const kmQuaternion* q, const struct kmVec3* v);
|
||||
CC_DLL kmQuaternion* kmQuaternionScale(kmQuaternion* pOut, const kmQuaternion* pIn, kmScalar s);
|
||||
CC_DLL kmQuaternion* kmQuaternionAssign(kmQuaternion* pOut, const kmQuaternion* pIn);
|
||||
CC_DLL kmQuaternion* kmQuaternionAdd(kmQuaternion* pOut, const kmQuaternion* pQ1, const kmQuaternion* pQ2);
|
||||
CC_DLL kmQuaternion* kmQuaternionRotationBetweenVec3(kmQuaternion* pOut, const struct kmVec3* vec1, const struct kmVec3* vec2, const struct kmVec3* fallback);
|
||||
CC_DLL struct kmVec3* kmQuaternionMultiplyVec3(struct kmVec3* pOut, const kmQuaternion* q, const struct kmVec3* v);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef RAY_2_H
|
||||
#define RAY_2_H
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "utility.h"
|
||||
#include "vec2.h"
|
||||
|
||||
|
@ -38,10 +39,10 @@ typedef struct kmRay2 {
|
|||
kmVec2 dir;
|
||||
} kmRay2;
|
||||
|
||||
void kmRay2Fill(kmRay2* ray, kmScalar px, kmScalar py, kmScalar vx, kmScalar vy);
|
||||
kmBool kmRay2IntersectLineSegment(const kmRay2* ray, const kmVec2* p1, const kmVec2* p2, kmVec2* intersection);
|
||||
kmBool kmRay2IntersectTriangle(const kmRay2* ray, const kmVec2* p1, const kmVec2* p2, const kmVec2* p3, kmVec2* intersection, kmVec2* normal_out);
|
||||
kmBool kmRay2IntersectCircle(const kmRay2* ray, const kmVec2 centre, const kmScalar radius, kmVec2* intersection);
|
||||
CC_DLL void kmRay2Fill(kmRay2* ray, kmScalar px, kmScalar py, kmScalar vx, kmScalar vy);
|
||||
CC_DLL kmBool kmRay2IntersectLineSegment(const kmRay2* ray, const kmVec2* p1, const kmVec2* p2, kmVec2* intersection);
|
||||
CC_DLL kmBool kmRay2IntersectTriangle(const kmRay2* ray, const kmVec2* p1, const kmVec2* p2, const kmVec2* p3, kmVec2* intersection, kmVec2* normal_out);
|
||||
CC_DLL kmBool kmRay2IntersectCircle(const kmRay2* ray, const kmVec2 centre, const kmScalar radius, kmVec2* intersection);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef UTILITY_H_INCLUDED
|
||||
#define UTILITY_H_INCLUDED
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifndef kmScalar
|
||||
|
@ -59,13 +60,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern kmScalar kmSQR(kmScalar s);
|
||||
extern kmScalar kmDegreesToRadians(kmScalar degrees);
|
||||
extern kmScalar kmRadiansToDegrees(kmScalar radians);
|
||||
CC_DLL kmScalar kmSQR(kmScalar s);
|
||||
CC_DLL kmScalar kmDegreesToRadians(kmScalar degrees);
|
||||
CC_DLL kmScalar kmRadiansToDegrees(kmScalar radians);
|
||||
|
||||
extern kmScalar kmMin(kmScalar lhs, kmScalar rhs);
|
||||
extern kmScalar kmMax(kmScalar lhs, kmScalar rhs);
|
||||
extern kmBool kmAlmostEqual(kmScalar lhs, kmScalar rhs);
|
||||
CC_DLL kmScalar kmMin(kmScalar lhs, kmScalar rhs);
|
||||
CC_DLL kmScalar kmMax(kmScalar lhs, kmScalar rhs);
|
||||
CC_DLL kmBool kmAlmostEqual(kmScalar lhs, kmScalar rhs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef VEC2_H_INCLUDED
|
||||
#define VEC2_H_INCLUDED
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
|
||||
struct kmMat3;
|
||||
|
||||
#ifndef kmScalar
|
||||
|
@ -44,17 +46,17 @@ typedef struct kmVec2 {
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
kmVec2* kmVec2Fill(kmVec2* pOut, kmScalar x, kmScalar y);
|
||||
kmScalar kmVec2Length(const kmVec2* pIn); ///< Returns the length of the vector
|
||||
kmScalar kmVec2LengthSq(const kmVec2* pIn); ///< Returns the square of the length of the vector
|
||||
kmVec2* kmVec2Normalize(kmVec2* pOut, const kmVec2* pIn); ///< Returns the vector passed in set to unit length
|
||||
kmVec2* kmVec2Add(kmVec2* pOut, const kmVec2* pV1, const kmVec2* pV2); ///< Adds 2 vectors and returns the result
|
||||
kmScalar kmVec2Dot(const kmVec2* pV1, const kmVec2* pV2); /** Returns the Dot product which is the cosine of the angle between the two vectors multiplied by their lengths */
|
||||
kmVec2* kmVec2Subtract(kmVec2* pOut, const kmVec2* pV1, const kmVec2* pV2); ///< Subtracts 2 vectors and returns the result
|
||||
kmVec2* kmVec2Transform(kmVec2* pOut, const kmVec2* pV1, const struct kmMat3* pM); /** Transform the Vector */
|
||||
kmVec2* kmVec2TransformCoord(kmVec2* pOut, const kmVec2* pV, const struct kmMat3* pM); ///<Transforms a 2D vector by a given matrix, projecting the result back into w = 1.
|
||||
kmVec2* kmVec2Scale(kmVec2* pOut, const kmVec2* pIn, const kmScalar s); ///< Scales a vector to length s
|
||||
int kmVec2AreEqual(const kmVec2* p1, const kmVec2* p2); ///< Returns 1 if both vectors are equal
|
||||
CC_DLL kmVec2* kmVec2Fill(kmVec2* pOut, kmScalar x, kmScalar y);
|
||||
CC_DLL kmScalar kmVec2Length(const kmVec2* pIn); ///< Returns the length of the vector
|
||||
CC_DLL kmScalar kmVec2LengthSq(const kmVec2* pIn); ///< Returns the square of the length of the vector
|
||||
CC_DLL kmVec2* kmVec2Normalize(kmVec2* pOut, const kmVec2* pIn); ///< Returns the vector passed in set to unit length
|
||||
CC_DLL kmVec2* kmVec2Add(kmVec2* pOut, const kmVec2* pV1, const kmVec2* pV2); ///< Adds 2 vectors and returns the result
|
||||
CC_DLL kmScalar kmVec2Dot(const kmVec2* pV1, const kmVec2* pV2); /** Returns the Dot product which is the cosine of the angle between the two vectors multiplied by their lengths */
|
||||
CC_DLL kmVec2* kmVec2Subtract(kmVec2* pOut, const kmVec2* pV1, const kmVec2* pV2); ///< Subtracts 2 vectors and returns the result
|
||||
CC_DLL kmVec2* kmVec2Transform(kmVec2* pOut, const kmVec2* pV1, const struct kmMat3* pM); /** Transform the Vector */
|
||||
CC_DLL kmVec2* kmVec2TransformCoord(kmVec2* pOut, const kmVec2* pV, const struct kmMat3* pM); ///<Transforms a 2D vector by a given matrix, projecting the result back into w = 1.
|
||||
CC_DLL kmVec2* kmVec2Scale(kmVec2* pOut, const kmVec2* pIn, const kmScalar s); ///< Scales a vector to length s
|
||||
CC_DLL int kmVec2AreEqual(const kmVec2* p1, const kmVec2* p2); ///< Returns 1 if both vectors are equal
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef VEC3_H_INCLUDED
|
||||
#define VEC3_H_INCLUDED
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef kmScalar
|
||||
|
@ -44,23 +45,23 @@ typedef struct kmVec3 {
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
kmVec3* kmVec3Fill(kmVec3* pOut, kmScalar x, kmScalar y, kmScalar z);
|
||||
kmScalar kmVec3Length(const kmVec3* pIn); /** Returns the length of the vector */
|
||||
kmScalar kmVec3LengthSq(const kmVec3* pIn); /** Returns the square of the length of the vector */
|
||||
kmVec3* kmVec3Normalize(kmVec3* pOut, const kmVec3* pIn); /** Returns the vector passed in set to unit length */
|
||||
kmVec3* kmVec3Cross(kmVec3* pOut, const kmVec3* pV1, const kmVec3* pV2); /** Returns a vector perpendicular to 2 other vectors */
|
||||
kmScalar kmVec3Dot(const kmVec3* pV1, const kmVec3* pV2); /** Returns the cosine of the angle between 2 vectors */
|
||||
kmVec3* kmVec3Add(kmVec3* pOut, const kmVec3* pV1, const kmVec3* pV2); /** Adds 2 vectors and returns the result */
|
||||
kmVec3* kmVec3Subtract(kmVec3* pOut, const kmVec3* pV1, const kmVec3* pV2); /** Subtracts 2 vectors and returns the result */
|
||||
kmVec3* kmVec3Transform(kmVec3* pOut, const kmVec3* pV1, const struct kmMat4* pM); /** Transforms a vector (assuming w=1) by a given matrix */
|
||||
kmVec3* kmVec3TransformNormal(kmVec3* pOut, const kmVec3* pV, const struct kmMat4* pM);/**Transforms a 3D normal by a given matrix */
|
||||
kmVec3* kmVec3TransformCoord(kmVec3* pOut, const kmVec3* pV, const struct kmMat4* pM); /**Transforms a 3D vector by a given matrix, projecting the result back into w = 1. */
|
||||
kmVec3* kmVec3Scale(kmVec3* pOut, const kmVec3* pIn, const kmScalar s); /** Scales a vector to length s */
|
||||
int kmVec3AreEqual(const kmVec3* p1, const kmVec3* p2);
|
||||
kmVec3* kmVec3InverseTransform(kmVec3* pOut, const kmVec3* pV, const struct kmMat4* pM);
|
||||
kmVec3* kmVec3InverseTransformNormal(kmVec3* pOut, const kmVec3* pVect, const struct kmMat4* pM);
|
||||
kmVec3* kmVec3Assign(kmVec3* pOut, const kmVec3* pIn);
|
||||
kmVec3* kmVec3Zero(kmVec3* pOut);
|
||||
CC_DLL kmVec3* kmVec3Fill(kmVec3* pOut, kmScalar x, kmScalar y, kmScalar z);
|
||||
CC_DLL kmScalar kmVec3Length(const kmVec3* pIn); /** Returns the length of the vector */
|
||||
CC_DLL kmScalar kmVec3LengthSq(const kmVec3* pIn); /** Returns the square of the length of the vector */
|
||||
CC_DLL kmVec3* kmVec3Normalize(kmVec3* pOut, const kmVec3* pIn); /** Returns the vector passed in set to unit length */
|
||||
CC_DLL kmVec3* kmVec3Cross(kmVec3* pOut, const kmVec3* pV1, const kmVec3* pV2); /** Returns a vector perpendicular to 2 other vectors */
|
||||
CC_DLL kmScalar kmVec3Dot(const kmVec3* pV1, const kmVec3* pV2); /** Returns the cosine of the angle between 2 vectors */
|
||||
CC_DLL kmVec3* kmVec3Add(kmVec3* pOut, const kmVec3* pV1, const kmVec3* pV2); /** Adds 2 vectors and returns the result */
|
||||
CC_DLL kmVec3* kmVec3Subtract(kmVec3* pOut, const kmVec3* pV1, const kmVec3* pV2); /** Subtracts 2 vectors and returns the result */
|
||||
CC_DLL kmVec3* kmVec3Transform(kmVec3* pOut, const kmVec3* pV1, const struct kmMat4* pM); /** Transforms a vector (assuming w=1) by a given matrix */
|
||||
CC_DLL kmVec3* kmVec3TransformNormal(kmVec3* pOut, const kmVec3* pV, const struct kmMat4* pM);/**Transforms a 3D normal by a given matrix */
|
||||
CC_DLL kmVec3* kmVec3TransformCoord(kmVec3* pOut, const kmVec3* pV, const struct kmMat4* pM); /**Transforms a 3D vector by a given matrix, projecting the result back into w = 1. */
|
||||
CC_DLL kmVec3* kmVec3Scale(kmVec3* pOut, const kmVec3* pIn, const kmScalar s); /** Scales a vector to length s */
|
||||
CC_DLL int kmVec3AreEqual(const kmVec3* p1, const kmVec3* p2);
|
||||
CC_DLL kmVec3* kmVec3InverseTransform(kmVec3* pOut, const kmVec3* pV, const struct kmMat4* pM);
|
||||
CC_DLL kmVec3* kmVec3InverseTransformNormal(kmVec3* pOut, const kmVec3* pVect, const struct kmMat4* pM);
|
||||
CC_DLL kmVec3* kmVec3Assign(kmVec3* pOut, const kmVec3* pIn);
|
||||
CC_DLL kmVec3* kmVec3Zero(kmVec3* pOut);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef VEC4_H_INCLUDED
|
||||
#define VEC4_H_INCLUDED
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "utility.h"
|
||||
|
||||
struct kmMat4;
|
||||
|
@ -46,20 +47,20 @@ typedef struct kmVec4 {
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
kmVec4* kmVec4Fill(kmVec4* pOut, kmScalar x, kmScalar y, kmScalar z, kmScalar w);
|
||||
kmVec4* kmVec4Add(kmVec4* pOut, const kmVec4* pV1, const kmVec4* pV2);
|
||||
kmScalar kmVec4Dot(const kmVec4* pV1, const kmVec4* pV2);
|
||||
kmScalar kmVec4Length(const kmVec4* pIn);
|
||||
kmScalar kmVec4LengthSq(const kmVec4* pIn);
|
||||
kmVec4* kmVec4Lerp(kmVec4* pOut, const kmVec4* pV1, const kmVec4* pV2, kmScalar t);
|
||||
kmVec4* kmVec4Normalize(kmVec4* pOut, const kmVec4* pIn);
|
||||
kmVec4* kmVec4Scale(kmVec4* pOut, const kmVec4* pIn, const kmScalar s); ///< Scales a vector to length s
|
||||
kmVec4* kmVec4Subtract(kmVec4* pOut, const kmVec4* pV1, const kmVec4* pV2);
|
||||
kmVec4* kmVec4Transform(kmVec4* pOut, const kmVec4* pV, const struct kmMat4* pM);
|
||||
kmVec4* kmVec4TransformArray(kmVec4* pOut, unsigned int outStride,
|
||||
CC_DLL kmVec4* kmVec4Fill(kmVec4* pOut, kmScalar x, kmScalar y, kmScalar z, kmScalar w);
|
||||
CC_DLL kmVec4* kmVec4Add(kmVec4* pOut, const kmVec4* pV1, const kmVec4* pV2);
|
||||
CC_DLL kmScalar kmVec4Dot(const kmVec4* pV1, const kmVec4* pV2);
|
||||
CC_DLL kmScalar kmVec4Length(const kmVec4* pIn);
|
||||
CC_DLL kmScalar kmVec4LengthSq(const kmVec4* pIn);
|
||||
CC_DLL kmVec4* kmVec4Lerp(kmVec4* pOut, const kmVec4* pV1, const kmVec4* pV2, kmScalar t);
|
||||
CC_DLL kmVec4* kmVec4Normalize(kmVec4* pOut, const kmVec4* pIn);
|
||||
CC_DLL kmVec4* kmVec4Scale(kmVec4* pOut, const kmVec4* pIn, const kmScalar s); ///< Scales a vector to length s
|
||||
CC_DLL kmVec4* kmVec4Subtract(kmVec4* pOut, const kmVec4* pV1, const kmVec4* pV2);
|
||||
CC_DLL kmVec4* kmVec4Transform(kmVec4* pOut, const kmVec4* pV, const struct kmMat4* pM);
|
||||
CC_DLL kmVec4* kmVec4TransformArray(kmVec4* pOut, unsigned int outStride,
|
||||
const kmVec4* pV, unsigned int vStride, const struct kmMat4* pM, unsigned int count);
|
||||
int kmVec4AreEqual(const kmVec4* p1, const kmVec4* p2);
|
||||
kmVec4* kmVec4Assign(kmVec4* pOut, const kmVec4* pIn);
|
||||
CC_DLL int kmVec4AreEqual(const kmVec4* p1, const kmVec4* p2);
|
||||
CC_DLL kmVec4* kmVec4Assign(kmVec4* pOut, const kmVec4* pIn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -481,7 +481,9 @@ void CCParticleBatchNode::insertChild(CCParticleSystem* pSystem, unsigned int in
|
|||
|
||||
// make room for quads, not necessary for last child
|
||||
if (pSystem->getAtlasIndex() + pSystem->getTotalParticles() != m_pTextureAtlas->getTotalQuads())
|
||||
{
|
||||
m_pTextureAtlas->moveQuadsFromIndex(index, index+pSystem->getTotalParticles());
|
||||
}
|
||||
|
||||
// increase totalParticles here for new particles, update method of particlesystem will fill the quads
|
||||
m_pTextureAtlas->increaseTotalQuadsWith(pSystem->getTotalParticles());
|
||||
|
|
|
@ -301,8 +301,12 @@ void CCParticleSystemQuad::draw()
|
|||
|
||||
glBindVertexArray( m_uVAOname );
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_pBuffersVBO[1]);
|
||||
|
||||
glDrawElements(GL_TRIANGLES, (GLsizei) m_uParticleIdx*6, GL_UNSIGNED_SHORT, 0);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
glBindVertexArray( 0 );
|
||||
|
||||
CC_INCREMENT_GL_DRAWS(1);
|
||||
|
|
|
@ -486,8 +486,9 @@ void CCTextureAtlas::moveQuadsFromIndex(unsigned int oldIndex, unsigned int amou
|
|||
CCAssert(oldIndex < m_uTotalQuads, "insertQuadFromIndex:atIndex: Invalid index");
|
||||
|
||||
if( oldIndex == newIndex )
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
//create buffer
|
||||
size_t quadSize = sizeof(ccV3F_C4B_T2F_Quad);
|
||||
ccV3F_C4B_T2F_Quad* tempQuads = (ccV3F_C4B_T2F_Quad*)malloc( quadSize * amount);
|
||||
|
@ -519,12 +520,13 @@ void CCTextureAtlas::moveQuadsFromIndex(unsigned int index, unsigned int newInde
|
|||
|
||||
void CCTextureAtlas::fillWithEmptyQuadsFromIndex(unsigned int index, unsigned int amount)
|
||||
{
|
||||
ccV3F_C4B_T2F_Quad* quad = (ccV3F_C4B_T2F_Quad*)calloc(1,sizeof(ccV3F_C4B_T2F_Quad));
|
||||
ccV3F_C4B_T2F_Quad quad;
|
||||
memset(&quad, 0, sizeof(quad));
|
||||
|
||||
unsigned int to = index + amount;
|
||||
for (int i = index ; i < to ; i++)
|
||||
{
|
||||
m_pQuads[i] = *quad;
|
||||
m_pQuads[i] = quad;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -552,25 +554,25 @@ void CCTextureAtlas::drawNumberOfQuads(unsigned int n, unsigned int start)
|
|||
//
|
||||
|
||||
// XXX: update is done in draw... perhaps it should be done in a timer
|
||||
if (m_bDirty) {
|
||||
if (m_bDirty)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_pBuffersVBO[0]);
|
||||
|
||||
glBufferSubData(GL_ARRAY_BUFFER, sizeof(m_pQuads[0])*start, sizeof(m_pQuads[0]) * n , &m_pQuads[start] );
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
m_bDirty = false;
|
||||
}
|
||||
|
||||
glBindVertexArray( m_uVAOname );
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_pBuffersVBO[1]);
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
#if CC_TEXTURE_ATLAS_USE_TRIANGLE_STRIP
|
||||
glDrawElements(GL_TRIANGLE_STRIP, (GLsizei) n*6, GL_UNSIGNED_SHORT, (GLvoid*) (start*6*sizeof(m_pIndices[0])) );
|
||||
#else
|
||||
glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, (GLvoid*) (start*6*sizeof(m_pIndices[0])) );
|
||||
#endif // CC_TEXTURE_ATLAS_USE_TRIANGLE_STRIP
|
||||
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
#else // ! CC_TEXTURE_ATLAS_USE_VAO
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
# set params
|
||||
NDK_ROOT_LOCAL=/cygdrive/d/programe/android/ndk/android-ndk-r7b
|
||||
COCOS2DX_ROOT_LOCAL=/cygdrive/e/cocos2d-x
|
||||
NDK_ROOT_LOCAL=/cygdrive/e/android/android-ndk-r7b
|
||||
COCOS2DX_ROOT_LOCAL=/cygdrive/f/Project/dumganhar/cocos2d-x
|
||||
|
||||
# try to get global variable
|
||||
if [ $NDK_ROOT"aaa" != "aaa" ]; then
|
||||
|
|
|
@ -1099,9 +1099,9 @@ ParticleDemo::ParticleDemo(void)
|
|||
|
||||
CCLabelAtlas* labelAtlas = CCLabelAtlas::labelWithString("0000", "fonts/fps_images.png", 16, 24, '.');
|
||||
addChild(labelAtlas, 100, kTagParticleCount);
|
||||
labelAtlas->setPosition( CCPointMake(s.width-66,50) );
|
||||
labelAtlas->setPosition(CCPointMake(s.width-66,50));
|
||||
|
||||
// moving background
|
||||
// moving background
|
||||
m_background = CCSprite::spriteWithFile(s_back3);
|
||||
addChild(m_background, 5);
|
||||
m_background->setPosition( CCPointMake(s.width/2, s.height-180) );
|
||||
|
@ -1170,10 +1170,10 @@ void ParticleDemo::update(ccTime dt)
|
|||
{
|
||||
if (m_emitter)
|
||||
{
|
||||
CCLabelAtlas* atlas = (CCLabelAtlas*)getChildByTag(kTagParticleCount);
|
||||
CCLabelAtlas* atlas = (CCLabelAtlas*)getChildByTag(kTagParticleCount);
|
||||
char str[5] = {0};
|
||||
sprintf(str, "%04d", m_emitter->getParticleCount());
|
||||
atlas->setString(str);
|
||||
atlas->setString(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1241,24 +1241,24 @@ void ParticleBatchHybrid::onEnter()
|
|||
|
||||
addChild(batch, 10);
|
||||
|
||||
schedule(schedule_selector(ParticleBatchHybrid::switchRender), 2.0f);
|
||||
schedule(schedule_selector(ParticleBatchHybrid::switchRender), 2.0f);
|
||||
|
||||
CCNode *node = CCNode::node();
|
||||
addChild(node);
|
||||
CCNode *node = CCNode::node();
|
||||
addChild(node);
|
||||
|
||||
m_pParent1 = batch;
|
||||
m_pParent2 = node;
|
||||
m_pParent1 = batch;
|
||||
m_pParent2 = node;
|
||||
}
|
||||
|
||||
void ParticleBatchHybrid::switchRender(ccTime dt)
|
||||
{
|
||||
bool usingBatch = ( m_emitter->getBatchNode() != NULL );
|
||||
m_emitter->removeFromParentAndCleanup(false);
|
||||
bool usingBatch = ( m_emitter->getBatchNode() != NULL );
|
||||
m_emitter->removeFromParentAndCleanup(false);
|
||||
|
||||
CCNode *newParent = (usingBatch ? m_pParent2 : m_pParent1 );
|
||||
newParent->addChild(m_emitter);
|
||||
CCNode *newParent = (usingBatch ? m_pParent2 : m_pParent1 );
|
||||
newParent->addChild(m_emitter);
|
||||
|
||||
CCLog("Particle: Using new parent: %s", usingBatch ? "CCNode" : "CCParticleBatchNode");
|
||||
CCLog("Particle: Using new parent: %s", usingBatch ? "CCNode" : "CCParticleBatchNode");
|
||||
}
|
||||
|
||||
std::string ParticleBatchHybrid::title()
|
||||
|
@ -1324,11 +1324,13 @@ void ParticleReorder::onEnter()
|
|||
removeChild(m_background, true);
|
||||
m_background = NULL;
|
||||
|
||||
CCParticleSystem *ignore = CCParticleSystemQuad::particleWithFile("Images/SmallSun.plist");
|
||||
CCParticleSystem* ignore = CCParticleSystemQuad::particleWithFile("Images/SmallSun.plist");
|
||||
CCNode *parent1 = CCNode::node();
|
||||
CCNode *parent2 = CCParticleBatchNode::batchNodeWithTexture(ignore->getTexture());
|
||||
ignore->unscheduleUpdate();
|
||||
|
||||
for( unsigned int i=0; i<2;i++) {
|
||||
for( unsigned int i=0; i<2;i++)
|
||||
{
|
||||
CCNode *parent = ( i==0 ? parent1 : parent2 );
|
||||
|
||||
CCParticleSystemQuad *emitter1 = CCParticleSystemQuad::particleWithFile("Images/SmallSun.plist");
|
||||
|
|
Loading…
Reference in New Issue