Skip to content

Instantly share code, notes, and snippets.

@PopupAsylum
Created September 23, 2016 13:50
Show Gist options
  • Save PopupAsylum/35cf8da25de007b271be00a3b0a8d643 to your computer and use it in GitHub Desktop.
Save PopupAsylum/35cf8da25de007b271be00a3b0a8d643 to your computer and use it in GitHub Desktop.
float3 GetAxis(float3 input) {
input = normalize(input) ;
float3 signs = sign(input) ;
float3 abss = abs(input) ;
float maxs = max(abss.x, max(abss.y, abbs.z));
return floor(abss/maxs) * signs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment