Skip to content

Instantly share code, notes, and snippets.

@otanodesignco
Created November 10, 2024 23:55
Show Gist options
  • Save otanodesignco/640c777e40f13e15bd45f44fecb8d3db to your computer and use it in GitHub Desktop.
Save otanodesignco/640c777e40f13e15bd45f44fecb8d3db to your computer and use it in GitHub Desktop.
void clip( float clipValue, float alphaThreshold, int type )
{
// switch operation because were only value checking type
switch( type )
{
case 0: // 0 means less than
if( clipValue < alphaThreshold ) discard;
break;
case 1: // 1 means greater than
if( clipValue > alphaThreshold ) discard;
break;
case 2: // less than equal to
if( clipValue <= alphaThreshold ) discard;
break;
case 3: // greater than equal 2
if( clipValue >= alphaThreshold ) discard;
break;
case 4: // equal to
if( clipValue == alphaThreshold ) discard;
break;
default: // defaults to less than
if( clipValue < alphaThreshold ) discard;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment