remove kmMat4 in Cpp-tests

This commit is contained in:
Huabing.Xu 2014-04-11 18:03:07 +08:00
parent 867c60a971
commit 1aa909371d
7 changed files with 26 additions and 30 deletions

View File

@ -1672,10 +1672,10 @@ void ActionCatmullRomStacked::draw(Renderer *renderer, const Matrix &transform,
CCASSERT(nullptr != director, "Director is null when seting matrix stack"); CCASSERT(nullptr != director, "Director is null when seting matrix stack");
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
kmMat4 translation; Matrix translation;
//Create a rotation matrix using the axis and the angle //Create a rotation matrix using the axis and the angle
kmMat4Translation(&translation,50,50,0); Matrix::createTranslation(50, 50, 0, &translation);
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation); director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation);
_modelViewMV1 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); _modelViewMV1 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
@ -1692,7 +1692,7 @@ void ActionCatmullRomStacked::onDraw(const Matrix &transform, bool transformUpda
Director* director = Director::getInstance(); Director* director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null when seting matrix stack"); CCASSERT(nullptr != director, "Director is null when seting matrix stack");
kmMat4 oldMat; Matrix oldMat;
oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1);
DrawPrimitives::drawCatmullRom(_array1,50); DrawPrimitives::drawCatmullRom(_array1,50);
@ -1792,10 +1792,10 @@ void ActionCardinalSplineStacked::draw(Renderer *renderer, const Matrix &transfo
CCASSERT(nullptr != director, "Director is null when seting matrix stack"); CCASSERT(nullptr != director, "Director is null when seting matrix stack");
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
kmMat4 translation; Matrix translation;
//Create a rotation matrix using the axis and the angle //Create a rotation matrix using the axis and the angle
kmMat4Translation(&translation,50,50,0); Matrix::createTranslation(50, 50, 0, &translation);
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation); director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation);
_modelViewMV1 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); _modelViewMV1 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
@ -1806,7 +1806,7 @@ void ActionCardinalSplineStacked::draw(Renderer *renderer, const Matrix &transfo
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
//Create a rotation matrix using the axis and the angle //Create a rotation matrix using the axis and the angle
kmMat4Translation(&translation,s.width/2,50,0); Matrix::createTranslation(s.width/2, 50, 0, &translation);
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation); director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation);
_modelViewMV2 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); _modelViewMV2 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
@ -1822,7 +1822,7 @@ void ActionCardinalSplineStacked::onDraw(const Matrix &transform, bool transform
Director* director = Director::getInstance(); Director* director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null when seting matrix stack"); CCASSERT(nullptr != director, "Director is null when seting matrix stack");
kmMat4 oldMat; Matrix oldMat;
oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1);
DrawPrimitives::drawCardinalSpline(_array, 0, 100); DrawPrimitives::drawCardinalSpline(_array, 0, 100);
@ -2174,10 +2174,10 @@ void ActionCatmullRom::draw(Renderer *renderer, const Matrix &transform, bool tr
CCASSERT(nullptr != director, "Director is null when seting matrix stack"); CCASSERT(nullptr != director, "Director is null when seting matrix stack");
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
kmMat4 translation; Matrix translation;
//Create a rotation matrix using the axis and the angle //Create a rotation matrix using the axis and the angle
kmMat4Translation(&translation,50,50,0); Matrix::createTranslation(50, 50, 0, &translation);
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation); director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation);
_modelViewMV1 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); _modelViewMV1 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
@ -2195,7 +2195,7 @@ void ActionCatmullRom::onDraw(const Matrix &transform, bool transformUpdated)
Director* director = Director::getInstance(); Director* director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null when seting matrix stack"); CCASSERT(nullptr != director, "Director is null when seting matrix stack");
kmMat4 oldMat; Matrix oldMat;
oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1);
DrawPrimitives::drawCatmullRom(_array1, 50); DrawPrimitives::drawCatmullRom(_array1, 50);
@ -2279,10 +2279,10 @@ void ActionCardinalSpline::draw(Renderer *renderer, const Matrix &transform, boo
CCASSERT(nullptr != director, "Director is null when seting matrix stack"); CCASSERT(nullptr != director, "Director is null when seting matrix stack");
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
kmMat4 translation; Matrix translation;
//Create a rotation matrix using the axis and the angle //Create a rotation matrix using the axis and the angle
kmMat4Translation(&translation,50,50,0); Matrix::createTranslation(50, 50, 0, &translation);
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation); director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation);
_modelViewMV1 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); _modelViewMV1 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
@ -2292,7 +2292,7 @@ void ActionCardinalSpline::draw(Renderer *renderer, const Matrix &transform, boo
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
//Create a rotation matrix using the axis and the angle //Create a rotation matrix using the axis and the angle
kmMat4Translation(&translation,s.width/2,50,0); Matrix::createTranslation(s.width/2, 50, 0, &translation);
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation); director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation);
_modelViewMV2 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); _modelViewMV2 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
@ -2307,7 +2307,7 @@ void ActionCardinalSpline::onDraw(const Matrix &transform, bool transformUpdated
Director* director = Director::getInstance(); Director* director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null when seting matrix stack"); CCASSERT(nullptr != director, "Director is null when seting matrix stack");
kmMat4 oldMat; Matrix oldMat;
oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1);
DrawPrimitives::drawCardinalSpline(_array, 0, 100); DrawPrimitives::drawCardinalSpline(_array, 0, 100);

View File

@ -168,7 +168,7 @@ void Box2DTestLayer::onDraw()
Director* director = Director::getInstance(); Director* director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null when seting matrix stack"); CCASSERT(nullptr != director, "Director is null when seting matrix stack");
kmMat4 oldMV; Matrix oldMV;
oldMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); oldMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV);
world->DrawDebugData(); world->DrawDebugData();

View File

@ -845,7 +845,7 @@ void TestColliderDetector::onExit()
ArmatureTestLayer::onExit(); ArmatureTestLayer::onExit();
} }
void TestColliderDetector::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) void TestColliderDetector::draw(Renderer *renderer, const Matrix &transform, bool transformUpdated)
{ {
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
Director* director = Director::getInstance(); Director* director = Director::getInstance();

View File

@ -17,7 +17,7 @@ public:
setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR)); setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
} }
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) virtual void draw(Renderer *renderer, const Matrix &transform, bool transformUpdated)
{ {
DrawPrimitives::setDrawColor4B(_touchColor.r, _touchColor.g, _touchColor.b, 255); DrawPrimitives::setDrawColor4B(_touchColor.r, _touchColor.g, _touchColor.b, 255);
glLineWidth(10); glLineWidth(10);

View File

@ -992,7 +992,7 @@ public:
return sprite; return sprite;
} }
virtual void draw(Renderer *renderer, const Matrix &transform, bool transformUpdated) override; virtual void draw(Renderer *renderer, const Matrix &transform, bool transformUpdated) override;
void onDraw(const kmMat4 &transform, bool transformUpdated); void onDraw(const Matrix &transform, bool transformUpdated);
protected: protected:
CustomCommand _customCommand; CustomCommand _customCommand;
@ -1006,7 +1006,7 @@ void MySprite::draw(Renderer *renderer, const Matrix &transform, bool transformU
renderer->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void MySprite::onDraw(const kmMat4 &transform, bool transformUpdated) void MySprite::onDraw(const Matrix &transform, bool transformUpdated)
{ {
getShaderProgram()->use(); getShaderProgram()->use();
getShaderProgram()->setUniformsForBuiltins(transform); getShaderProgram()->setUniformsForBuiltins(transform);
@ -1117,14 +1117,10 @@ CameraTest2::CameraTest2()
_sprite2->setPosition( Point(3*s.width/4, s.height/2) ); _sprite2->setPosition( Point(3*s.width/4, s.height/2) );
_sprite2->setScale(0.5); _sprite2->setScale(0.5);
kmVec3 eye, center, up; Vector3 eye(150, 0, 200), center(0, 0, 0), up(0, 1, 0);
kmVec3Fill(&eye, 150, 0, 200); Matrix lookupMatrix;
kmVec3Fill(&center, 0, 0, 0); Matrix::createLookAt(eye, center, up, &lookupMatrix);
kmVec3Fill(&up, 0, 1, 0);
kmMat4 lookupMatrix;
kmMat4LookAt(&lookupMatrix, &eye, &center, &up);
Matrix lookupMatrix2 = lookupMatrix; Matrix lookupMatrix2 = lookupMatrix;

View File

@ -436,7 +436,7 @@ public:
static SpriteBlur* create(const char *pszFileName); static SpriteBlur* create(const char *pszFileName);
protected: protected:
void onDraw(const kmMat4 &transform, bool transformUpdated); void onDraw(const Matrix &transform, bool transformUpdated);
int _blurRadius; int _blurRadius;
Point _pixelSize; Point _pixelSize;
@ -536,7 +536,7 @@ void SpriteBlur::draw(Renderer *renderer, const Matrix &transform, bool transfor
renderer->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void SpriteBlur::onDraw(const kmMat4 &transform, bool transformUpdated) void SpriteBlur::onDraw(const Matrix &transform, bool transformUpdated)
{ {
GL::enableVertexAttribs(cocos2d::GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX ); GL::enableVertexAttribs(cocos2d::GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX );
BlendFunc blend = getBlendFunc(); BlendFunc blend = getBlendFunc();

View File

@ -123,7 +123,7 @@ protected:
protected: protected:
CustomCommand _renderCommand; CustomCommand _renderCommand;
void onDraw(const kmMat4 &transform, bool transformUpdated); void onDraw(const Matrix &transform, bool transformUpdated);
}; };
@ -184,7 +184,7 @@ void ShaderSprite::draw(Renderer *renderer, const Matrix &transform, bool transf
} }
void ShaderSprite::onDraw(const kmMat4 &transform, bool transformUpdated) void ShaderSprite::onDraw(const Matrix &transform, bool transformUpdated)
{ {
auto shader = getShaderProgram(); auto shader = getShaderProgram();
shader->use(); shader->use();