mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
fully working
This commit is contained in:
parent
85463c85ac
commit
f6dc694bd4
10 changed files with 88 additions and 75 deletions
|
|
@ -111,7 +111,7 @@ ConsoleSetType(TypeImageAssetId)
|
||||||
ImplementEnumType(ImageAssetType,
|
ImplementEnumType(ImageAssetType,
|
||||||
"Type of mesh data available in a shape.\n"
|
"Type of mesh data available in a shape.\n"
|
||||||
"@ingroup gameObjects")
|
"@ingroup gameObjects")
|
||||||
{ ImageAsset::Albedo, "Albedo", "" },
|
{ ImageAsset::Albedo, "Albedo", "" },
|
||||||
{ ImageAsset::Normal, "Normal", "" },
|
{ ImageAsset::Normal, "Normal", "" },
|
||||||
{ ImageAsset::ORMConfig, "ORMConfig", "" },
|
{ ImageAsset::ORMConfig, "ORMConfig", "" },
|
||||||
{ ImageAsset::GUI, "GUI", "" },
|
{ ImageAsset::GUI, "GUI", "" },
|
||||||
|
|
@ -121,8 +121,7 @@ ImplementEnumType(ImageAssetType,
|
||||||
{ ImageAsset::Glow, "Glow", "" },
|
{ ImageAsset::Glow, "Glow", "" },
|
||||||
{ ImageAsset::Particle, "Particle", "" },
|
{ ImageAsset::Particle, "Particle", "" },
|
||||||
{ ImageAsset::Decal, "Decal", "" },
|
{ ImageAsset::Decal, "Decal", "" },
|
||||||
{ ImageAsset::Cubemap, "Cubemap", "" },
|
{ ImageAsset::Cubemap, "Cubemap", "" },
|
||||||
{ ImageAsset::Target, "Target", "" },
|
|
||||||
|
|
||||||
EndImplementEnumType;
|
EndImplementEnumType;
|
||||||
|
|
||||||
|
|
@ -278,7 +277,7 @@ U32 ImageAsset::load()
|
||||||
// this is a target.
|
// this is a target.
|
||||||
if (mImageFileName[0] == '$' || mImageFileName[0] == '#')
|
if (mImageFileName[0] == '$' || mImageFileName[0] == '#')
|
||||||
{
|
{
|
||||||
NamedTexTarget* namedTarget = NamedTexTarget::find(mImageFileName + 1);
|
NamedTexTargetRef namedTarget = NamedTexTarget::find(mImageFileName + 1);
|
||||||
if (namedTarget) {
|
if (namedTarget) {
|
||||||
mLoadedState = Ok;
|
mLoadedState = Ok;
|
||||||
mIsValidImage = true;
|
mIsValidImage = true;
|
||||||
|
|
@ -289,7 +288,6 @@ U32 ImageAsset::load()
|
||||||
Con::errorf("ImageAsset::initializeAsset: Attempted find named target %s failed.", mImageFileName);
|
Con::errorf("ImageAsset::initializeAsset: Attempted find named target %s failed.", mImageFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Torque::FS::IsFile(mImagePath))
|
if (!Torque::FS::IsFile(mImagePath))
|
||||||
{
|
{
|
||||||
Con::errorf("ImageAsset::initializeAsset: Attempted to load file %s but it was not valid!", mImageFileName);
|
Con::errorf("ImageAsset::initializeAsset: Attempted to load file %s but it was not valid!", mImageFileName);
|
||||||
|
|
@ -364,6 +362,7 @@ void ImageAsset::setImageFileName(const char* pScriptFile)
|
||||||
|
|
||||||
GFXTexHandle ImageAsset::getTexture(GFXTextureProfile* requestedProfile)
|
GFXTexHandle ImageAsset::getTexture(GFXTextureProfile* requestedProfile)
|
||||||
{
|
{
|
||||||
|
load();
|
||||||
if (mResourceMap.contains(requestedProfile))
|
if (mResourceMap.contains(requestedProfile))
|
||||||
{
|
{
|
||||||
mLoadedState = Ok;
|
mLoadedState = Ok;
|
||||||
|
|
@ -371,21 +370,41 @@ GFXTexHandle ImageAsset::getTexture(GFXTextureProfile* requestedProfile)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//If we don't have an existing map case to the requested format, we'll just create it and insert it in
|
// this is a target.
|
||||||
GFXTexHandle newTex = TEXMGR->createTexture(mImagePath, requestedProfile);
|
if (mImageFileName[0] == '$' || mImageFileName[0] == '#')
|
||||||
if (newTex)
|
|
||||||
{
|
{
|
||||||
mResourceMap.insert(requestedProfile, newTex);
|
|
||||||
mLoadedState = Ok;
|
mLoadedState = Ok;
|
||||||
return newTex;
|
NamedTexTargetRef namedTarget = NamedTexTarget::find(mImageFileName + 1);
|
||||||
|
if (namedTarget.isValid() && namedTarget->getTexture())
|
||||||
|
{
|
||||||
|
if (mNamedTarget == NULL) {
|
||||||
|
mNamedTarget = namedTarget;
|
||||||
|
mResourceMap.insert(requestedProfile, mNamedTarget->getTexture());
|
||||||
|
mIsValidImage = true;
|
||||||
|
mChangeSignal.trigger();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mNamedTarget == NULL)
|
||||||
|
return nullptr;
|
||||||
|
else
|
||||||
|
return mNamedTarget->getTexture();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mLoadedState = BadFileReference;
|
{
|
||||||
|
//If we don't have an existing map case to the requested format, we'll just create it and insert it in
|
||||||
|
GFXTexHandle newTex = TEXMGR->createTexture(mImagePath, requestedProfile);
|
||||||
|
if (newTex)
|
||||||
|
{
|
||||||
|
mResourceMap.insert(requestedProfile, newTex);
|
||||||
|
mLoadedState = Ok;
|
||||||
|
return newTex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mLoadedState = BadFileReference;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (mTexture.isValid())
|
|
||||||
// return mTexture;
|
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -428,7 +447,6 @@ const char* ImageAsset::getImageTypeNameFromType(ImageAsset::ImageTypes type)
|
||||||
"Particle",
|
"Particle",
|
||||||
"Decal",
|
"Decal",
|
||||||
"Cubemap"
|
"Cubemap"
|
||||||
"Target"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (type < 0 || type >= ImageTypeCount)
|
if (type < 0 || type >= ImageTypeCount)
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,7 @@
|
||||||
#endif
|
#endif
|
||||||
#ifndef _ASSET_PTR_H_
|
#ifndef _ASSET_PTR_H_
|
||||||
#include "assets/assetPtr.h"
|
#include "assets/assetPtr.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _MATTEXTURETARGET_H_
|
|
||||||
#include "materials/matTextureTarget.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gfx/bitmap/gBitmap.h"
|
#include "gfx/bitmap/gBitmap.h"
|
||||||
#include "gfx/gfxTextureHandle.h"
|
#include "gfx/gfxTextureHandle.h"
|
||||||
|
|
@ -54,6 +50,11 @@
|
||||||
#include "assetMacroHelpers.h"
|
#include "assetMacroHelpers.h"
|
||||||
|
|
||||||
#include "gfx/gfxDevice.h"
|
#include "gfx/gfxDevice.h"
|
||||||
|
|
||||||
|
#ifndef _MATTEXTURETARGET_H_
|
||||||
|
#include "materials/matTextureTarget.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
class ImageAsset : public AssetBase
|
class ImageAsset : public AssetBase
|
||||||
{
|
{
|
||||||
|
|
@ -75,8 +76,7 @@ public:
|
||||||
Particle = 8,
|
Particle = 8,
|
||||||
Decal = 9,
|
Decal = 9,
|
||||||
Cubemap = 10,
|
Cubemap = 10,
|
||||||
Target = 11,
|
ImageTypeCount = 11
|
||||||
ImageTypeCount = 12
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static StringTableEntry smNoImageAssetFallback;
|
static StringTableEntry smNoImageAssetFallback;
|
||||||
|
|
@ -100,6 +100,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
StringTableEntry mImageFileName;
|
StringTableEntry mImageFileName;
|
||||||
StringTableEntry mImagePath;
|
StringTableEntry mImagePath;
|
||||||
|
NamedTexTargetRef mNamedTarget;
|
||||||
|
|
||||||
bool mIsValidImage;
|
bool mIsValidImage;
|
||||||
bool mUseMips;
|
bool mUseMips;
|
||||||
|
|
@ -256,12 +257,10 @@ public: \
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
if (get##name()[0] == '$' || get##name()[0] == '#') {\
|
if (get##name()[0] == '$' || get##name()[0] == '#') {\
|
||||||
NamedTexTarget* namedTarget = NamedTexTarget::find(get##name() + 1);\
|
NamedTexTargetRef namedTarget = NamedTexTarget::find(get##name() + 1);\
|
||||||
if (namedTarget)\
|
if (namedTarget.isValid())\
|
||||||
{\
|
{\
|
||||||
m##name = namedTarget->getTexture(0);\
|
m##name = namedTarget->getTexture(0);\
|
||||||
m##name##Name = get##name();\
|
|
||||||
m##name##AssetId = StringTable->EmptyString();\
|
|
||||||
}\
|
}\
|
||||||
}\
|
}\
|
||||||
else\
|
else\
|
||||||
|
|
@ -306,6 +305,8 @@ public: \
|
||||||
}\
|
}\
|
||||||
GFXTexHandle get##name##Resource() \
|
GFXTexHandle get##name##Resource() \
|
||||||
{\
|
{\
|
||||||
|
if (m##name##Asset && (m##name##Asset->getImageFileName() != StringTable->EmptyString()))\
|
||||||
|
return m##name##Asset->getTexture(m##name##Profile);\
|
||||||
return m##name;\
|
return m##name;\
|
||||||
}\
|
}\
|
||||||
bool name##Valid() {return (get##name() != StringTable->EmptyString() && m##name##Asset->getStatus() == AssetBase::Ok); }
|
bool name##Valid() {return (get##name() != StringTable->EmptyString() && m##name##Asset->getStatus() == AssetBase::Ok); }
|
||||||
|
|
@ -341,7 +342,7 @@ if (m##name##AssetId != StringTable->EmptyString())\
|
||||||
#pragma region Arrayed Asset Macros
|
#pragma region Arrayed Asset Macros
|
||||||
|
|
||||||
//Arrayed Assets
|
//Arrayed Assets
|
||||||
#define DECLARE_IMAGEASSET_ARRAY(className, name, max) public: \
|
#define DECLARE_IMAGEASSET_ARRAY(className, name, max, changeFunc) public: \
|
||||||
static const U32 sm##name##Count = max;\
|
static const U32 sm##name##Count = max;\
|
||||||
GFXTexHandle m##name[max];\
|
GFXTexHandle m##name[max];\
|
||||||
StringTableEntry m##name##Name[max]; \
|
StringTableEntry m##name##Name[max]; \
|
||||||
|
|
@ -412,13 +413,7 @@ public: \
|
||||||
if (get##name(index) != StringTable->EmptyString() && m##name##Name[index] != StringTable->insert("texhandle"))\
|
if (get##name(index) != StringTable->EmptyString() && m##name##Name[index] != StringTable->insert("texhandle"))\
|
||||||
{\
|
{\
|
||||||
if (get##name(index)[0] == '$' || get##name(index)[0] == '#') {\
|
if (get##name(index)[0] == '$' || get##name(index)[0] == '#') {\
|
||||||
NamedTexTarget* namedTarget = NamedTexTarget::find(get##name(index) + 1);\
|
m##name##Asset[index]->getChangedSignal().notify(this, &className::changeFunc);\
|
||||||
if (namedTarget)\
|
|
||||||
{\
|
|
||||||
m##name[index] = namedTarget->getTexture(0);\
|
|
||||||
m##name##Name[index] = get##name(index);\
|
|
||||||
m##name##AssetId[index] = StringTable->EmptyString();\
|
|
||||||
}\
|
|
||||||
}\
|
}\
|
||||||
else\
|
else\
|
||||||
m##name[index].set(get##name(index), m##name##Profile[index], 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__));\
|
||||||
|
|
@ -469,6 +464,8 @@ public: \
|
||||||
{\
|
{\
|
||||||
if(index >= sm##name##Count || index < 0)\
|
if(index >= sm##name##Count || index < 0)\
|
||||||
return nullptr;\
|
return nullptr;\
|
||||||
|
if (m##name##Asset[index] && (m##name##Asset[index]->getImageFileName() != StringTable->EmptyString()))\
|
||||||
|
return m##name##Asset[index]->getTexture(m##name##Profile[index]);\
|
||||||
return m##name[index];\
|
return m##name[index];\
|
||||||
}\
|
}\
|
||||||
bool name##Valid(const U32& id) {return (get##name(id) != StringTable->EmptyString() && m##name##Asset[id]->getStatus() == AssetBase::Ok); }
|
bool name##Valid(const U32& id) {return (get##name(id) != StringTable->EmptyString() && m##name##Asset[id]->getStatus() == AssetBase::Ok); }
|
||||||
|
|
|
||||||
|
|
@ -122,8 +122,9 @@ public:
|
||||||
F32 times[ NUM_TIME_KEYS ];
|
F32 times[ NUM_TIME_KEYS ];
|
||||||
LinearColorF colors[ NUM_TIME_KEYS ];
|
LinearColorF colors[ NUM_TIME_KEYS ];
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(SplashData, Texture, NUM_TEX);
|
DECLARE_IMAGEASSET_ARRAY(SplashData, Texture, NUM_TEX, onTextureChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(SplashData, Texture)
|
DECLARE_IMAGEASSET_ARRAY_SETGET(SplashData, Texture)
|
||||||
|
void onTextureChanged() {}
|
||||||
|
|
||||||
ExplosionData* explosion;
|
ExplosionData* explosion;
|
||||||
S32 explosionId;
|
S32 explosionId;
|
||||||
|
|
|
||||||
|
|
@ -94,9 +94,9 @@ protected:
|
||||||
static U32 smVertCount;
|
static U32 smVertCount;
|
||||||
static U32 smTriangleCount;
|
static U32 smTriangleCount;
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(BasicClouds, Texture, TEX_COUNT);
|
DECLARE_IMAGEASSET_ARRAY(BasicClouds, Texture, TEX_COUNT, onTextureChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_NET_SETGET(BasicClouds, Texture, -1);
|
DECLARE_IMAGEASSET_ARRAY_NET_SETGET(BasicClouds, Texture, -1);
|
||||||
|
void onTextureChanged() {}
|
||||||
GFXStateBlockRef mStateblock;
|
GFXStateBlockRef mStateblock;
|
||||||
|
|
||||||
GFXShaderRef mShader;
|
GFXShaderRef mShader;
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,10 @@ protected:
|
||||||
DECLARE_IMAGEASSET(CubemapData, CubeMap, onCubemapChanged, GFXStaticTextureSRGBProfile);
|
DECLARE_IMAGEASSET(CubemapData, CubeMap, onCubemapChanged, GFXStaticTextureSRGBProfile);
|
||||||
DECLARE_ASSET_SETGET(CubemapData, CubeMap);
|
DECLARE_ASSET_SETGET(CubemapData, CubeMap);
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(CubemapData, CubeMapFace, 6);
|
DECLARE_IMAGEASSET_ARRAY(CubemapData, CubeMapFace, 6, onCubeMapFaceChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(CubemapData, CubeMapFace);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(CubemapData, CubeMapFace);
|
||||||
|
|
||||||
|
void onCubeMapFaceChanged() {}
|
||||||
GFXTexHandle mDepthBuff;
|
GFXTexHandle mDepthBuff;
|
||||||
GFXTextureTargetRef mRenderTarget;
|
GFXTextureTargetRef mRenderTarget;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,9 +126,9 @@ protected:
|
||||||
NumBitmapModes = 2
|
NumBitmapModes = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrl, Bitmap, NumBitmapModes);
|
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrl, Bitmap, NumBitmapModes, onBitmapChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(GuiPopUpMenuCtrl, Bitmap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(GuiPopUpMenuCtrl, Bitmap);
|
||||||
|
void onBitmapChanged() {}
|
||||||
Point2I mBitmapBounds; // Added
|
Point2I mBitmapBounds; // Added
|
||||||
S32 mIdMax;
|
S32 mIdMax;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,9 +131,9 @@ class GuiPopUpMenuCtrlEx : public GuiTextCtrl
|
||||||
NumBitmapModes = 2
|
NumBitmapModes = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrlEx, Bitmap, NumBitmapModes);
|
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrlEx, Bitmap, NumBitmapModes, onBitmapChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(GuiPopUpMenuCtrlEx, Bitmap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(GuiPopUpMenuCtrlEx, Bitmap);
|
||||||
|
void onBitmapChanged() {}
|
||||||
Point2I mBitmapBounds; // Added
|
Point2I mBitmapBounds; // Added
|
||||||
|
|
||||||
S32 mIdMax;
|
S32 mIdMax;
|
||||||
|
|
|
||||||
|
|
@ -208,49 +208,53 @@ public:
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Data
|
// Data
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
DECLARE_IMAGEASSET_ARRAY(Material, DiffuseMap, MAX_STAGES);
|
void onImageAssetChanged() {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
DECLARE_IMAGEASSET_ARRAY(Material, DiffuseMap, MAX_STAGES, onImageAssetChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DiffuseMap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DiffuseMap);
|
||||||
|
|
||||||
bool mDiffuseMapSRGB[MAX_STAGES]; // SRGB diffuse
|
bool mDiffuseMapSRGB[MAX_STAGES]; // SRGB diffuse
|
||||||
DECLARE_IMAGEASSET_ARRAY(Material, OverlayMap, MAX_STAGES);
|
DECLARE_IMAGEASSET_ARRAY(Material, OverlayMap, MAX_STAGES, onImageAssetChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, OverlayMap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, OverlayMap);
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(Material, LightMap, MAX_STAGES);
|
DECLARE_IMAGEASSET_ARRAY(Material, LightMap, MAX_STAGES, onImageAssetChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, LightMap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, LightMap);
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(Material, ToneMap, MAX_STAGES);
|
DECLARE_IMAGEASSET_ARRAY(Material, ToneMap, MAX_STAGES, onImageAssetChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, ToneMap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, ToneMap);
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(Material, DetailMap, MAX_STAGES);
|
DECLARE_IMAGEASSET_ARRAY(Material, DetailMap, MAX_STAGES, onImageAssetChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailMap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailMap);
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(Material, NormalMap, MAX_STAGES);
|
DECLARE_IMAGEASSET_ARRAY(Material, NormalMap, MAX_STAGES, onImageAssetChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, NormalMap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, NormalMap);
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(Material, ORMConfigMap, MAX_STAGES);
|
DECLARE_IMAGEASSET_ARRAY(Material, ORMConfigMap, MAX_STAGES, onImageAssetChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, ORMConfigMap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, ORMConfigMap);
|
||||||
|
|
||||||
bool mIsSRGb[MAX_STAGES];
|
bool mIsSRGb[MAX_STAGES];
|
||||||
DECLARE_IMAGEASSET_ARRAY(Material, AOMap, MAX_STAGES);
|
DECLARE_IMAGEASSET_ARRAY(Material, AOMap, MAX_STAGES, onImageAssetChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, AOMap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, AOMap);
|
||||||
F32 mAOChan[MAX_STAGES];
|
F32 mAOChan[MAX_STAGES];
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(Material, RoughMap, MAX_STAGES);
|
DECLARE_IMAGEASSET_ARRAY(Material, RoughMap, MAX_STAGES, onImageAssetChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, RoughMap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, RoughMap);
|
||||||
bool mInvertRoughness[MAX_STAGES];
|
bool mInvertRoughness[MAX_STAGES];
|
||||||
F32 mRoughnessChan[MAX_STAGES];
|
F32 mRoughnessChan[MAX_STAGES];
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(Material, MetalMap, MAX_STAGES);
|
DECLARE_IMAGEASSET_ARRAY(Material, MetalMap, MAX_STAGES, onImageAssetChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, MetalMap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, MetalMap);
|
||||||
|
|
||||||
F32 mMetalChan[MAX_STAGES];
|
F32 mMetalChan[MAX_STAGES];
|
||||||
DECLARE_IMAGEASSET_ARRAY(Material, GlowMap, MAX_STAGES);
|
DECLARE_IMAGEASSET_ARRAY(Material, GlowMap, MAX_STAGES, onImageAssetChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, GlowMap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, GlowMap);
|
||||||
|
|
||||||
F32 mGlowMul[MAX_STAGES];
|
F32 mGlowMul[MAX_STAGES];
|
||||||
/// A second normal map which repeats at the detail map
|
/// A second normal map which repeats at the detail map
|
||||||
/// scale and blended with the base normal map.
|
/// scale and blended with the base normal map.
|
||||||
DECLARE_IMAGEASSET_ARRAY(Material, DetailNormalMap, MAX_STAGES);
|
DECLARE_IMAGEASSET_ARRAY(Material, DetailNormalMap, MAX_STAGES, onImageAssetChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailNormalMap);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailNormalMap);
|
||||||
|
|
||||||
/// The strength scalar for the detail normal map.
|
/// The strength scalar for the detail normal map.
|
||||||
|
|
|
||||||
|
|
@ -398,29 +398,20 @@ void ProcessedMaterial::_setStageData()
|
||||||
//mStages[i].setTex(MFT_DiffuseMap, _createTexture(mMaterial->getDiffuseMap(i), &GFXStaticTextureSRGBProfile));
|
//mStages[i].setTex(MFT_DiffuseMap, _createTexture(mMaterial->getDiffuseMap(i), &GFXStaticTextureSRGBProfile));
|
||||||
if (!mStages[i].getTex(MFT_DiffuseMap))
|
if (!mStages[i].getTex(MFT_DiffuseMap))
|
||||||
{
|
{
|
||||||
// Load a debug texture to make it clear to the user
|
if (String(mMaterial->mDiffuseMapAsset[i]->getImageFileName()).startsWith("#") || String(mMaterial->mDiffuseMapAsset[i]->getImageFileName()).startsWith("$"))
|
||||||
// that the texture for this stage was missing.
|
|
||||||
mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (mMaterial->mDiffuseMapName[i] != StringTable->EmptyString())
|
|
||||||
{
|
|
||||||
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("#") || String(mMaterial->mDiffuseMapName[i]).startsWith("$"))
|
|
||||||
{
|
{
|
||||||
NamedTexTarget* namedTarget = NamedTexTarget::find(mMaterial->mDiffuseMapName[i] + 1);
|
NamedTexTarget* namedTarget = NamedTexTarget::find(mMaterial->mDiffuseMapAsset[i]->getImageFileName() + 1);
|
||||||
if(namedTarget)
|
if (namedTarget)
|
||||||
mStages[i].setTex(MFT_DiffuseMap, namedTarget->getTexture(0));
|
mStages[i].setTex(MFT_DiffuseMap, namedTarget->getTexture(0));
|
||||||
}
|
if (mStages[i].getTex(MFT_DiffuseMap))
|
||||||
else
|
{
|
||||||
{
|
mMaterial->mDiffuseMap[i] = namedTarget->getTexture(0);
|
||||||
if (!String(mMaterial->mDiffuseMapName[i]).startsWith("#"))
|
}
|
||||||
mMaterial->logError("Failed to load diffuse map %s for stage %i", mMaterial->mDiffuseMapName[i], i);
|
|
||||||
|
|
||||||
|
if (!mStages[i].getTex(MFT_DiffuseMap))
|
||||||
|
mHasSetStageData = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
// Load a debug texture to make it clear to the user
|
// Load a debug texture to make it clear to the user
|
||||||
// that the texture for this stage was missing.
|
// that the texture for this stage was missing.
|
||||||
mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile));
|
mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile));
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(PostEffect, Texture, NumTextures);
|
DECLARE_IMAGEASSET_ARRAY(PostEffect, Texture, NumTextures, onTextureChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(PostEffect, Texture);
|
DECLARE_IMAGEASSET_ARRAY_SETGET(PostEffect, Texture);
|
||||||
|
void onTextureChanged() {}
|
||||||
|
|
||||||
bool mTexSRGB[NumTextures];
|
bool mTexSRGB[NumTextures];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue