mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
level-wide accumulation assignment - overidden if an object's origin is in an accumulationVolume.
** do note changing the value does require nudging a mesh and/or a level reload to kick in at time of writing for visual feedback.
This commit is contained in:
parent
5122360552
commit
2b57bed899
3 changed files with 47 additions and 4 deletions
|
|
@ -46,6 +46,8 @@
|
||||||
Vector< SimObjectPtr<SceneObject> > AccumulationVolume::smAccuObjects;
|
Vector< SimObjectPtr<SceneObject> > AccumulationVolume::smAccuObjects;
|
||||||
Vector< SimObjectPtr<AccumulationVolume> > AccumulationVolume::smAccuVolumes;
|
Vector< SimObjectPtr<AccumulationVolume> > AccumulationVolume::smAccuVolumes;
|
||||||
|
|
||||||
|
GFXTexHandle gLevelAccuMap;
|
||||||
|
|
||||||
//#define DEBUG_DRAW
|
//#define DEBUG_DRAW
|
||||||
|
|
||||||
IMPLEMENT_CO_NETOBJECT_V1( AccumulationVolume );
|
IMPLEMENT_CO_NETOBJECT_V1( AccumulationVolume );
|
||||||
|
|
@ -295,7 +297,7 @@ void AccumulationVolume::refreshVolumes()
|
||||||
{
|
{
|
||||||
SimObjectPtr<SceneObject> object = smAccuObjects[n];
|
SimObjectPtr<SceneObject> object = smAccuObjects[n];
|
||||||
if ( object.isValid() )
|
if ( object.isValid() )
|
||||||
object->mAccuTex = GFXTexHandle::ZERO;
|
object->mAccuTex = gLevelAccuMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -336,7 +338,7 @@ void AccumulationVolume::updateObject(SceneObject* object)
|
||||||
|
|
||||||
// We use ZERO instead of NULL so the accumulation
|
// We use ZERO instead of NULL so the accumulation
|
||||||
// texture will be updated in renderMeshMgr.
|
// texture will be updated in renderMeshMgr.
|
||||||
object->mAccuTex = GFXTexHandle::ZERO;
|
object->mAccuTex = gLevelAccuMap;
|
||||||
|
|
||||||
for (S32 i = 0; i < smAccuVolumes.size(); ++i)
|
for (S32 i = 0; i < smAccuVolumes.size(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,8 @@ extern ColorI gCanvasClearColor;
|
||||||
/// @see DecalManager
|
/// @see DecalManager
|
||||||
extern F32 gDecalBias;
|
extern F32 gDecalBias;
|
||||||
|
|
||||||
|
/// @see AccumulationVolume
|
||||||
|
extern GFXTexHandle gLevelAccuMap;
|
||||||
|
|
||||||
/// Default SFXAmbience used to reset the global soundscape.
|
/// Default SFXAmbience used to reset the global soundscape.
|
||||||
static SFXAmbience sDefaultAmbience;
|
static SFXAmbience sDefaultAmbience;
|
||||||
|
|
@ -96,6 +98,8 @@ LevelInfo::LevelInfo()
|
||||||
mNetFlags.set( ScopeAlways | Ghostable );
|
mNetFlags.set( ScopeAlways | Ghostable );
|
||||||
|
|
||||||
mAdvancedLightmapSupport = false;
|
mAdvancedLightmapSupport = false;
|
||||||
|
mAccuTextureName = "";
|
||||||
|
mAccuTexture = NULL;
|
||||||
|
|
||||||
// Register with the light manager activation signal, and we need to do it first
|
// Register with the light manager activation signal, and we need to do it first
|
||||||
// so the advanced light bin manager can be instructed about MRT lightmaps
|
// so the advanced light bin manager can be instructed about MRT lightmaps
|
||||||
|
|
@ -157,6 +161,9 @@ void LevelInfo::initPersistFields()
|
||||||
addField( "advancedLightmapSupport", TypeBool, Offset( mAdvancedLightmapSupport, LevelInfo ),
|
addField( "advancedLightmapSupport", TypeBool, Offset( mAdvancedLightmapSupport, LevelInfo ),
|
||||||
"Enable expanded support for mixing static and dynamic lighting (more costly)" );
|
"Enable expanded support for mixing static and dynamic lighting (more costly)" );
|
||||||
|
|
||||||
|
addProtectedField("AccuTexture", TypeStringFilename, Offset(mAccuTextureName, LevelInfo),
|
||||||
|
&_setLevelAccuTexture, &defaultProtectedGetFn, "Accumulation texture.");
|
||||||
|
|
||||||
endGroup( "Lighting" );
|
endGroup( "Lighting" );
|
||||||
|
|
||||||
addGroup( "Sound" );
|
addGroup( "Sound" );
|
||||||
|
|
@ -203,7 +210,8 @@ U32 LevelInfo::packUpdate(NetConnection *conn, U32 mask, BitStream *stream)
|
||||||
|
|
||||||
sfxWrite( stream, mSoundAmbience );
|
sfxWrite( stream, mSoundAmbience );
|
||||||
stream->writeInt( mSoundDistanceModel, 1 );
|
stream->writeInt( mSoundDistanceModel, 1 );
|
||||||
|
|
||||||
|
stream->write(mAccuTextureName);
|
||||||
return retMask;
|
return retMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,6 +256,8 @@ void LevelInfo::unpackUpdate(NetConnection *conn, BitStream *stream)
|
||||||
|
|
||||||
SFX->setDistanceModel( mSoundDistanceModel );
|
SFX->setDistanceModel( mSoundDistanceModel );
|
||||||
}
|
}
|
||||||
|
stream->read(&mAccuTextureName);
|
||||||
|
setLevelAccuTexture(mAccuTextureName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -341,4 +351,25 @@ void LevelInfo::_onLMActivate(const char *lm, bool enable)
|
||||||
lightMgr->getLightBinManager()->MRTLightmapsDuringPrePass(mAdvancedLightmapSupport);
|
lightMgr->getLightBinManager()->MRTLightmapsDuringPrePass(mAdvancedLightmapSupport);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LevelInfo::_setLevelAccuTexture(void *object, const char *index, const char *data)
|
||||||
|
{
|
||||||
|
LevelInfo* volume = reinterpret_cast< LevelInfo* >(object);
|
||||||
|
volume->setLevelAccuTexture(data);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LevelInfo::setLevelAccuTexture(const String& name)
|
||||||
|
{
|
||||||
|
mAccuTextureName = name;
|
||||||
|
if (isClientObject() && mAccuTextureName.isNotEmpty())
|
||||||
|
{
|
||||||
|
mAccuTexture.set(mAccuTextureName, &GFXDefaultStaticDiffuseProfile, "AccumulationVolume::mAccuTexture");
|
||||||
|
if (mAccuTexture.isNull())
|
||||||
|
Con::warnf("AccumulationVolume::setTexture - Unable to load texture: %s", mAccuTextureName.c_str());
|
||||||
|
else
|
||||||
|
gLevelAccuMap = mAccuTexture;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -36,6 +36,10 @@
|
||||||
#include "sfx/sfxCommon.h"
|
#include "sfx/sfxCommon.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _GFXTEXTUREHANDLE_H_
|
||||||
|
#include "gfx/gfxTextureHandle.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class SFXAmbience;
|
class SFXAmbience;
|
||||||
class SFXSoundscape;
|
class SFXSoundscape;
|
||||||
|
|
||||||
|
|
@ -96,6 +100,9 @@ class LevelInfo : public NetObject
|
||||||
void _updateSceneGraph();
|
void _updateSceneGraph();
|
||||||
|
|
||||||
void _onLMActivate(const char *lm, bool enable);
|
void _onLMActivate(const char *lm, bool enable);
|
||||||
|
protected:
|
||||||
|
// Name (path) of the accumulation texture.
|
||||||
|
String mAccuTextureName;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -130,9 +137,12 @@ class LevelInfo : public NetObject
|
||||||
UpdateMask = BIT(0)
|
UpdateMask = BIT(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GFXTexHandle mAccuTexture;
|
||||||
|
|
||||||
virtual U32 packUpdate( NetConnection *conn, U32 mask, BitStream *stream );
|
virtual U32 packUpdate( NetConnection *conn, U32 mask, BitStream *stream );
|
||||||
virtual void unpackUpdate( NetConnection *conn, BitStream *stream );
|
virtual void unpackUpdate( NetConnection *conn, BitStream *stream );
|
||||||
|
static bool _setLevelAccuTexture(void *object, const char *index, const char *data);
|
||||||
|
void setLevelAccuTexture(const String& name);
|
||||||
/// @}
|
/// @}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue