Fix transparent displacement rendering with advanced pipeline off
Allowing them to render using the same custom alpha uniform used by ghost karts, fixed #2459.
This commit is contained in:
parent
c1e931f5ba
commit
61a00a9068
@ -50,8 +50,9 @@ void DrawCalls::clearLists()
|
||||
{
|
||||
ListBlendTransparent::getInstance()->clear();
|
||||
ListAdditiveTransparent::getInstance()->clear();
|
||||
ListGhostKart::getInstance()->clear();
|
||||
ListGhostKartTangents::getInstance()->clear();
|
||||
ListTranslucentStandard::getInstance()->clear();
|
||||
ListTranslucentTangents::getInstance()->clear();
|
||||
ListTranslucent2TCoords::getInstance()->clear();
|
||||
ListBlendTransparentFog::getInstance()->clear();
|
||||
ListAdditiveTransparentFog::getInstance()->clear();
|
||||
ListDisplacement::getInstance()->clear();
|
||||
@ -175,10 +176,12 @@ void DrawCalls::handleSTKCommon(scene::ISceneNode *Node,
|
||||
custom_alpha = y > 128.0f ? 0.5f : 0.35f;
|
||||
}
|
||||
|
||||
for (GLMesh *mesh : node->TransparentMesh[TM_GHOST_KART])
|
||||
pushVector(ListGhostKart::getInstance(), mesh, Node->getAbsoluteTransformation(), mesh->TextureMatrix, custom_alpha);
|
||||
for (GLMesh *mesh : node->TransparentMesh[TM_GHOST_KART_TANGENTS])
|
||||
pushVector(ListGhostKartTangents::getInstance(), mesh, Node->getAbsoluteTransformation(), mesh->TextureMatrix, custom_alpha);
|
||||
for (GLMesh *mesh : node->TransparentMesh[TM_TRANSLUCENT_STD])
|
||||
pushVector(ListTranslucentStandard::getInstance(), mesh, Node->getAbsoluteTransformation(), mesh->TextureMatrix, custom_alpha);
|
||||
for (GLMesh *mesh : node->TransparentMesh[TM_TRANSLUCENT_TAN])
|
||||
pushVector(ListTranslucentTangents::getInstance(), mesh, Node->getAbsoluteTransformation(), mesh->TextureMatrix, custom_alpha);
|
||||
for (GLMesh *mesh : node->TransparentMesh[TM_TRANSLUCENT_2TC])
|
||||
pushVector(ListTranslucent2TCoords::getInstance(), mesh, Node->getAbsoluteTransformation(), mesh->TextureMatrix, custom_alpha);
|
||||
for (GLMesh *mesh : node->TransparentMesh[TM_DISPLACEMENT])
|
||||
pushVector(ListDisplacement::getInstance(), mesh, Node->getAbsoluteTransformation());
|
||||
|
||||
|
@ -250,11 +250,15 @@ void AbstractGeometryPasses::renderTransparent(const DrawCalls& draw_calls,
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
renderTransparenPass<Shaders::TransparentShader, video::EVT_STANDARD, 3, 2, 1>(
|
||||
TexUnits(RenderGeometry::TexUnit(0, true)),
|
||||
ListGhostKart::getInstance());
|
||||
ListTranslucentStandard::getInstance());
|
||||
|
||||
renderTransparenPass<Shaders::TransparentShader, video::EVT_TANGENTS, 3, 2, 1>(
|
||||
TexUnits(RenderGeometry::TexUnit(0, true)),
|
||||
ListGhostKartTangents::getInstance());
|
||||
ListTranslucentTangents::getInstance());
|
||||
|
||||
renderTransparenPass<Shaders::TransparentShader, video::EVT_2TCOORDS, 3, 2, 1>(
|
||||
TexUnits(RenderGeometry::TexUnit(0, true)),
|
||||
ListTranslucent2TCoords::getInstance());
|
||||
|
||||
glDepthMask(GL_FALSE);
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
@ -170,9 +170,9 @@ void STKAnimatedMesh::updateNoGL()
|
||||
else if (mesh.m_render_info != NULL && mesh.m_render_info->isTransparent())
|
||||
{
|
||||
if (mesh.VAOType == video::EVT_TANGENTS)
|
||||
TransparentMesh[TM_GHOST_KART_TANGENTS].push_back(&mesh);
|
||||
TransparentMesh[TM_TRANSLUCENT_TAN].push_back(&mesh);
|
||||
else
|
||||
TransparentMesh[TM_GHOST_KART].push_back(&mesh);
|
||||
TransparentMesh[TM_TRANSLUCENT_STD].push_back(&mesh);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -57,7 +57,12 @@ TransparentMaterial getTransparentMaterialFromType(video::E_MATERIAL_TYPE type,
|
||||
Material* material)
|
||||
{
|
||||
if (type == Shaders::getShader(ES_DISPLACE))
|
||||
return TM_DISPLACEMENT;
|
||||
{
|
||||
if (CVS->isDefferedEnabled())
|
||||
return TM_DISPLACEMENT;
|
||||
else
|
||||
return TM_TRANSLUCENT_2TC;
|
||||
}
|
||||
if (material->getShaderType() == Material::SHADERTYPE_ADDITIVE)
|
||||
return TM_ADDITIVE;
|
||||
return TM_DEFAULT;
|
||||
|
@ -37,8 +37,9 @@ enum TransparentMaterial
|
||||
TM_DEFAULT,
|
||||
TM_ADDITIVE,
|
||||
TM_DISPLACEMENT,
|
||||
TM_GHOST_KART,
|
||||
TM_GHOST_KART_TANGENTS,
|
||||
TM_TRANSLUCENT_STD,
|
||||
TM_TRANSLUCENT_TAN,
|
||||
TM_TRANSLUCENT_2TC,
|
||||
TM_COUNT
|
||||
}; // TransparentMaterial
|
||||
|
||||
@ -169,13 +170,19 @@ class ListAdditiveTransparent : public MiscList<ListAdditiveTransparent,
|
||||
{};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
class ListGhostKart : public MiscList<ListGhostKart,
|
||||
class ListTranslucentStandard : public MiscList<ListTranslucentStandard,
|
||||
GLMesh *, core::matrix4,
|
||||
core::matrix4, float>
|
||||
{};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
class ListGhostKartTangents : public MiscList<ListGhostKartTangents,
|
||||
class ListTranslucentTangents : public MiscList<ListTranslucentTangents,
|
||||
GLMesh *, core::matrix4,
|
||||
core::matrix4, float>
|
||||
{};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
class ListTranslucent2TCoords : public MiscList<ListTranslucent2TCoords,
|
||||
GLMesh *, core::matrix4,
|
||||
core::matrix4, float>
|
||||
{};
|
||||
|
@ -209,9 +209,9 @@ void STKMeshSceneNode::updateNoGL()
|
||||
{
|
||||
assert(!immediate_draw);
|
||||
if (mesh.VAOType == video::EVT_TANGENTS)
|
||||
TransparentMesh[TM_GHOST_KART_TANGENTS].push_back(&mesh);
|
||||
TransparentMesh[TM_TRANSLUCENT_TAN].push_back(&mesh);
|
||||
else
|
||||
TransparentMesh[TM_GHOST_KART].push_back(&mesh);
|
||||
TransparentMesh[TM_TRANSLUCENT_STD].push_back(&mesh);
|
||||
}
|
||||
else if (rnd->isTransparent())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user