Use InitTexture for transparents too
This commit is contained in:
parent
d0b996ab4a
commit
7d602225fb
@ -723,25 +723,9 @@ void renderTransparenPass(const std::vector<TexUnit> &TexUnits, std::vector<STK:
|
|||||||
glBindVertexArray(VAOManager::getInstance()->getVAO(VertexType));
|
glBindVertexArray(VAOManager::getInstance()->getVAO(VertexType));
|
||||||
for (unsigned i = 0; i < meshes->size(); i++)
|
for (unsigned i = 0; i < meshes->size(); i++)
|
||||||
{
|
{
|
||||||
std::vector<uint64_t> Handles;
|
|
||||||
GLMesh &mesh = *(STK::tuple_get<0>(meshes->at(i)));
|
GLMesh &mesh = *(STK::tuple_get<0>(meshes->at(i)));
|
||||||
if (!irr_driver->hasARB_base_instance())
|
if (!irr_driver->hasARB_base_instance())
|
||||||
glBindVertexArray(mesh.vao);
|
glBindVertexArray(mesh.vao);
|
||||||
for (unsigned j = 0; j < TexUnits.size(); j++)
|
|
||||||
{
|
|
||||||
if (!mesh.textures[TexUnits[j].m_id])
|
|
||||||
mesh.textures[TexUnits[j].m_id] = getUnicolorTexture(video::SColor(255, 255, 255, 255));
|
|
||||||
compressTexture(mesh.textures[TexUnits[j].m_id], TexUnits[j].m_premul_alpha);
|
|
||||||
if (UserConfigParams::m_azdo)
|
|
||||||
{
|
|
||||||
if (!mesh.TextureHandles[TexUnits[j].m_id])
|
|
||||||
mesh.TextureHandles[TexUnits[j].m_id] = glGetTextureSamplerHandleARB(getTextureGLuint(mesh.textures[TexUnits[j].m_id]), Shader::getInstance()->SamplersId[Handles.size()]);
|
|
||||||
if (!glIsTextureHandleResidentARB(mesh.TextureHandles[TexUnits[j].m_id]))
|
|
||||||
glMakeTextureHandleResidentARB(mesh.TextureHandles[TexUnits[j].m_id]);
|
|
||||||
Handles.push_back(mesh.TextureHandles[TexUnits[j].m_id]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mesh.VAOType != VertexType)
|
if (mesh.VAOType != VertexType)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -751,7 +735,7 @@ void renderTransparenPass(const std::vector<TexUnit> &TexUnits, std::vector<STK:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (UserConfigParams::m_azdo)
|
if (UserConfigParams::m_azdo)
|
||||||
Shader::getInstance()->SetTextureHandles(Handles[0]);
|
Shader::getInstance()->SetTextureHandles(mesh.TextureHandles[0]);
|
||||||
else
|
else
|
||||||
Shader::getInstance()->SetTextureUnits(getTextureGLuint(mesh.textures[0]));
|
Shader::getInstance()->SetTextureUnits(getTextureGLuint(mesh.textures[0]));
|
||||||
custom_unroll_args<List...>::template exec(Shader::getInstance(), meshes->at(i));
|
custom_unroll_args<List...>::template exec(Shader::getInstance(), meshes->at(i));
|
||||||
|
@ -149,6 +149,8 @@ void STKAnimatedMesh::updateGL()
|
|||||||
Material::ShaderType MatType = MaterialTypeToMeshMaterial(type, mb->getVertexType(), material, material2);
|
Material::ShaderType MatType = MaterialTypeToMeshMaterial(type, mb->getVertexType(), material, material2);
|
||||||
InitTextures(mesh, MatType);
|
InitTextures(mesh, MatType);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
InitTexturesTransparent(mesh);
|
||||||
|
|
||||||
if (irr_driver->hasARB_base_instance())
|
if (irr_driver->hasARB_base_instance())
|
||||||
{
|
{
|
||||||
|
@ -349,4 +349,21 @@ void InitTextures(GLMesh &mesh, Material::ShaderType Mat)
|
|||||||
SetTexture(mesh, 6, false, getShaderTypeName(Mat));
|
SetTexture(mesh, 6, false, getShaderTypeName(Mat));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitTexturesTransparent(GLMesh &mesh)
|
||||||
|
{
|
||||||
|
if (!mesh.textures[0])
|
||||||
|
{
|
||||||
|
Log::fatal("STKMesh", "Missing texture for material transparent");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
|
if (UserConfigParams::m_azdo)
|
||||||
|
{
|
||||||
|
if (!mesh.TextureHandles[0])
|
||||||
|
mesh.TextureHandles[0] = glGetTextureSamplerHandleARB(getTextureGLuint(mesh.textures[0]), MeshShader::ObjectPass1Shader::getInstance()->SamplersId[0]);
|
||||||
|
if (!glIsTextureHandleResidentARB(mesh.TextureHandles[0]))
|
||||||
|
glMakeTextureHandleResidentARB(mesh.TextureHandles[0]);
|
||||||
|
}
|
||||||
}
|
}
|
@ -179,5 +179,6 @@ Material::ShaderType MaterialTypeToMeshMaterial(video::E_MATERIAL_TYPE MaterialT
|
|||||||
TransparentMaterial MaterialTypeToTransparentMaterial(video::E_MATERIAL_TYPE, f32 MaterialTypeParam, Material* material);
|
TransparentMaterial MaterialTypeToTransparentMaterial(video::E_MATERIAL_TYPE, f32 MaterialTypeParam, Material* material);
|
||||||
|
|
||||||
void InitTextures(GLMesh &mesh, Material::ShaderType);
|
void InitTextures(GLMesh &mesh, Material::ShaderType);
|
||||||
|
void InitTexturesTransparent(GLMesh &mesh);
|
||||||
|
|
||||||
#endif // STKMESH_H
|
#endif // STKMESH_H
|
||||||
|
@ -189,6 +189,8 @@ void STKMeshSceneNode::updateGL()
|
|||||||
if (!immediate_draw)
|
if (!immediate_draw)
|
||||||
InitTextures(mesh, MatType);
|
InitTextures(mesh, MatType);
|
||||||
}
|
}
|
||||||
|
else if (!immediate_draw)
|
||||||
|
InitTexturesTransparent(mesh);
|
||||||
|
|
||||||
if (!immediate_draw && irr_driver->hasARB_base_instance())
|
if (!immediate_draw && irr_driver->hasARB_base_instance())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user