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

Method unpackUpdate

Engine/source/environment/VolumetricFog.cpp:594–688  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592}
593
594void VolumetricFog::unpackUpdate(NetConnection *con, BitStream *stream)
595{
596 Parent::unpackUpdate(con, stream);
597 MatrixF mat;
598 VectorF scale;
599 VectorF mOldScale = getScale();
600 StringTableEntry oldTextureName = mTextureAssetId;
601 StringTableEntry oldShapeAsset = mShapeAssetId;
602 StringTableEntry oldShape = mShapeName;
603
604 if (stream->readFlag())// Fog color
605 stream->read(&mFogColor);
606 if (stream->readFlag())// Fog Density
607 {
608 stream->read(&mFogDensity);
609 if (isTicking())
610 {
611 char buf[20];
612 dSprintf(buf, sizeof(buf), "%3.7f", mFogDensity);
613 Con::setVariable("$VolumetricFog::density", buf);
614 }
615 }
616 if (stream->readFlag())// Fog Modulation
617 {
618 UNPACK_ASSET(con, Texture);
619 stream->read(&mTexTiles);
620 mTexTiles = mFabs(mTexTiles);
621 stream->read(&mStrength);
622 mathRead(*stream, &mSpeed);
623 mSpeed1.set(mSpeed.x, mSpeed.y);
624 mSpeed2.set(mSpeed.z, mSpeed.w);
625
626 if (isProperlyAdded())
627 {
628 if (oldTextureName != mTextureAssetId)
629 InitTexture();
630 if (oldTextureName != StringTable->EmptyString() && mTextureAssetId == StringTable->EmptyString())
631 {
632 mIsTextured = false;
633 mTexture.free();
634 }
635 }
636 }
637 if (stream->readFlag())//Fog PostFX
638 {
639 mUseGlow = stream->readFlag();
640 stream->read(&mGlowStrength);
641 mModifLightRays = stream->readFlag();
642 stream->read(&mLightRayMod);
643 if (isTicking())
644 {
645 char glowStrBuf[20];
646 dSprintf(glowStrBuf, sizeof(glowStrBuf), "%3.7f", mGlowStrength);
647 Con::setVariable("$VolFogGlowPostFx::glowStrength", glowStrBuf);
648 if (mUseGlow && !glowFX->isEnabled())
649 glowFX->enable();
650 if (!mUseGlow && glowFX->isEnabled())
651 glowFX->disable();

Callers

nothing calls this directly

Calls 15

dSprintfFunction · 0.85
setVariableFunction · 0.85
mFabsFunction · 0.85
mathReadFunction · 0.85
getMaxFunction · 0.85
readFlagMethod · 0.80
EmptyStringMethod · 0.80
getExtentsMethod · 0.80
readMethod · 0.45
setMethod · 0.45
freeMethod · 0.45

Tested by

no test coverage detected