From 1aa909371d43a166b6837d64c0dd5a44378d3eaf Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Fri, 11 Apr 2014 18:03:07 +0800 Subject: [PATCH] remove kmMat4 in Cpp-tests --- .../Classes/ActionsTest/ActionsTest.cpp | 28 +++++++++---------- .../cpp-tests/Classes/Box2DTest/Box2dTest.cpp | 2 +- .../CocoStudioArmatureTest/ArmatureScene.cpp | 2 +- .../Classes/MutiTouchTest/MutiTouchTest.cpp | 2 +- tests/cpp-tests/Classes/NodeTest/NodeTest.cpp | 14 ++++------ .../Classes/ShaderTest/ShaderTest.cpp | 4 +-- .../Classes/ShaderTest/ShaderTest2.cpp | 4 +-- 7 files changed, 26 insertions(+), 30 deletions(-) diff --git a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp index 751bd2838e..a2060512cf 100644 --- a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp +++ b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp @@ -1672,10 +1672,10 @@ void ActionCatmullRomStacked::draw(Renderer *renderer, const Matrix &transform, CCASSERT(nullptr != director, "Director is null when seting matrix stack"); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); - kmMat4 translation; + Matrix translation; //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); _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(); CCASSERT(nullptr != director, "Director is null when seting matrix stack"); - kmMat4 oldMat; + Matrix oldMat; oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1); 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"); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); - kmMat4 translation; + Matrix translation; //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); _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); //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); _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(); CCASSERT(nullptr != director, "Director is null when seting matrix stack"); - kmMat4 oldMat; + Matrix oldMat; oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1); 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"); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); - kmMat4 translation; + Matrix translation; //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); _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(); CCASSERT(nullptr != director, "Director is null when seting matrix stack"); - kmMat4 oldMat; + Matrix oldMat; oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1); 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"); director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); - kmMat4 translation; + Matrix translation; //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); _modelViewMV1 = director->getMatrix(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); //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); _modelViewMV2 = director->getMatrix(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(); CCASSERT(nullptr != director, "Director is null when seting matrix stack"); - kmMat4 oldMat; + Matrix oldMat; oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1); DrawPrimitives::drawCardinalSpline(_array, 0, 100); diff --git a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp index b4ea342c8b..f78cb95f6f 100644 --- a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp +++ b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp @@ -168,7 +168,7 @@ void Box2DTestLayer::onDraw() Director* director = Director::getInstance(); CCASSERT(nullptr != director, "Director is null when seting matrix stack"); - kmMat4 oldMV; + Matrix oldMV; oldMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV); world->DrawDebugData(); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp index 3f7377e0f5..74b2855181 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp @@ -845,7 +845,7 @@ void TestColliderDetector::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 ); Director* director = Director::getInstance(); diff --git a/tests/cpp-tests/Classes/MutiTouchTest/MutiTouchTest.cpp b/tests/cpp-tests/Classes/MutiTouchTest/MutiTouchTest.cpp index 3af3ab5d74..09b2124872 100644 --- a/tests/cpp-tests/Classes/MutiTouchTest/MutiTouchTest.cpp +++ b/tests/cpp-tests/Classes/MutiTouchTest/MutiTouchTest.cpp @@ -17,7 +17,7 @@ public: 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); glLineWidth(10); diff --git a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp index c2d7fd55a9..7bff9f0f31 100644 --- a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp +++ b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp @@ -992,7 +992,7 @@ public: return sprite; } 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: CustomCommand _customCommand; @@ -1006,7 +1006,7 @@ void MySprite::draw(Renderer *renderer, const Matrix &transform, bool transformU renderer->addCommand(&_customCommand); } -void MySprite::onDraw(const kmMat4 &transform, bool transformUpdated) +void MySprite::onDraw(const Matrix &transform, bool transformUpdated) { getShaderProgram()->use(); getShaderProgram()->setUniformsForBuiltins(transform); @@ -1117,14 +1117,10 @@ CameraTest2::CameraTest2() _sprite2->setPosition( Point(3*s.width/4, s.height/2) ); _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); - kmVec3Fill(¢er, 0, 0, 0); - kmVec3Fill(&up, 0, 1, 0); - - kmMat4 lookupMatrix; - kmMat4LookAt(&lookupMatrix, &eye, ¢er, &up); + Matrix lookupMatrix; + Matrix::createLookAt(eye, center, up, &lookupMatrix); Matrix lookupMatrix2 = lookupMatrix; diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp b/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp index 44f3b8ecda..74cf848177 100644 --- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp +++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp @@ -436,7 +436,7 @@ public: static SpriteBlur* create(const char *pszFileName); protected: - void onDraw(const kmMat4 &transform, bool transformUpdated); + void onDraw(const Matrix &transform, bool transformUpdated); int _blurRadius; Point _pixelSize; @@ -536,7 +536,7 @@ void SpriteBlur::draw(Renderer *renderer, const Matrix &transform, bool transfor 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 ); BlendFunc blend = getBlendFunc(); diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp index aa328454b5..ba48f29485 100644 --- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp +++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp @@ -123,7 +123,7 @@ protected: protected: 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(); shader->use();