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

Function convertToFloat

examples/Heightfield/HeightfieldExample.cpp:142–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140
141
142static btScalar
143convertToFloat
144(
145 const byte_t * p,
146 PHY_ScalarType type
147)
148{
149 btAssert(p);
150
151 switch (type) {
152 case PHY_FLOAT:
153 {
154 btScalar * pf = (btScalar *)p;
155 return *pf;
156 }
157
158 case PHY_UCHAR:
159 {
160 unsigned char * pu = (unsigned char *)p;
161 return ((*pu) * s_gridHeightScale);
162 }
163
164 case PHY_SHORT:
165 {
166 short * ps = (short *)p;
167 return ((*ps) * s_gridHeightScale);
168 }
169
170 default:
171 btAssert(!"bad type");
172 }
173
174 return 0;
175}
176
177
178

Callers 4

getGridHeightFunction · 0.85
dumpGridFunction · 0.85
updateHeightFunction · 0.85
setFractalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected