mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-23 00:23:46 +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
File diff suppressed because it is too large
Load diff
|
|
@ -23,22 +23,22 @@
|
|||
#define _MATERIALDEFINITION_H_
|
||||
|
||||
#ifndef _BASEMATERIALDEFINITION_H_
|
||||
#include "materials/baseMaterialDefinition.h"
|
||||
#include "materials/baseMaterialDefinition.h"
|
||||
#endif
|
||||
#ifndef _TDICTIONARY_H_
|
||||
#include "core/util/tDictionary.h"
|
||||
#include "core/util/tDictionary.h"
|
||||
#endif
|
||||
#ifndef _GFXTEXTUREHANDLE_H_
|
||||
#include "gfx/gfxTextureHandle.h"
|
||||
#include "gfx/gfxTextureHandle.h"
|
||||
#endif
|
||||
#ifndef _GFXSTRUCTS_H_
|
||||
#include "gfx/gfxStructs.h"
|
||||
#include "gfx/gfxStructs.h"
|
||||
#endif
|
||||
#ifndef _GFXCUBEMAP_H_
|
||||
#include "gfx/gfxCubemap.h"
|
||||
#include "gfx/gfxCubemap.h"
|
||||
#endif
|
||||
#ifndef _DYNAMIC_CONSOLETYPES_H_
|
||||
#include "console/dynamicTypes.h"
|
||||
#include "console/dynamicTypes.h"
|
||||
#endif
|
||||
|
||||
#ifndef IMAGE_ASSET_H
|
||||
|
|
@ -61,7 +61,7 @@ class Material : public BaseMaterialDefinition
|
|||
{
|
||||
typedef BaseMaterialDefinition Parent;
|
||||
public:
|
||||
static GFXCubemap *GetNormalizeCube();
|
||||
static GFXCubemap* GetNormalizeCube();
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Enums
|
||||
|
|
@ -113,8 +113,8 @@ public:
|
|||
{
|
||||
Scroll = 1,
|
||||
Rotate = 2,
|
||||
Wave = 4,
|
||||
Scale = 8,
|
||||
Wave = 4,
|
||||
Scale = 8,
|
||||
Sequence = 16,
|
||||
};
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ public:
|
|||
protected:
|
||||
|
||||
///
|
||||
typedef HashTable<const FeatureType*,GFXTexHandle> TextureTable;
|
||||
typedef HashTable<const FeatureType*, GFXTexHandle> TextureTable;
|
||||
|
||||
/// The sparse table of textures by feature index.
|
||||
/// @see getTex
|
||||
|
|
@ -138,39 +138,39 @@ public:
|
|||
TextureTable mTextures;
|
||||
|
||||
/// The cubemap for this stage.
|
||||
GFXCubemap *mCubemap;
|
||||
GFXCubemap* mCubemap;
|
||||
|
||||
public:
|
||||
|
||||
StageData()
|
||||
: mCubemap( NULL )
|
||||
: mCubemap(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
/// Returns the texture object or NULL if there is no
|
||||
/// texture entry for that feature type in the table.
|
||||
inline GFXTextureObject* getTex( const FeatureType &type ) const
|
||||
inline GFXTextureObject* getTex(const FeatureType& type) const
|
||||
{
|
||||
TextureTable::ConstIterator iter = mTextures.find( &type );
|
||||
if ( iter == mTextures.end() )
|
||||
TextureTable::ConstIterator iter = mTextures.find(&type);
|
||||
if (iter == mTextures.end())
|
||||
return NULL;
|
||||
|
||||
return iter->value.getPointer();
|
||||
}
|
||||
|
||||
/// Assigns a texture object by feature type.
|
||||
inline void setTex( const FeatureType &type, GFXTextureObject *tex )
|
||||
inline void setTex(const FeatureType& type, GFXTextureObject* tex)
|
||||
{
|
||||
if ( !tex )
|
||||
if (!tex)
|
||||
{
|
||||
TextureTable::Iterator iter = mTextures.find( &type );
|
||||
if ( iter != mTextures.end() )
|
||||
mTextures.erase( iter );
|
||||
TextureTable::Iterator iter = mTextures.find(&type);
|
||||
if (iter != mTextures.end())
|
||||
mTextures.erase(iter);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
TextureTable::Iterator iter = mTextures.findOrInsert( &type );
|
||||
TextureTable::Iterator iter = mTextures.findOrInsert(&type);
|
||||
iter->value = tex;
|
||||
}
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ public:
|
|||
TextureTable::ConstIterator iter = mTextures.begin();
|
||||
for (; iter != mTextures.end(); ++iter)
|
||||
{
|
||||
if ( iter->value.isValid() )
|
||||
if (iter->value.isValid())
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -189,13 +189,13 @@ public:
|
|||
}
|
||||
|
||||
/// Returns the active texture features.
|
||||
void getFeatureSet( FeatureSet *outFeatures ) const;
|
||||
void getFeatureSet(FeatureSet* outFeatures) const;
|
||||
|
||||
/// Returns the stage cubemap.
|
||||
GFXCubemap* getCubemap() const { return mCubemap; }
|
||||
|
||||
/// Set the stage cubemap.
|
||||
void setCubemap( GFXCubemap *cubemap ) { mCubemap = cubemap; }
|
||||
void setCubemap(GFXCubemap* cubemap) { mCubemap = cubemap; }
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -204,27 +204,51 @@ public:
|
|||
//-----------------------------------------------------------------------
|
||||
// Data
|
||||
//-----------------------------------------------------------------------
|
||||
DECLARE_TEXTUREARRAY(Material, DiffuseMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DiffuseMap, GFXStaticTextureSRGBProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DiffuseMap);
|
||||
|
||||
bool mDiffuseMapSRGB[MAX_STAGES]; // SRGB diffuse
|
||||
DECLARE_TEXTUREARRAY(Material, OverlayMap, MAX_STAGES);
|
||||
DECLARE_TEXTUREARRAY(Material, LightMap, MAX_STAGES);;
|
||||
DECLARE_TEXTUREARRAY(Material, ToneMap, MAX_STAGES);
|
||||
DECLARE_TEXTUREARRAY(Material, DetailMap, MAX_STAGES);;
|
||||
DECLARE_TEXTUREARRAY(Material, NormalMap, MAX_STAGES);
|
||||
DECLARE_TEXTUREARRAY(Material, ORMConfigMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, OverlayMap, GFXStaticTextureSRGBProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, OverlayMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, LightMap, GFXStaticTextureSRGBProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, LightMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, ToneMap, GFXStaticTextureSRGBProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, ToneMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DetailMap, GFXStaticTextureSRGBProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, NormalMap, GFXStaticTextureSRGBProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, NormalMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, ORMConfigMap, GFXStaticTextureSRGBProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, ORMConfigMap);
|
||||
|
||||
bool mIsSRGb[MAX_STAGES];
|
||||
DECLARE_TEXTUREARRAY(Material, RoughMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, RoughMap, GFXStaticTextureSRGBProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, RoughMap);
|
||||
|
||||
bool mInvertRoughness[MAX_STAGES];
|
||||
F32 mRoughnessChan[MAX_STAGES];
|
||||
DECLARE_TEXTUREARRAY(Material, AOMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, AOMap, GFXStaticTextureSRGBProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, AOMap);
|
||||
|
||||
F32 mAOChan[MAX_STAGES];
|
||||
DECLARE_TEXTUREARRAY(Material, MetalMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, MetalMap, GFXStaticTextureSRGBProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, MetalMap);
|
||||
|
||||
F32 mMetalChan[MAX_STAGES];
|
||||
DECLARE_TEXTUREARRAY(Material, GlowMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, GlowMap, GFXStaticTextureSRGBProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, GlowMap);
|
||||
|
||||
F32 mGlowMul[MAX_STAGES];
|
||||
/// A second normal map which repeats at the detail map
|
||||
/// scale and blended with the base normal map.
|
||||
DECLARE_TEXTUREARRAY(Material, DetailNormalMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DetailNormalMap, GFXStaticTextureSRGBProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailNormalMap);
|
||||
|
||||
/// The strength scalar for the detail normal map.
|
||||
F32 mDetailNormalMapStrength[MAX_STAGES];
|
||||
|
||||
|
|
@ -239,18 +263,18 @@ public:
|
|||
/// or if it has a texture it is multiplied against
|
||||
/// the diffuse texture color.
|
||||
LinearColorF mDiffuse[MAX_STAGES];
|
||||
|
||||
|
||||
F32 mRoughness[MAX_STAGES];
|
||||
F32 mMetalness[MAX_STAGES];
|
||||
|
||||
|
||||
bool mVertLit[MAX_STAGES];
|
||||
|
||||
|
||||
/// If true for a stage, vertex colors are multiplied
|
||||
/// against diffuse colors.
|
||||
bool mVertColor[ MAX_STAGES ];
|
||||
bool mVertColor[MAX_STAGES];
|
||||
|
||||
F32 mParallaxScale[MAX_STAGES];
|
||||
|
||||
F32 mParallaxScale[MAX_STAGES];
|
||||
|
||||
F32 mMinnaertConstant[MAX_STAGES];
|
||||
bool mSubSurface[MAX_STAGES];
|
||||
LinearColorF mSubSurfaceColor[MAX_STAGES];
|
||||
|
|
@ -268,15 +292,15 @@ public:
|
|||
F32 mRotSpeed[MAX_STAGES];
|
||||
Point2F mRotPivotOffset[MAX_STAGES];
|
||||
F32 mRotPos[MAX_STAGES];
|
||||
|
||||
|
||||
F32 mWavePos[MAX_STAGES];
|
||||
F32 mWaveFreq[MAX_STAGES];
|
||||
F32 mWaveAmp[MAX_STAGES];
|
||||
U32 mWaveType[MAX_STAGES];
|
||||
|
||||
|
||||
F32 mSeqFramePerSec[MAX_STAGES];
|
||||
F32 mSeqSegSize[MAX_STAGES];
|
||||
|
||||
|
||||
bool mGlow[MAX_STAGES]; // entire stage glows
|
||||
bool mEmissive[MAX_STAGES];
|
||||
|
||||
|
|
@ -305,7 +329,7 @@ public:
|
|||
|
||||
// Deferred Shading
|
||||
F32 mMatInfoFlags[MAX_STAGES];
|
||||
bool mTranslucent;
|
||||
bool mTranslucent;
|
||||
BlendOp mTranslucentBlendOp;
|
||||
bool mTranslucentZWrite;
|
||||
|
||||
|
|
@ -329,7 +353,7 @@ public:
|
|||
bool mShowDust; ///< If true, show dust emitters (footpuffs, hover trails, etc) when on surface with this material. Defaults to false.
|
||||
|
||||
/// Color to use for particle effects and such when located on this material.
|
||||
LinearColorF mEffectColor[ NUM_EFFECT_COLOR_STAGES ];
|
||||
LinearColorF mEffectColor[NUM_EFFECT_COLOR_STAGES];
|
||||
|
||||
/// Footstep sound to play when walking on surface with this material.
|
||||
/// Numeric ID of footstep sound defined on player datablock (0 == soft,
|
||||
|
|
@ -352,7 +376,7 @@ public:
|
|||
F32 mReverbSoundOcclusion; ///< Amount of volume occlusion on reverb sounds.
|
||||
|
||||
///@}
|
||||
|
||||
|
||||
String mMapTo; // map Material to this texture name
|
||||
|
||||
///
|
||||
|
|
@ -362,7 +386,7 @@ public:
|
|||
|
||||
/// Allocates and returns a BaseMatInstance for this material. Caller is responsible
|
||||
/// for freeing the instance
|
||||
virtual BaseMatInstance* createMatInstance();
|
||||
virtual BaseMatInstance* createMatInstance();
|
||||
virtual bool isTranslucent() const { return mTranslucent && mTranslucentBlendOp != Material::None; }
|
||||
virtual bool isAlphatest() const { return mAlphaTest; }
|
||||
virtual bool isDoubleSided() const { return mDoubleSided; }
|
||||
|
|
@ -370,7 +394,7 @@ public:
|
|||
virtual void setAutoGenerated(bool isAutoGenerated) { mAutoGenerated = isAutoGenerated; }
|
||||
virtual bool isLightmapped() const;
|
||||
virtual bool castsShadows() const { return mCastShadows; }
|
||||
const String &getPath() const { return mPath; }
|
||||
const String& getPath() const { return mPath; }
|
||||
|
||||
void flush();
|
||||
|
||||
|
|
@ -386,7 +410,7 @@ public:
|
|||
virtual bool onAdd();
|
||||
virtual void onRemove();
|
||||
virtual void inspectPostApply();
|
||||
virtual bool writeField( StringTableEntry fieldname, const char *value );
|
||||
virtual bool writeField(StringTableEntry fieldname, const char* value);
|
||||
|
||||
//
|
||||
// ConsoleObject interface
|
||||
|
|
@ -394,7 +418,7 @@ public:
|
|||
static void initPersistFields();
|
||||
|
||||
// Accumulation
|
||||
static bool _setAccuEnabled( void *object, const char *index, const char *data );
|
||||
static bool _setAccuEnabled(void* object, const char* index, const char* data);
|
||||
|
||||
DECLARE_CONOBJECT(Material);
|
||||
protected:
|
||||
|
|
@ -420,8 +444,8 @@ typedef Material::AnimType MaterialAnimType;
|
|||
typedef Material::BlendOp MaterialBlendOp;
|
||||
typedef Material::WaveType MaterialWaveType;
|
||||
|
||||
DefineBitfieldType( MaterialAnimType );
|
||||
DefineEnumType( MaterialBlendOp );
|
||||
DefineEnumType( MaterialWaveType );
|
||||
DefineBitfieldType(MaterialAnimType);
|
||||
DefineEnumType(MaterialBlendOp);
|
||||
DefineEnumType(MaterialWaveType);
|
||||
|
||||
#endif // _MATERIALDEFINITION_H_
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ void MaterialList::mapMaterial( U32 i )
|
|||
newMat->mAutoGenerated = true;
|
||||
|
||||
// Overwrite diffuseMap in new material
|
||||
newMat->mDiffuseMapFilename[0] = texHandle->mTextureLookupName;
|
||||
newMat->mDiffuseMapName[0] = texHandle->mTextureLookupName;
|
||||
|
||||
// Set up some defaults for transparent textures
|
||||
if (texHandle->mHasTransparency)
|
||||
|
|
|
|||
|
|
@ -402,26 +402,27 @@ void ProcessedMaterial::_setStageData()
|
|||
for (i = 0; i < Material::MAX_STAGES; i++)
|
||||
{
|
||||
// DiffuseMap
|
||||
if (mMaterial->mDiffuseMapFilename[i].isNotEmpty())
|
||||
if (mMaterial->mDiffuseMapAsset[i] && !mMaterial->mDiffuseMapAsset[i].isNull())
|
||||
{
|
||||
mStages[i].setTex(MFT_DiffuseMap, _createTexture(mMaterial->mDiffuseMapFilename[i], &GFXStaticTextureSRGBProfile));
|
||||
mStages[i].setTex(MFT_DiffuseMap, mMaterial->getDiffuseMapResource(i));
|
||||
//mStages[i].setTex(MFT_DiffuseMap, _createTexture(mMaterial->getDiffuseMap(i), &GFXStaticTextureSRGBProfile));
|
||||
if (!mStages[i].getTex(MFT_DiffuseMap))
|
||||
{
|
||||
//If we start with a #, we're probably actually attempting to hit a named target and it may not get a hit on the first pass. So we'll
|
||||
//pass on the error rather than spamming the console
|
||||
if (!mMaterial->mDiffuseMapFilename[i].startsWith("#"))
|
||||
mMaterial->logError("Failed to load diffuse map %s for stage %i", _getTexturePath(mMaterial->mDiffuseMapFilename[i]).c_str(), i);
|
||||
|
||||
// Load a debug texture to make it clear to the user
|
||||
// that the texture for this stage was missing.
|
||||
mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile));
|
||||
}
|
||||
}
|
||||
else if (mMaterial->mDiffuseMapAsset[i] && !mMaterial->mDiffuseMapAsset[i].isNull())
|
||||
else if (mMaterial->mDiffuseMapName[i] != StringTable->EmptyString())
|
||||
{
|
||||
mStages[i].setTex(MFT_DiffuseMap, mMaterial->mDiffuseMapAsset[i]->getImage(GFXStaticTextureSRGBProfile));
|
||||
mStages[i].setTex(MFT_DiffuseMap, _createTexture(mMaterial->mDiffuseMapName[i], &GFXStaticTextureSRGBProfile));
|
||||
if (!mStages[i].getTex(MFT_DiffuseMap))
|
||||
{
|
||||
//If we start with a #, we're probably actually attempting to hit a named target and it may not get a hit on the first pass. So we'll
|
||||
//pass on the error rather than spamming the console
|
||||
if (!String(mMaterial->mDiffuseMapName[i]).startsWith("#"))
|
||||
mMaterial->logError("Failed to load diffuse map %s for stage %i", _getTexturePath(mMaterial->mDiffuseMapName[i]).c_str(), i);
|
||||
|
||||
// Load a debug texture to make it clear to the user
|
||||
// that the texture for this stage was missing.
|
||||
mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile));
|
||||
|
|
@ -429,85 +430,86 @@ void ProcessedMaterial::_setStageData()
|
|||
}
|
||||
|
||||
// OverlayMap
|
||||
if (mMaterial->mOverlayMapFilename[i].isNotEmpty())
|
||||
if (mMaterial->getOverlayMap(i) != StringTable->EmptyString())
|
||||
{
|
||||
mStages[i].setTex(MFT_OverlayMap, _createTexture(mMaterial->mOverlayMapFilename[i], &GFXStaticTextureSRGBProfile));
|
||||
mStages[i].setTex(MFT_OverlayMap, mMaterial->getOverlayMapResource(i));
|
||||
if (!mStages[i].getTex(MFT_OverlayMap))
|
||||
mMaterial->logError("Failed to load overlay map %s for stage %i", _getTexturePath(mMaterial->mOverlayMapFilename[i]).c_str(), i);
|
||||
mMaterial->logError("Failed to load overlay map %s for stage %i", mMaterial->getOverlayMap(i), i);
|
||||
}
|
||||
|
||||
// LightMap
|
||||
if (mMaterial->mLightMapFilename[i].isNotEmpty())
|
||||
if (mMaterial->getLightMap(i) != StringTable->EmptyString())
|
||||
{
|
||||
mStages[i].setTex(MFT_LightMap, _createTexture(mMaterial->mLightMapFilename[i], &GFXStaticTextureSRGBProfile));
|
||||
mStages[i].setTex(MFT_LightMap, mMaterial->getLightMapResource(i));
|
||||
if (!mStages[i].getTex(MFT_LightMap))
|
||||
mMaterial->logError("Failed to load light map %s for stage %i", _getTexturePath(mMaterial->mLightMapFilename[i]).c_str(), i);
|
||||
mMaterial->logError("Failed to load light map %s for stage %i", mMaterial->getLightMap(i), i);
|
||||
}
|
||||
|
||||
// ToneMap
|
||||
if (mMaterial->mToneMapFilename[i].isNotEmpty())
|
||||
if (mMaterial->getToneMap(i) != StringTable->EmptyString())
|
||||
{
|
||||
mStages[i].setTex(MFT_ToneMap, _createTexture(mMaterial->mToneMapFilename[i], &GFXStaticTextureProfile));
|
||||
mStages[i].setTex(MFT_ToneMap, mMaterial->getToneMapResource(i));
|
||||
if (!mStages[i].getTex(MFT_ToneMap))
|
||||
mMaterial->logError("Failed to load tone map %s for stage %i", _getTexturePath(mMaterial->mToneMapFilename[i]).c_str(), i);
|
||||
mMaterial->logError("Failed to load tone map %s for stage %i", mMaterial->getToneMap(i), i);
|
||||
}
|
||||
|
||||
// DetailMap
|
||||
if (mMaterial->mDetailMapFilename[i].isNotEmpty())
|
||||
if (mMaterial->getDetailMap(i) != StringTable->EmptyString())
|
||||
{
|
||||
mStages[i].setTex(MFT_DetailMap, _createTexture(mMaterial->mDetailMapFilename[i], &GFXStaticTextureProfile));
|
||||
mStages[i].setTex(MFT_DetailMap, mMaterial->getDetailMapResource(i));
|
||||
if (!mStages[i].getTex(MFT_DetailMap))
|
||||
mMaterial->logError("Failed to load detail map %s for stage %i", _getTexturePath(mMaterial->mDetailMapFilename[i]).c_str(), i);
|
||||
mMaterial->logError("Failed to load detail map %s for stage %i", mMaterial->getDetailMap(i), i);
|
||||
}
|
||||
|
||||
// NormalMap
|
||||
if (mMaterial->mNormalMapFilename[i].isNotEmpty())
|
||||
if (mMaterial->getNormalMap(i) != StringTable->EmptyString())
|
||||
{
|
||||
mStages[i].setTex(MFT_NormalMap, _createTexture(mMaterial->mNormalMapFilename[i], &GFXNormalMapProfile));
|
||||
mStages[i].setTex(MFT_NormalMap, mMaterial->getNormalMapResource(i));
|
||||
if (!mStages[i].getTex(MFT_NormalMap))
|
||||
mMaterial->logError("Failed to load normal map %s for stage %i", _getTexturePath(mMaterial->mNormalMapFilename[i]).c_str(), i);
|
||||
mMaterial->logError("Failed to load normal map %s for stage %i", mMaterial->getNormalMap(i), i);
|
||||
}
|
||||
|
||||
// Detail Normal Map
|
||||
if (mMaterial->mDetailNormalMapFilename[i].isNotEmpty())
|
||||
if (mMaterial->getDetailNormalMap(i) != StringTable->EmptyString())
|
||||
{
|
||||
mStages[i].setTex(MFT_DetailNormalMap, _createTexture(mMaterial->mDetailNormalMapFilename[i], &GFXNormalMapProfile));
|
||||
mStages[i].setTex(MFT_DetailNormalMap, mMaterial->getDetailNormalMapResource(i));
|
||||
if (!mStages[i].getTex(MFT_DetailNormalMap))
|
||||
mMaterial->logError("Failed to load normal map %s for stage %i", _getTexturePath(mMaterial->mDetailNormalMapFilename[i]).c_str(), i);
|
||||
mMaterial->logError("Failed to load normal map %s for stage %i", mMaterial->getDetailNormalMap(i), i);
|
||||
}
|
||||
|
||||
//depending on creation method this may or may not have been shoved into srgb space eroneously
|
||||
GFXTextureProfile* profile = &GFXStaticTextureProfile;
|
||||
if (mMaterial->mIsSRGb[i])
|
||||
profile = &GFXStaticTextureSRGBProfile;
|
||||
|
||||
// ORMConfig
|
||||
if (mMaterial->mORMConfigMapFilename[i].isNotEmpty())
|
||||
if (mMaterial->getORMConfigMap(i) != StringTable->EmptyString())
|
||||
{
|
||||
mStages[i].setTex(MFT_OrmMap, _createTexture(mMaterial->mORMConfigMapFilename[i], profile));
|
||||
mStages[i].setTex(MFT_OrmMap, _createTexture(mMaterial->getORMConfigMap(i), profile));
|
||||
if (!mStages[i].getTex(MFT_OrmMap))
|
||||
mMaterial->logError("Failed to load PBR Config map %s for stage %i", _getTexturePath(mMaterial->mORMConfigMapFilename[i]).c_str(), i);
|
||||
mMaterial->logError("Failed to load PBR Config map %s for stage %i", mMaterial->getORMConfigMap(i), i);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mMaterial->mRoughMapFilename[i].isNotEmpty() && mMaterial->mMetalMapFilename[i].isNotEmpty())
|
||||
if ((mMaterial->getRoughMap(i) != StringTable->EmptyString()) && (mMaterial->getMetalMap(i) != StringTable->EmptyString()))
|
||||
{
|
||||
U32 inputKey[4];
|
||||
inputKey[0] = mMaterial->mAOChan[i];
|
||||
inputKey[1] = mMaterial->mRoughnessChan[i];
|
||||
inputKey[2] = mMaterial->mMetalChan[i];
|
||||
inputKey[3] = 0;
|
||||
mStages[i].setTex(MFT_OrmMap, _createCompositeTexture( mMaterial->mAOMapFilename[i], mMaterial->mRoughMapFilename[i],
|
||||
mMaterial->mMetalMapFilename[i], "",
|
||||
mStages[i].setTex(MFT_OrmMap, _createCompositeTexture( mMaterial->getAOMap(i), mMaterial->getRoughMap(i),
|
||||
mMaterial->getMetalMap(i), "",
|
||||
inputKey, profile));
|
||||
if (!mStages[i].getTex(MFT_OrmMap))
|
||||
mMaterial->logError("Failed to load PBR Config map %s for stage %i", _getTexturePath(mMaterial->mORMConfigMapFilename[i]).c_str(), i);
|
||||
mMaterial->logError("Failed to dynamically create ORM Config map for stage %i", i);
|
||||
}
|
||||
}
|
||||
if (mMaterial->mGlowMapFilename[i].isNotEmpty())
|
||||
if (mMaterial->getGlowMap(i) != StringTable->EmptyString())
|
||||
{
|
||||
mStages[i].setTex(MFT_GlowMap, _createTexture(mMaterial->mGlowMapFilename[i], &GFXStaticTextureProfile));
|
||||
mStages[i].setTex(MFT_GlowMap, mMaterial->getGlowMapResource(i));
|
||||
if (!mStages[i].getTex(MFT_GlowMap))
|
||||
mMaterial->logError("Failed to load glow map %s for stage %i", _getTexturePath(mMaterial->mGlowMapFilename[i]).c_str(), i);
|
||||
mMaterial->logError("Failed to load glow map %s for stage %i", mMaterial->getGlowMap(i), i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -227,9 +227,9 @@ bool ProcessedShaderMaterial::init( const FeatureSet &features,
|
|||
mInstancingState = new InstancingState();
|
||||
mInstancingState->setFormat( _getRPD( 0 )->shader->getInstancingFormat(), mVertexFormat );
|
||||
}
|
||||
if (mMaterial && mMaterial->mDiffuseMapFilename[0].isNotEmpty() && mMaterial->mDiffuseMapFilename[0].substr(0, 1).equal("#"))
|
||||
if (mMaterial && mMaterial->mDiffuseMapName[0] != StringTable->EmptyString() && String(mMaterial->mDiffuseMapName[0]).startsWith("#"))
|
||||
{
|
||||
String texTargetBufferName = mMaterial->mDiffuseMapFilename[0].substr(1, mMaterial->mDiffuseMapFilename[0].length() - 1);
|
||||
String texTargetBufferName = String(mMaterial->mDiffuseMapName[0]).substr(1, strlen(mMaterial->mDiffuseMapName[0]) - 1);
|
||||
NamedTexTarget *texTarget = NamedTexTarget::find(texTargetBufferName);
|
||||
RenderPassData* rpd = getPass(0);
|
||||
|
||||
|
|
|
|||
|
|
@ -55,13 +55,13 @@ protected:
|
|||
|
||||
F32 mPixVersion;
|
||||
|
||||
FileName mDXVertexShaderName;
|
||||
StringTableEntry mDXVertexShaderName;
|
||||
|
||||
FileName mDXPixelShaderName;
|
||||
StringTableEntry mDXPixelShaderName;
|
||||
|
||||
FileName mOGLVertexShaderName;
|
||||
StringTableEntry mOGLVertexShaderName;
|
||||
|
||||
FileName mOGLPixelShaderName;
|
||||
StringTableEntry mOGLPixelShaderName;
|
||||
|
||||
/// A semicolon, tab, or newline delimited string of case
|
||||
/// sensitive defines that are passed to the shader compiler.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue