From e45b959d7d5b056719538ecc1fa845bcfc837729 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Wed, 3 Nov 2021 12:30:52 -0500 Subject: [PATCH] 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 --- Engine/source/T3D/assets/ImageAsset.h | 15 +++++++++--- Engine/source/T3D/fx/splash.cpp | 2 +- Engine/source/T3D/fx/splash.h | 2 +- Engine/source/environment/basicClouds.cpp | 3 +++ Engine/source/environment/basicClouds.h | 4 ++-- Engine/source/gfx/sim/cubemapData.cpp | 2 +- Engine/source/gfx/sim/cubemapData.h | 2 +- Engine/source/gui/controls/guiPopUpCtrl.cpp | 4 ++-- Engine/source/gui/controls/guiPopUpCtrl.h | 2 +- Engine/source/gui/controls/guiPopUpCtrlEx.cpp | 4 ++-- Engine/source/gui/controls/guiPopUpCtrlEx.h | 2 +- .../source/materials/materialDefinition.cpp | 24 +++++++++---------- Engine/source/materials/materialDefinition.h | 24 +++++++++---------- Engine/source/postFx/postEffect.cpp | 22 ++++++++++------- Engine/source/postFx/postEffect.h | 2 +- 15 files changed, 66 insertions(+), 48 deletions(-) diff --git a/Engine/source/T3D/assets/ImageAsset.h b/Engine/source/T3D/assets/ImageAsset.h index d4de538f7..f53cb4fa0 100644 --- a/Engine/source/T3D/assets/ImageAsset.h +++ b/Engine/source/T3D/assets/ImageAsset.h @@ -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 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")\ {\ diff --git a/Engine/source/T3D/fx/splash.cpp b/Engine/source/T3D/fx/splash.cpp index 3ae7e54b4..7cc835c93 100644 --- a/Engine/source/T3D/fx/splash.cpp +++ b/Engine/source/T3D/fx/splash.cpp @@ -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