MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / clampRangeClamp

Function clampRangeClamp

Engine/source/T3D/gameBase/moveManager.cpp:172–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172static inline S32 clampRangeClamp(F32 val)
173{
174 if(val < -1)
175 return 0;
176 if(val > 1)
177 return 32;
178
179 // 0.5 / 16 = 0.03125 ... this forces a round up to
180 // make the precision near zero equal in the negative
181 // and positive directions. See...
182 //
183 // http://www.garagegames.com/community/forums/viewthread/49714
184
185 return (S32)((val + 1.03125) * 16);
186}
187
188
189#define FANG2IANG(x) ((U32)((S16)((F32(0x10000) / M_2PI) * x)) & 0xFFFF)

Callers 1

clampMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected