fireball/lib/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl

30 lines
537 B
Plaintext
Raw Normal View History

2018-12-25 13:59:22 +00:00
#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#pragma unroll_loop
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
if ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;
}
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
bool clipped = true;
#pragma unroll_loop
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
clipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;
}
if ( clipped ) discard;
#endif
#endif