mirror of https://github.com/axmolengine/axmol.git
Merge pull request #14264 from super626/v3
Fix: Mesh::setGLProgramState may modify state block
This commit is contained in:
commit
b58e656620
|
@ -404,6 +404,8 @@ void Mesh::setGLProgramState(GLProgramState* glProgramState)
|
|||
{
|
||||
// XXX create dummy texture
|
||||
auto material = Material::createWithGLStateProgram(glProgramState);
|
||||
if (_material)
|
||||
material->setStateBlock(_material->getStateBlock());
|
||||
setMaterial(material);
|
||||
}
|
||||
|
||||
|
|
|
@ -158,6 +158,13 @@ RenderState::StateBlock* RenderState::getStateBlock() const
|
|||
return _state;
|
||||
}
|
||||
|
||||
void RenderState::setStateBlock(RenderState::StateBlock* state)
|
||||
{
|
||||
CC_SAFE_RETAIN(state);
|
||||
CC_SAFE_RELEASE(_state);
|
||||
_state = state;
|
||||
}
|
||||
|
||||
void RenderState::cloneInto(RenderState* renderState) const
|
||||
{
|
||||
CCASSERT(renderState, "must be non null");
|
||||
|
|
Loading…
Reference in New Issue