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

Method unpackData

Engine/source/T3D/fx/particle.cpp:323–404  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Unpack data -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

321// Unpack data
322//-----------------------------------------------------------------------------
323void ParticleData::unpackData(BitStream* stream)
324{
325 Parent::unpackData(stream);
326
327 dragCoefficient = stream->readFloat(10) * 5;
328 if(stream->readFlag())
329 stream->read(&windCoefficient);
330 else
331 windCoefficient = sgDefaultWindCoefficient;
332 if (stream->readFlag())
333 gravityCoefficient = stream->readSignedFloat(12)*10;
334 else
335 gravityCoefficient = 0.0f;
336 inheritedVelFactor = stream->readFloat(9);
337 if(stream->readFlag())
338 stream->read(&constantAcceleration);
339 else
340 constantAcceleration = sgDefaultConstantAcceleration;
341
342 stream->read( &lifetimeMS );
343 stream->read( &lifetimeVarianceMS );
344
345 if(stream->readFlag())
346 stream->read(&spinSpeed);
347 else
348 spinSpeed = sgDefaultSpinSpeed;
349
350 if(stream->readFlag())
351 {
352 spinRandomMin = (F32)(stream->readInt(11) - 1000);
353 spinRandomMax = (F32)(stream->readInt(11) - 1000);
354 }
355 else
356 {
357 spinRandomMin = sgDefaultSpinRandomMin;
358 spinRandomMax = sgDefaultSpinRandomMax;
359 }
360
361 if(stream->readFlag())
362 stream->read(&spinBias);
363 else
364 spinBias = sgDefaultSpinBias;
365 randomizeSpinDir = stream->readFlag();
366 useInvAlpha = stream->readFlag();
367
368 S32 i;
369 // An extra bit is needed for 8 keys.
370 S32 count = stream->readInt(3) + 1;
371 for(i = 0;i < count; i++)
372 {
373 colors[i].red = stream->readFloat(7);
374 colors[i].green = stream->readFloat(7);
375 colors[i].blue = stream->readFloat(7);
376 colors[i].alpha = stream->readFloat(7);
377 // AFX bits raised from 14 to 16 to allow larger sizes
378 sizes[i] = stream->readFloat(16) * MaxParticleSize;
379 times[i] = stream->readFloat(8);
380 }

Callers

nothing calls this directly

Calls 7

mathReadFunction · 0.85
readFloatMethod · 0.80
readFlagMethod · 0.80
readSignedFloatMethod · 0.80
readIntMethod · 0.80
readMethod · 0.45
readSTStringMethod · 0.45

Tested by

no test coverage detected