Cache working OK.

Performance increased in 20% for static objects.
This commit is contained in:
Ricardo Quesada 2014-02-28 16:10:48 -08:00
parent 13b60c8759
commit d78304599d
88 changed files with 338 additions and 357 deletions

View File

@ -35,7 +35,6 @@ THE SOFTWARE.
#include "CCDirector.h" #include "CCDirector.h"
#include "TransformUtils.h" #include "TransformUtils.h"
#include "renderer/CCRenderer.h" #include "renderer/CCRenderer.h"
#include "renderer/CCQuadCommand.h"
// external // external
#include "kazmath/GL/matrix.h" #include "kazmath/GL/matrix.h"
@ -110,8 +109,7 @@ bool AtlasNode::initWithTexture(Texture2D* texture, int tileWidth, int tileHeigh
_quadsToDraw = itemsToRender; _quadsToDraw = itemsToRender;
// shader stuff // shader stuff
setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_U_COLOR)); setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP));
_uniformColor = glGetUniformLocation( getShaderProgram()->getProgram(), "u_color");
return true; return true;
} }
@ -138,20 +136,18 @@ void AtlasNode::updateAtlasValues()
} }
// AtlasNode - draw // AtlasNode - draw
void AtlasNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void AtlasNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
auto shader = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP);
_quadCommand.init( _quadCommand.init(
_globalZOrder, _globalZOrder,
_textureAtlas->getTexture()->getName(), _textureAtlas->getTexture()->getName(),
shader, _shaderProgram,
_blendFunc, _blendFunc,
_textureAtlas->getQuads(), _textureAtlas->getQuads(),
_quadsToDraw, _quadsToDraw,
_modelViewTransform); transform);
Director::getInstance()->getRenderer()->addCommand(&_quadCommand); renderer->addCommand(&_quadCommand);
} }

View File

@ -69,7 +69,7 @@ public:
// Overrides // Overrides
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual Texture2D* getTexture() const override; virtual Texture2D* getTexture() const override;
virtual void setTexture(Texture2D *texture) override; virtual void setTexture(Texture2D *texture) override;
virtual bool isOpacityModifyRGB() const override; virtual bool isOpacityModifyRGB() const override;

View File

@ -199,14 +199,15 @@ void ClippingNode::drawFullScreenQuadClearStencil()
kmGLPopMatrix(); kmGLPopMatrix();
} }
void ClippingNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) void ClippingNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated)
{ {
if(!_visible) if(!_visible)
return; return;
bool dirty = parentTransformDirty || _transformDirty; bool dirty = parentTransformUpdated || _transformUpdated;
if(dirty) if(dirty)
_modelViewTransform = transform(parentTransform); _modelViewTransform = transform(parentTransform);
_transformUpdated = false;
// IMPORTANT: // IMPORTANT:
// To ease the migration to v3.0, we still support the kmGL stack, // To ease the migration to v3.0, we still support the kmGL stack,

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 parentTransformDirty) override; virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override;
protected: protected:
ClippingNode(); ClippingNode();

View File

@ -282,7 +282,7 @@ void Director::drawScene()
// draw the scene // draw the scene
if (_runningScene) if (_runningScene)
{ {
_runningScene->visit(_renderer, identity, true); _runningScene->visit(_renderer, identity, false);
_eventDispatcher->dispatchEvent(_eventAfterVisit); _eventDispatcher->dispatchEvent(_eventAfterVisit);
} }

View File

@ -239,11 +239,11 @@ void DrawNode::render()
CHECK_GL_ERROR_DEBUG(); CHECK_GL_ERROR_DEBUG();
} }
void DrawNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void DrawNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(DrawNode::onDraw, this); _customCommand.func = CC_CALLBACK_0(DrawNode::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void DrawNode::onDraw() void DrawNode::onDraw()

View File

@ -92,7 +92,7 @@ public:
void onDraw(); void onDraw();
// Overrides // Overrides
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
protected: protected:
DrawNode(); DrawNode();

View File

@ -679,23 +679,24 @@ void Label::onDraw()
CC_PROFILER_STOP("Label - draw"); CC_PROFILER_STOP("Label - draw");
} }
void Label::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void Label::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(Label::onDraw, this); _customCommand.func = CC_CALLBACK_0(Label::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated)
{ {
if (! _visible) if (! _visible)
{ {
return; return;
} }
bool dirty = parentTransformDirty || _transformDirty; bool dirty = parentTransformUpdated || _transformUpdated;
if(dirty) if(dirty)
_modelViewTransform = transform(parentTransform); _modelViewTransform = transform(parentTransform);
_transformUpdated = false;
// IMPORTANT: // IMPORTANT:
// To ease the migration to v3.0, we still support the kmGL stack, // To ease the migration to v3.0, we still support the kmGL stack,

View File

@ -128,8 +128,8 @@ public:
void addChild(Node * child, int zOrder=0, int tag=0) override; void addChild(Node * child, int zOrder=0, int tag=0) override;
virtual std::string getDescription() const override; virtual std::string getDescription() const override;
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) override; virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual void onDraw(); virtual void onDraw();
virtual FontAtlas* getFontAtlas() const {return _fontAtlas;} virtual FontAtlas* getFontAtlas() const {return _fontAtlas;}

View File

@ -581,11 +581,11 @@ void LayerColor::updateColor()
} }
} }
void LayerColor::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void LayerColor::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(LayerColor::onDraw, this); _customCommand.func = CC_CALLBACK_0(LayerColor::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
for(int i = 0; i < 4; ++i) for(int i = 0; i < 4; ++i)
{ {

View File

@ -37,7 +37,6 @@ THE SOFTWARE.
#include "CCEventKeyboard.h" #include "CCEventKeyboard.h"
#include "renderer/CCCustomCommand.h" #include "renderer/CCCustomCommand.h"
#include "renderer/CCQuadCommand.h"
NS_CC_BEGIN NS_CC_BEGIN
@ -266,7 +265,7 @@ public:
// //
// Overrides // Overrides
// //
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual void onDraw(); virtual void onDraw();
virtual void setContentSize(const Size & var) override; virtual void setContentSize(const Size & var) override;

View File

@ -328,7 +328,7 @@ void MotionStreak::reset()
void MotionStreak::onDraw() void MotionStreak::onDraw()
{ {
getShaderProgram()->use(); getShaderProgram()->use();
getShaderProgram()->setUniformsForBuiltins(_cachedMV); getShaderProgram()->setUniformsForBuiltins(_modelViewTransform);
GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX ); GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX );
GL::blendFunc( _blendFunc.src, _blendFunc.dst ); GL::blendFunc( _blendFunc.src, _blendFunc.dst );
@ -352,16 +352,16 @@ void MotionStreak::onDraw()
#endif // EMSCRIPTEN #endif // EMSCRIPTEN
glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)_nuPoints*2); glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)_nuPoints*2);
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _nuPoints*2);
} }
void MotionStreak::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void MotionStreak::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
if(_nuPoints <= 1) if(_nuPoints <= 1)
return; return;
kmGLGetMatrix(KM_GL_MODELVIEW,&_cachedMV);
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(MotionStreak::onDraw, this); _customCommand.func = CC_CALLBACK_0(MotionStreak::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }

View File

@ -78,7 +78,7 @@ public:
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
@ -102,19 +102,9 @@ public:
virtual bool isOpacityModifyRGB() const override; virtual bool isOpacityModifyRGB() const override;
protected: protected:
kmMat4 _cachedMV;
//renderer callback //renderer callback
void onDraw(); void onDraw();
protected:
/**
* @js ctor
*/
MotionStreak(); MotionStreak();
/**
* @js NA
* @lua NA
*/
virtual ~MotionStreak(); virtual ~MotionStreak();
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture filename */ /** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture filename */

View File

@ -92,6 +92,7 @@ Node::Node(void)
, _useAdditionalTransform(false) , _useAdditionalTransform(false)
, _transformDirty(true) , _transformDirty(true)
, _inverseDirty(true) , _inverseDirty(true)
, _transformUpdated(true)
// children (lazy allocs) // children (lazy allocs)
// lazy alloc // lazy alloc
, _localZOrder(0) , _localZOrder(0)
@ -193,7 +194,7 @@ void Node::setSkewX(float skewX)
return; return;
_skewX = skewX; _skewX = skewX;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
} }
float Node::getSkewY() const float Node::getSkewY() const
@ -207,7 +208,7 @@ void Node::setSkewY(float skewY)
return; return;
_skewY = skewY; _skewY = skewY;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
} }
@ -255,8 +256,8 @@ void Node::setRotation(float rotation)
return; return;
_rotationZ_X = _rotationZ_Y = rotation; _rotationZ_X = _rotationZ_Y = rotation;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS #if CC_USE_PHYSICS
if (_physicsBody) if (_physicsBody)
{ {
@ -277,7 +278,7 @@ void Node::setRotation3D(const Vertex3F& rotation)
_rotationZ_X == rotation.z) _rotationZ_X == rotation.z)
return; return;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
_rotationX = rotation.x; _rotationX = rotation.x;
_rotationY = rotation.y; _rotationY = rotation.y;
@ -307,7 +308,7 @@ void Node::setRotationSkewX(float rotationX)
return; return;
_rotationZ_X = rotationX; _rotationZ_X = rotationX;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
} }
float Node::getRotationSkewY() const float Node::getRotationSkewY() const
@ -321,7 +322,7 @@ void Node::setRotationSkewY(float rotationY)
return; return;
_rotationZ_Y = rotationY; _rotationZ_Y = rotationY;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
} }
/// scale getter /// scale getter
@ -338,7 +339,7 @@ void Node::setScale(float scale)
return; return;
_scaleX = _scaleY = _scaleZ = scale; _scaleX = _scaleY = _scaleZ = scale;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
} }
/// scaleX getter /// scaleX getter
@ -355,7 +356,7 @@ void Node::setScale(float scaleX,float scaleY)
_scaleX = scaleX; _scaleX = scaleX;
_scaleY = scaleY; _scaleY = scaleY;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
} }
/// scaleX setter /// scaleX setter
@ -365,7 +366,7 @@ void Node::setScaleX(float scaleX)
return; return;
_scaleX = scaleX; _scaleX = scaleX;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
} }
/// scaleY getter /// scaleY getter
@ -381,7 +382,7 @@ void Node::setScaleZ(float scaleZ)
return; return;
_scaleZ = scaleZ; _scaleZ = scaleZ;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
} }
/// scaleY getter /// scaleY getter
@ -397,7 +398,7 @@ void Node::setScaleY(float scaleY)
return; return;
_scaleY = scaleY; _scaleY = scaleY;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
} }
@ -414,8 +415,8 @@ void Node::setPosition(const Point& position)
return; return;
_position = position; _position = position;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS #if CC_USE_PHYSICS
if (_physicsBody) if (_physicsBody)
{ {
@ -480,7 +481,7 @@ void Node::setPositionZ(float positionZ)
if (_positionZ == positionZ) if (_positionZ == positionZ)
return; return;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
_positionZ = positionZ; _positionZ = positionZ;
@ -538,7 +539,7 @@ void Node::setAnchorPoint(const Point& point)
{ {
_anchorPoint = point; _anchorPoint = point;
_anchorPointInPoints = Point(_contentSize.width * _anchorPoint.x, _contentSize.height * _anchorPoint.y ); _anchorPointInPoints = Point(_contentSize.width * _anchorPoint.x, _contentSize.height * _anchorPoint.y );
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
} }
} }
@ -555,7 +556,7 @@ void Node::setContentSize(const Size & size)
_contentSize = size; _contentSize = size;
_anchorPointInPoints = Point(_contentSize.width * _anchorPoint.x, _contentSize.height * _anchorPoint.y ); _anchorPointInPoints = Point(_contentSize.width * _anchorPoint.x, _contentSize.height * _anchorPoint.y );
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
} }
} }
@ -582,7 +583,7 @@ void Node::ignoreAnchorPointForPosition(bool newValue)
if (newValue != _ignoreAnchorPointForPosition) if (newValue != _ignoreAnchorPointForPosition)
{ {
_ignoreAnchorPointForPosition = newValue; _ignoreAnchorPointForPosition = newValue;
_transformDirty = _inverseDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
} }
} }
@ -906,7 +907,7 @@ void Node::draw()
draw(renderer, _modelViewTransform, true); draw(renderer, _modelViewTransform, true);
} }
void Node::draw(Renderer* renderer, const kmMat4 &transform, bool transformDirty) void Node::draw(Renderer* renderer, const kmMat4 &transform, bool transformUpdated)
{ {
} }
@ -918,7 +919,7 @@ void Node::visit()
visit(renderer, parentTransform, true); visit(renderer, parentTransform, true);
} }
void Node::visit(Renderer* renderer, const kmMat4 &parentTransform, bool parentTransformDirty) void Node::visit(Renderer* renderer, const kmMat4 &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)
@ -926,9 +927,10 @@ void Node::visit(Renderer* renderer, const kmMat4 &parentTransform, bool parentT
return; return;
} }
bool dirty = _transformDirty || parentTransformDirty; bool dirty = _transformUpdated || parentTransformUpdated;
if(dirty) if(dirty)
_modelViewTransform = this->transform(parentTransform); _modelViewTransform = this->transform(parentTransform);
_transformUpdated = false;
// IMPORTANT: // IMPORTANT:
@ -969,17 +971,10 @@ void Node::visit(Renderer* renderer, const kmMat4 &parentTransform, bool parentT
kmGLPopMatrix(); kmGLPopMatrix();
} }
void Node::transformAncestors()
{
// remove me
CCASSERT(false, "no longer supported");
}
kmMat4 Node::transform(const kmMat4& parentTransform) kmMat4 Node::transform(const kmMat4& parentTransform)
{ {
kmMat4 ret; kmMat4 ret = this->getNodeToParentTransform();
kmMat4 transfrom4x4 = this->getNodeToParentTransform(); kmMat4Multiply(&ret, &parentTransform, &ret);
kmMat4Multiply(&ret, &parentTransform, &transfrom4x4);
return ret; return ret;
} }
@ -1362,19 +1357,20 @@ void Node::setNodeToParentTransform(const kmMat4& transform)
{ {
_transform = transform; _transform = transform;
_transformDirty = false; _transformDirty = false;
_transformUpdated = true;
} }
void Node::setAdditionalTransform(const AffineTransform& additionalTransform) void Node::setAdditionalTransform(const AffineTransform& additionalTransform)
{ {
CGAffineToGL(additionalTransform, _additionalTransform.mat); CGAffineToGL(additionalTransform, _additionalTransform.mat);
_transformDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
_useAdditionalTransform = true; _useAdditionalTransform = true;
} }
void Node::setAdditionalTransform(const kmMat4& additionalTransform) void Node::setAdditionalTransform(const kmMat4& additionalTransform)
{ {
_additionalTransform = additionalTransform; _additionalTransform = additionalTransform;
_transformDirty = true; _transformUpdated = _transformDirty = _inverseDirty = true;
_useAdditionalTransform = true; _useAdditionalTransform = true;
} }

View File

@ -991,13 +991,13 @@ public:
* AND YOU SHOULD NOT DISABLE THEM AFTER DRAWING YOUR NODE * AND YOU SHOULD NOT DISABLE THEM AFTER DRAWING YOUR NODE
* But if you enable any other GL state, you should disable it after drawing your node. * But if you enable any other GL state, you should disable it after drawing your node.
*/ */
virtual void draw(Renderer *renderer, const kmMat4& transform, bool transformDirty); virtual void draw(Renderer *renderer, const kmMat4& transform, bool transformUpdated);
virtual void draw() final; virtual void draw() final;
/** /**
* 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 parentTransformDirty); virtual void visit(Renderer *renderer, const kmMat4& parentTransform, bool parentTransformUpdated);
virtual void visit() final; virtual void visit() final;
@ -1253,16 +1253,6 @@ public:
/// @{ /// @{
/// @name Transformations /// @name Transformations
/**
* Performs OpenGL view-matrix transformation based on position, scale, rotation and other attributes.
*/
kmMat4 transform(const kmMat4 &parentTransform);
/**
* Performs OpenGL view-matrix transformation of it's ancestors.
* Generally the ancestors are already transformed, but in certain cases (eg: attaching a FBO)
* It's necessary to transform the ancestors again.
*/
void transformAncestors();
/** /**
* Calls children's updateTransform() method recursively. * Calls children's updateTransform() method recursively.
* *
@ -1313,7 +1303,7 @@ public:
virtual AffineTransform getWorldToNodeAffineTransform() const; virtual AffineTransform getWorldToNodeAffineTransform() const;
/** @deprecated Use worldToNodeTransform() instead */ /** @deprecated Use getWorldToNodeTransform() instead */
CC_DEPRECATED_ATTRIBUTE inline virtual AffineTransform worldToNodeTransform() const { return getWorldToNodeAffineTransform(); } CC_DEPRECATED_ATTRIBUTE inline virtual AffineTransform worldToNodeTransform() const { return getWorldToNodeAffineTransform(); }
/// @} end of Transformations /// @} end of Transformations
@ -1404,8 +1394,8 @@ public:
spriteB->setAdditionalTransform(t); spriteB->setAdditionalTransform(t);
@endcode @endcode
*/ */
void setAdditionalTransform(const AffineTransform& additionalTransform);
void setAdditionalTransform(const kmMat4& additionalTransform); void setAdditionalTransform(const kmMat4& additionalTransform);
void setAdditionalTransform(const AffineTransform& additionalTransform);
/// @} end of Coordinate Converters /// @} end of Coordinate Converters
@ -1481,7 +1471,9 @@ protected:
/// Convert cocos2d coordinates to UI windows coordinate. /// Convert cocos2d coordinates to UI windows coordinate.
Point convertToWindowSpace(const Point& nodePoint) const; Point convertToWindowSpace(const Point& nodePoint) const;
kmMat4 transform(const kmMat4 &parentTransform);
virtual void updateCascadeOpacity(); virtual void updateCascadeOpacity();
virtual void disableCascadeOpacity(); virtual void disableCascadeOpacity();
virtual void updateCascadeColor(); virtual void updateCascadeColor();
@ -1506,32 +1498,32 @@ protected:
float _skewX; ///< skew angle on x-axis float _skewX; ///< skew angle on x-axis
float _skewY; ///< skew angle on y-axis float _skewY; ///< skew angle on y-axis
Point _anchorPointInPoints; ///< anchor point in points Point _anchorPointInPoints; ///< anchor point in points
Point _anchorPoint; ///< anchor point normalized (NOT in points) Point _anchorPoint; ///< anchor point normalized (NOT in points)
Size _contentSize; ///< untransformed size of the node Size _contentSize; ///< untransformed size of the node
kmMat4 _modelViewTransform; ///< ModelView transform of the Node. kmMat4 _modelViewTransform; ///< ModelView transform of the Node.
// "cache" variables are allowed to be mutable // "cache" variables are allowed to be mutable
mutable kmMat4 _transform; ///< transform
mutable bool _transformDirty; ///< transform dirty flag
mutable kmMat4 _inverse; ///< inverse transform
mutable bool _inverseDirty; ///< inverse transform dirty flag
mutable kmMat4 _additionalTransform; ///< transform mutable kmMat4 _additionalTransform; ///< transform
mutable kmMat4 _transform; ///< transform
mutable kmMat4 _inverse; ///< inverse transform
bool _useAdditionalTransform; ///< The flag to check whether the additional transform is dirty bool _useAdditionalTransform; ///< The flag to check whether the additional transform is dirty
mutable bool _transformDirty; ///< transform dirty flag bool _transformUpdated; ///< Whether or not the Transform object was updated since the last frame
mutable bool _inverseDirty; ///< inverse transform dirty flag
int _localZOrder; ///< Local order (relative to its siblings) used to sort the node
float _globalZOrder; ///< Global order used to sort the node
int _localZOrder; ///< Local order (relative to its siblings) used to sort the node Vector<Node*> _children; ///< array of children nodes
float _globalZOrder; ///< Global order used to sort the node
Vector<Node*> _children; ///< array of children nodes
Node *_parent; ///< weak reference to parent node Node *_parent; ///< weak reference to parent node
int _tag; ///< a tag. Can be any number you assigned just to identify this node int _tag; ///< a tag. Can be any number you assigned just to identify this node
void *_userData; ///< A user assingned void pointer, Can be point to any cpp object void *_userData; ///< A user assingned void pointer, Can be point to any cpp object
Ref *_userObject; ///< A user assigned Object Ref *_userObject; ///< A user assigned Object
GLProgram *_shaderProgram; ///< OpenGL shader GLProgram *_shaderProgram; ///< OpenGL shader
@ -1543,9 +1535,9 @@ protected:
EventDispatcher* _eventDispatcher; ///< event dispatcher used to dispatch all kinds of events EventDispatcher* _eventDispatcher; ///< event dispatcher used to dispatch all kinds of events
bool _running; ///< is running bool _running; ///< is running
bool _visible; ///< is this node visible bool _visible; ///< is this node visible
bool _ignoreAnchorPointForPosition; ///< true if the Anchor Point will be (0,0) when you position the Node, false otherwise. bool _ignoreAnchorPointForPosition; ///< true if the Anchor Point will be (0,0) when you position the Node, false otherwise.
///< Used by Layer and Scene. ///< Used by Layer and Scene.

View File

@ -82,7 +82,7 @@ void NodeGrid::onGridEndDraw()
} }
} }
void NodeGrid::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) void NodeGrid::visit(Renderer *renderer, const kmMat4 &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)
@ -94,9 +94,10 @@ void NodeGrid::visit(Renderer *renderer, const kmMat4 &parentTransform, bool par
renderer->addCommand(&_groupCommand); renderer->addCommand(&_groupCommand);
renderer->pushGroup(_groupCommand.getRenderQueueID()); renderer->pushGroup(_groupCommand.getRenderQueueID());
bool dirty = parentTransformDirty || _transformDirty; bool dirty = parentTransformUpdated || _transformUpdated;
if(dirty) if(dirty)
_modelViewTransform = this->transform(parentTransform); _modelViewTransform = this->transform(parentTransform);
_transformUpdated = false;
// IMPORTANT: // IMPORTANT:
// To ease the migration to v3.0, we still support the kmGL stack, // To ease the migration to v3.0, we still support the kmGL stack,

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 parentTransformDirty) override; virtual void visit(Renderer *renderer, const kmMat4 &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 parentTransformDirty) void ParallaxNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated)
{ {
// Point pos = position_; // Point pos = position_;
// Point pos = [self convertToWorldSpace:Point::ZERO]; // Point pos = [self convertToWorldSpace:Point::ZERO];
@ -161,7 +161,7 @@ void ParallaxNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool
} }
_lastPosition = pos; _lastPosition = pos;
} }
Node::visit(renderer, parentTransform, parentTransformDirty); Node::visit(renderer, parentTransform, parentTransformUpdated);
} }
NS_CC_END NS_CC_END

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 parentTransformDirty) override; virtual void visit(Renderer *renderer, const kmMat4 &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 parentTransformDirty) void ParticleBatchNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated)
{ {
// CAREFUL: // CAREFUL:
// This visit is almost identical to Node#visit // This visit is almost identical to Node#visit
@ -134,9 +134,10 @@ void ParticleBatchNode::visit(Renderer *renderer, const kmMat4 &parentTransform,
return; return;
} }
bool dirty = parentTransformDirty || _transformDirty; bool dirty = parentTransformUpdated || _transformUpdated;
if(dirty) if(dirty)
_modelViewTransform = transform(parentTransform); _modelViewTransform = transform(parentTransform);
_transformUpdated = false;
// IMPORTANT: // IMPORTANT:
// To ease the migration to v3.0, we still support the kmGL stack, // To ease the migration to v3.0, we still support the kmGL stack,
@ -379,7 +380,7 @@ void ParticleBatchNode::removeAllChildrenWithCleanup(bool doCleanup)
_textureAtlas->removeAllQuads(); _textureAtlas->removeAllQuads();
} }
void ParticleBatchNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void ParticleBatchNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
CC_PROFILER_START("CCParticleBatchNode - draw"); CC_PROFILER_START("CCParticleBatchNode - draw");
@ -394,7 +395,7 @@ void ParticleBatchNode::draw(Renderer *renderer, const kmMat4 &transform, bool t
_blendFunc, _blendFunc,
_textureAtlas, _textureAtlas,
_modelViewTransform); _modelViewTransform);
Director::getInstance()->getRenderer()->addCommand(&_batchCommand); renderer->addCommand(&_batchCommand);
CC_PROFILER_STOP("CCParticleBatchNode - draw"); CC_PROFILER_STOP("CCParticleBatchNode - draw");
} }

View File

@ -97,13 +97,13 @@ 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 parentTransformDirty) override; virtual void visit(Renderer *renderer, const kmMat4 &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;
virtual void removeChild(Node* child, bool cleanup) override; virtual void removeChild(Node* child, bool cleanup) override;
virtual void reorderChild(Node * child, int zOrder) override; virtual void reorderChild(Node * child, int zOrder) override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual Texture2D* getTexture(void) const override; virtual Texture2D* getTexture(void) const override;
virtual void setTexture(Texture2D *texture) override; virtual void setTexture(Texture2D *texture) override;
/** /**

View File

@ -72,7 +72,7 @@ bool ParticleSystemQuad::initWithTotalParticles(int numberOfParticles)
setupVBO(); setupVBO();
} }
setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR)); setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP));
#if CC_ENABLE_CACHE_TEXTURE_DATA #if CC_ENABLE_CACHE_TEXTURE_DATA
// Need to listen the event only when not use batchnode, because it will use VBO // Need to listen the event only when not use batchnode, because it will use VBO
@ -358,16 +358,14 @@ void ParticleSystemQuad::postStep()
} }
// overriding draw method // overriding draw method
void ParticleSystemQuad::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void ParticleSystemQuad::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
CCASSERT( _particleIdx == _particleCount, "Abnormal error in particle quad"); CCASSERT( _particleIdx == _particleCount, "Abnormal error in particle quad");
//quad command //quad command
if(_particleIdx > 0) if(_particleIdx > 0)
{ {
auto shader = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP); _quadCommand.init(_globalZOrder, _texture->getName(), _shaderProgram, _blendFunc, _quads, _particleIdx, _modelViewTransform);
renderer->addCommand(&_quadCommand);
_quadCommand.init(_globalZOrder, _texture->getName(), shader, _blendFunc, _quads, _particleIdx, _modelViewTransform);
Director::getInstance()->getRenderer()->addCommand(&_quadCommand);
} }
} }

View File

@ -104,7 +104,7 @@ public:
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
/** /**
* @js NA * @js NA

View File

@ -550,14 +550,14 @@ void ProgressTimer::onDraw()
} }
} }
void ProgressTimer::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void ProgressTimer::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
if( ! _vertexData || ! _sprite) if( ! _vertexData || ! _sprite)
return; return;
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(ProgressTimer::onDraw, this); _customCommand.func = CC_CALLBACK_0(ProgressTimer::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }

View File

@ -111,7 +111,7 @@ public:
inline Point getBarChangeRate() const { return _barChangeRate; } inline Point getBarChangeRate() const { return _barChangeRate; }
// Overrides // Overrides
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual void setAnchorPoint(const Point& anchorPoint) override; virtual void setAnchorPoint(const Point& anchorPoint) override;
virtual void setColor(const Color3B &color) override; virtual void setColor(const Color3B &color) override;
virtual const Color3B& getColor() const override; virtual const Color3B& getColor() const override;

View File

@ -361,7 +361,7 @@ void RenderTexture::clearStencil(int stencilValue)
glClearStencil(stencilClearValue); glClearStencil(stencilClearValue);
} }
void RenderTexture::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) void RenderTexture::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated)
{ {
// override visit. // override visit.
// Don't call visit on its children // Don't call visit on its children
@ -370,9 +370,10 @@ void RenderTexture::visit(Renderer *renderer, const kmMat4 &parentTransform, boo
return; return;
} }
bool dirty = parentTransformDirty || _transformDirty; bool dirty = parentTransformUpdated || _transformUpdated;
if(dirty) if(dirty)
_modelViewTransform = transform(parentTransform); _modelViewTransform = transform(parentTransform);
_transformUpdated = false;
// IMPORTANT: // IMPORTANT:
// To ease the migration to v3.0, we still support the kmGL stack, // To ease the migration to v3.0, we still support the kmGL stack,
@ -617,7 +618,7 @@ void RenderTexture::onClearDepth()
glClearDepth(depthClearValue); glClearDepth(depthClearValue);
} }
void RenderTexture::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void RenderTexture::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
if (_autoDraw) if (_autoDraw)
{ {
@ -635,7 +636,7 @@ void RenderTexture::draw(Renderer *renderer, const kmMat4 &transform, bool trans
for(const auto &child: _children) for(const auto &child: _children)
{ {
if (child != _sprite) if (child != _sprite)
child->visit(renderer, transform, transformDirty); child->visit(renderer, transform, transformUpdated);
} }
//End will pop the current render group //End will pop the current render group

View File

@ -154,8 +154,8 @@ public:
}; };
// Overrides // Overrides
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) override; virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
public: public:
// XXX should be procted. // XXX should be procted.

View File

@ -277,6 +277,7 @@ bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect, bool rotated)
Sprite::Sprite(void) Sprite::Sprite(void)
: _shouldBeHidden(false) : _shouldBeHidden(false)
, _texture(nullptr) , _texture(nullptr)
, _insideBounds(true)
{ {
} }
@ -586,16 +587,19 @@ void Sprite::updateTransform(void)
// draw // draw
void Sprite::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void Sprite::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
if(isInsideBounds()) // Don't do calculate the culling if the transform was not updated
_insideBounds = transformUpdated ? isInsideBounds() : _insideBounds;
if(_insideBounds)
{ {
_quadCommand.init(_globalZOrder, _texture->getName(), _shaderProgram, _blendFunc, &_quad, 1, _modelViewTransform); _quadCommand.init(_globalZOrder, _texture->getName(), _shaderProgram, _blendFunc, &_quad, 1, transform);
Director::getInstance()->getRenderer()->addCommand(&_quadCommand); renderer->addCommand(&_quadCommand);
#if CC_SPRITE_DEBUG_DRAW #if CC_SPRITE_DEBUG_DRAW
_customDebugDrawCommand.init(_globalZOrder); _customDebugDrawCommand.init(_globalZOrder);
_customDebugDrawCommand.func = CC_CALLBACK_0(Sprite::drawDebugData, this); _customDebugDrawCommand.func = CC_CALLBACK_0(Sprite::drawDebugData, this);
Director::getInstance()->getRenderer()->addCommand(&_customDebugDrawCommand); renderer->addCommand(&_customDebugDrawCommand);
#endif //CC_SPRITE_DEBUG_DRAW #endif //CC_SPRITE_DEBUG_DRAW
} }
} }

View File

@ -424,7 +424,7 @@ public:
virtual void setAnchorPoint(const Point& anchor) override; virtual void setAnchorPoint(const Point& anchor) override;
virtual void ignoreAnchorPointForPosition(bool value) override; virtual void ignoreAnchorPointForPosition(bool value) override;
virtual void setVisible(bool bVisible) override; virtual void setVisible(bool bVisible) override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual void setOpacityModifyRGB(bool modify) override; virtual void setOpacityModifyRGB(bool modify) override;
virtual bool isOpacityModifyRGB(void) const override; virtual bool isOpacityModifyRGB(void) const override;
/// @} /// @}
@ -573,6 +573,8 @@ protected:
bool _flippedX; /// Whether the sprite is flipped horizontally or not bool _flippedX; /// Whether the sprite is flipped horizontally or not
bool _flippedY; /// Whether the sprite is flipped vertically or not bool _flippedY; /// Whether the sprite is flipped vertically or not
bool _insideBounds; /// whether or not the sprite was inside bounds the previous frame
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(Sprite); CC_DISALLOW_COPY_AND_ASSIGN(Sprite);
}; };

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 parentTransformDirty) void SpriteBatchNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated)
{ {
CC_PROFILER_START_CATEGORY(kProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit"); CC_PROFILER_START_CATEGORY(kProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");
@ -149,9 +149,10 @@ void SpriteBatchNode::visit(Renderer *renderer, const kmMat4 &parentTransform, b
sortAllChildren(); sortAllChildren();
bool dirty = parentTransformDirty || _transformDirty; bool dirty = parentTransformUpdated || _transformUpdated;
if(dirty) if(dirty)
_modelViewTransform = transform(parentTransform); _modelViewTransform = transform(parentTransform);
_transformUpdated = false;
// IMPORTANT: // IMPORTANT:
// To ease the migration to v3.0, we still support the kmGL stack, // To ease the migration to v3.0, we still support the kmGL stack,
@ -352,7 +353,7 @@ void SpriteBatchNode::reorderBatch(bool reorder)
_reorderChildDirty=reorder; _reorderChildDirty=reorder;
} }
void SpriteBatchNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void SpriteBatchNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
// Optimization: Fast Dispatch // Optimization: Fast Dispatch
if( _textureAtlas->getTotalQuads() == 0 ) if( _textureAtlas->getTotalQuads() == 0 )
@ -368,8 +369,8 @@ void SpriteBatchNode::draw(Renderer *renderer, const kmMat4 &transform, bool tra
_shaderProgram, _shaderProgram,
_blendFunc, _blendFunc,
_textureAtlas, _textureAtlas,
_modelViewTransform); transform);
Director::getInstance()->getRenderer()->addCommand(&_batchCommand); renderer->addCommand(&_batchCommand);
} }
void SpriteBatchNode::increaseAtlasCapacity(void) void SpriteBatchNode::increaseAtlasCapacity(void)

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 parentTransformDirty) override; virtual void visit(Renderer *renderer, const kmMat4 &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;
@ -164,7 +164,7 @@ public:
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 sortAllChildren() override; virtual void sortAllChildren() override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual std::string getDescription() const override; virtual std::string getDescription() const override;
/** Inserts a quad at a certain index into the texture atlas. The Sprite won't be added into the children array. /** Inserts a quad at a certain index into the texture atlas. The Sprite won't be added into the children array.

View File

@ -242,7 +242,7 @@ const std::string& TextFieldTTF::getContentText()
return _inputText; return _inputText;
} }
void TextFieldTTF::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TextFieldTTF::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
if (_delegate && _delegate->onDraw(this)) if (_delegate && _delegate->onDraw(this))
{ {
@ -250,14 +250,14 @@ void TextFieldTTF::draw(Renderer *renderer, const kmMat4 &transform, bool transf
} }
if (_inputText.length()) if (_inputText.length())
{ {
LabelTTF::draw(renderer, transform, transformDirty); LabelTTF::draw(renderer, transform, transformUpdated);
return; return;
} }
// draw placeholder // draw placeholder
Color3B color = getColor(); Color3B color = getColor();
setColor(_colorSpaceHolder); setColor(_colorSpaceHolder);
LabelTTF::draw(renderer, transform, transformDirty); LabelTTF::draw(renderer, transform, transformUpdated);
setColor(color); setColor(color);
} }

View File

@ -173,7 +173,7 @@ protected:
bool _secureTextEntry; bool _secureTextEntry;
protected: protected:
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// IMEDelegate interface // IMEDelegate interface

View File

@ -97,16 +97,16 @@ void TransitionScene::sceneOrder()
_isInSceneOnTop = true; _isInSceneOnTop = true;
} }
void TransitionScene::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TransitionScene::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
Scene::draw(renderer, transform, transformDirty); Scene::draw(renderer, transform, transformUpdated);
if( _isInSceneOnTop ) { if( _isInSceneOnTop ) {
_outScene->visit(renderer, transform, transformDirty); _outScene->visit(renderer, transform, transformUpdated);
_inScene->visit(renderer, transform, transformDirty); _inScene->visit(renderer, transform, transformUpdated);
} else { } else {
_inScene->visit(renderer, transform, transformDirty); _inScene->visit(renderer, transform, transformUpdated);
_outScene->visit(renderer, transform, transformDirty); _outScene->visit(renderer, transform, transformUpdated);
} }
} }
@ -1258,7 +1258,7 @@ TransitionCrossFade* TransitionCrossFade::create(float t, Scene* scene)
return nullptr; return nullptr;
} }
void TransitionCrossFade::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TransitionCrossFade::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
// override draw since both scenes (textures) are rendered in 1 scene // override draw since both scenes (textures) are rendered in 1 scene
} }
@ -1407,19 +1407,19 @@ void TransitionTurnOffTiles::onExit()
TransitionScene::onExit(); TransitionScene::onExit();
} }
void TransitionTurnOffTiles::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TransitionTurnOffTiles::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
Scene::draw(renderer, transform, transformDirty); Scene::draw(renderer, transform, transformUpdated);
if( _isInSceneOnTop ) if( _isInSceneOnTop )
{ {
_outSceneProxy->visit(renderer, transform, transformDirty); _outSceneProxy->visit(renderer, transform, transformUpdated);
_inScene->visit(renderer, transform, transformDirty); _inScene->visit(renderer, transform, transformUpdated);
} }
else else
{ {
_inScene->visit(renderer, transform, transformDirty); _inScene->visit(renderer, transform, transformUpdated);
_outSceneProxy->visit(renderer, transform, transformDirty); _outSceneProxy->visit(renderer, transform, transformUpdated);
} }
} }
@ -1487,10 +1487,10 @@ void TransitionSplitCols::switchTargetToInscene()
_gridProxy->setTarget(_inScene); _gridProxy->setTarget(_inScene);
} }
void TransitionSplitCols::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TransitionSplitCols::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
Scene::draw(renderer, transform, transformDirty); Scene::draw(renderer, transform, transformUpdated);
_gridProxy->visit(renderer, transform, transformDirty); _gridProxy->visit(renderer, transform, transformUpdated);
} }
void TransitionSplitCols::onExit() void TransitionSplitCols::onExit()
@ -1603,19 +1603,19 @@ void TransitionFadeTR::onExit()
TransitionScene::onExit(); TransitionScene::onExit();
} }
void TransitionFadeTR::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TransitionFadeTR::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
Scene::draw(renderer, transform, transformDirty); Scene::draw(renderer, transform, transformUpdated);
if( _isInSceneOnTop ) if( _isInSceneOnTop )
{ {
_outSceneProxy->visit(renderer, transform, transformDirty); _outSceneProxy->visit(renderer, transform, transformUpdated);
_inScene->visit(renderer, transform, transformDirty); _inScene->visit(renderer, transform, transformUpdated);
} }
else else
{ {
_inScene->visit(renderer, transform, transformDirty); _inScene->visit(renderer, transform, transformUpdated);
_outSceneProxy->visit(renderer, transform, transformDirty); _outSceneProxy->visit(renderer, transform, transformUpdated);
} }
} }

View File

@ -91,7 +91,7 @@ public:
// //
// Overrides // Overrides
// //
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual void onEnter() override; virtual void onEnter() override;
virtual void onExit() override; virtual void onExit() override;
virtual void cleanup() override; virtual void cleanup() override;
@ -609,7 +609,7 @@ public :
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
@ -647,7 +647,7 @@ public :
virtual void onEnter() override; virtual void onEnter() override;
virtual void onExit() override; virtual void onExit() override;
virtual ActionInterval * easeActionWithAction(ActionInterval * action) override; virtual ActionInterval * easeActionWithAction(ActionInterval * action) override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
protected: protected:
TransitionTurnOffTiles(); TransitionTurnOffTiles();
@ -680,7 +680,7 @@ public:
virtual void onEnter() override; virtual void onEnter() override;
virtual ActionInterval * easeActionWithAction(ActionInterval * action) override; virtual ActionInterval * easeActionWithAction(ActionInterval * action) override;
virtual void onExit() override; virtual void onExit() override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
protected: protected:
TransitionSplitCols(); TransitionSplitCols();
virtual ~TransitionSplitCols(); virtual ~TransitionSplitCols();
@ -731,7 +731,7 @@ public:
virtual void onEnter() override; virtual void onEnter() override;
virtual ActionInterval* easeActionWithAction(ActionInterval * action) override; virtual ActionInterval* easeActionWithAction(ActionInterval * action) override;
virtual void onExit() override; virtual void onExit() override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
protected: protected:
TransitionFadeTR(); TransitionFadeTR();
virtual ~TransitionFadeTR(); virtual ~TransitionFadeTR();

View File

@ -92,31 +92,31 @@ void TransitionPageTurn::onDisablePolygonOffset()
glPolygonOffset(0, 0); glPolygonOffset(0, 0);
} }
void TransitionPageTurn::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TransitionPageTurn::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
Scene::draw(renderer, transform, transformDirty); Scene::draw(renderer, transform, transformUpdated);
if( _isInSceneOnTop ) { if( _isInSceneOnTop ) {
_outSceneProxy->visit(renderer, transform, transformDirty); _outSceneProxy->visit(renderer, transform, transformUpdated);
_enableOffsetCmd.init(_globalZOrder); _enableOffsetCmd.init(_globalZOrder);
_enableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onEnablePolygonOffset, this); _enableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onEnablePolygonOffset, this);
Director::getInstance()->getRenderer()->addCommand(&_enableOffsetCmd); renderer->addCommand(&_enableOffsetCmd);
_inSceneProxy->visit(renderer, transform, transformDirty); _inSceneProxy->visit(renderer, transform, transformUpdated);
_disableOffsetCmd.init(_globalZOrder); _disableOffsetCmd.init(_globalZOrder);
_disableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onDisablePolygonOffset, this); _disableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onDisablePolygonOffset, this);
Director::getInstance()->getRenderer()->addCommand(&_disableOffsetCmd); renderer->addCommand(&_disableOffsetCmd);
} else { } else {
_inSceneProxy->visit(renderer, transform, transformDirty); _inSceneProxy->visit(renderer, transform, transformUpdated);
_enableOffsetCmd.init(_globalZOrder); _enableOffsetCmd.init(_globalZOrder);
_enableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onEnablePolygonOffset, this); _enableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onEnablePolygonOffset, this);
Director::getInstance()->getRenderer()->addCommand(&_enableOffsetCmd); renderer->addCommand(&_enableOffsetCmd);
_outSceneProxy->visit(renderer, transform, transformDirty); _outSceneProxy->visit(renderer, transform, transformUpdated);
_disableOffsetCmd.init(_globalZOrder); _disableOffsetCmd.init(_globalZOrder);
_disableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onDisablePolygonOffset, this); _disableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onDisablePolygonOffset, this);
Director::getInstance()->getRenderer()->addCommand(&_disableOffsetCmd); renderer->addCommand(&_disableOffsetCmd);
} }
} }

View File

@ -72,7 +72,7 @@ public:
// //
// Overrides // Overrides
// //
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
/** /**
* Creates a base transition with duration and incoming scene. * Creates a base transition with duration and incoming scene.

View File

@ -29,7 +29,6 @@ THE SOFTWARE.
#include "cocostudio/CCDatas.h" #include "cocostudio/CCDatas.h"
#include "cocostudio/CCSkin.h" #include "cocostudio/CCSkin.h"
#include "renderer/CCQuadCommand.h"
#include "renderer/CCRenderer.h" #include "renderer/CCRenderer.h"
#include "renderer/CCGroupCommand.h" #include "renderer/CCGroupCommand.h"
#include "CCShaderCache.h" #include "CCShaderCache.h"
@ -378,7 +377,7 @@ void Armature::update(float dt)
_armatureTransformDirty = false; _armatureTransformDirty = false;
} }
void Armature::draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformDirty) void Armature::draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
if (_parentBone == nullptr && _batchNode == nullptr) if (_parentBone == nullptr && _batchNode == nullptr)
{ {
@ -408,17 +407,17 @@ void Armature::draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool t
{ {
skin->setBlendFunc(bone->getBlendFunc()); skin->setBlendFunc(bone->getBlendFunc());
} }
skin->draw(renderer, transform, transformDirty); skin->draw(renderer, transform, transformUpdated);
} }
break; break;
case CS_DISPLAY_ARMATURE: case CS_DISPLAY_ARMATURE:
{ {
node->draw(renderer, transform, transformDirty); node->draw(renderer, transform, transformUpdated);
} }
break; break;
default: default:
{ {
node->visit(renderer, transform, transformDirty); node->visit(renderer, transform, transformUpdated);
CC_NODE_DRAW_SETUP(); CC_NODE_DRAW_SETUP();
} }
break; break;
@ -426,7 +425,7 @@ void Armature::draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool t
} }
else if(Node *node = dynamic_cast<Node *>(object)) else if(Node *node = dynamic_cast<Node *>(object))
{ {
node->visit(renderer, transform, transformDirty); node->visit(renderer, transform, transformUpdated);
CC_NODE_DRAW_SETUP(); CC_NODE_DRAW_SETUP();
} }
} }
@ -445,7 +444,7 @@ void Armature::onExit()
} }
void Armature::visit(cocos2d::Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) void Armature::visit(cocos2d::Renderer *renderer, const kmMat4 &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)
@ -453,9 +452,10 @@ void Armature::visit(cocos2d::Renderer *renderer, const kmMat4 &parentTransform,
return; return;
} }
bool dirty = parentTransformDirty || _transformDirty; bool dirty = parentTransformUpdated || _transformUpdated;
if(dirty) if(dirty)
_modelViewTransform = transform(parentTransform); _modelViewTransform = transform(parentTransform);
_transformUpdated = false;
// IMPORTANT: // IMPORTANT:
// To ease the migration to v3.0, we still support the kmGL stack, // To ease the migration to v3.0, we still support the kmGL stack,

View File

@ -156,8 +156,8 @@ public:
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual void visit(cocos2d::Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) override; virtual void visit(cocos2d::Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override;
virtual void draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformDirty) 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;
virtual void onEnter() override; virtual void onEnter() 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 parentTransformDirty) void BatchNode::visit(Renderer *renderer, const kmMat4 &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)
@ -109,9 +109,10 @@ void BatchNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool pa
return; return;
} }
bool dirty = parentTransformDirty || _transformDirty; bool dirty = parentTransformUpdated || _transformUpdated;
if(dirty) if(dirty)
_modelViewTransform = transform(parentTransform); _modelViewTransform = transform(parentTransform);
_transformUpdated = false;
// IMPORTANT: // IMPORTANT:
// To ease the migration to v3.0, we still support the kmGL stack, // To ease the migration to v3.0, we still support the kmGL stack,
@ -128,7 +129,7 @@ void BatchNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool pa
kmGLPopMatrix(); kmGLPopMatrix();
} }
void BatchNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void BatchNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
if (_children.empty()) if (_children.empty())
{ {
@ -149,14 +150,14 @@ void BatchNode::draw(Renderer *renderer, const kmMat4 &transform, bool transform
pushed = true; pushed = true;
} }
armature->visit(renderer, transform, transformDirty); armature->visit(renderer, transform, transformUpdated);
} }
else else
{ {
Director::getInstance()->getRenderer()->popGroup(); renderer->popGroup();
pushed = false; pushed = false;
((Node *)object)->visit(renderer, transform, transformDirty); ((Node *)object)->visit(renderer, transform, transformUpdated);
} }
} }
} }

View File

@ -56,8 +56,8 @@ 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 parentTransformDirty) override; virtual void visit(cocos2d::Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override;
virtual void draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
protected: protected:
void generateGroupCommand(); void generateGroupCommand();

View File

@ -219,14 +219,14 @@ kmMat4 Skin::getNodeToWorldTransformAR() const
return TransformConcat( _bone->getArmature()->getNodeToWorldTransform(),displayTransform); return TransformConcat( _bone->getArmature()->getNodeToWorldTransform(),displayTransform);
} }
void Skin::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void Skin::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
kmMat4 mv; kmMat4 mv;
kmGLGetMatrix(KM_GL_MODELVIEW, &mv); kmGLGetMatrix(KM_GL_MODELVIEW, &mv);
//TODO implement z order //TODO implement z order
_quadCommand.init(_globalZOrder, _texture->getName(), _shaderProgram, _blendFunc, &_quad, 1, mv); _quadCommand.init(_globalZOrder, _texture->getName(), _shaderProgram, _blendFunc, &_quad, 1, mv);
Director::getInstance()->getRenderer()->addCommand(&_quadCommand); renderer->addCommand(&_quadCommand);
} }
void Skin::setBone(Bone *bone) void Skin::setBone(Bone *bone)

View File

@ -54,7 +54,7 @@ public:
kmMat4 getNodeToWorldTransform() const override; kmMat4 getNodeToWorldTransform() const override;
kmMat4 getNodeToWorldTransformAR() const; kmMat4 getNodeToWorldTransformAR() const;
virtual void draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
/** /**
* @js NA * @js NA

View File

@ -125,12 +125,12 @@ void Skeleton::update (float deltaTime) {
spSkeleton_update(skeleton, deltaTime * timeScale); spSkeleton_update(skeleton, deltaTime * timeScale);
} }
void Skeleton::draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformDirty) void Skeleton::draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(Skeleton::onDraw, this); _customCommand.func = CC_CALLBACK_0(Skeleton::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void Skeleton::onDraw () void Skeleton::onDraw ()

View File

@ -67,7 +67,7 @@ public:
virtual ~Skeleton (); virtual ~Skeleton ();
virtual void update (float deltaTime) override; virtual void update (float deltaTime) override;
virtual void draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
void onDraw(); void onDraw();
void onEnter() override; void onEnter() override;
void onExit() override; void onExit() override;

View File

@ -167,7 +167,7 @@ bool Layout::hitTest(const Point &pt)
return false; return false;
} }
void Layout::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) void Layout::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated)
{ {
if (!_enabled) if (!_enabled)
{ {
@ -178,10 +178,10 @@ void Layout::visit(Renderer *renderer, const kmMat4 &parentTransform, bool paren
switch (_clippingType) switch (_clippingType)
{ {
case LAYOUT_CLIPPING_STENCIL: case LAYOUT_CLIPPING_STENCIL:
stencilClippingVisit(renderer, parentTransform, parentTransformDirty); stencilClippingVisit(renderer, parentTransform, parentTransformUpdated);
break; break;
case LAYOUT_CLIPPING_SCISSOR: case LAYOUT_CLIPPING_SCISSOR:
scissorClippingVisit(renderer, parentTransform, parentTransformDirty); scissorClippingVisit(renderer, parentTransform, parentTransformUpdated);
break; break;
default: default:
break; break;
@ -189,7 +189,7 @@ void Layout::visit(Renderer *renderer, const kmMat4 &parentTransform, bool paren
} }
else else
{ {
Node::visit(renderer, parentTransform, parentTransformDirty); Node::visit(renderer, parentTransform, parentTransformUpdated);
} }
} }
@ -199,14 +199,15 @@ void Layout::sortAllChildren()
doLayout(); doLayout();
} }
void Layout::stencilClippingVisit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) void Layout::stencilClippingVisit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated)
{ {
if(!_visible) if(!_visible)
return; return;
bool dirty = parentTransformDirty || _transformDirty; bool dirty = parentTransformUpdated || _transformUpdated;
if(dirty) if(dirty)
_modelViewTransform = transform(parentTransform); _modelViewTransform = transform(parentTransform);
_transformUpdated = false;
// IMPORTANT: // IMPORTANT:
// To ease the migration to v3.0, we still support the kmGL stack, // To ease the migration to v3.0, we still support the kmGL stack,
@ -339,13 +340,13 @@ void Layout::onAfterVisitScissor()
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
} }
void Layout::scissorClippingVisit(Renderer *renderer, const kmMat4& parentTransform, bool parentTransformDirty) void Layout::scissorClippingVisit(Renderer *renderer, const kmMat4& parentTransform, bool parentTransformUpdated)
{ {
_beforeVisitCmdScissor.init(_globalZOrder); _beforeVisitCmdScissor.init(_globalZOrder);
_beforeVisitCmdScissor.func = CC_CALLBACK_0(Layout::onBeforeVisitScissor, this); _beforeVisitCmdScissor.func = CC_CALLBACK_0(Layout::onBeforeVisitScissor, this);
renderer->addCommand(&_beforeVisitCmdScissor); renderer->addCommand(&_beforeVisitCmdScissor);
Node::visit(renderer, parentTransform, parentTransformDirty); Node::visit(renderer, parentTransform, parentTransformUpdated);
_afterVisitCmdScissor.init(_globalZOrder); _afterVisitCmdScissor.init(_globalZOrder);
_afterVisitCmdScissor.func = CC_CALLBACK_0(Layout::onAfterVisitScissor, this); _afterVisitCmdScissor.func = CC_CALLBACK_0(Layout::onAfterVisitScissor, this);

View File

@ -209,7 +209,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 parentTransformDirty) override; virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override;
virtual void sortAllChildren() override; virtual void sortAllChildren() override;
@ -234,8 +234,8 @@ protected:
virtual void copySpecialProperties(Widget* model) override; virtual void copySpecialProperties(Widget* model) override;
virtual void copyClonedWidgetChildren(Widget* model) override; virtual void copyClonedWidgetChildren(Widget* model) override;
void stencilClippingVisit(Renderer *renderer, const kmMat4& parentTransform, bool parentTransformDirty); void stencilClippingVisit(Renderer *renderer, const kmMat4& parentTransform, bool parentTransformUpdated);
void scissorClippingVisit(Renderer *renderer, const kmMat4& parentTransform, bool parentTransformDirty); void scissorClippingVisit(Renderer *renderer, const kmMat4& parentTransform, bool parentTransformUpdated);
void setStencilClippingSize(const Size& size); void setStencilClippingSize(const Size& size);
const Rect& getClippingRect(); const Rect& getClippingRect();

View File

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

View File

@ -331,7 +331,7 @@ public:
virtual void removeAllNodes(); virtual void removeAllNodes();
virtual void visit(cocos2d::Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) override; virtual void visit(cocos2d::Renderer *renderer, const kmMat4 &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

@ -769,14 +769,14 @@ void Scale9Sprite::setInsetBottom(float insetBottom)
this->updateCapInset(); this->updateCapInset();
} }
void Scale9Sprite::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) void Scale9Sprite::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated)
{ {
if(this->_positionsAreDirty) if(this->_positionsAreDirty)
{ {
this->updatePositions(); this->updatePositions();
this->_positionsAreDirty = false; this->_positionsAreDirty = false;
} }
Node::visit(renderer, parentTransform, parentTransformDirty); Node::visit(renderer, parentTransform, parentTransformUpdated);
} }
void Scale9Sprite::setColor(const Color3B& color) void Scale9Sprite::setColor(const Color3B& color)

View File

@ -261,7 +261,7 @@ public:
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) override; virtual void visit(Renderer *renderer, const kmMat4 &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

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

View File

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

View File

@ -552,7 +552,7 @@ void ScrollView::onAfterDraw()
} }
} }
void ScrollView::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) void ScrollView::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated)
{ {
// quick return if not visible // quick return if not visible
if (!isVisible()) if (!isVisible())
@ -560,9 +560,10 @@ void ScrollView::visit(Renderer *renderer, const kmMat4 &parentTransform, bool p
return; return;
} }
bool dirty = parentTransformDirty || _transformDirty; bool dirty = parentTransformUpdated || _transformUpdated;
if(dirty) if(dirty)
_modelViewTransform = this->transform(parentTransform); _modelViewTransform = this->transform(parentTransform);
_transformUpdated = false;
// IMPORTANT: // IMPORTANT:
// To ease the migration to v3.0, we still support the kmGL stack, // To ease the migration to v3.0, we still support the kmGL stack,

View File

@ -225,7 +225,7 @@ public:
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformDirty) override; virtual void visit(Renderer *renderer, const kmMat4 &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

@ -182,7 +182,7 @@ static void DrawConstraint(cpConstraint *constraint, DrawNode *renderer)
// implementation of PhysicsDebugNode // implementation of PhysicsDebugNode
void PhysicsDebugNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void PhysicsDebugNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
if (! _spacePtr) if (! _spacePtr)
{ {
@ -192,7 +192,7 @@ void PhysicsDebugNode::draw(Renderer *renderer, const kmMat4 &transform, bool tr
cpSpaceEachShape(_spacePtr, (cpSpaceShapeIteratorFunc)DrawShape, this); cpSpaceEachShape(_spacePtr, (cpSpaceShapeIteratorFunc)DrawShape, this);
cpSpaceEachConstraint(_spacePtr, (cpSpaceConstraintIteratorFunc)DrawConstraint, this); cpSpaceEachConstraint(_spacePtr, (cpSpaceConstraintIteratorFunc)DrawConstraint, this);
DrawNode::draw(renderer, transform, transformDirty); DrawNode::draw(renderer, transform, transformUpdated);
DrawNode::clear(); DrawNode::clear();
#endif #endif
} }

View File

@ -61,7 +61,7 @@ public:
void setSpace(cpSpace *space); void setSpace(cpSpace *space);
// Overrides // Overrides
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
protected: protected:
cpSpace *_spacePtr; cpSpace *_spacePtr;

View File

@ -1342,12 +1342,12 @@ void ActionFollow::onEnter()
this->runAction(Follow::create(_grossini, Rect(0, 0, s.width * 2 - 100, s.height))); this->runAction(Follow::create(_grossini, Rect(0, 0, s.width * 2 - 100, s.height)));
} }
void ActionFollow::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void ActionFollow::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(ActionFollow::onDraw, this); _customCommand.func = CC_CALLBACK_0(ActionFollow::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void ActionFollow::onDraw() void ActionFollow::onDraw()
@ -1649,9 +1649,9 @@ ActionCatmullRomStacked::~ActionCatmullRomStacked()
CC_SAFE_RELEASE(_array2); CC_SAFE_RELEASE(_array2);
} }
void ActionCatmullRomStacked::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void ActionCatmullRomStacked::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
ActionsDemo::draw(renderer, transform, transformDirty); ActionsDemo::draw(renderer, transform, transformUpdated);
// move to 50,50 since the "by" path will start at 50,50 // move to 50,50 since the "by" path will start at 50,50
kmGLPushMatrix(); kmGLPushMatrix();
@ -1662,7 +1662,7 @@ void ActionCatmullRomStacked::draw(Renderer *renderer, const kmMat4 &transform,
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(ActionCatmullRomStacked::onDraw, this); _customCommand.func = CC_CALLBACK_0(ActionCatmullRomStacked::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void ActionCatmullRomStacked::onDraw() void ActionCatmullRomStacked::onDraw()
@ -1758,9 +1758,9 @@ ActionCardinalSplineStacked::~ActionCardinalSplineStacked()
CC_SAFE_RELEASE(_array); CC_SAFE_RELEASE(_array);
} }
void ActionCardinalSplineStacked::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void ActionCardinalSplineStacked::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
ActionsDemo::draw(renderer, transform, transformDirty); ActionsDemo::draw(renderer, transform, transformUpdated);
// move to 50,50 since the "by" path will start at 50,50 // move to 50,50 since the "by" path will start at 50,50
kmGLPushMatrix(); kmGLPushMatrix();
@ -1777,7 +1777,7 @@ void ActionCardinalSplineStacked::draw(Renderer *renderer, const kmMat4 &transfo
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(ActionCardinalSplineStacked::onDraw, this); _customCommand.func = CC_CALLBACK_0(ActionCardinalSplineStacked::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void ActionCardinalSplineStacked::onDraw() void ActionCardinalSplineStacked::onDraw()
@ -2125,9 +2125,9 @@ ActionCatmullRom::~ActionCatmullRom()
_array2->release(); _array2->release();
} }
void ActionCatmullRom::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void ActionCatmullRom::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
ActionsDemo::draw(renderer, transform, transformDirty); ActionsDemo::draw(renderer, transform, transformUpdated);
// move to 50,50 since the "by" path will start at 50,50 // move to 50,50 since the "by" path will start at 50,50
kmGLPushMatrix(); kmGLPushMatrix();
@ -2139,7 +2139,7 @@ void ActionCatmullRom::draw(Renderer *renderer, const kmMat4 &transform, bool tr
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(ActionCatmullRom::onDraw, this); _customCommand.func = CC_CALLBACK_0(ActionCatmullRom::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
@ -2220,9 +2220,9 @@ ActionCardinalSpline::~ActionCardinalSpline()
_array->release(); _array->release();
} }
void ActionCardinalSpline::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void ActionCardinalSpline::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
ActionsDemo::draw(renderer, transform, transformDirty); ActionsDemo::draw(renderer, transform, transformUpdated);
// move to 50,50 since the "by" path will start at 50,50 // move to 50,50 since the "by" path will start at 50,50
kmGLPushMatrix(); kmGLPushMatrix();
@ -2239,7 +2239,7 @@ void ActionCardinalSpline::draw(Renderer *renderer, const kmMat4 &transform, boo
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(ActionCardinalSpline::onDraw, this); _customCommand.func = CC_CALLBACK_0(ActionCardinalSpline::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void ActionCardinalSpline::onDraw() void ActionCardinalSpline::onDraw()

View File

@ -375,7 +375,7 @@ public:
CREATE_FUNC(ActionFollow); CREATE_FUNC(ActionFollow);
virtual void onEnter() override; virtual void onEnter() override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
protected: protected:
@ -451,7 +451,7 @@ public:
CREATE_FUNC(ActionCatmullRomStacked); CREATE_FUNC(ActionCatmullRomStacked);
virtual ~ActionCatmullRomStacked(); virtual ~ActionCatmullRomStacked();
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual void onEnter() override; virtual void onEnter() override;
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
@ -472,7 +472,7 @@ public:
CREATE_FUNC(ActionCardinalSplineStacked); CREATE_FUNC(ActionCardinalSplineStacked);
virtual ~ActionCardinalSplineStacked(); virtual ~ActionCardinalSplineStacked();
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty); virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated);
virtual void onEnter() override; virtual void onEnter() override;
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
@ -567,7 +567,7 @@ public:
~ActionCatmullRom(); ~ActionCatmullRom();
virtual void onEnter() override; virtual void onEnter() override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
virtual std::string title() const override; virtual std::string title() const override;
private: private:
@ -588,7 +588,7 @@ public:
~ActionCardinalSpline(); ~ActionCardinalSpline();
virtual void onEnter() override; virtual void onEnter() override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
virtual std::string title() const override; virtual std::string title() const override;
private: private:

View File

@ -137,14 +137,14 @@ void Box2DTestLayer::createResetButton()
} }
void Box2DTestLayer::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void Box2DTestLayer::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
// //
// IMPORTANT: // IMPORTANT:
// This is only for debug purposes // This is only for debug purposes
// It is recommend to disable it // It is recommend to disable it
// //
Layer::draw(renderer, transform, transformDirty); Layer::draw(renderer, transform, transformUpdated);
#if CC_ENABLE_BOX2D_INTEGRATION #if CC_ENABLE_BOX2D_INTEGRATION
GL::enableVertexAttribs( cocos2d::GL::VERTEX_ATTRIB_FLAG_POSITION ); GL::enableVertexAttribs( cocos2d::GL::VERTEX_ATTRIB_FLAG_POSITION );
@ -154,7 +154,7 @@ void Box2DTestLayer::draw(Renderer *renderer, const kmMat4 &transform, bool tran
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(Box2DTestLayer::onDraw, this); _customCommand.func = CC_CALLBACK_0(Box2DTestLayer::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
kmGLPopMatrix(); kmGLPopMatrix();
#endif #endif

View File

@ -17,7 +17,7 @@ public:
void initPhysics(); void initPhysics();
void createResetButton(); void createResetButton();
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
void addNewSpriteAtPosition(Point p); void addNewSpriteAtPosition(Point p);
void update(float dt); void update(float dt);

View File

@ -207,13 +207,13 @@ void Box2DView::tick(float dt)
m_test->Step(&settings); m_test->Step(&settings);
} }
void Box2DView::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void Box2DView::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
Layer::draw(renderer, transform, transformDirty); Layer::draw(renderer, transform, transformUpdated);
_customCmd.init(_globalZOrder); _customCmd.init(_globalZOrder);
_customCmd.func = CC_CALLBACK_0(Box2DView::onDraw, this); _customCmd.func = CC_CALLBACK_0(Box2DView::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCmd); renderer->addCommand(&_customCmd);
} }
void Box2DView::onDraw() void Box2DView::onDraw()

View File

@ -42,7 +42,7 @@ public:
bool initWithEntryID(int entryId); bool initWithEntryID(int entryId);
std::string title() const; std::string title() const;
void tick(float dt); void tick(float dt);
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
// virtual void registerWithTouchDispatcher(); // virtual void registerWithTouchDispatcher();
bool onTouchBegan(Touch* touch, Event* event); bool onTouchBegan(Touch* touch, Event* event);

View File

@ -596,7 +596,7 @@ void RawStencilBufferTest::setup()
Director::getInstance()->setAlphaBlending(true); Director::getInstance()->setAlphaBlending(true);
} }
void RawStencilBufferTest::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void RawStencilBufferTest::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
auto winPoint = Point(Director::getInstance()->getWinSize()); auto winPoint = Point(Director::getInstance()->getWinSize());
@ -614,9 +614,7 @@ void RawStencilBufferTest::draw(Renderer *renderer, const kmMat4 &transform, boo
iter->func = CC_CALLBACK_0(RawStencilBufferTest::onEnableStencil, this); iter->func = CC_CALLBACK_0(RawStencilBufferTest::onEnableStencil, this);
renderer->addCommand(&(*iter)); renderer->addCommand(&(*iter));
++iter; ++iter;
for (int i = 0; i < _planeCount; i++) { for (int i = 0; i < _planeCount; i++) {
auto stencilPoint = planeSize * (_planeCount - i); auto stencilPoint = planeSize * (_planeCount - i);
@ -634,7 +632,7 @@ void RawStencilBufferTest::draw(Renderer *renderer, const kmMat4 &transform, boo
kmGLPushMatrix(); kmGLPushMatrix();
_modelViewTransform = this->transform(transform); _modelViewTransform = this->transform(transform);
_sprites.at(i)->visit(renderer, _modelViewTransform, transformDirty); _sprites.at(i)->visit(renderer, _modelViewTransform, transformUpdated);
kmGLPopMatrix(); kmGLPopMatrix();
iter->init(_globalZOrder); iter->init(_globalZOrder);
@ -644,14 +642,13 @@ void RawStencilBufferTest::draw(Renderer *renderer, const kmMat4 &transform, boo
kmGLPushMatrix(); kmGLPushMatrix();
_modelViewTransform = this->transform(transform); _modelViewTransform = this->transform(transform);
_sprites.at(i)->visit(renderer, _modelViewTransform, transformDirty); _sprites.at(i)->visit(renderer, _modelViewTransform, transformUpdated);
kmGLPopMatrix(); kmGLPopMatrix();
} }
iter->init(_globalZOrder); iter->init(_globalZOrder);
iter->func = CC_CALLBACK_0(RawStencilBufferTest::onDisableStencil, this); iter->func = CC_CALLBACK_0(RawStencilBufferTest::onDisableStencil, this);
renderer->addCommand(&(*iter)); renderer->addCommand(&(*iter));
} }
void RawStencilBufferTest::onEnableStencil() void RawStencilBufferTest::onEnableStencil()

View File

@ -153,7 +153,7 @@ public:
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
virtual void setup(); virtual void setup();
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual void setupStencilForClippingOnPlane(GLint plane); virtual void setupStencilForClippingOnPlane(GLint plane);
virtual void setupStencilForDrawingOnPlane(GLint plane); virtual void setupStencilForDrawingOnPlane(GLint plane);

View File

@ -114,11 +114,11 @@ DrawPrimitivesTest::DrawPrimitivesTest()
{ {
} }
void DrawPrimitivesTest::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void DrawPrimitivesTest::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(DrawPrimitivesTest::onDraw, this); _customCommand.func = CC_CALLBACK_0(DrawPrimitivesTest::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void DrawPrimitivesTest::onDraw() void DrawPrimitivesTest::onDraw()

View File

@ -27,7 +27,7 @@ public:
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
protected: protected:
void onDraw(); void onDraw();
protected: protected:

View File

@ -845,7 +845,7 @@ void TestColliderDetector::onExit()
ArmatureTestLayer::onExit(); ArmatureTestLayer::onExit();
} }
void TestColliderDetector::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TestColliderDetector::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
kmGLPushMatrix(); kmGLPushMatrix();
@ -1065,11 +1065,11 @@ void TestColliderDetector::update(float delta)
} }
} }
} }
void TestColliderDetector::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TestColliderDetector::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(TestColliderDetector::onDraw, this); _customCommand.func = CC_CALLBACK_0(TestColliderDetector::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void TestColliderDetector::onDraw() void TestColliderDetector::onDraw()
@ -1106,12 +1106,12 @@ std::string TestBoundingBox::title() const
{ {
return "Test BoundingBox"; return "Test BoundingBox";
} }
void TestBoundingBox::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TestBoundingBox::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(TestBoundingBox::onDraw, this); _customCommand.func = CC_CALLBACK_0(TestBoundingBox::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void TestBoundingBox::onDraw() void TestBoundingBox::onDraw()

View File

@ -211,7 +211,7 @@ public:
virtual void onEnter() override; virtual void onEnter() override;
virtual void onExit() override; virtual void onExit() override;
virtual std::string title() const override; virtual std::string title() const override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual void update(float delta); virtual void update(float delta);
void onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex); void onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex);
@ -270,7 +270,7 @@ public:
virtual void onEnter() override; virtual void onEnter() override;
virtual std::string title() const override; virtual std::string title() const override;
virtual void update(float delta); virtual void update(float delta);
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
void onDraw(); void onDraw();
void onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex); void onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex);
@ -293,7 +293,7 @@ class TestBoundingBox : public ArmatureTestLayer
public: public:
virtual void onEnter() override; virtual void onEnter() override;
virtual std::string title() const override; virtual std::string title() const override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
cocostudio::Armature *armature; cocostudio::Armature *armature;
Rect rect; Rect rect;

View File

@ -194,9 +194,9 @@ void SceneEditorTestLayer::backCallback(Ref *pSender)
s->release(); s->release();
} }
void SceneEditorTestLayer::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void SceneEditorTestLayer::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
Layer::draw(renderer, transform, transformDirty); Layer::draw(renderer, transform, transformUpdated);
} }

View File

@ -43,7 +43,7 @@ public:
virtual void nextCallback(cocos2d::Ref* pSender); virtual void nextCallback(cocos2d::Ref* pSender);
virtual void backCallback(cocos2d::Ref* pSender); virtual void backCallback(cocos2d::Ref* pSender);
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
protected: protected:
MenuItemImage *restartItem; MenuItemImage *restartItem;

View File

@ -2,9 +2,9 @@
USING_NS_CC; USING_NS_CC;
void CustomTableViewCell::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void CustomTableViewCell::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
TableViewCell::draw(renderer, transform, transformDirty); TableViewCell::draw(renderer, transform, transformUpdated);
// draw bounding box // draw bounding box
// auto pos = getPosition(); // auto pos = getPosition();
// auto size = Size(178, 200); // auto size = Size(178, 200);

View File

@ -7,7 +7,7 @@
class CustomTableViewCell : public cocos2d::extension::TableViewCell class CustomTableViewCell : public cocos2d::extension::TableViewCell
{ {
public: public:
virtual void draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(cocos2d::Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
}; };
#endif /* __CUSTOMTABELVIEWCELL_H__ */ #endif /* __CUSTOMTABELVIEWCELL_H__ */

View File

@ -206,14 +206,14 @@ Atlas1::~Atlas1()
_textureAtlas->release(); _textureAtlas->release();
} }
void Atlas1::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void Atlas1::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
// GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY // GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
// GL_TEXTURE_2D // GL_TEXTURE_2D
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(Atlas1::onDraw, this); _customCommand.func = CC_CALLBACK_0(Atlas1::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
// [textureAtlas drawNumberOfQuads:3]; // [textureAtlas drawNumberOfQuads:3];
} }
@ -529,11 +529,11 @@ Atlas4::Atlas4()
schedule( schedule_selector(Atlas4::step), 0.1f); schedule( schedule_selector(Atlas4::step), 0.1f);
} }
void Atlas4::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void Atlas4::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(Atlas4::onDraw, this); _customCommand.func = CC_CALLBACK_0(Atlas4::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void Atlas4::onDraw() void Atlas4::onDraw()
@ -1615,11 +1615,11 @@ std::string LabelBMFontBounds::subtitle() const
return "You should see string enclosed by a box"; return "You should see string enclosed by a box";
} }
void LabelBMFontBounds::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void LabelBMFontBounds::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(LabelBMFontBounds::onDraw, this); _customCommand.func = CC_CALLBACK_0(LabelBMFontBounds::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void LabelBMFontBounds::onDraw() void LabelBMFontBounds::onDraw()

View File

@ -35,7 +35,7 @@ public:
~Atlas1(); ~Atlas1();
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
protected: protected:
void onDraw(); void onDraw();
protected: protected:
@ -102,7 +102,7 @@ public:
Atlas4(); Atlas4();
virtual void step(float dt); virtual void step(float dt);
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
@ -377,7 +377,7 @@ public:
LabelBMFontBounds(); LabelBMFontBounds();
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
protected: protected:

View File

@ -309,12 +309,12 @@ LabelFNTSpriteActions::LabelFNTSpriteActions()
schedule( schedule_selector(LabelFNTSpriteActions::step), 0.1f); schedule( schedule_selector(LabelFNTSpriteActions::step), 0.1f);
} }
void LabelFNTSpriteActions::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void LabelFNTSpriteActions::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_renderCmd.init(_globalZOrder); _renderCmd.init(_globalZOrder);
_renderCmd.func = CC_CALLBACK_0(LabelFNTSpriteActions::onDraw, this); _renderCmd.func = CC_CALLBACK_0(LabelFNTSpriteActions::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_renderCmd); renderer->addCommand(&_renderCmd);
} }
void LabelFNTSpriteActions::onDraw() void LabelFNTSpriteActions::onDraw()
@ -926,11 +926,11 @@ std::string LabelFNTBounds::subtitle() const
return "You should see string enclosed by a box"; return "You should see string enclosed by a box";
} }
void LabelFNTBounds::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void LabelFNTBounds::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_renderCmd.init(_globalZOrder); _renderCmd.init(_globalZOrder);
_renderCmd.func = CC_CALLBACK_0(LabelFNTBounds::onDraw, this); _renderCmd.func = CC_CALLBACK_0(LabelFNTBounds::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_renderCmd); renderer->addCommand(&_renderCmd);
} }
void LabelFNTBounds::onDraw() void LabelFNTBounds::onDraw()
@ -1515,11 +1515,11 @@ void LabelTTFOldNew::onDraw()
kmGLLoadMatrix(&oldMat); kmGLLoadMatrix(&oldMat);
} }
void LabelTTFOldNew::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void LabelTTFOldNew::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_renderCmd.init(_globalZOrder); _renderCmd.init(_globalZOrder);
_renderCmd.func = CC_CALLBACK_0(LabelTTFOldNew::onDraw, this); _renderCmd.func = CC_CALLBACK_0(LabelTTFOldNew::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_renderCmd); renderer->addCommand(&_renderCmd);
} }
std::string LabelTTFOldNew::title() const std::string LabelTTFOldNew::title() const

View File

@ -57,7 +57,7 @@ public:
LabelFNTSpriteActions(); LabelFNTSpriteActions();
virtual void step(float dt); virtual void step(float dt);
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
@ -222,7 +222,7 @@ public:
LabelFNTBounds(); LabelFNTBounds();
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
private: private:
@ -411,7 +411,7 @@ public:
LabelTTFOldNew(); LabelTTFOldNew();
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;

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 transformDirty) virtual void draw(Renderer *renderer, const kmMat4 &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

@ -974,7 +974,7 @@ public:
sprite->setShaderProgram(shader); sprite->setShaderProgram(shader);
return sprite; return sprite;
} }
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
void onDraw(); void onDraw();
protected: protected:
@ -982,11 +982,11 @@ protected:
}; };
void MySprite::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void MySprite::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(MySprite::onDraw, this); _customCommand.func = CC_CALLBACK_0(MySprite::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void MySprite::onDraw() void MySprite::onDraw()

View File

@ -462,32 +462,31 @@ RenderTextureTestDepthStencil::~RenderTextureTestDepthStencil()
CC_SAFE_RELEASE(_spriteDS); CC_SAFE_RELEASE(_spriteDS);
} }
void RenderTextureTestDepthStencil::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void RenderTextureTestDepthStencil::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_renderCmds[0].init(_globalZOrder); _renderCmds[0].init(_globalZOrder);
_renderCmds[0].func = CC_CALLBACK_0(RenderTextureTestDepthStencil::onBeforeClear, this); _renderCmds[0].func = CC_CALLBACK_0(RenderTextureTestDepthStencil::onBeforeClear, this);
Director::getInstance()->getRenderer()->addCommand(&_renderCmds[0]); renderer->addCommand(&_renderCmds[0]);
_rend->beginWithClear(0, 0, 0, 0, 0, 0); _rend->beginWithClear(0, 0, 0, 0, 0, 0);
_renderCmds[1].init(_globalZOrder); _renderCmds[1].init(_globalZOrder);
_renderCmds[1].func = CC_CALLBACK_0(RenderTextureTestDepthStencil::onBeforeStencil, this); _renderCmds[1].func = CC_CALLBACK_0(RenderTextureTestDepthStencil::onBeforeStencil, this);
Director::getInstance()->getRenderer()->addCommand(&_renderCmds[1]); renderer->addCommand(&_renderCmds[1]);
_spriteDS->visit(); _spriteDS->visit();
_renderCmds[2].init(_globalZOrder); _renderCmds[2].init(_globalZOrder);
_renderCmds[2].func = CC_CALLBACK_0(RenderTextureTestDepthStencil::onBeforDraw, this); _renderCmds[2].func = CC_CALLBACK_0(RenderTextureTestDepthStencil::onBeforDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_renderCmds[2]); renderer->addCommand(&_renderCmds[2]);
_spriteDraw->visit(); _spriteDraw->visit();
_rend->end(); _rend->end();
_renderCmds[3].init(_globalZOrder); _renderCmds[3].init(_globalZOrder);
_renderCmds[3].func = CC_CALLBACK_0(RenderTextureTestDepthStencil::onAfterDraw, this); _renderCmds[3].func = CC_CALLBACK_0(RenderTextureTestDepthStencil::onAfterDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_renderCmds[3]); renderer->addCommand(&_renderCmds[3]);
} }
void RenderTextureTestDepthStencil::onBeforeClear() void RenderTextureTestDepthStencil::onBeforeClear()
@ -630,13 +629,13 @@ SpriteRenderTextureBug::SimpleSprite* SpriteRenderTextureBug::SimpleSprite::crea
return sprite; return sprite;
} }
void SpriteRenderTextureBug::SimpleSprite::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void SpriteRenderTextureBug::SimpleSprite::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(SpriteRenderTextureBug::SimpleSprite::onBeforeDraw, this); _customCommand.func = CC_CALLBACK_0(SpriteRenderTextureBug::SimpleSprite::onBeforeDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
Sprite::draw(renderer, transform, transformDirty); Sprite::draw(renderer, transform, transformUpdated);
} }

View File

@ -86,7 +86,7 @@ public:
virtual ~RenderTextureTestDepthStencil(); virtual ~RenderTextureTestDepthStencil();
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
private: private:
CustomCommand _renderCmds[4]; CustomCommand _renderCmds[4];
void onBeforeClear(); void onBeforeClear();
@ -125,7 +125,7 @@ public:
public: public:
static SimpleSprite* create(const char* filename, const Rect &rect); static SimpleSprite* create(const char* filename, const Rect &rect);
SimpleSprite(); SimpleSprite();
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty); virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated);
protected: protected:
void onBeforeDraw(); void onBeforeDraw();

View File

@ -191,11 +191,11 @@ void ShaderNode::setPosition(const Point &newPosition)
_center = Vertex2F(position.x * CC_CONTENT_SCALE_FACTOR(), position.y * CC_CONTENT_SCALE_FACTOR()); _center = Vertex2F(position.x * CC_CONTENT_SCALE_FACTOR(), position.y * CC_CONTENT_SCALE_FACTOR());
} }
void ShaderNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void ShaderNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(ShaderNode::onDraw, this); _customCommand.func = CC_CALLBACK_0(ShaderNode::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void ShaderNode::onDraw() void ShaderNode::onDraw()
@ -433,7 +433,7 @@ public:
~SpriteBlur(); ~SpriteBlur();
void setBlurSize(float f); void setBlurSize(float f);
bool initWithTexture(Texture2D* texture, const Rect& rect); bool initWithTexture(Texture2D* texture, const Rect& rect);
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
void initProgram(); void initProgram();
static SpriteBlur* create(const char *pszFileName); static SpriteBlur* create(const char *pszFileName);
@ -525,11 +525,11 @@ void SpriteBlur::initProgram()
CHECK_GL_ERROR_DEBUG(); CHECK_GL_ERROR_DEBUG();
} }
void SpriteBlur::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void SpriteBlur::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_customCommand.init(_globalZOrder); _customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(SpriteBlur::onDraw, this); _customCommand.func = CC_CALLBACK_0(SpriteBlur::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_customCommand); renderer->addCommand(&_customCommand);
} }
void SpriteBlur::onDraw() void SpriteBlur::onDraw()

View File

@ -121,7 +121,7 @@ public:
virtual void update(float dt); virtual void update(float dt);
virtual void setPosition(const Point &newPosition); virtual void setPosition(const Point &newPosition);
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
static ShaderNode* shaderNodeWithVertex(const char *vert, const char *frag); static ShaderNode* shaderNodeWithVertex(const char *vert, const char *frag);

View File

@ -112,7 +112,7 @@ public:
virtual void initShader(); virtual void initShader();
void setBackgroundNotification(); void setBackgroundNotification();
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
void listenBackToForeground(Ref *obj); void listenBackToForeground(Ref *obj);
protected: protected:
@ -176,12 +176,12 @@ void ShaderSprite::initShader()
CHECK_GL_ERROR_DEBUG(); CHECK_GL_ERROR_DEBUG();
} }
void ShaderSprite::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void ShaderSprite::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_renderCommand.init(_globalZOrder); _renderCommand.init(_globalZOrder);
_renderCommand.func = CC_CALLBACK_0(ShaderSprite::onDraw, this); _renderCommand.func = CC_CALLBACK_0(ShaderSprite::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_renderCommand); renderer->addCommand(&_renderCommand);
} }
void ShaderSprite::onDraw() void ShaderSprite::onDraw()

View File

@ -1791,13 +1791,13 @@ std::string TextureDrawAtPoint::subtitle() const
return "draws 2 textures using drawAtPoint"; return "draws 2 textures using drawAtPoint";
} }
void TextureDrawAtPoint::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TextureDrawAtPoint::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
TextureDemo::draw(renderer, transform, transformDirty); TextureDemo::draw(renderer, transform, transformUpdated);
_renderCmd.init(_globalZOrder); _renderCmd.init(_globalZOrder);
_renderCmd.func = CC_CALLBACK_0(TextureDrawAtPoint::onDraw, this); _renderCmd.func = CC_CALLBACK_0(TextureDrawAtPoint::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_renderCmd); renderer->addCommand(&_renderCmd);
} }
@ -1832,14 +1832,13 @@ TextureDrawInRect::~TextureDrawInRect()
_Tex2F->release(); _Tex2F->release();
} }
void TextureDrawInRect::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TextureDrawInRect::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
TextureDemo::draw(renderer, transform, transformDirty); TextureDemo::draw(renderer, transform, transformUpdated);
_renderCmd.init(_globalZOrder); _renderCmd.init(_globalZOrder);
_renderCmd.func = CC_CALLBACK_0(TextureDrawInRect::onDraw, this); _renderCmd.func = CC_CALLBACK_0(TextureDrawInRect::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_renderCmd); renderer->addCommand(&_renderCmd);
} }
void TextureDrawInRect::onDraw() void TextureDrawInRect::onDraw()

View File

@ -466,7 +466,7 @@ public:
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
virtual void onEnter() override; virtual void onEnter() override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
protected: protected:
CustomCommand _renderCmd; CustomCommand _renderCmd;
void onDraw(); void onDraw();
@ -482,7 +482,7 @@ public:
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
virtual void onEnter() override; virtual void onEnter() override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
protected: protected:
CustomCommand _renderCmd; CustomCommand _renderCmd;
void onDraw(); void onDraw();

View File

@ -755,11 +755,11 @@ TMXOrthoObjectsTest::TMXOrthoObjectsTest()
CCLOG("%s", objectsVal.getDescription().c_str()); CCLOG("%s", objectsVal.getDescription().c_str());
} }
void TMXOrthoObjectsTest::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TMXOrthoObjectsTest::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_renderCmd.init(_globalZOrder); _renderCmd.init(_globalZOrder);
_renderCmd.func = CC_CALLBACK_0(TMXOrthoObjectsTest::onDraw, this); _renderCmd.func = CC_CALLBACK_0(TMXOrthoObjectsTest::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_renderCmd); renderer->addCommand(&_renderCmd);
} }
void TMXOrthoObjectsTest::onDraw() void TMXOrthoObjectsTest::onDraw()
@ -829,11 +829,11 @@ TMXIsoObjectsTest::TMXIsoObjectsTest()
CCLOG("%s", objectsVal.getDescription().c_str()); CCLOG("%s", objectsVal.getDescription().c_str());
} }
void TMXIsoObjectsTest::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TMXIsoObjectsTest::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_renderCmd.init(_globalZOrder); _renderCmd.init(_globalZOrder);
_renderCmd.func = CC_CALLBACK_0(TMXIsoObjectsTest::onDraw, this); _renderCmd.func = CC_CALLBACK_0(TMXIsoObjectsTest::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_renderCmd); renderer->addCommand(&_renderCmd);
} }
void TMXIsoObjectsTest::onDraw() void TMXIsoObjectsTest::onDraw()
@ -1513,11 +1513,11 @@ TMXGIDObjectsTest::TMXGIDObjectsTest()
} }
void TMXGIDObjectsTest::draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) void TMXGIDObjectsTest::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
_renderCmd.init(_globalZOrder); _renderCmd.init(_globalZOrder);
_renderCmd.func = CC_CALLBACK_0(TMXGIDObjectsTest::onDraw, this); _renderCmd.func = CC_CALLBACK_0(TMXGIDObjectsTest::onDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_renderCmd); renderer->addCommand(&_renderCmd);
} }
void TMXGIDObjectsTest::onDraw() void TMXGIDObjectsTest::onDraw()

View File

@ -134,7 +134,7 @@ public:
TMXOrthoObjectsTest(void); TMXOrthoObjectsTest(void);
virtual std::string title() const override; virtual std::string title() const override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
protected: protected:
CustomCommand _renderCmd; CustomCommand _renderCmd;
@ -147,7 +147,7 @@ public:
TMXIsoObjectsTest(void); TMXIsoObjectsTest(void);
virtual std::string title() const override; virtual std::string title() const override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
protected: protected:
CustomCommand _renderCmd; CustomCommand _renderCmd;
@ -292,7 +292,7 @@ public:
TMXGIDObjectsTest(); TMXGIDObjectsTest();
virtual std::string title() const override; virtual std::string title() const override;
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformDirty) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
protected: protected:
CustomCommand _renderCmd; CustomCommand _renderCmd;