visit() using Matrix instead of kmMat4

This commit is contained in:
Huabing.Xu 2014-04-08 21:45:54 +08:00
parent e8596094a4
commit b9af100493
38 changed files with 40 additions and 38 deletions

View File

@ -200,7 +200,7 @@ void ClippingNode::drawFullScreenQuadClearStencil()
} }
void ClippingNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void ClippingNode::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
if(!_visible) if(!_visible)
return; return;

View File

@ -95,7 +95,7 @@ public:
* @lua NA * @lua NA
*/ */
virtual void onExit() override; virtual void onExit() override;
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
ClippingNode(); ClippingNode();

View File

@ -1098,7 +1098,7 @@ void Label::drawTextSprite(Renderer *renderer, bool parentTransformUpdated)
_textSprite->visit(renderer, _modelViewTransform, parentTransformUpdated); _textSprite->visit(renderer, _modelViewTransform, parentTransformUpdated);
} }
void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void Label::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
if (! _visible || _originalUTF8String.empty()) if (! _visible || _originalUTF8String.empty())
{ {

View File

@ -240,7 +240,7 @@ public:
virtual Rect getBoundingBox() const override; virtual Rect getBoundingBox() const override;
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
/** Listen "come to background" message /** Listen "come to background" message

View File

@ -262,7 +262,7 @@ void LabelTTF::setFlippedY(bool flippedY)
} }
} }
void LabelTTF::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void LabelTTF::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
if (_contentDirty) if (_contentDirty)
{ {

View File

@ -150,7 +150,7 @@ public:
* @lua NA * @lua NA
*/ */
virtual std::string getDescription() const override; virtual std::string getDescription() const override;
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
virtual const Size& getContentSize() const override; virtual const Size& getContentSize() const override;
protected: protected:
Label* _renderLabel; Label* _renderLabel;

View File

@ -938,7 +938,7 @@ void Node::visit()
visit(renderer, parentTransform, true); visit(renderer, parentTransform, true);
} }
void Node::visit(Renderer* renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void Node::visit(Renderer* renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
// quick return if not visible. children won't be drawn. // quick return if not visible. children won't be drawn.
if (!_visible) if (!_visible)

View File

@ -929,7 +929,7 @@ public:
/** /**
* Visits this node's children and draw them recursively. * Visits this node's children and draw them recursively.
*/ */
virtual void visit(Renderer *renderer, const kmMat4& parentTransform, bool parentTransformUpdated); virtual void visit(Renderer *renderer, const Matrix& parentTransform, bool parentTransformUpdated);
virtual void visit() final; virtual void visit() final;

View File

@ -82,7 +82,7 @@ void NodeGrid::onGridEndDraw()
} }
} }
void NodeGrid::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void NodeGrid::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
// quick return if not visible. children won't be drawn. // quick return if not visible. children won't be drawn.
if (!_visible) if (!_visible)

View File

@ -55,7 +55,7 @@ public:
void setTarget(Node *target); void setTarget(Node *target);
// overrides // overrides
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
protected: protected:
NodeGrid(); NodeGrid();

View File

@ -145,7 +145,7 @@ The positions are updated at visit because:
- using a timer is not guaranteed that it will called after all the positions were updated - using a timer is not guaranteed that it will called after all the positions were updated
- overriding "draw" will only precise if the children have a z > 0 - overriding "draw" will only precise if the children have a z > 0
*/ */
void ParallaxNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void ParallaxNode::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
// Point pos = position_; // Point pos = position_;
// Point pos = [self convertToWorldSpace:Point::ZERO]; // Point pos = [self convertToWorldSpace:Point::ZERO];

View File

@ -67,7 +67,7 @@ public:
virtual void addChild(Node * child, int zOrder, int tag) override; virtual void addChild(Node * child, int zOrder, int tag) override;
virtual void removeChild(Node* child, bool cleanup) override; virtual void removeChild(Node* child, bool cleanup) override;
virtual void removeAllChildrenWithCleanup(bool cleanup) override; virtual void removeAllChildrenWithCleanup(bool cleanup) override;
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
protected: protected:
/** Adds a child to the container with a z-order, a parallax ratio and a position offset /** Adds a child to the container with a z-order, a parallax ratio and a position offset

View File

@ -120,7 +120,7 @@ bool ParticleBatchNode::initWithFile(const std::string& fileImage, int capacity)
// override visit. // override visit.
// Don't call visit on it's children // Don't call visit on it's children
void ParticleBatchNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void ParticleBatchNode::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
// CAREFUL: // CAREFUL:
// This visit is almost identical to Node#visit // This visit is almost identical to Node#visit

View File

@ -91,7 +91,7 @@ public:
inline void setTextureAtlas(TextureAtlas* atlas) { _textureAtlas = atlas; }; inline void setTextureAtlas(TextureAtlas* atlas) { _textureAtlas = atlas; };
// Overrides // Overrides
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
using Node::addChild; using Node::addChild;
virtual void addChild(Node * child, int zOrder, int tag) override; virtual void addChild(Node * child, int zOrder, int tag) override;

View File

@ -383,7 +383,7 @@ void RenderTexture::clearStencil(int stencilValue)
glClearStencil(stencilClearValue); glClearStencil(stencilClearValue);
} }
void RenderTexture::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void RenderTexture::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
// override visit. // override visit.
// Don't call visit on its children // Don't call visit on its children

View File

@ -154,7 +154,7 @@ public:
}; };
// Overrides // Overrides
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
//flag: use stack matrix computed from scene hierarchy or generate new modelView and projection matrix //flag: use stack matrix computed from scene hierarchy or generate new modelView and projection matrix

View File

@ -131,7 +131,7 @@ SpriteBatchNode::~SpriteBatchNode()
// override visit // override visit
// don't call visit on it's children // don't call visit on it's children
void SpriteBatchNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void SpriteBatchNode::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
CC_PROFILER_START_CATEGORY(kProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit"); CC_PROFILER_START_CATEGORY(kProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");

View File

@ -155,7 +155,7 @@ public:
*/ */
virtual const BlendFunc& getBlendFunc() const override; virtual const BlendFunc& getBlendFunc() const override;
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
using Node::addChild; using Node::addChild;
virtual void addChild(Node * child, int zOrder, int tag) override; virtual void addChild(Node * child, int zOrder, int tag) override;

View File

@ -263,7 +263,7 @@ void TextFieldTTF::setTextColor(const Color4B &color)
Label::setTextColor(_colorText); Label::setTextColor(_colorText);
} }
void TextFieldTTF::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void TextFieldTTF::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
if (_delegate && _delegate->onVisit(this,renderer,parentTransform,parentTransformUpdated)) if (_delegate && _delegate->onVisit(this,renderer,parentTransform,parentTransformUpdated))
{ {

View File

@ -165,7 +165,7 @@ public:
virtual void setSecureTextEntry(bool value); virtual void setSecureTextEntry(bool value);
virtual bool isSecureTextEntry(); virtual bool isSecureTextEntry();
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
protected: protected:
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////

View File

@ -445,7 +445,7 @@ void Armature::onExit()
} }
void Armature::visit(cocos2d::Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void Armature::visit(cocos2d::Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
// quick return if not visible. children won't be drawn. // quick return if not visible. children won't be drawn.
if (!_visible) if (!_visible)

View File

@ -159,7 +159,7 @@ public:
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual void visit(cocos2d::Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(cocos2d::Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
virtual void draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override; virtual void draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual void update(float dt) override; virtual void update(float dt) override;

View File

@ -101,7 +101,7 @@ void BatchNode::removeChild(Node* child, bool cleanup)
Node::removeChild(child, cleanup); Node::removeChild(child, cleanup);
} }
void BatchNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void BatchNode::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
// quick return if not visible. children won't be drawn. // quick return if not visible. children won't be drawn.
if (!_visible) if (!_visible)

View File

@ -34,6 +34,8 @@ namespace cocos2d {
namespace cocostudio { namespace cocostudio {
USING_NS_CC_MATH;
class BatchNode : public cocos2d::Node class BatchNode : public cocos2d::Node
{ {
public: public:
@ -56,7 +58,7 @@ public:
virtual void addChild(cocos2d::Node *pChild, int zOrder) override; virtual void addChild(cocos2d::Node *pChild, int zOrder) override;
virtual void addChild(cocos2d::Node *pChild, int zOrder, int tag) override; virtual void addChild(cocos2d::Node *pChild, int zOrder, int tag) override;
virtual void removeChild(cocos2d::Node* child, bool cleanup) override; virtual void removeChild(cocos2d::Node* child, bool cleanup) override;
virtual void visit(cocos2d::Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(cocos2d::Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
virtual void draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override; virtual void draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
protected: protected:

View File

@ -272,7 +272,7 @@ void ProtectedNode::reorderProtectedChild(cocos2d::Node *child, int localZOrder)
child->_setLocalZOrder(localZOrder); child->_setLocalZOrder(localZOrder);
} }
void ProtectedNode::visit(Renderer* renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void ProtectedNode::visit(Renderer* renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
// quick return if not visible. children won't be drawn. // quick return if not visible. children won't be drawn.
if (!_visible) if (!_visible)

View File

@ -127,7 +127,7 @@ public:
/// @} end of Children and Parent /// @} end of Children and Parent
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool transformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool transformUpdated) override;
virtual void cleanup() override; virtual void cleanup() override;

View File

@ -712,7 +712,7 @@ bool Layout::hitTest(const Point &pt)
return false; return false;
} }
void Layout::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void Layout::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
if (!_enabled) if (!_enabled)
{ {

View File

@ -240,7 +240,7 @@ public:
*/ */
virtual void addChild(Node* child, int zOrder, int tag) override; virtual void addChild(Node* child, int zOrder, int tag) override;
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
virtual void removeChild(Node* child, bool cleanup = true) override; virtual void removeChild(Node* child, bool cleanup = true) override;

View File

@ -420,7 +420,7 @@ void RichText::pushToContainer(cocos2d::Node *renderer)
_elementRenders[_elementRenders.size()-1]->pushBack(renderer); _elementRenders[_elementRenders.size()-1]->pushBack(renderer);
} }
void RichText::visit(cocos2d::Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void RichText::visit(cocos2d::Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
if (_enabled) if (_enabled)
{ {

View File

@ -102,7 +102,7 @@ public:
void pushBackElement(RichElement* element); void pushBackElement(RichElement* element);
void removeElement(int index); void removeElement(int index);
void removeElement(RichElement* element); void removeElement(RichElement* element);
virtual void visit(cocos2d::Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(cocos2d::Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
void setVerticalSpace(float space); void setVerticalSpace(float space);
virtual void setAnchorPoint(const Point &pt); virtual void setAnchorPoint(const Point &pt);
virtual const Size& getContentSize() const; virtual const Size& getContentSize() const;

View File

@ -108,7 +108,7 @@ void Widget::onExit()
ProtectedNode::onExit(); ProtectedNode::onExit();
} }
void Widget::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void Widget::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
if (_enabled) if (_enabled)
{ {

View File

@ -208,7 +208,7 @@ public:
*/ */
virtual Widget* getChildByName(const char* name); virtual Widget* getChildByName(const char* name);
virtual void visit(cocos2d::Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(cocos2d::Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
/** /**
* Sets the touch event target/selector of the menu item * Sets the touch event target/selector of the menu item

View File

@ -764,7 +764,7 @@ void Scale9Sprite::setInsetBottom(float insetBottom)
this->updateCapInset(); this->updateCapInset();
} }
void Scale9Sprite::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void Scale9Sprite::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
if(this->_positionsAreDirty) if(this->_positionsAreDirty)
{ {

View File

@ -261,7 +261,7 @@ public:
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
virtual void setOpacityModifyRGB(bool bValue) override; virtual void setOpacityModifyRGB(bool bValue) override;
virtual bool isOpacityModifyRGB(void) const override; virtual bool isOpacityModifyRGB(void) const override;
virtual void setOpacity(GLubyte opacity) override; virtual void setOpacity(GLubyte opacity) override;

View File

@ -318,7 +318,7 @@ void EditBox::setAnchorPoint(const Point& anchorPoint)
} }
} }
void EditBox::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void EditBox::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
ControlButton::visit(renderer, parentTransform, parentTransformUpdated); ControlButton::visit(renderer, parentTransform, parentTransformUpdated);
if (_editBoxImpl != NULL) if (_editBoxImpl != NULL)

View File

@ -379,7 +379,7 @@ public:
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
/** /**
* @js NA * @js NA
* @lua NA * @lua NA

View File

@ -553,7 +553,7 @@ void ScrollView::onAfterDraw()
} }
} }
void ScrollView::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) void ScrollView::visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated)
{ {
// quick return if not visible // quick return if not visible
if (!isVisible()) if (!isVisible())

View File

@ -225,7 +225,7 @@ public:
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void visit(Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
using Node::addChild; using Node::addChild;
virtual void addChild(Node * child, int zOrder, int tag) override; virtual void addChild(Node * child, int zOrder, int tag) override;