MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / packData

Method packData

Engine/source/T3D/item.cpp:182–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182void ItemData::packData(BitStream* stream)
183{
184 Parent::packData(stream);
185 stream->writeFloat(friction, 10);
186 stream->writeFloat(elasticity, 10);
187 stream->writeFlag(sticky);
188 if(stream->writeFlag(gravityMod != 1.0))
189 stream->writeFloat(gravityMod, 10);
190 if(stream->writeFlag(maxVelocity != -1))
191 stream->write(maxVelocity);
192
193 if(stream->writeFlag(lightType != Item::NoLight))
194 {
195 AssertFatal(Item::NumLightTypes < (1 << 2), "ItemData: light type needs more bits");
196 stream->writeInt(lightType, 2);
197 stream->writeFloat(lightColor.red, 7);
198 stream->writeFloat(lightColor.green, 7);
199 stream->writeFloat(lightColor.blue, 7);
200 stream->writeFloat(lightColor.alpha, 7);
201 stream->write(lightTime);
202 stream->write(lightRadius);
203 stream->writeFlag(lightOnlyStatic);
204 }
205
206 stream->writeFlag(simpleServerCollision);
207}
208
209void ItemData::unpackData(BitStream* stream)
210{

Callers

nothing calls this directly

Calls 4

writeFloatMethod · 0.80
writeIntMethod · 0.80
writeFlagMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected