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:
Areloch 2021-07-19 01:07:08 -05:00
parent 83b0432283
commit 5525f8ecdd
1708 changed files with 19619 additions and 4596 deletions

View file

@ -73,11 +73,11 @@ TerrainMaterial::TerrainMaterial()
mIsSRGB(false),
mInvertRoughness(false)
{
initMapSlot(DiffuseMap);
initMapSlot(NormalMap);
initMapSlot(DetailMap);
initMapSlot(ORMConfigMap);
initMapSlot(MacroMap);
INIT_IMAGEASSET(DiffuseMap);
INIT_IMAGEASSET(NormalMap);
INIT_IMAGEASSET(DetailMap);
INIT_IMAGEASSET(ORMConfigMap);
INIT_IMAGEASSET(MacroMap);
}
TerrainMaterial::~TerrainMaterial()
@ -86,10 +86,10 @@ TerrainMaterial::~TerrainMaterial()
void TerrainMaterial::initPersistFields()
{
scriptBindMapSlot(DiffuseMap, TerrainMaterial,"Base Albedo stretched over the whole map");
INITPERSISTFIELD_IMAGEASSET(DiffuseMap, TerrainMaterial,"Base Albedo stretched over the whole map");
addField( "diffuseSize", TypeF32, Offset( mDiffuseSize, TerrainMaterial ), "Used to scale the diffuse map to the material square" );
scriptBindMapSlot(NormalMap, TerrainMaterial,"NormalMap");
INITPERSISTFIELD_IMAGEASSET(NormalMap, TerrainMaterial,"NormalMap");
addField( "parallaxScale", TypeF32, Offset( mParallaxScale, TerrainMaterial ), "Used to scale the height from the normal map to give some self "
"occlusion effect (aka parallax) to the terrain material" );
@ -99,7 +99,7 @@ void TerrainMaterial::initPersistFields()
addField("blendHeightContrast", TypeF32, Offset(mBlendContrast, TerrainMaterial), "A fixed value to add while blending using heightmap-based blending."
"Higher numbers = larger blend radius.");
scriptBindMapSlot(DetailMap, TerrainMaterial, "Raises and lowers the RGB result of the Base Albedo up close.");
INITPERSISTFIELD_IMAGEASSET(DetailMap, TerrainMaterial, "Raises and lowers the RGB result of the Base Albedo up close.");
addField( "detailSize", TypeF32, Offset( mDetailSize, TerrainMaterial ), "Used to scale the detail map to the material square" );
addField( "detailStrength", TypeF32, Offset( mDetailStrength, TerrainMaterial ), "Exponentially sharpens or lightens the detail map rendering on the material" );
addField( "detailDistance", TypeF32, Offset( mDetailDistance, TerrainMaterial ), "Changes how far camera can see the detail map rendering on the material" );
@ -107,12 +107,12 @@ void TerrainMaterial::initPersistFields()
addField( "useSideProjection", TypeBool, Offset( mSideProjection, TerrainMaterial ),"Makes that terrain material project along the sides of steep "
"slopes instead of projected downwards");
scriptBindMapSlot(ORMConfigMap, TerrainMaterial, "AO|Roughness|metalness map (uses DetailMap UV Coords)");
INITPERSISTFIELD_IMAGEASSET(ORMConfigMap, TerrainMaterial, "AO|Roughness|metalness map (uses DetailMap UV Coords)");
addField("isSRGB", TypeBool, Offset(mIsSRGB, TerrainMaterial), "Is the PBR Config map's image in sRGB format?");
addField("invertRoughness", TypeBool, Offset(mInvertRoughness, TerrainMaterial), "Should the roughness channel of the PBR Config map be inverted?");
//Macro maps additions
scriptBindMapSlot(MacroMap, TerrainMaterial, "Raises and lowers the RGB result of the Base Albedo at a distance.");
INITPERSISTFIELD_IMAGEASSET(MacroMap, TerrainMaterial, "Raises and lowers the RGB result of the Base Albedo at a distance.");
addField( "macroSize", TypeF32, Offset( mMacroSize, TerrainMaterial ), "Used to scale the Macro map to the material square" );
addField( "macroStrength", TypeF32, Offset( mMacroStrength, TerrainMaterial ), "Exponentially sharpens or lightens the Macro map rendering on the material" );
addField( "macroDistance", TypeF32, Offset( mMacroDistance, TerrainMaterial ), "Changes how far camera can see the Macro map rendering on the material" );
@ -140,13 +140,6 @@ bool TerrainMaterial::onAdd()
Con::warnf( "TerrainMaterial::onAdd() - Internal name collision; '%s' already exists!", mInternalName );
}
//bind any assets we have
bindMapSlot(DiffuseMap);
bindMapSlot(NormalMap);
bindMapSlot(DetailMap);
bindMapSlot(ORMConfigMap);
bindMapSlot(MacroMap);
set->addObject( this );
return true;
@ -175,7 +168,7 @@ TerrainMaterial* TerrainMaterial::findOrCreate( const char *nameOrPath )
{
mat = new TerrainMaterial();
mat->setInternalName( nameOrPath );
mat->mDiffuseMapFilename = nameOrPath;
mat->mDiffuseMapName = nameOrPath;
mat->registerObject();
Sim::getRootGroup()->addObject( mat );
return mat;
@ -190,12 +183,12 @@ TerrainMaterial* TerrainMaterial::findOrCreate( const char *nameOrPath )
// fallback here just in case it gets "lost".
mat = new TerrainMaterial();
mat->setInternalName( "warning_material" );
mat->mDiffuseMapFilename = GFXTextureManager::getWarningTexturePath();
mat->mDiffuseMapName = GFXTextureManager::getWarningTexturePath();
mat->mDiffuseSize = 500;
mat->mDetailMapFilename = GFXTextureManager::getWarningTexturePath();
mat->mDiffuseMapName = GFXTextureManager::getWarningTexturePath();
mat->mDetailSize = 5;
mat->mMacroMapFilename = GFXTextureManager::getWarningTexturePath();
mat->mMacroSize = 200;
mat->mDiffuseMapName = GFXTextureManager::getWarningTexturePath();
mat->mMacroSize = 200;
mat->registerObject();
Sim::getRootGroup()->addObject( mat );
@ -203,3 +196,15 @@ TerrainMaterial* TerrainMaterial::findOrCreate( const char *nameOrPath )
return mat;
}
//declare general get<entry>, get<entry>Asset and set<entry> methods
//signatures are:
//using DiffuseMap as an example
//material.getDiffuseMap(); //returns the raw file referenced
//material.getDiffuseMapAsset(); //returns the asset id
//material.setDiffuseMap(%texture); //tries to set the asset and failing that attempts a flat file reference
DEF_IMAGEASSET_BINDS(TerrainMaterial, DiffuseMap);
DEF_IMAGEASSET_BINDS(TerrainMaterial, NormalMap);
DEF_IMAGEASSET_BINDS(TerrainMaterial, DetailMap);
DEF_IMAGEASSET_BINDS(TerrainMaterial, ORMConfigMap);
DEF_IMAGEASSET_BINDS(TerrainMaterial, MacroMap);