mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-02 12:03:51 +00:00
correct imageassetarrays having a singular texture profile as oposed to a type per.
while that certainly works for most cases it falls apart when dealing with postfx where it's an unnamed array of variable types of inputs. shifted the profile assignment to #define INIT_IMAGEASSET_ARRAY(name, profile, index) so there's still a really obvious point where you can see the default setting, even if it's not in the more desireable OG definition spot for postfx in particular, given we can swap that, provided an example of how to do just that
This commit is contained in:
parent
a0e0e1f220
commit
e45b959d7d
15 changed files with 66 additions and 48 deletions
|
|
@ -304,13 +304,13 @@ if (m##name##AssetId != StringTable->EmptyString())\
|
|||
#pragma region Arrayed Asset Macros
|
||||
|
||||
//Arrayed Assets
|
||||
#define DECLARE_IMAGEASSET_ARRAY(className, name, profile, max) public: \
|
||||
#define DECLARE_IMAGEASSET_ARRAY(className, name, max) public: \
|
||||
static const U32 sm##name##Count = max;\
|
||||
GFXTexHandle m##name[max];\
|
||||
StringTableEntry m##name##Name[max]; \
|
||||
StringTableEntry m##name##AssetId[max];\
|
||||
AssetPtr<ImageAsset> m##name##Asset[max];\
|
||||
GFXTextureProfile * m##name##Profile = &profile;\
|
||||
GFXTextureProfile * m##name##Profile[max];\
|
||||
public: \
|
||||
const StringTableEntry get##name##File(const U32& index) const { return m##name##Name[index]; }\
|
||||
void set##name##File(const FileName &_in, const U32& index) { m##name##Name[index] = StringTable->insert(_in.c_str());}\
|
||||
|
|
@ -374,7 +374,7 @@ public: \
|
|||
}\
|
||||
if (get##name(index) != StringTable->EmptyString() && m##name##Name[index] != StringTable->insert("texhandle"))\
|
||||
{\
|
||||
m##name[index].set(get##name(index), m##name##Profile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__));\
|
||||
m##name[index].set(get##name(index), m##name##Profile[index], avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__));\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
|
|
@ -445,6 +445,15 @@ public: \
|
|||
return ret;\
|
||||
}
|
||||
|
||||
#define INIT_IMAGEASSET_ARRAY(name, profile, index) \
|
||||
{\
|
||||
m##name##Name[index] = StringTable->EmptyString(); \
|
||||
m##name##AssetId[index] = StringTable->EmptyString(); \
|
||||
m##name##Asset[index] = NULL;\
|
||||
m##name[index] = NULL;\
|
||||
m##name##Profile[index] = &profile;\
|
||||
}
|
||||
|
||||
#define DEF_IMAGEASSET_ARRAY_BINDS(className,name)\
|
||||
DefineEngineMethod(className, get##name, const char*, (S32 index), , "get name")\
|
||||
{\
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ SplashData::SplashData()
|
|||
U32 i;
|
||||
for (i = 0; i < NUM_TEX; i++)
|
||||
{
|
||||
INIT_ASSET_ARRAY(Texture, i);
|
||||
INIT_IMAGEASSET_ARRAY(Texture, GFXStaticTextureSRGBProfile, i);
|
||||
}
|
||||
|
||||
for( i=0; i<NUM_TIME_KEYS; i++ )
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ public:
|
|||
F32 times[ NUM_TIME_KEYS ];
|
||||
LinearColorF colors[ NUM_TIME_KEYS ];
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(SplashData, Texture, GFXStaticTextureSRGBProfile, NUM_TEX);
|
||||
DECLARE_IMAGEASSET_ARRAY(SplashData, Texture, NUM_TEX);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(SplashData, Texture)
|
||||
|
||||
ExplosionData* explosion;
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@ BasicClouds::BasicClouds()
|
|||
mTexOffset[0].set( 0.5f, 0.5f );
|
||||
mTexOffset[1].set( 0.5f, 0.5f );
|
||||
mTexOffset[2].set( 0.5f, 0.5f );
|
||||
|
||||
for (U32 i=0; i< TEX_COUNT;i++)
|
||||
INIT_IMAGEASSET_ARRAY(Texture, GFXStaticTextureSRGBProfile, i);
|
||||
}
|
||||
|
||||
IMPLEMENT_CO_NETOBJECT_V1( BasicClouds );
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ protected:
|
|||
static U32 smVertCount;
|
||||
static U32 smTriangleCount;
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(BasicClouds, Texture, GFXStaticTextureSRGBProfile, TEX_COUNT);
|
||||
DECLARE_IMAGEASSET_ARRAY(BasicClouds, Texture, TEX_COUNT);
|
||||
DECLARE_IMAGEASSET_ARRAY_NET_SETGET(BasicClouds, Texture, -1);
|
||||
|
||||
GFXStateBlockRef mStateblock;
|
||||
|
|
@ -122,4 +122,4 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
#endif // _BASICCLOUDS_H_
|
||||
#endif // _BASICCLOUDS_H_
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ CubemapData::CubemapData()
|
|||
|
||||
for (U32 i = 0; i < 6; i++)
|
||||
{
|
||||
INIT_ASSET_ARRAY(CubeMapFace, i);
|
||||
INIT_IMAGEASSET_ARRAY(CubeMapFace, GFXStaticTextureSRGBProfile, i);
|
||||
}
|
||||
|
||||
INIT_ASSET(CubeMap);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ protected:
|
|||
DECLARE_IMAGEASSET(CubemapData, CubeMap, onCubemapChanged, GFXStaticTextureSRGBProfile);
|
||||
DECLARE_ASSET_SETGET(CubemapData, CubeMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(CubemapData, CubeMapFace, GFXStaticTextureSRGBProfile, 6);
|
||||
DECLARE_IMAGEASSET_ARRAY(CubemapData, CubeMapFace, 6);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(CubemapData, CubeMapFace);
|
||||
|
||||
GFXTexHandle mDepthBuff;
|
||||
|
|
|
|||
|
|
@ -278,8 +278,8 @@ GuiPopUpMenuCtrl::GuiPopUpMenuCtrl(void)
|
|||
mBackgroundCancel = false; // Added
|
||||
mReverseTextList = false; // Added - Don't reverse text list if displaying up
|
||||
|
||||
INIT_ASSET_ARRAY(Bitmap, 0);
|
||||
INIT_ASSET_ARRAY(Bitmap, 1);
|
||||
INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, 0);
|
||||
INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, 1);
|
||||
|
||||
mBitmapBounds.set(16, 16); // Added
|
||||
mIdMax = -1;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ protected:
|
|||
NumBitmapModes = 2
|
||||
};
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrl, Bitmap, GFXDefaultGUIProfile, NumBitmapModes);
|
||||
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrl, Bitmap, NumBitmapModes);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(GuiPopUpMenuCtrl, Bitmap);
|
||||
|
||||
Point2I mBitmapBounds; // Added
|
||||
|
|
|
|||
|
|
@ -329,8 +329,8 @@ GuiPopUpMenuCtrlEx::GuiPopUpMenuCtrlEx(void)
|
|||
mBackgroundCancel = false; // Added
|
||||
mReverseTextList = false; // Added - Don't reverse text list if displaying up
|
||||
|
||||
INIT_ASSET_ARRAY(Bitmap, Normal);
|
||||
INIT_ASSET_ARRAY(Bitmap, Depressed);
|
||||
INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, Normal);
|
||||
INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, Depressed);
|
||||
|
||||
mBitmapBounds.set(16, 16); // Added
|
||||
mHotTrackItems = false;
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class GuiPopUpMenuCtrlEx : public GuiTextCtrl
|
|||
NumBitmapModes = 2
|
||||
};
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrlEx, Bitmap, GFXDefaultGUIProfile, NumBitmapModes);
|
||||
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrlEx, Bitmap, NumBitmapModes);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(GuiPopUpMenuCtrlEx, Bitmap);
|
||||
|
||||
Point2I mBitmapBounds; // Added
|
||||
|
|
|
|||
|
|
@ -142,18 +142,18 @@ Material::Material()
|
|||
mAccuCoverage[i] = 0.9f;
|
||||
mAccuSpecular[i] = 16.0f;
|
||||
|
||||
INIT_ASSET_ARRAY(DiffuseMap, i);
|
||||
INIT_ASSET_ARRAY(OverlayMap, i);
|
||||
INIT_ASSET_ARRAY(LightMap, i);
|
||||
INIT_ASSET_ARRAY(ToneMap, i);
|
||||
INIT_ASSET_ARRAY(DetailMap, i);
|
||||
INIT_ASSET_ARRAY(NormalMap, i);
|
||||
INIT_ASSET_ARRAY(ORMConfigMap, i);
|
||||
INIT_ASSET_ARRAY(RoughMap, i);
|
||||
INIT_ASSET_ARRAY(AOMap, i);
|
||||
INIT_ASSET_ARRAY(MetalMap, i);
|
||||
INIT_ASSET_ARRAY(GlowMap, i);
|
||||
INIT_ASSET_ARRAY(DetailNormalMap, i);
|
||||
INIT_IMAGEASSET_ARRAY(DiffuseMap, GFXStaticTextureSRGBProfile, i);
|
||||
INIT_IMAGEASSET_ARRAY(OverlayMap, GFXStaticTextureProfile, i);
|
||||
INIT_IMAGEASSET_ARRAY(LightMap, GFXStaticTextureProfile, i);
|
||||
INIT_IMAGEASSET_ARRAY(ToneMap, GFXStaticTextureProfile, i);
|
||||
INIT_IMAGEASSET_ARRAY(DetailMap, GFXStaticTextureProfile, i);
|
||||
INIT_IMAGEASSET_ARRAY(NormalMap, GFXNormalMapProfile, i);
|
||||
INIT_IMAGEASSET_ARRAY(ORMConfigMap, GFXStaticTextureProfile, i);
|
||||
INIT_IMAGEASSET_ARRAY(RoughMap, GFXStaticTextureProfile, i);
|
||||
INIT_IMAGEASSET_ARRAY(AOMap, GFXStaticTextureProfile, i);
|
||||
INIT_IMAGEASSET_ARRAY(MetalMap, GFXStaticTextureProfile, i);
|
||||
INIT_IMAGEASSET_ARRAY(GlowMap, GFXStaticTextureProfile, i);
|
||||
INIT_IMAGEASSET_ARRAY(DetailNormalMap, GFXNormalMapProfile, i);
|
||||
|
||||
mParallaxScale[i] = 0.0f;
|
||||
|
||||
|
|
|
|||
|
|
@ -207,49 +207,49 @@ public:
|
|||
//-----------------------------------------------------------------------
|
||||
// Data
|
||||
//-----------------------------------------------------------------------
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DiffuseMap, GFXStaticTextureSRGBProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DiffuseMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DiffuseMap);
|
||||
|
||||
bool mDiffuseMapSRGB[MAX_STAGES]; // SRGB diffuse
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, OverlayMap, GFXStaticTextureProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, OverlayMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, OverlayMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, LightMap, GFXStaticTextureProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, LightMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, LightMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, ToneMap, GFXStaticTextureProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, ToneMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, ToneMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DetailMap, GFXStaticTextureProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DetailMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, NormalMap, GFXNormalMapProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, NormalMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, NormalMap);
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, ORMConfigMap, GFXStaticTextureProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, ORMConfigMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, ORMConfigMap);
|
||||
|
||||
bool mIsSRGb[MAX_STAGES];
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, RoughMap, GFXStaticTextureProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, RoughMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, RoughMap);
|
||||
|
||||
bool mInvertRoughness[MAX_STAGES];
|
||||
F32 mRoughnessChan[MAX_STAGES];
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, AOMap, GFXStaticTextureProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, AOMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, AOMap);
|
||||
|
||||
F32 mAOChan[MAX_STAGES];
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, MetalMap, GFXStaticTextureProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, MetalMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, MetalMap);
|
||||
|
||||
F32 mMetalChan[MAX_STAGES];
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, GlowMap, GFXStaticTextureProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, GlowMap, 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_IMAGEASSET_ARRAY(Material, DetailNormalMap, GFXNormalMapProfile, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY(Material, DetailNormalMap, MAX_STAGES);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailNormalMap);
|
||||
|
||||
/// The strength scalar for the detail normal map.
|
||||
|
|
|
|||
|
|
@ -508,7 +508,7 @@ PostEffect::PostEffect()
|
|||
|
||||
for (U32 i = 0; i < NumTextures; i++)
|
||||
{
|
||||
INIT_ASSET_ARRAY(Texture, i);
|
||||
INIT_IMAGEASSET_ARRAY(Texture, PostFxTextureProfile, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -602,9 +602,19 @@ bool PostEffect::onAdd()
|
|||
scriptPath.setExtension( String::EmptyString );
|
||||
|
||||
// Find additional textures
|
||||
for( S32 i = 0; i < NumTextures; i++ )
|
||||
for (S32 i = 0; i < NumTextures; i++)
|
||||
{
|
||||
mTextureType[i] = NormalTextureType;
|
||||
String texFilename = getTexture(i);
|
||||
|
||||
// Skip empty stages or ones with variable or target names.
|
||||
if (texFilename.isEmpty() ||
|
||||
texFilename[0] == '$' ||
|
||||
texFilename[0] == '#')
|
||||
continue;
|
||||
|
||||
mTextureProfile[i] = (mTexSRGB[i]) ? &PostFxTextureSRGBProfile : &PostFxTextureProfile;
|
||||
_setTexture(texFilename, i);
|
||||
}
|
||||
|
||||
// Is the target a named target?
|
||||
|
|
@ -1625,12 +1635,8 @@ void PostEffect::setTexture( U32 index, const String &texFilePath )
|
|||
texFilePath[0] == '#' )
|
||||
return;
|
||||
|
||||
GFXTextureProfile* profile = &PostFxTextureProfile;
|
||||
if (mTexSRGB[index])
|
||||
profile = &PostFxTextureSRGBProfile;
|
||||
|
||||
// Try to load the texture.
|
||||
mTexture[index].set( texFilePath, profile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) );
|
||||
mTextureProfile[index] = (mTexSRGB[index])? &PostFxTextureSRGBProfile : &PostFxTextureProfile;
|
||||
_setTexture(texFilePath, index);
|
||||
|
||||
mTextureType[index] = NormalTextureType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(PostEffect, Texture, PostFxTextureProfile, NumTextures);
|
||||
DECLARE_IMAGEASSET_ARRAY(PostEffect, Texture, NumTextures);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(PostEffect, Texture);
|
||||
|
||||
bool mTexSRGB[NumTextures];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue