MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / convertFromFloat

Function convertFromFloat

examples/Heightfield/HeightfieldExample.cpp:205–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203
204
205static void
206convertFromFloat
207(
208 byte_t * p,
209 btScalar value,
210 PHY_ScalarType type
211)
212{
213 btAssert(p && "null");
214
215 switch (type) {
216 case PHY_FLOAT:
217 {
218 btScalar * pf = (btScalar *)p;
219 *pf = value;
220 }
221 break;
222
223 case PHY_UCHAR:
224 {
225 unsigned char * pu = (unsigned char *)p;
226 *pu = (unsigned char)(value / s_gridHeightScale);
227 }
228 break;
229
230 case PHY_SHORT:
231 {
232 short * ps = (short *)p;
233 *ps = (short)(value / s_gridHeightScale);
234 }
235 break;
236
237 default:
238 btAssert(!"bad type");
239 }
240}
241
242
243

Callers 4

setRadialFunction · 0.85
updateHeightFunction · 0.85
setFractalFunction · 0.85
getRawHeightfieldDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected