mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
Converts all game, gui editor, and system classes to utilize assets
Processed core, tools and default modules to utilize assets Converted all console types that were string based, such as TypeImageFilename to utilize const char*/the string table, which avoids a lot of type swapping shenanigans and avoids string corruption Removed unneeded MainEditor mockup module Removed some unused/duplicate image assets from the tools
This commit is contained in:
parent
83b0432283
commit
5525f8ecdd
1708 changed files with 19619 additions and 4596 deletions
|
|
@ -277,8 +277,6 @@ DecalRoad::DecalRoad()
|
|||
mTextureLength( 5.0f ),
|
||||
mRenderPriority( 10 ),
|
||||
mLoadRenderData( true ),
|
||||
mMaterial( NULL ),
|
||||
mMatInst( NULL ),
|
||||
mTriangleCount(0),
|
||||
mVertCount(0),
|
||||
mUpdateEventId( -1 ),
|
||||
|
|
@ -289,7 +287,9 @@ DecalRoad::DecalRoad()
|
|||
mTypeMask |= StaticObjectType | StaticShapeObjectType;
|
||||
mNetFlags.set(Ghostable);
|
||||
|
||||
initMaterialAsset(Material);
|
||||
INIT_MATERIALASSET(Material);
|
||||
|
||||
mMaterialInst = nullptr;
|
||||
}
|
||||
|
||||
DecalRoad::~DecalRoad()
|
||||
|
|
@ -305,8 +305,7 @@ void DecalRoad::initPersistFields()
|
|||
{
|
||||
addGroup( "DecalRoad" );
|
||||
|
||||
addProtectedField("materialAsset", TypeMaterialAssetId, Offset(mMaterialAssetId, DecalRoad), &DecalRoad::_setMaterialAsset, &defaultProtectedGetFn, "Material Asset used for rendering.");
|
||||
addProtectedField( "material", TypeMaterialName, Offset( mMaterialName, DecalRoad ), &DecalRoad::_setMaterialName, &defaultProtectedGetFn, "Material used for rendering." );
|
||||
INITPERSISTFIELD_MATERIALASSET(Material, DecalRoad, "Material used for rendering.");
|
||||
|
||||
addProtectedField( "textureLength", TypeF32, Offset( mTextureLength, DecalRoad ), &DecalRoad::ptSetTextureLength, &defaultProtectedGetFn,
|
||||
"The length in meters of textures mapped to the DecalRoad" );
|
||||
|
|
@ -398,7 +397,7 @@ bool DecalRoad::onAdd()
|
|||
|
||||
void DecalRoad::onRemove()
|
||||
{
|
||||
SAFE_DELETE( mMatInst );
|
||||
SAFE_DELETE( mMaterialInst );
|
||||
|
||||
TerrainBlock::smUpdateSignal.remove( this, &DecalRoad::_onTerrainChanged );
|
||||
|
||||
|
|
@ -492,7 +491,7 @@ U32 DecalRoad::packUpdate(NetConnection * con, U32 mask, BitStream * stream)
|
|||
if ( stream->writeFlag( mask & DecalRoadMask ) )
|
||||
{
|
||||
// Write Texture Name.
|
||||
packMaterialAsset(con, Material);
|
||||
PACK_MATERIALASSET(con, Material);
|
||||
|
||||
stream->write( mBreakAngle );
|
||||
|
||||
|
|
@ -581,7 +580,7 @@ void DecalRoad::unpackUpdate( NetConnection *con, BitStream *stream )
|
|||
// DecalRoadMask
|
||||
if ( stream->readFlag() )
|
||||
{
|
||||
unpackMaterialAsset(con, Material);
|
||||
UNPACK_MATERIALASSET(con, Material);
|
||||
|
||||
if (isProperlyAdded())
|
||||
_initMaterial();
|
||||
|
|
@ -685,13 +684,13 @@ void DecalRoad::prepRenderImage( SceneRenderState* state )
|
|||
|
||||
if ( mNodes.size() <= 1 ||
|
||||
mBatches.size() == 0 ||
|
||||
!mMatInst ||
|
||||
!mMaterialInst ||
|
||||
state->isShadowPass() )
|
||||
return;
|
||||
|
||||
// If we don't have a material instance after the override then
|
||||
// we can skip rendering all together.
|
||||
BaseMatInstance *matInst = state->getOverrideMaterial( mMatInst );
|
||||
BaseMatInstance *matInst = state->getOverrideMaterial(mMaterialInst);
|
||||
if ( !matInst )
|
||||
return;
|
||||
|
||||
|
|
@ -1045,12 +1044,14 @@ bool DecalRoad::addNodeFromField( void *object, const char *index, const char *d
|
|||
|
||||
void DecalRoad::_initMaterial()
|
||||
{
|
||||
_setMaterial(getMaterial());
|
||||
|
||||
if (mMaterialAsset.notNull())
|
||||
{
|
||||
if (mMatInst && String(mMaterialAsset->getMaterialDefinitionName()).equal(mMatInst->getMaterial()->getName(), String::NoCase))
|
||||
if (mMaterialInst && String(mMaterialAsset->getMaterialDefinitionName()).equal(mMaterialInst->getMaterial()->getName(), String::NoCase))
|
||||
return;
|
||||
|
||||
SAFE_DELETE(mMatInst);
|
||||
SAFE_DELETE(mMaterialInst);
|
||||
|
||||
Material* tMat = nullptr;
|
||||
|
||||
|
|
@ -1060,22 +1061,22 @@ void DecalRoad::_initMaterial()
|
|||
mMaterial = tMat;
|
||||
|
||||
if (mMaterial)
|
||||
mMatInst = mMaterial->createMatInstance();
|
||||
mMaterialInst = mMaterial->createMatInstance();
|
||||
else
|
||||
mMatInst = MATMGR->createMatInstance("WarningMaterial");
|
||||
mMaterialInst = MATMGR->createMatInstance("WarningMaterial");
|
||||
|
||||
if (!mMatInst)
|
||||
if (!mMaterialInst)
|
||||
Con::errorf("DecalRoad::_initMaterial - no Material called '%s'", mMaterialAsset->getMaterialDefinitionName());
|
||||
}
|
||||
|
||||
if (!mMatInst)
|
||||
if (!mMaterialInst)
|
||||
return;
|
||||
|
||||
GFXStateBlockDesc desc;
|
||||
desc.setZReadWrite( true, false );
|
||||
mMatInst->addStateBlockDesc( desc );
|
||||
mMaterialInst->addStateBlockDesc( desc );
|
||||
|
||||
mMatInst->init( MATMGR->getDefaultFeatures(), getGFXVertexFormat<GFXVertexPNTBT>() );
|
||||
mMaterialInst->init( MATMGR->getDefaultFeatures(), getGFXVertexFormat<GFXVertexPNTBT>() );
|
||||
}
|
||||
|
||||
void DecalRoad::_debugRender( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance* )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue