mirror of https://github.com/axmolengine/axmol.git
tmp work
This commit is contained in:
parent
c5515874d5
commit
fdc0fad935
|
@ -293,19 +293,32 @@ void Sprite3D::genGLProgramState()
|
||||||
bool textured = mesh->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_TEX_COORD);
|
bool textured = mesh->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_TEX_COORD);
|
||||||
bool hasSkin = mesh->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_BLEND_INDEX)
|
bool hasSkin = mesh->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_BLEND_INDEX)
|
||||||
&& mesh->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_BLEND_WEIGHT);
|
&& mesh->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_BLEND_WEIGHT);
|
||||||
|
bool hasNormal = mesh->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_NORMAL);
|
||||||
|
|
||||||
GLProgram* glProgram = nullptr;
|
GLProgram* glProgram = nullptr;
|
||||||
|
const char* shader = nullptr;
|
||||||
if(textured)
|
if(textured)
|
||||||
{
|
{
|
||||||
if (hasSkin)
|
if (hasSkin)
|
||||||
glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_SKINPOSITION_TEXTURE);
|
{
|
||||||
|
if (hasNormal)
|
||||||
|
shader = GLProgram::SHADER_3D_SKINPOSITION_NORMAL_TEXTURE;
|
||||||
|
else
|
||||||
|
shader = GLProgram::SHADER_3D_SKINPOSITION_TEXTURE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (hasNormal)
|
||||||
|
shader = GLProgram::SHADER_3D_POSITION_NORMAL_TEXTURE;
|
||||||
glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_POSITION_TEXTURE);
|
glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_POSITION_TEXTURE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_POSITION);
|
glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_POSITION);
|
||||||
}
|
}
|
||||||
|
if (shader)
|
||||||
|
glProgram = GLProgramCache::getInstance()->getGLProgram(shader);
|
||||||
|
|
||||||
auto programstate = GLProgramState::create(glProgram);
|
auto programstate = GLProgramState::create(glProgram);
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
|
|
Loading…
Reference in New Issue