beyond_the_board

Square Distance Check - Shader

Oct 29th, 2024
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | Software | 0 0
  1.     float3 halfDimensions = dimensions * 0.5;
  2.    
  3.     bool insideX = abs(center.x - cubeCenter.x) <= halfDimensions.x;
  4.     bool insideY = abs(center.y - cubeCenter.y) <= halfDimensions.y;
  5.     bool insideZ = abs(center.z - cubeCenter.z) <= halfDimensions.z;
  6.  
  7.    bool flag = insideX && insideY && insideZ;
  8.  
  9. result= flag ? 1 : 0
Advertisement
Add Comment
Please, Sign In to add comment