Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
float4 _planePos;
float4 _planeNorm;
#if (CLIP_TWO || CLIP_THREE)
float4 _planePos2;
float4 _planeNorm2;
#endif
#if (CLIP_THREE)
float4 _planePos3;
float4 _planeNorm3;
#endif
void PlaneClip(float3 posWorld) {
#if CLIP_THREE
clip(float3(
distanceToPlane(_planePos.xyz, _planeNorm.xyz, posWorld),
distanceToPlane(_planePos2.xyz, _planeNorm2.xyz, posWorld),
distanceToPlane(_planePos3.xyz, _planeNorm3.xyz, posWorld)
));
#else //CLIP_THREE
#if CLIP_TWO
clip(float2(
distanceToPlane(_planePos.xyz, _planeNorm.xyz, posWorld),
distanceToPlane(_planePos2.xyz, _planeNorm2.xyz, posWorld)
));
#else //CLIP_TWO
clip(distanceToPlane(_planePos.xyz, _planeNorm.xyz, posWorld));
#endif //CLIP_TWO
#endif //CLIP_THREE
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment