Created
November 1, 2019 20:54
-
-
Save gamemachine/d24b6fe7e092de05ed1e842f9f9b8357 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ClipBounds(float4 bounds, float2 pos) { | |
float2 min = bounds.xy; | |
float2 max = bounds.zw; | |
float a = step(min.x, pos.x); | |
float b = step(pos.x, max.x); | |
float c = step(min.y, pos.y); | |
float d = step(pos.y, max.y); | |
clip(3.0f - a - b - c - d); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment