fixed #3683. fixed convertToWorldSpaceAR of CCSkin returning error coordinate

This commit is contained in:
andyque 2014-01-16 12:10:41 +08:00
parent da32bfd5d7
commit 4a6e137389
4 changed files with 19 additions and 3 deletions

View File

@ -115,7 +115,7 @@ void DisplayFactory::updateDisplay(Bone *bone, float dt, bool dirty)
anchorPoint = PointApplyTransform(anchorPoint, displayTransform);
displayTransform.mat[12] = anchorPoint.x;
displayTransform.mat[13] = anchorPoint.y;
kmMat4 t = TransformConcat(displayTransform, bone->getArmature()->getNodeToParentTransform());
kmMat4 t = TransformConcat( bone->getArmature()->getNodeToParentTransform(),displayTransform);
detector->updateTransform(t);
}
while (0);

View File

@ -197,7 +197,7 @@ void Skin::updateTransform()
kmMat4 Skin::getNodeToWorldTransform() const
{
return TransformConcat(_transform, _bone->getArmature()->getNodeToWorldTransform());
return TransformConcat( _bone->getArmature()->getNodeToWorldTransform(), _transform);
}
kmMat4 Skin::getNodeToWorldTransformAR() const

View File

@ -1067,8 +1067,22 @@ void TestColliderDetector::update(float delta)
}
void TestColliderDetector::draw()
{
armature2->drawContour();
_customCommand.init(0, _vertexZ);
_customCommand.func = CC_CALLBACK_0(TestColliderDetector::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand);
}
void TestColliderDetector::onDraw()
{
kmMat4 oldMat;
kmGLGetMatrix(KM_GL_MODELVIEW, &oldMat);
kmGLLoadMatrix(&_modelViewTransform);
armature2->drawContour();
kmGLLoadMatrix(&oldMat);
}
#endif

View File

@ -271,6 +271,7 @@ public:
virtual std::string title() const override;
virtual void update(float delta);
virtual void draw();
void onDraw();
void onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex);
@ -278,6 +279,7 @@ public:
cocostudio::Armature *armature;
cocostudio::Armature *armature2;
CustomCommand _customCommand; //new render needed this for drawing primitives
cocos2d::Sprite *bullet;
};
#endif