mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/super626/cocos2d-x into v3
This commit is contained in:
commit
3687504982
|
@ -300,15 +300,10 @@ void Sprite3D::createAttachSprite3DNode(NodeData* nodedata,const MaterialDatas&
|
|||
createAttachSprite3DNode(it,matrialdatas);
|
||||
}
|
||||
}
|
||||
void Sprite3D::genGLProgramState()
|
||||
void Sprite3D::genGLProgramState(bool useLight)
|
||||
{
|
||||
const auto& lights = Director::getInstance()->getRunningScene()->getLights();
|
||||
_shaderUsingLight = false;
|
||||
for (const auto light : lights) {
|
||||
_shaderUsingLight = ((unsigned int)light->getLightFlag() & _lightMask) > 0;
|
||||
if (_shaderUsingLight)
|
||||
break;
|
||||
}
|
||||
_shaderUsingLight = useLight;
|
||||
|
||||
std::unordered_map<const MeshVertexData*, GLProgramState*> glProgramestates;
|
||||
for(auto& mesh : _meshVertexDatas)
|
||||
{
|
||||
|
@ -532,7 +527,7 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|||
break;
|
||||
}
|
||||
if (usingLight != _shaderUsingLight)
|
||||
genGLProgramState();
|
||||
genGLProgramState(usingLight);
|
||||
|
||||
int i = 0;
|
||||
for (auto& mesh : _meshes) {
|
||||
|
|
|
@ -137,7 +137,7 @@ CC_CONSTRUCTOR_ACCESS:
|
|||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
||||
|
||||
/**generate default GLProgramState*/
|
||||
void genGLProgramState();
|
||||
void genGLProgramState(bool useLight = false);
|
||||
|
||||
void createNode(NodeData* nodedata, Node* root, const MaterialDatas& matrialdatas, bool singleSprite);
|
||||
void createAttachSprite3DNode(NodeData* nodedata,const MaterialDatas& matrialdatas);
|
||||
|
|
Loading…
Reference in New Issue