mirror of https://github.com/axmolengine/axmol.git
transform object returns the MV
code cleaner. the kmGL code is altogether
This commit is contained in:
parent
ff79c0d9ad
commit
6920bec6ef
|
@ -204,11 +204,16 @@ void ClippingNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool
|
|||
if(!_visible)
|
||||
return;
|
||||
|
||||
kmGLPushMatrix();
|
||||
|
||||
bool dirty = parentTransformDirty || _transformDirty;
|
||||
if(dirty)
|
||||
transform();
|
||||
_modelViewTransform = transform(parentTransform);
|
||||
|
||||
// IMPORTANT:
|
||||
// To ease the migration to v3.0, we still support the kmGL stack,
|
||||
// but it is deprecated and your code should not rely on it
|
||||
kmGLPushMatrix();
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
//Add group command
|
||||
|
||||
_groupCommand.init(_globalZOrder);
|
||||
|
|
|
@ -693,11 +693,16 @@ void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parent
|
|||
return;
|
||||
}
|
||||
|
||||
kmGLPushMatrix();
|
||||
|
||||
bool dirty = parentTransformDirty || _transformDirty;
|
||||
if(dirty)
|
||||
transform();
|
||||
_modelViewTransform = transform(parentTransform);
|
||||
|
||||
// IMPORTANT:
|
||||
// To ease the migration to v3.0, we still support the kmGL stack,
|
||||
// but it is deprecated and your code should not rely on it
|
||||
kmGLPushMatrix();
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
draw(renderer, _modelViewTransform, dirty);
|
||||
|
||||
kmGLPopMatrix();
|
||||
|
|
|
@ -925,13 +925,17 @@ void Node::visit(Renderer* renderer, const kmMat4 &parentTransform, bool parentT
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
kmGLPushMatrix();
|
||||
|
||||
bool dirty = _transformDirty || parentTransformDirty;
|
||||
|
||||
if(dirty)
|
||||
this->transform();
|
||||
_modelViewTransform = this->transform(parentTransform);
|
||||
|
||||
|
||||
// IMPORTANT:
|
||||
// To ease the migration to v3.0, we still support the kmGL stack,
|
||||
// but it is deprecated and your code should not rely on it
|
||||
kmGLPushMatrix();
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
int i = 0;
|
||||
|
||||
|
@ -967,21 +971,17 @@ void Node::visit(Renderer* renderer, const kmMat4 &parentTransform, bool parentT
|
|||
|
||||
void Node::transformAncestors()
|
||||
{
|
||||
if( _parent != nullptr )
|
||||
{
|
||||
_parent->transformAncestors();
|
||||
_parent->transform();
|
||||
}
|
||||
// remove me
|
||||
CCASSERT(false, "no longer supported");
|
||||
}
|
||||
|
||||
void Node::transform()
|
||||
kmMat4 Node::transform(const kmMat4& parentTransform)
|
||||
{
|
||||
kmMat4 ret;
|
||||
kmMat4 transfrom4x4 = this->getNodeToParentTransform();
|
||||
kmMat4Multiply(&ret, &parentTransform, &transfrom4x4);
|
||||
|
||||
kmGLMultMatrix( &transfrom4x4 );
|
||||
|
||||
// saves the MV matrix
|
||||
kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewTransform);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Node::onEnter()
|
||||
|
|
|
@ -1256,7 +1256,7 @@ public:
|
|||
/**
|
||||
* Performs OpenGL view-matrix transformation based on position, scale, rotation and other attributes.
|
||||
*/
|
||||
void transform();
|
||||
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)
|
||||
|
|
|
@ -94,7 +94,16 @@ void NodeGrid::visit(Renderer *renderer, const kmMat4 &parentTransform, bool par
|
|||
renderer->addCommand(&_groupCommand);
|
||||
renderer->pushGroup(_groupCommand.getRenderQueueID());
|
||||
|
||||
bool dirty = parentTransformDirty || _transformDirty;
|
||||
if(dirty)
|
||||
_modelViewTransform = this->transform(parentTransform);
|
||||
|
||||
// IMPORTANT:
|
||||
// To ease the migration to v3.0, we still support the kmGL stack,
|
||||
// but it is deprecated and your code should not rely on it
|
||||
kmGLPushMatrix();
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
Director::Projection beforeProjectionType;
|
||||
if(_nodeGrid && _nodeGrid->isActive())
|
||||
{
|
||||
|
@ -106,10 +115,7 @@ void NodeGrid::visit(Renderer *renderer, const kmMat4 &parentTransform, bool par
|
|||
_gridBeginCommand.func = CC_CALLBACK_0(NodeGrid::onGridBeginDraw, this);
|
||||
renderer->addCommand(&_gridBeginCommand);
|
||||
|
||||
bool dirty = parentTransformDirty || _transformDirty;
|
||||
if(dirty)
|
||||
this->transform();
|
||||
|
||||
|
||||
if(_gridTarget)
|
||||
{
|
||||
_gridTarget->visit(renderer, _modelViewTransform, dirty);
|
||||
|
|
|
@ -134,11 +134,15 @@ void ParticleBatchNode::visit(Renderer *renderer, const kmMat4 &parentTransform,
|
|||
return;
|
||||
}
|
||||
|
||||
kmGLPushMatrix();
|
||||
|
||||
bool dirty = parentTransformDirty || _transformDirty;
|
||||
if(dirty)
|
||||
transform();
|
||||
_modelViewTransform = transform(parentTransform);
|
||||
|
||||
// IMPORTANT:
|
||||
// To ease the migration to v3.0, we still support the kmGL stack,
|
||||
// but it is deprecated and your code should not rely on it
|
||||
kmGLPushMatrix();
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
draw(renderer, _modelViewTransform, dirty);
|
||||
|
||||
|
|
|
@ -370,11 +370,15 @@ void RenderTexture::visit(Renderer *renderer, const kmMat4 &parentTransform, boo
|
|||
return;
|
||||
}
|
||||
|
||||
kmGLPushMatrix();
|
||||
|
||||
bool dirty = parentTransformDirty || _transformDirty;
|
||||
if(dirty)
|
||||
transform();
|
||||
_modelViewTransform = transform(parentTransform);
|
||||
|
||||
// IMPORTANT:
|
||||
// To ease the migration to v3.0, we still support the kmGL stack,
|
||||
// but it is deprecated and your code should not rely on it
|
||||
kmGLPushMatrix();
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
_sprite->visit(renderer, _modelViewTransform, dirty);
|
||||
draw(renderer, _modelViewTransform, dirty);
|
||||
|
|
|
@ -147,13 +147,17 @@ void SpriteBatchNode::visit(Renderer *renderer, const kmMat4 &parentTransform, b
|
|||
return;
|
||||
}
|
||||
|
||||
kmGLPushMatrix();
|
||||
|
||||
sortAllChildren();
|
||||
|
||||
bool dirty = parentTransformDirty || _transformDirty;
|
||||
if(dirty)
|
||||
transform();
|
||||
_modelViewTransform = transform(parentTransform);
|
||||
|
||||
// IMPORTANT:
|
||||
// To ease the migration to v3.0, we still support the kmGL stack,
|
||||
// but it is deprecated and your code should not rely on it
|
||||
kmGLPushMatrix();
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
draw(renderer, _modelViewTransform, dirty);
|
||||
|
||||
|
|
|
@ -452,11 +452,17 @@ void Armature::visit(cocos2d::Renderer *renderer, const kmMat4 &parentTransform,
|
|||
{
|
||||
return;
|
||||
}
|
||||
kmGLPushMatrix();
|
||||
|
||||
bool dirty = parentTransformDirty || _transformDirty;
|
||||
if(dirty)
|
||||
transform();
|
||||
_modelViewTransform = transform(parentTransform);
|
||||
|
||||
// IMPORTANT:
|
||||
// To ease the migration to v3.0, we still support the kmGL stack,
|
||||
// but it is deprecated and your code should not rely on it
|
||||
kmGLPushMatrix();
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
sortAllChildren();
|
||||
draw(renderer, _modelViewTransform, dirty);
|
||||
|
||||
|
|
|
@ -108,11 +108,16 @@ void BatchNode::visit(Renderer *renderer, const kmMat4 &parentTransform, bool pa
|
|||
{
|
||||
return;
|
||||
}
|
||||
kmGLPushMatrix();
|
||||
|
||||
bool dirty = parentTransformDirty || _transformDirty;
|
||||
if(dirty)
|
||||
transform();
|
||||
_modelViewTransform = transform(parentTransform);
|
||||
|
||||
// IMPORTANT:
|
||||
// To ease the migration to v3.0, we still support the kmGL stack,
|
||||
// but it is deprecated and your code should not rely on it
|
||||
kmGLPushMatrix();
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
sortAllChildren();
|
||||
draw(renderer, _modelViewTransform, dirty);
|
||||
|
|
|
@ -204,10 +204,16 @@ void Layout::stencilClippingVisit(Renderer *renderer, const kmMat4 &parentTransf
|
|||
if(!_visible)
|
||||
return;
|
||||
|
||||
kmGLPushMatrix();
|
||||
bool dirty = parentTransformDirty || _transformDirty;
|
||||
if(dirty)
|
||||
transform();
|
||||
_modelViewTransform = transform(parentTransform);
|
||||
|
||||
// IMPORTANT:
|
||||
// To ease the migration to v3.0, we still support the kmGL stack,
|
||||
// but it is deprecated and your code should not rely on it
|
||||
kmGLPushMatrix();
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
//Add group command
|
||||
|
||||
_groupCommand.init(_globalZOrder);
|
||||
|
|
|
@ -560,11 +560,15 @@ void ScrollView::visit(Renderer *renderer, const kmMat4 &parentTransform, bool p
|
|||
return;
|
||||
}
|
||||
|
||||
kmGLPushMatrix();
|
||||
|
||||
bool dirty = parentTransformDirty || _transformDirty;
|
||||
if(dirty)
|
||||
this->transform();
|
||||
_modelViewTransform = this->transform(parentTransform);
|
||||
|
||||
// IMPORTANT:
|
||||
// To ease the migration to v3.0, we still support the kmGL stack,
|
||||
// but it is deprecated and your code should not rely on it
|
||||
kmGLPushMatrix();
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
this->beforeDraw();
|
||||
|
||||
|
|
|
@ -633,7 +633,7 @@ void RawStencilBufferTest::draw(Renderer *renderer, const kmMat4 &transform, boo
|
|||
++iter;
|
||||
|
||||
kmGLPushMatrix();
|
||||
this->transform();
|
||||
_modelViewTransform = this->transform(transform);
|
||||
_sprites.at(i)->visit(renderer, _modelViewTransform, transformDirty);
|
||||
kmGLPopMatrix();
|
||||
|
||||
|
@ -643,7 +643,7 @@ void RawStencilBufferTest::draw(Renderer *renderer, const kmMat4 &transform, boo
|
|||
++iter;
|
||||
|
||||
kmGLPushMatrix();
|
||||
this->transform();
|
||||
_modelViewTransform = this->transform(transform);
|
||||
_sprites.at(i)->visit(renderer, _modelViewTransform, transformDirty);
|
||||
kmGLPopMatrix();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue