Commit cf015c66 authored by Martin Heistermann's avatar Martin Heistermann
Browse files

ClippingNode: perform clipping in world space, not in object space.

This fixes clipping for instanced rendering and other situations with
non-identity model matrices.
parent 05dd27d2
......@@ -205,10 +205,10 @@ void ClippingNode::ClippingShaderModifier::modifyVertexIO(ShaderGenerator* _shad
void ClippingNode::ClippingShaderModifier::modifyVertexBeginCode(QStringList* _code)
void ClippingNode::ClippingShaderModifier::modifyVertexEndCode(QStringList* _code)
for (int i = 0; i < numClipPlanes_; ++i)
_code->push_back(QString("gl_ClipDistance[%1] = dot(SG_INPUT_POSOS, g_SlicePlane%1);").arg(i));
_code->push_back(QString("gl_ClipDistance[%1] = dot(inverse(g_mWV) * sg_vPosVS, g_SlicePlane%1);").arg(i));
......@@ -174,7 +174,7 @@ private:
void modifyVertexIO(ShaderGenerator* _shader);
void modifyVertexBeginCode(QStringList* _code);
void modifyVertexEndCode(QStringList* _code);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment