void LevelInfo::unpackUpdate(NetConnection *conn, BitStream *stream) { Parent::unpackUpdate(conn, stream); stream->read( &mNearClip ); stream->read( &mVisibleDistance ); stream->read( &mDecalBias ); stream->read( &mFogData.density ); stream->read( &mFogData.densityOffset ); stream->read( &mFogData.atmosphereHeight ); stream->read( &mFogData.color ); stream->read( &mCanvasClearColor ); stream->read( &mWorldSize ); mAdvancedLightmapSupport = stream->readFlag(); stream->read( &mAmbientLightBlendPhase ); mathRead( *stream, &mAmbientLightBlendCurve ); String errorStr; if( !sfxReadAndResolve( stream, &mSoundAmbience, errorStr ) ) Con::errorf( "%s", errorStr.c_str() ); mSoundDistanceModel = ( SFXDistanceModel ) stream->readInt( 1 ); if( isProperlyAdded() ) { _updateSceneGraph(); if( mSoundscape ) { if( mSoundAmbience ) mSoundscape->setAmbience( mSoundAmbience ); else mSoundscape->setAmbience( &sDefaultAmbience ); } SFX->setDistanceModel( mSoundDistanceModel ); } stream->read(&mAccuTextureName); setLevelAccuTexture(mAccuTextureName); }
void WaterObject::unpackUpdate( NetConnection * conn, BitStream *stream ) { Parent::unpackUpdate( conn, stream ); // UpdateMask if ( stream->readFlag() ) { stream->read( &mDensity ); stream->read( &mViscosity ); stream->read( &mLiquidType ); if ( stream->readFlag() ) { mFullReflect = true; stream->read( &mReflectorDesc.priority ); mReflectorDesc.maxRateMs = stream->readInt( 32 ); //stream->read( &mReflectMaxDist ); //stream->read( &mReflectMinDist ); stream->read( &mReflectorDesc.detailAdjust ); mReflectNormalUp = stream->readFlag(); mReflectorDesc.useOcclusionQuery = stream->readFlag(); mReflectorDesc.texSize = stream->readInt( 32 ); if ( isProperlyAdded() && !mPlaneReflector.isEnabled() && !smDisableTrueReflections ) mPlaneReflector.registerReflector( this, &mReflectorDesc ); } else { mFullReflect = false; if ( isProperlyAdded() && mPlaneReflector.isEnabled() ) mPlaneReflector.unregisterReflector(); } stream->read( &mReflectivity ); stream->read( &mWaterFogData.density ); stream->read( &mWaterFogData.densityOffset ); stream->read( &mWaterFogData.wetDepth ); stream->read( &mWaterFogData.wetDarkening ); stream->read( &mDistortStartDist ); stream->read( &mDistortEndDist ); stream->read( &mDistortFullDepth ); stream->read( &mDepthGradientMax ); mEmissive = stream->readFlag(); stream->read( &mFoamMaxDepth ); stream->read( &mFoamAmbientLerp ); stream->read( &mFoamRippleInfluence ); stream->read( &mWaterFogData.color ); stream->read( &mFresnelBias ); stream->read( &mFresnelPower ); Point4F specularData; mathRead( *stream, &specularData ); mSpecularColor.set( specularData.x, specularData.y, specularData.z, 1.0f ); mSpecularPower = specularData.w; stream->read( &mClarity ); stream->read( &mUnderwaterColor ); stream->read( &mOverallRippleMagnitude ); stream->read( &mOverallWaveMagnitude ); stream->read( &mOverallFoamOpacity ); } // WaveMask if ( stream->readFlag() ) { for( U32 i=0; i<MAX_WAVES; i++ ) { stream->read( &mRippleSpeed[i] ); mathRead( *stream, &mRippleDir[i] ); mathRead( *stream, &mRippleTexScale[i] ); stream->read( &mRippleMagnitude[i] ); stream->read( &mWaveSpeed[i] ); mathRead( *stream, &mWaveDir[i] ); stream->read( &mWaveMagnitude[i] ); } for ( U32 i = 0; i < MAX_FOAM; i++ ) { stream->read( &mFoamSpeed[i] ); mathRead( *stream, &mFoamDir[i] ); mathRead( *stream, &mFoamTexScale[i] ); stream->read( &mFoamOpacity[i] ); } } // MaterialMask if ( stream->readFlag() ) { for ( U32 i = 0; i < NumMatTypes; i++ ) stream->read( &mSurfMatName[i] ); if ( isProperlyAdded() ) { // So they will be reloaded on next use. cleanupMaterials(); } } // TextureMask if ( stream->readFlag() ) { stream->read( &mRippleTexName ); stream->read( &mDepthGradientTexName ); stream->read( &mFoamTexName ); stream->read( &mCubemapName ); if ( isProperlyAdded() ) initTextures(); } // Sound environment. if( stream->readFlag() ) { String errorStr; if( !sfxReadAndResolve( stream, &mSoundAmbience, errorStr ) ) Con::errorf( "WaterObject::unpackUpdate - pad packet: %s", errorStr.c_str() ); if( isProperlyAdded() && gSFX3DWorld ) gSFX3DWorld->notifyChanged( this ); } }
void SFXEmitter::unpackUpdate( NetConnection *conn, BitStream *stream ) { Parent::unpackUpdate( conn, stream ); // initial update? bool initialUpdate = stream->readFlag(); mPlayOnAdd = stream->readFlag(); // transform if ( _readDirtyFlag( stream, Transform ) ) { MatrixF mat; stream->readAffineTransform(&mat); Parent::setTransform(mat); } // track if ( _readDirtyFlag( stream, Track ) ) { String errorStr; if( !sfxReadAndResolve( stream, &mTrack, errorStr ) ) Con::errorf( "%s", errorStr.c_str() ); } // filename if ( _readDirtyFlag( stream, Filename ) ) mLocalProfile.mFilename = stream->readSTString(); // volume if ( _readDirtyFlag( stream, Volume ) ) stream->read( &mDescription.mVolume ); // pitch if( _readDirtyFlag( stream, Pitch ) ) stream->read( &mDescription.mPitch ); // islooping if ( _readDirtyFlag( stream, IsLooping ) ) mDescription.mIsLooping = stream->readFlag(); if( _readDirtyFlag( stream, IsStreaming ) ) mDescription.mIsStreaming = stream->readFlag(); // is3d if ( _readDirtyFlag( stream, Is3D ) ) mDescription.mIs3D = stream->readFlag(); // mindistance if ( _readDirtyFlag( stream, MinDistance ) ) stream->read( &mDescription.mMinDistance ); // maxdistance if ( _readDirtyFlag( stream, MaxDistance ) ) { stream->read( &mDescription.mMaxDistance ); mObjScale.set( mDescription.mMaxDistance, mDescription.mMaxDistance, mDescription.mMaxDistance ); } // coneinsideangle if ( _readDirtyFlag( stream, ConeInsideAngle ) ) stream->read( &mDescription.mConeInsideAngle ); // coneoutsideangle if ( _readDirtyFlag( stream, ConeOutsideAngle ) ) stream->read( &mDescription.mConeOutsideAngle ); // coneoutsidevolume if ( _readDirtyFlag( stream, ConeOutsideVolume ) ) stream->read( &mDescription.mConeOutsideVolume ); // sourcegroup if ( _readDirtyFlag( stream, SourceGroup ) ) { String errorStr; if( !sfxReadAndResolve( stream, &mDescription.mSourceGroup, errorStr ) ) Con::errorf( "%s", errorStr.c_str() ); } // fadein if ( _readDirtyFlag( stream, FadeInTime ) ) stream->read( &mDescription.mFadeInTime ); // fadeout if( _readDirtyFlag( stream, FadeOutTime ) ) stream->read( &mDescription.mFadeOutTime ); // scatterdistance if( _readDirtyFlag( stream, ScatterDistance ) ) mathRead( *stream, &mDescription.mScatterDistance ); mUseTrackDescriptionOnly = stream->readFlag(); // update the emitter now? if ( !initialUpdate ) _update(); // Check the source playback masks. if ( stream->readFlag() ) // SourcePlayMask play(); if ( stream->readFlag() ) // SourceStopMask stop(); }