migrate Vertex3f to Vector3

This commit is contained in:
Huabing.Xu 2014-04-02 15:06:16 +08:00
parent 4e93943347
commit 49de7511f5
16 changed files with 103 additions and 96 deletions

View File

@ -103,19 +103,19 @@ GridBase* Grid3DAction::getGrid()
return Grid3D::create(_gridSize);
}
Vertex3F Grid3DAction::getVertex(const Point& position) const
Vector3 Grid3DAction::getVertex(const Point& position) const
{
Grid3D *g = (Grid3D*)_gridNodeTarget->getGrid();
return g->getVertex(position);
}
Vertex3F Grid3DAction::getOriginalVertex(const Point& position) const
Vector3 Grid3DAction::getOriginalVertex(const Point& position) const
{
Grid3D *g = (Grid3D*)_gridNodeTarget->getGrid();
return g->getOriginalVertex(position);
}
void Grid3DAction::setVertex(const Point& position, const Vertex3F& vertex)
void Grid3DAction::setVertex(const Point& position, const Vector3& vertex)
{
Grid3D *g = (Grid3D*)_gridNodeTarget->getGrid();
g->setVertex(position, vertex);

View File

@ -82,31 +82,31 @@ public:
* @js NA
* @lua NA
*/
Vertex3F getVertex(const Point& position) const;
Vector3 getVertex(const Point& position) const;
/** @deprecated Use getVertex() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE inline Vertex3F vertex(const Point& position) { return getVertex(position); }
CC_DEPRECATED_ATTRIBUTE inline Vector3 vertex(const Point& position) { return getVertex(position); }
/** returns the non-transformed vertex than belongs to certain position in the grid
* @js NA
* @lua NA
*/
Vertex3F getOriginalVertex(const Point& position) const;
Vector3 getOriginalVertex(const Point& position) const;
/** @deprecated Use getOriginalVertex() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE inline Vertex3F originalVertex(const Point& position) { return getOriginalVertex(position); }
CC_DEPRECATED_ATTRIBUTE inline Vector3 originalVertex(const Point& position) { return getOriginalVertex(position); }
/** sets a new vertex to a certain position of the grid
* @js NA
* @lua NA
*/
void setVertex(const Point& position, const Vertex3F& vertex);
void setVertex(const Point& position, const Vector3& vertex);
// Overrides
virtual Grid3DAction * clone() const override = 0;

View File

@ -79,7 +79,7 @@ void Waves3D::update(float time)
{
for (j = 0; j < _gridSize.height + 1; ++j)
{
Vertex3F v = getOriginalVertex(Point(i ,j));
Vector3 v = getOriginalVertex(Point(i ,j));
v.z += (sinf((float)M_PI * time * _waves * 2 + (v.y+v.x) * 0.01f) * _amplitude * _amplitudeRate);
//CCLOG("v.z offset is %f\n", (sinf((float)M_PI * time * _waves * 2 + (v.y+v.x) * .01f) * _amplitude * _amplitudeRate));
setVertex(Point(i, j), v);
@ -142,7 +142,7 @@ void FlipX3D::update(float time)
angle = angle / 2.0f; // x calculates degrees from 0 to 90
float mx = cosf(angle);
Vertex3F v0, v1, v, diff;
Vector3 v0, v1, v, diff;
v0 = getOriginalVertex(Point(1, 1));
v1 = getOriginalVertex(Point(0, 0));
@ -236,7 +236,7 @@ void FlipY3D::update(float time)
angle = angle / 2.0f; // x calculates degrees from 0 to 90
float my = cosf(angle);
Vertex3F v0, v1, v, diff;
Vector3 v0, v1, v, diff;
v0 = getOriginalVertex(Point(1, 1));
v1 = getOriginalVertex(Point(0, 0));
@ -361,7 +361,7 @@ void Lens3D::update(float time)
{
for (j = 0; j < _gridSize.height + 1; ++j)
{
Vertex3F v = getOriginalVertex(Point(i, j));
Vector3 v = getOriginalVertex(Point(i, j));
Point vect = _position - Point(v.x, v.y);
float r = vect.getLength();
@ -453,7 +453,7 @@ void Ripple3D::update(float time)
{
for (j = 0; j < (_gridSize.height+1); ++j)
{
Vertex3F v = getOriginalVertex(Point(i, j));
Vector3 v = getOriginalVertex(Point(i, j));
Point vect = _position - Point(v.x,v.y);
float r = vect.getLength();
@ -521,7 +521,7 @@ void Shaky3D::update(float time)
{
for (j = 0; j < (_gridSize.height+1); ++j)
{
Vertex3F v = getOriginalVertex(Point(i ,j));
Vector3 v = getOriginalVertex(Point(i ,j));
v.x += (rand() % (_randrange*2)) - _randrange;
v.y += (rand() % (_randrange*2)) - _randrange;
if (_shakeZ)
@ -586,7 +586,7 @@ void Liquid::update(float time)
{
for (j = 1; j < _gridSize.height; ++j)
{
Vertex3F v = getOriginalVertex(Point(i, j));
Vector3 v = getOriginalVertex(Point(i, j));
v.x = (v.x + (sinf(time * (float)M_PI * _waves * 2 + v.x * .01f) * _amplitude * _amplitudeRate));
v.y = (v.y + (sinf(time * (float)M_PI * _waves * 2 + v.y * .01f) * _amplitude * _amplitudeRate));
setVertex(Point(i, j), v);
@ -648,7 +648,7 @@ void Waves::update(float time)
{
for (j = 0; j < _gridSize.height + 1; ++j)
{
Vertex3F v = getOriginalVertex(Point(i, j));
Vector3 v = getOriginalVertex(Point(i, j));
if (_vertical)
{
@ -724,7 +724,7 @@ void Twirl::update(float time)
{
for (j = 0; j < (_gridSize.height+1); ++j)
{
Vertex3F v = getOriginalVertex(Point(i ,j));
Vector3 v = getOriginalVertex(Point(i ,j));
Point avg = Point(i-(_gridSize.width/2.0f), j-(_gridSize.height/2.0f));
float r = avg.getLength();

View File

@ -856,7 +856,7 @@ RotateBy* RotateBy::create(float duration, float deltaAngleX, float deltaAngleY)
return rotateBy;
}
RotateBy* RotateBy::create(float duration, const Vertex3F& deltaAngle3D)
RotateBy* RotateBy::create(float duration, const Vector3& deltaAngle3D)
{
RotateBy *rotateBy = new RotateBy();
rotateBy->initWithDuration(duration, deltaAngle3D);
@ -893,7 +893,7 @@ bool RotateBy::initWithDuration(float duration, float deltaAngleX, float deltaAn
return false;
}
bool RotateBy::initWithDuration(float duration, const Vertex3F& deltaAngle3D)
bool RotateBy::initWithDuration(float duration, const Vector3& deltaAngle3D)
{
if (ActionInterval::initWithDuration(duration))
{
@ -939,7 +939,7 @@ void RotateBy::update(float time)
{
if(_is3D)
{
Vertex3F v;
Vector3 v;
v.x = _startAngle3D.x + _angle3D.x * time;
v.y = _startAngle3D.y + _angle3D.y * time;
v.z = _startAngle3D.z + _angle3D.z * time;
@ -957,7 +957,7 @@ RotateBy* RotateBy::reverse() const
{
if(_is3D)
{
Vertex3F v;
Vector3 v;
v.x = - _angle3D.x;
v.y = - _angle3D.y;
v.z = - _angle3D.z;

View File

@ -370,7 +370,7 @@ public:
/** creates the action */
static RotateBy* create(float duration, float deltaAngle);
static RotateBy* create(float duration, float deltaAngleZ_X, float deltaAngleZ_Y);
static RotateBy* create(float duration, const Vertex3F& deltaAngle3D);
static RotateBy* create(float duration, const Vector3& deltaAngle3D);
//
// Override
@ -387,7 +387,7 @@ CC_CONSTRUCTOR_ACCESS:
/** initializes the action */
bool initWithDuration(float duration, float deltaAngle);
bool initWithDuration(float duration, float deltaAngleZ_X, float deltaAngleZ_Y);
bool initWithDuration(float duration, const Vertex3F& deltaAngle3D);
bool initWithDuration(float duration, const Vector3& deltaAngle3D);
protected:
float _angleZ_X;
@ -396,8 +396,8 @@ protected:
float _startAngleZ_Y;
bool _is3D;
Vertex3F _angle3D;
Vertex3F _startAngle3D;
Vector3 _angle3D;
Vector3 _startAngle3D;
private:
CC_DISALLOW_COPY_AND_ASSIGN(RotateBy);

View File

@ -76,7 +76,7 @@ void PageTurn3D::update(float time)
for (int j = 0; j <= _gridSize.height; ++j)
{
// Get original vertex
Vertex3F p = getOriginalVertex(Point(i ,j));
Vector3 p = getOriginalVertex(Point(i ,j));
float R = sqrtf((p.x * p.x) + ((p.y - ay) * (p.y - ay)));
float r = R * sinTheta;

View File

@ -460,9 +460,9 @@ CC_DEPRECATED_ATTRIBUTE static inline Vertex2F vertex2(const float x, const floa
return c;
}
CC_DEPRECATED_ATTRIBUTE static inline Vertex3F vertex3(const float x, const float y, const float z)
CC_DEPRECATED_ATTRIBUTE static inline Vector3 vertex3(const float x, const float y, const float z)
{
Vertex3F c(x, y, z);
Vector3 c(x, y, z);
return c;
}
@ -776,7 +776,8 @@ CC_DEPRECATED_ATTRIBUTE typedef Color3B ccColor3B;
CC_DEPRECATED_ATTRIBUTE typedef Color4F ccColor4F;
CC_DEPRECATED_ATTRIBUTE typedef Color4B ccColor4B;
CC_DEPRECATED_ATTRIBUTE typedef Vertex2F ccVertex2F;
CC_DEPRECATED_ATTRIBUTE typedef Vertex3F ccVertex3F;
CC_DEPRECATED_ATTRIBUTE typedef Vector3 ccVertex3F;
CC_DEPRECATED_ATTRIBUTE typedef Vector3 Vertex3F;
CC_DEPRECATED_ATTRIBUTE typedef Tex2F ccTex2F;
CC_DEPRECATED_ATTRIBUTE typedef PointSprite ccPointSprite;
CC_DEPRECATED_ATTRIBUTE typedef Quad2 ccQuad2;

View File

@ -330,7 +330,7 @@ void Grid3D::blit(void)
unsigned int numOfPoints = (_gridSize.width+1) * (_gridSize.height+1);
// position
setGLBufferData(_vertices, numOfPoints * sizeof(Vertex3F), 0);
setGLBufferData(_vertices, numOfPoints * sizeof(Vector3), 0);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, 0);
// texCoords
@ -365,8 +365,8 @@ void Grid3D::calculateVertexPoints(void)
unsigned int numOfPoints = (_gridSize.width+1) * (_gridSize.height+1);
_vertices = malloc(numOfPoints * sizeof(Vertex3F));
_originalVertices = malloc(numOfPoints * sizeof(Vertex3F));
_vertices = malloc(numOfPoints * sizeof(Vector3));
_originalVertices = malloc(numOfPoints * sizeof(Vector3));
_texCoordinates = malloc(numOfPoints * sizeof(Vertex2F));
_indices = (GLushort*)malloc(_gridSize.width * _gridSize.height * sizeof(GLushort) * 6);
@ -395,12 +395,12 @@ void Grid3D::calculateVertexPoints(void)
memcpy(&idxArray[6*idx], tempidx, 6*sizeof(GLushort));
int l1[4] = {a*3, b*3, c*3, d*3};
Vertex3F e(x1, y1, 0);
Vertex3F f(x2, y1, 0);
Vertex3F g(x2, y2, 0);
Vertex3F h(x1, y2, 0);
Vector3 e(x1, y1, 0);
Vector3 f(x2, y1, 0);
Vector3 g(x2, y2, 0);
Vector3 h(x1, y2, 0);
Vertex3F l2[4] = {e, f, g, h};
Vector3 l2[4] = {e, f, g, h};
int tex1[4] = {a*2, b*2, c*2, d*2};
Point Tex2F[4] = {Point(x1, y1), Point(x2, y1), Point(x2, y2), Point(x1, y2)};
@ -424,34 +424,34 @@ void Grid3D::calculateVertexPoints(void)
}
}
memcpy(_originalVertices, _vertices, (_gridSize.width+1) * (_gridSize.height+1) * sizeof(Vertex3F));
memcpy(_originalVertices, _vertices, (_gridSize.width+1) * (_gridSize.height+1) * sizeof(Vector3));
}
Vertex3F Grid3D::getVertex(const Point& pos) const
Vector3 Grid3D::getVertex(const Point& pos) const
{
CCASSERT( pos.x == (unsigned int)pos.x && pos.y == (unsigned int) pos.y , "Numbers must be integers");
int index = (pos.x * (_gridSize.height+1) + pos.y) * 3;
float *vertArray = (float*)_vertices;
Vertex3F vert(vertArray[index], vertArray[index+1], vertArray[index+2]);
Vector3 vert(vertArray[index], vertArray[index+1], vertArray[index+2]);
return vert;
}
Vertex3F Grid3D::getOriginalVertex(const Point& pos) const
Vector3 Grid3D::getOriginalVertex(const Point& pos) const
{
CCASSERT( pos.x == (unsigned int)pos.x && pos.y == (unsigned int) pos.y , "Numbers must be integers");
int index = (pos.x * (_gridSize.height+1) + pos.y) * 3;
float *vertArray = (float*)_originalVertices;
Vertex3F vert(vertArray[index], vertArray[index+1], vertArray[index+2]);
Vector3 vert(vertArray[index], vertArray[index+1], vertArray[index+2]);
return vert;
}
void Grid3D::setVertex(const Point& pos, const Vertex3F& vertex)
void Grid3D::setVertex(const Point& pos, const Vector3& vertex)
{
CCASSERT( pos.x == (unsigned int)pos.x && pos.y == (unsigned int) pos.y , "Numbers must be integers");
int index = (pos.x * (_gridSize.height + 1) + pos.y) * 3;
@ -465,7 +465,7 @@ void Grid3D::reuse(void)
{
if (_reuseGrid > 0)
{
memcpy(_originalVertices, _vertices, (_gridSize.width+1) * (_gridSize.height+1) * sizeof(Vertex3F));
memcpy(_originalVertices, _vertices, (_gridSize.width+1) * (_gridSize.height+1) * sizeof(Vector3));
--_reuseGrid;
}
}
@ -545,7 +545,7 @@ void TiledGrid3D::blit(void)
int numQuads = _gridSize.width * _gridSize.height;
// position
setGLBufferData(_vertices, (numQuads*4*sizeof(Vertex3F)), 0);
setGLBufferData(_vertices, (numQuads*4*sizeof(Vector3)), 0);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, 0);
// texCoords
@ -580,8 +580,8 @@ void TiledGrid3D::calculateVertexPoints(void)
CC_SAFE_FREE(_texCoordinates);
CC_SAFE_FREE(_indices);
_vertices = malloc(numQuads*4*sizeof(Vertex3F));
_originalVertices = malloc(numQuads*4*sizeof(Vertex3F));
_vertices = malloc(numQuads*4*sizeof(Vector3));
_originalVertices = malloc(numQuads*4*sizeof(Vector3));
_texCoordinates = malloc(numQuads*4*sizeof(Vertex2F));
_indices = (GLushort*)malloc(numQuads*6*sizeof(GLushort));

View File

@ -132,28 +132,28 @@ public:
* @js NA
* @lua NA
*/
Vertex3F getVertex(const Point& pos) const;
Vector3 getVertex(const Point& pos) const;
/** @deprecated Use getVertex() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE Vertex3F vertex(const Point& pos) const { return getVertex(pos); }
CC_DEPRECATED_ATTRIBUTE Vector3 vertex(const Point& pos) const { return getVertex(pos); }
/** returns the original (non-transformed) vertex at a given position
* @js NA
* @lua NA
*/
Vertex3F getOriginalVertex(const Point& pos) const;
Vector3 getOriginalVertex(const Point& pos) const;
/** @deprecated Use getOriginalVertex() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE Vertex3F originalVertex(const Point& pos) const { return getOriginalVertex(pos); }
CC_DEPRECATED_ATTRIBUTE Vector3 originalVertex(const Point& pos) const { return getOriginalVertex(pos); }
/** sets a new vertex at a given position
* @js NA
* @lua NA
*/
void setVertex(const Point& pos, const Vertex3F& vertex);
void setVertex(const Point& pos, const Vector3& vertex);
// Overrides
virtual void blit() override;

View File

@ -592,7 +592,7 @@ void LayerColor::draw(Renderer *renderer, const kmMat4 &transform, bool transfor
kmVec3 pos;
pos.x = _squareVertices[i].x; pos.y = _squareVertices[i].y; pos.z = _positionZ;
kmVec3TransformCoord(&pos, &pos, &_modelViewTransform);
_noMVPVertices[i] = Vertex3F(pos.x,pos.y,pos.z);
_noMVPVertices[i] = Vector3(pos.x,pos.y,pos.z);
}
}
@ -606,7 +606,7 @@ void LayerColor::onDraw(const kmMat4& transform, bool transformUpdated)
// Attributes
//
#ifdef EMSCRIPTEN
setGLBufferData(_noMVPVertices, 4 * sizeof(Vertex3F), 0);
setGLBufferData(_noMVPVertices, 4 * sizeof(Vector3), 0);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, 0);
setGLBufferData(_squareColors, 4 * sizeof(Color4F), 1);

View File

@ -304,7 +304,7 @@ protected:
Vertex2F _squareVertices[4];
Color4F _squareColors[4];
CustomCommand _customCommand;
Vertex3F _noMVPVertices[4];
Vector3 _noMVPVertices[4];
private:
CC_DISALLOW_COPY_AND_ASSIGN(LayerColor);

View File

@ -280,7 +280,7 @@ float Node::getRotationSkewX() const
return _rotationZ_X;
}
void Node::setRotation3D(const Vertex3F& rotation)
void Node::setRotation3D(const Vector3& rotation)
{
if (_rotationX == rotation.x &&
_rotationY == rotation.y &&
@ -303,12 +303,12 @@ void Node::setRotation3D(const Vertex3F& rotation)
#endif
}
Vertex3F Node::getRotation3D() const
Vector3 Node::getRotation3D() const
{
// rotation Z is decomposed in 2 to simulate Skew for Flash animations
CCASSERT(_rotationZ_X == _rotationZ_Y, "_rotationZ_X != _rotationZ_Y");
return Vertex3F(_rotationX,_rotationY,_rotationZ_X);
return Vector3(_rotationX,_rotationY,_rotationZ_X);
}
void Node::setRotationSkewX(float rotationX)
@ -447,15 +447,15 @@ void Node::setPosition(float x, float y)
setPosition(Point(x, y));
}
void Node::setPosition3D(const Vertex3F& position)
void Node::setPosition3D(const Vector3& position)
{
_positionZ = position.z;
setPosition(Point(position.x, position.y));
}
Vertex3F Node::getPosition3D() const
Vector3 Node::getPosition3D() const
{
Vertex3F ret;
Vector3 ret;
ret.x = _position.x;
ret.y = _position.y;
ret.z = _positionZ;

View File

@ -40,6 +40,7 @@
#include "CCEventDispatcher.h"
#include "CCVector.h"
#include "kazmath/kazmath.h"
#include "CCMath.h"
NS_CC_BEGIN
@ -72,6 +73,8 @@ enum {
kNodeOnCleanup
};
USING_NS_CC_MATH;
bool nodeComparisonLess(Node* n1, Node* n2);
class EventListener;
@ -331,11 +334,11 @@ public:
/**
* Sets the position (X, Y, and Z) in its parent's coordinate system
*/
virtual void setPosition3D(const Vertex3F& position);
virtual void setPosition3D(const Vector3& position);
/**
* returns the position (X,Y,Z) in its parent's coordinate system
*/
virtual Vertex3F getPosition3D() const;
virtual Vector3 getPosition3D() const;
/**
* Sets the 'z' coordinate in the position. It is the OpenGL Z vertex value.
@ -499,11 +502,11 @@ public:
* Sets the rotation (X,Y,Z) in degrees.
* Useful for 3d rotations
*/
virtual void setRotation3D(const Vertex3F& rotation);
virtual void setRotation3D(const Vector3& rotation);
/**
* returns the rotation (X,Y,Z) in degrees.
*/
virtual Vertex3F getRotation3D() const;
virtual Vector3 getRotation3D() const;
/**
* Sets the X rotation (angle) of the node in degrees which performs a horizontal rotational skew.

View File

@ -404,10 +404,10 @@ void Sprite::setTextureRect(const Rect& rect, bool rotated, const Size& untrimme
float y2 = y1 + _rect.size.height;
// Don't update Z.
_quad.bl.vertices = Vertex3F(x1, y1, 0);
_quad.br.vertices = Vertex3F(x2, y1, 0);
_quad.tl.vertices = Vertex3F(x1, y2, 0);
_quad.tr.vertices = Vertex3F(x2, y2, 0);
_quad.bl.vertices = Vector3(x1, y1, 0);
_quad.br.vertices = Vector3(x2, y1, 0);
_quad.tl.vertices = Vector3(x1, y2, 0);
_quad.tr.vertices = Vector3(x2, y2, 0);
}
}
@ -510,7 +510,7 @@ void Sprite::updateTransform(void)
// If it is not visible, or one of its ancestors is not visible, then do nothing:
if( !_visible || ( _parent && _parent != _batchNode && static_cast<Sprite*>(_parent)->_shouldBeHidden) )
{
_quad.br.vertices = _quad.tl.vertices = _quad.tr.vertices = _quad.bl.vertices = Vertex3F(0,0,0);
_quad.br.vertices = _quad.tl.vertices = _quad.tr.vertices = _quad.bl.vertices = Vector3(0,0,0);
_shouldBeHidden = true;
}
else
@ -559,10 +559,10 @@ void Sprite::updateTransform(void)
float dx = x1 * cr - y2 * sr2 + x;
float dy = x1 * sr + y2 * cr2 + y;
_quad.bl.vertices = Vertex3F( RENDER_IN_SUBPIXEL(ax), RENDER_IN_SUBPIXEL(ay), _positionZ );
_quad.br.vertices = Vertex3F( RENDER_IN_SUBPIXEL(bx), RENDER_IN_SUBPIXEL(by), _positionZ );
_quad.tl.vertices = Vertex3F( RENDER_IN_SUBPIXEL(dx), RENDER_IN_SUBPIXEL(dy), _positionZ );
_quad.tr.vertices = Vertex3F( RENDER_IN_SUBPIXEL(cx), RENDER_IN_SUBPIXEL(cy), _positionZ );
_quad.bl.vertices = Vector3( RENDER_IN_SUBPIXEL(ax), RENDER_IN_SUBPIXEL(ay), _positionZ );
_quad.br.vertices = Vector3( RENDER_IN_SUBPIXEL(bx), RENDER_IN_SUBPIXEL(by), _positionZ );
_quad.tl.vertices = Vector3( RENDER_IN_SUBPIXEL(dx), RENDER_IN_SUBPIXEL(dy), _positionZ );
_quad.tr.vertices = Vector3( RENDER_IN_SUBPIXEL(cx), RENDER_IN_SUBPIXEL(cy), _positionZ );
}
// MARMALADE CHANGE: ADDED CHECK FOR nullptr, TO PERMIT SPRITES WITH NO BATCH NODE / TEXTURE ATLAS
@ -1028,10 +1028,10 @@ void Sprite::setBatchNode(SpriteBatchNode *spriteBatchNode)
float y1 = _offsetPosition.y;
float x2 = x1 + _rect.size.width;
float y2 = y1 + _rect.size.height;
_quad.bl.vertices = Vertex3F( x1, y1, 0 );
_quad.br.vertices = Vertex3F( x2, y1, 0 );
_quad.tl.vertices = Vertex3F( x1, y2, 0 );
_quad.tr.vertices = Vertex3F( x2, y2, 0 );
_quad.bl.vertices = Vector3( x1, y1, 0 );
_quad.br.vertices = Vector3( x2, y1, 0 );
_quad.tl.vertices = Vector3( x1, y2, 0 );
_quad.tr.vertices = Vector3( x2, y2, 0 );
} else {

View File

@ -31,9 +31,12 @@ THE SOFTWARE.
#include <string>
#include "CCGeometry.h"
#include "CCGL.h"
#include "CCMath.h"
NS_CC_BEGIN
USING_NS_CC_MATH;
struct Color4B;
struct Color4F;
@ -163,20 +166,20 @@ struct Vertex2F
/** A vertex composed of 2 floats: x, y
@since v3.0
*/
struct Vertex3F
{
Vertex3F(float _x, float _y, float _z)
: x(_x)
, y(_y)
, z(_z)
{}
// struct Vertex3F
// {
// Vertex3F(float _x, float _y, float _z)
// : x(_x)
// , y(_y)
// , z(_z)
// {}
Vertex3F(): x(0.f), y(0.f), z(0.f) {}
// Vertex3F(): x(0.f), y(0.f), z(0.f) {}
GLfloat x;
GLfloat y;
GLfloat z;
};
// GLfloat x;
// GLfloat y;
// GLfloat z;
// };
/** A texcoord composed of 2 floats: u, y
@since v3.0
@ -211,10 +214,10 @@ struct Quad2
//! A 3D Quad. 4 * 3 floats
struct Quad3 {
Vertex3F bl;
Vertex3F br;
Vertex3F tl;
Vertex3F tr;
Vector3 bl;
Vector3 br;
Vector3 tl;
Vector3 tr;
};
//! a Point with a vertex point, a tex coord point and a color 4B
@ -243,7 +246,7 @@ struct V2F_C4F_T2F
struct V3F_C4B_T2F
{
//! vertices (3F)
Vertex3F vertices; // 12 bytes
Vector3 vertices; // 12 bytes
//! colors (4B)
Color4B colors; // 4 bytes

View File

@ -153,7 +153,7 @@ void Skin::updateTransform()
// If it is not visible, or one of its ancestors is not visible, then do nothing:
if( !_visible)
{
_quad.br.vertices = _quad.tl.vertices = _quad.tr.vertices = _quad.bl.vertices = Vertex3F(0, 0, 0);
_quad.br.vertices = _quad.tl.vertices = _quad.tr.vertices = _quad.bl.vertices = Vector3(0, 0, 0);
}
else
{