Skip to content

Commit

Permalink
UPBGE: Fix alpha blending settings for geometry instancing and batching.
Browse files Browse the repository at this point in the history
Previously the alpha blending were set only for geometry instancing and batching
only if the shader was overrided, but the alpha blending should be always set
because the the material is not setting it due to the lack of call to ActivateMeshSlot.
  • Loading branch information
panzergame committed Jan 18, 2017
1 parent 4f45a9a commit 09f88ce
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions source/gameengine/Rasterizer/RAS_DisplayArrayBucket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,6 @@ void RAS_DisplayArrayBucket::RunInstancingNode(const RAS_RenderNodeArguments& ar
m_instancingBuffer->GetMatrixOffset(),
m_instancingBuffer->GetPositionOffset(),
m_instancingBuffer->GetStride());

/* Because the geometry instancing use setting for all instances we use the original alpha blend.
* This requierd that the user use "alpha blend" mode if he will mutate object color alpha.
*/
rasty->SetAlphaBlend(material->GetAlphaBlend());
}
else {
material->ActivateInstancing(
Expand All @@ -393,6 +388,11 @@ void RAS_DisplayArrayBucket::RunInstancingNode(const RAS_RenderNodeArguments& ar
m_instancingBuffer->GetStride());
}

/* Because the geometry instancing use setting for all instances we use the original alpha blend.
* This requierd that the user use "alpha blend" mode if he will mutate object color alpha.
*/
rasty->SetAlphaBlend(material->GetAlphaBlend());

/* It's a major issue of the geometry instancing : we can't manage face wise.
* To be sure we don't use the old face wise we force it to true. */
rasty->SetFrontFace(true);
Expand Down Expand Up @@ -453,12 +453,10 @@ void RAS_DisplayArrayBucket::RunBatchingNode(const RAS_RenderNodeArguments& args
RAS_IRasterizer *rasty = args.m_rasty;
RAS_IPolyMaterial *material = m_bucket->GetPolyMaterial();

if (args.m_shaderOverride) {
/* Because the batching use setting for all instances we use the original alpha blend.
* This requierd that the user use "alpha blend" mode if he will mutate object color alpha.
*/
rasty->SetAlphaBlend(material->GetAlphaBlend());
}
/* Because the batching use setting for all instances we use the original alpha blend.
* This requierd that the user use "alpha blend" mode if he will mutate object color alpha.
*/
rasty->SetAlphaBlend(material->GetAlphaBlend());

/* It's a major issue of the batching : we can't manage face wise per object.
* To be sure we don't use the old face wise we force it to true. */
Expand Down

0 comments on commit 09f88ce

Please sign in to comment.