Merge branch 'Preview4_0_DevHead' into tsneo

This commit is contained in:
Jeff Hutchinson 2021-08-29 22:28:42 -04:00
commit 6e072dbf91
62 changed files with 388 additions and 459 deletions

View file

@ -132,14 +132,14 @@ void CppAsset::setCppFile(const char* pCppFile)
AssertFatal(pCppFile != NULL, "Cannot use a NULL code file."); AssertFatal(pCppFile != NULL, "Cannot use a NULL code file.");
// Fetch image file. // Fetch image file.
pCppFile = StringTable->insert(pCppFile); pCppFile = StringTable->insert(pCppFile, true);
// Ignore no change, // Ignore no change,
if (pCppFile == mCodeFile) if (pCppFile == mCodeFile)
return; return;
// Update. // Update.
mCodeFile = /*getOwned() ? expandAssetFilePath(pCppFile) : */StringTable->insert(pCppFile); mCodeFile = getOwned() ? expandAssetFilePath(pCppFile) : pCppFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();
@ -158,7 +158,7 @@ void CppAsset::setHeaderFile(const char* pHeaderFile)
return; return;
// Update. // Update.
mHeaderFile = /*getOwned() ? expandAssetFilePath(pHeaderFile) :*/ StringTable->insert(pHeaderFile); mHeaderFile = getOwned() ? expandAssetFilePath(pHeaderFile) : pHeaderFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();

View file

@ -134,18 +134,21 @@ void CubemapAsset::copyTo(SimObject* object)
void CubemapAsset::initializeAsset() void CubemapAsset::initializeAsset()
{ {
mScriptFile = expandAssetFilePath(mScriptFile); // Call parent.
Parent::initializeAsset();
if(Torque::FS::IsScriptFile(mScriptFile)) mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
Con::executeFile(mScriptFile, false, false);
if (Torque::FS::IsScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false);
} }
void CubemapAsset::onAssetRefresh() void CubemapAsset::onAssetRefresh()
{ {
mScriptFile = expandAssetFilePath(mScriptFile); mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptFile)) if (Torque::FS::IsScriptFile(mScriptPath))
Con::executeFile(mScriptFile, false, false); Con::executeFile(mScriptPath, false, false);
} }
void CubemapAsset::setScriptFile(const char* pScriptFile) void CubemapAsset::setScriptFile(const char* pScriptFile)
@ -154,14 +157,14 @@ void CubemapAsset::setScriptFile(const char* pScriptFile)
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
// Fetch image file. // Fetch image file.
pScriptFile = StringTable->insert(pScriptFile); pScriptFile = StringTable->insert(pScriptFile, true);
// Ignore no change, // Ignore no change,
if (pScriptFile == mScriptFile) if (pScriptFile == mScriptFile)
return; return;
// Update. // Update.
mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : StringTable->insert(pScriptFile); mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();

View file

@ -53,6 +53,7 @@ class CubemapAsset : public AssetBase
StringTableEntry mDescription; StringTableEntry mDescription;
StringTableEntry mScriptFile; StringTableEntry mScriptFile;
StringTableEntry mScriptPath;
public: public:
CubemapAsset(); CubemapAsset();

View file

@ -117,12 +117,12 @@ void GUIAsset::copyTo(SimObject* object)
void GUIAsset::initializeAsset() void GUIAsset::initializeAsset()
{ {
mGUIPath = expandAssetFilePath(mGUIFile); mGUIPath = getOwned() ? expandAssetFilePath(mGUIFile) : mGUIPath;
if (Torque::FS::IsScriptFile(mGUIPath)) if (Torque::FS::IsScriptFile(mGUIPath))
Con::executeFile(mGUIPath, false, false); Con::executeFile(mGUIPath, false, false);
mScriptPath = expandAssetFilePath(mScriptFile); mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath)) if (Torque::FS::IsScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false); Con::executeFile(mScriptPath, false, false);
@ -130,12 +130,12 @@ void GUIAsset::initializeAsset()
void GUIAsset::onAssetRefresh() void GUIAsset::onAssetRefresh()
{ {
mGUIPath = expandAssetFilePath(mGUIFile); mGUIPath = getOwned() ? expandAssetFilePath(mGUIFile) : mGUIPath;
if (Torque::FS::IsScriptFile(mGUIPath)) if (Torque::FS::IsScriptFile(mGUIPath))
Con::executeFile(mGUIPath, false, false); Con::executeFile(mGUIPath, false, false);
mScriptPath = expandAssetFilePath(mScriptFile); mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath)) if (Torque::FS::IsScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false); Con::executeFile(mScriptPath, false, false);
@ -147,14 +147,14 @@ void GUIAsset::setGUIFile(const char* pScriptFile)
AssertFatal(pScriptFile != NULL, "Cannot use a NULL gui file."); AssertFatal(pScriptFile != NULL, "Cannot use a NULL gui file.");
// Fetch image file. // Fetch image file.
pScriptFile = StringTable->insert(pScriptFile); pScriptFile = StringTable->insert(pScriptFile, true);
// Ignore no change, // Ignore no change,
if (pScriptFile == mGUIFile) if (pScriptFile == mGUIFile)
return; return;
// Update. // Update.
mGUIFile = StringTable->insert(pScriptFile); mGUIFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();
@ -166,14 +166,14 @@ void GUIAsset::setScriptFile(const char* pScriptFile)
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
// Fetch image file. // Fetch image file.
pScriptFile = StringTable->insert(pScriptFile); pScriptFile = StringTable->insert(pScriptFile, true);
// Ignore no change, // Ignore no change,
if (pScriptFile == mScriptFile) if (pScriptFile == mScriptFile)
return; return;
// Update. // Update.
mScriptFile = StringTable->insert(pScriptFile); mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();

View file

@ -156,10 +156,10 @@ void GameObjectAsset::setScriptFile(const char* pScriptFile)
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
// Fetch image file. // Fetch image file.
pScriptFile = StringTable->insert(pScriptFile); pScriptFile = StringTable->insert(pScriptFile, true);
// Ignore no change, // Ignore no change,
if (pScriptFile == mScriptFile) if (pScriptFile == mTAMLFile)
return; return;
// Update. // Update.
@ -176,7 +176,7 @@ void GameObjectAsset::setTAMLFile(const char* pTAMLFile)
AssertFatal(pTAMLFile != NULL, "Cannot use a NULL TAML file."); AssertFatal(pTAMLFile != NULL, "Cannot use a NULL TAML file.");
// Fetch image file. // Fetch image file.
pTAMLFile = StringTable->insert(pTAMLFile); pTAMLFile = StringTable->insert(pTAMLFile, true);
// Ignore no change, // Ignore no change,
if (pTAMLFile == mTAMLFile) if (pTAMLFile == mTAMLFile)

View file

@ -52,7 +52,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
StringTableEntry ImageAsset::smNoImageAssetFallback(StringTable->insert(Con::getVariable("$Core::NoImageAssetFallback"))); StringTableEntry ImageAsset::smNoImageAssetFallback = NULL;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -147,6 +147,8 @@ void ImageAsset::consoleInit()
Con::addVariable("$Core::NoImageAssetFallback", TypeString, &smNoImageAssetFallback, Con::addVariable("$Core::NoImageAssetFallback", TypeString, &smNoImageAssetFallback,
"The assetId of the texture to display when the requested image asset is missing.\n" "The assetId of the texture to display when the requested image asset is missing.\n"
"@ingroup GFX\n"); "@ingroup GFX\n");
smNoImageAssetFallback = StringTable->insert(Con::getVariable("$Core::NoImageAssetFallback"));
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -296,21 +298,15 @@ void ImageAsset::loadImage()
void ImageAsset::initializeAsset() void ImageAsset::initializeAsset()
{ {
if (mImageFileName == StringTable->insert("z.png"))
{
Con::printf("Loaded z");
}
ResourceManager::get().getChangedSignal().notify(this, &ImageAsset::_onResourceChanged); ResourceManager::get().getChangedSignal().notify(this, &ImageAsset::_onResourceChanged);
mImagePath = expandAssetFilePath(mImageFileName); mImagePath = getOwned() ? expandAssetFilePath(mImageFileName) : mImagePath;
loadImage(); loadImage();
} }
void ImageAsset::onAssetRefresh() void ImageAsset::onAssetRefresh()
{ {
mImagePath = expandAssetFilePath(mImageFileName); mImagePath = getOwned() ? expandAssetFilePath(mImageFileName) : mImagePath;
loadImage(); loadImage();
} }
@ -321,7 +317,7 @@ void ImageAsset::_onResourceChanged(const Torque::Path& path)
refreshAsset(); refreshAsset();
loadImage(); //loadImage();
} }
void ImageAsset::setImageFileName(const char* pScriptFile) void ImageAsset::setImageFileName(const char* pScriptFile)
@ -330,7 +326,10 @@ void ImageAsset::setImageFileName(const char* pScriptFile)
AssertFatal(pScriptFile != NULL, "Cannot use a NULL image file."); AssertFatal(pScriptFile != NULL, "Cannot use a NULL image file.");
// Update. // Update.
mImageFileName = StringTable->insert(pScriptFile); mImageFileName = StringTable->insert(pScriptFile, true);
// Refresh the asset.
refreshAsset();
} }
const GBitmap& ImageAsset::getImage() const GBitmap& ImageAsset::getImage()

View file

@ -161,20 +161,18 @@ void LevelAsset::onAssetRefresh(void)
void LevelAsset::loadAsset() void LevelAsset::loadAsset()
{ {
// Ensure the image-file is expanded. // Ensure the image-file is expanded.
mLevelPath = expandAssetFilePath(mLevelFile); mLevelPath = getOwned() ? expandAssetFilePath(mLevelFile) : mLevelPath;
mPostFXPresetPath = expandAssetFilePath(mPostFXPresetFile); mPostFXPresetPath = getOwned() ? expandAssetFilePath(mPostFXPresetFile) : mPostFXPresetPath;
mDecalsPath = expandAssetFilePath(mDecalsFile); mDecalsPath = getOwned() ? expandAssetFilePath(mDecalsFile) : mDecalsPath;
mForestPath = expandAssetFilePath(mForestFile); mForestPath = getOwned() ? expandAssetFilePath(mForestFile) : mForestPath;
mNavmeshPath = expandAssetFilePath(mNavmeshFile); mNavmeshPath = getOwned() ? expandAssetFilePath(mNavmeshFile) : mNavmeshPath;
StringTableEntry previewImageAssetId = getAssetDependencyField("previewImageAsset"); StringTableEntry previewImageAssetId = getAssetDependencyField("previewImageAsset");
if (previewImageAssetId != StringTable->EmptyString()) if (previewImageAssetId != StringTable->EmptyString())
{ {
mPreviewImageAssetId = previewImageAssetId; mPreviewImageAssetId = previewImageAssetId;
mPreviewImageAsset = mPreviewImageAssetId;
AssetPtr<ImageAsset> previewImgAsset = mPreviewImageAssetId;
mPreviewImageAsset = previewImgAsset;
} }
} }
@ -185,14 +183,14 @@ void LevelAsset::setLevelFile(const char* pLevelFile)
AssertFatal(pLevelFile != NULL, "Cannot use a NULL level file."); AssertFatal(pLevelFile != NULL, "Cannot use a NULL level file.");
// Fetch image file. // Fetch image file.
pLevelFile = StringTable->insert(pLevelFile); pLevelFile = StringTable->insert(pLevelFile, true);
// Ignore no change, // Ignore no change,
if (pLevelFile == mLevelFile) if (pLevelFile == mLevelFile)
return; return;
// Update. // Update.
mLevelFile = pLevelFile; mLevelFile = getOwned() ? expandAssetFilePath(pLevelFile) : pLevelFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();
@ -219,14 +217,14 @@ void LevelAsset::setEditorFile(const char* pEditorFile)
AssertFatal(pEditorFile != NULL, "Cannot use a NULL level file."); AssertFatal(pEditorFile != NULL, "Cannot use a NULL level file.");
// Fetch image file. // Fetch image file.
pEditorFile = StringTable->insert(pEditorFile); pEditorFile = StringTable->insert(pEditorFile, true);
// Ignore no change, // Ignore no change,
if (pEditorFile == mEditorFile) if (pEditorFile == mEditorFile)
return; return;
// Update. // Update.
mEditorFile = pEditorFile; mEditorFile = getOwned() ? expandAssetFilePath(pEditorFile) : pEditorFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();
@ -238,14 +236,14 @@ void LevelAsset::setBakedSceneFile(const char* pBakedSceneFile)
AssertFatal(pBakedSceneFile != NULL, "Cannot use a NULL level file."); AssertFatal(pBakedSceneFile != NULL, "Cannot use a NULL level file.");
// Fetch image file. // Fetch image file.
pBakedSceneFile = StringTable->insert(pBakedSceneFile); pBakedSceneFile = StringTable->insert(pBakedSceneFile, true);
// Ignore no change, // Ignore no change,
if (pBakedSceneFile == mBakedSceneFile) if (pBakedSceneFile == mBakedSceneFile)
return; return;
// Update. // Update.
mBakedSceneFile = pBakedSceneFile; mBakedSceneFile = getOwned() ? expandAssetFilePath(pBakedSceneFile) : pBakedSceneFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();
@ -257,14 +255,14 @@ void LevelAsset::setPostFXPresetFile(const char* pPostFXPresetFile)
AssertFatal(pPostFXPresetFile != NULL, "Cannot use a NULL postFX preset file."); AssertFatal(pPostFXPresetFile != NULL, "Cannot use a NULL postFX preset file.");
// Fetch file. // Fetch file.
pPostFXPresetFile = StringTable->insert(pPostFXPresetFile); pPostFXPresetFile = StringTable->insert(pPostFXPresetFile, true);
// Ignore no change, // Ignore no change,
if (pPostFXPresetFile == mPostFXPresetFile) if (pPostFXPresetFile == mPostFXPresetFile)
return; return;
// Update. // Update.
mPostFXPresetFile = pPostFXPresetFile; mPostFXPresetFile = getOwned() ? expandAssetFilePath(pPostFXPresetFile) : pPostFXPresetFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();
@ -276,14 +274,14 @@ void LevelAsset::setDecalsFile(const char* pDecalsFile)
AssertFatal(pDecalsFile != NULL, "Cannot use a NULL decals file."); AssertFatal(pDecalsFile != NULL, "Cannot use a NULL decals file.");
// Fetch file. // Fetch file.
pDecalsFile = StringTable->insert(pDecalsFile); pDecalsFile = StringTable->insert(pDecalsFile, true);
// Ignore no change, // Ignore no change,
if (pDecalsFile == mDecalsFile) if (pDecalsFile == mDecalsFile)
return; return;
// Update. // Update.
mDecalsFile = pDecalsFile; mDecalsFile = getOwned() ? expandAssetFilePath(pDecalsFile) : pDecalsFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();
@ -295,14 +293,14 @@ void LevelAsset::setForestFile(const char* pForestFile)
AssertFatal(pForestFile != NULL, "Cannot use a NULL decals file."); AssertFatal(pForestFile != NULL, "Cannot use a NULL decals file.");
// Fetch file. // Fetch file.
pForestFile = StringTable->insert(pForestFile); pForestFile = StringTable->insert(pForestFile, true);
// Ignore no change, // Ignore no change,
if (pForestFile == mForestFile) if (pForestFile == mForestFile)
return; return;
// Update. // Update.
mForestFile = pForestFile; mForestFile = getOwned() ? expandAssetFilePath(pForestFile) : pForestFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();
@ -314,14 +312,14 @@ void LevelAsset::setNavmeshFile(const char* pNavmeshFile)
AssertFatal(pNavmeshFile != NULL, "Cannot use a NULL Navmesh file."); AssertFatal(pNavmeshFile != NULL, "Cannot use a NULL Navmesh file.");
// Fetch file. // Fetch file.
pNavmeshFile = StringTable->insert(pNavmeshFile); pNavmeshFile = StringTable->insert(pNavmeshFile, true);
// Ignore no change, // Ignore no change,
if (pNavmeshFile == mNavmeshFile) if (pNavmeshFile == mNavmeshFile)
return; return;
// Update. // Update.
mNavmeshFile = pNavmeshFile; mNavmeshFile = getOwned() ? expandAssetFilePath(pNavmeshFile) : pNavmeshFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();

View file

@ -43,7 +43,7 @@
#include "T3D/assets/assetImporter.h" #include "T3D/assets/assetImporter.h"
StringTableEntry MaterialAsset::smNoMaterialAssetFallback(StringTable->insert(Con::getVariable("$Core::NoMaterialAssetFallback"))); StringTableEntry MaterialAsset::smNoMaterialAssetFallback = NULL;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -145,6 +145,8 @@ void MaterialAsset::consoleInit()
Con::addVariable("$Core::NoMaterialAssetFallback", TypeString, &smNoMaterialAssetFallback, Con::addVariable("$Core::NoMaterialAssetFallback", TypeString, &smNoMaterialAssetFallback,
"The assetId of the material to display when the requested material asset is missing.\n" "The assetId of the material to display when the requested material asset is missing.\n"
"@ingroup GFX\n"); "@ingroup GFX\n");
smNoMaterialAssetFallback = StringTable->insert(Con::getVariable("$Core::NoMaterialAssetFallback"));
} }
void MaterialAsset::initPersistFields() void MaterialAsset::initPersistFields()
@ -188,7 +190,7 @@ void MaterialAsset::setScriptFile(const char* pScriptFile)
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
// Fetch image file. // Fetch image file.
pScriptFile = StringTable->insert(pScriptFile); pScriptFile = StringTable->insert(pScriptFile, true);
// Update. // Update.
mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile; mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;

View file

@ -109,7 +109,11 @@ protected:
virtual void initializeAsset(); virtual void initializeAsset();
virtual void onAssetRefresh(void); virtual void onAssetRefresh(void);
static bool setScriptFile(void *obj, const char *index, const char *data) { static_cast<MaterialAsset*>(obj)->setScriptFile(data); return false; } static bool setScriptFile(void *obj, const char *index, const char *data)
{
static_cast<MaterialAsset*>(obj)->setScriptFile(data);
return false;
}
static const char* getScriptFile(void* obj, const char* data) { return static_cast<MaterialAsset*>(obj)->getScriptFile(); } static const char* getScriptFile(void* obj, const char* data) { return static_cast<MaterialAsset*>(obj)->getScriptFile(); }
}; };

View file

@ -132,9 +132,9 @@ void PostEffectAsset::copyTo(SimObject* object)
void PostEffectAsset::initializeAsset() void PostEffectAsset::initializeAsset()
{ {
mScriptPath = expandAssetFilePath(mScriptFile); mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
mHLSLShaderPath = expandAssetFilePath(mHLSLShaderFile); mHLSLShaderPath = getOwned() ? expandAssetFilePath(mHLSLShaderFile) : mHLSLShaderPath;
mGLSLShaderPath = expandAssetFilePath(mGLSLShaderFile); mGLSLShaderPath = getOwned() ? expandAssetFilePath(mGLSLShaderFile) : mGLSLShaderPath;
if (Torque::FS::IsScriptFile(mScriptPath)) if (Torque::FS::IsScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false); Con::executeFile(mScriptPath, false, false);
@ -142,9 +142,9 @@ void PostEffectAsset::initializeAsset()
void PostEffectAsset::onAssetRefresh() void PostEffectAsset::onAssetRefresh()
{ {
mScriptPath = expandAssetFilePath(mScriptFile); mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
mHLSLShaderPath = expandAssetFilePath(mHLSLShaderFile); mHLSLShaderPath = getOwned() ? expandAssetFilePath(mHLSLShaderFile) : mHLSLShaderPath;
mGLSLShaderPath = expandAssetFilePath(mGLSLShaderFile); mGLSLShaderPath = getOwned() ? expandAssetFilePath(mGLSLShaderFile) : mGLSLShaderPath;
if (Torque::FS::IsScriptFile(mScriptPath)) if (Torque::FS::IsScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false); Con::executeFile(mScriptPath, false, false);
@ -156,14 +156,14 @@ void PostEffectAsset::setScriptFile(const char* pScriptFile)
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
// Fetch image file. // Fetch image file.
pScriptFile = StringTable->insert(pScriptFile); pScriptFile = StringTable->insert(pScriptFile, true);
// Ignore no change, // Ignore no change,
if (pScriptFile == mScriptFile) if (pScriptFile == mScriptFile)
return; return;
// Update. // Update.
mScriptFile = pScriptFile; mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();
@ -175,14 +175,14 @@ void PostEffectAsset::setHLSLShaderFile(const char* pShaderFile)
AssertFatal(pShaderFile != NULL, "Cannot use a NULL shader file."); AssertFatal(pShaderFile != NULL, "Cannot use a NULL shader file.");
// Fetch image file. // Fetch image file.
pShaderFile = StringTable->insert(pShaderFile); pShaderFile = StringTable->insert(pShaderFile, true);
// Ignore no change, // Ignore no change,
if (pShaderFile == mHLSLShaderFile) if (pShaderFile == mHLSLShaderFile)
return; return;
// Update. // Update.
mHLSLShaderFile = pShaderFile; mHLSLShaderFile = getOwned() ? expandAssetFilePath(pShaderFile) : pShaderFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();
@ -194,14 +194,14 @@ void PostEffectAsset::setGLSLShaderFile(const char* pShaderFile)
AssertFatal(pShaderFile != NULL, "Cannot use a NULL shader file."); AssertFatal(pShaderFile != NULL, "Cannot use a NULL shader file.");
// Fetch image file. // Fetch image file.
pShaderFile = StringTable->insert(pShaderFile); pShaderFile = StringTable->insert(pShaderFile, true);
// Ignore no change, // Ignore no change,
if (pShaderFile == mGLSLShaderFile) if (pShaderFile == mGLSLShaderFile)
return; return;
// Update. // Update.
mGLSLShaderFile = pShaderFile; mGLSLShaderFile = getOwned() ? expandAssetFilePath(pShaderFile) : pShaderFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();

View file

@ -122,7 +122,7 @@ void ScriptAsset::copyTo(SimObject* object)
void ScriptAsset::initializeAsset() void ScriptAsset::initializeAsset()
{ {
mScriptPath = expandAssetFilePath(mScriptFile); mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath)) if (Torque::FS::IsScriptFile(mScriptPath))
{ {
@ -150,7 +150,7 @@ void ScriptAsset::initializeAsset()
void ScriptAsset::onAssetRefresh() void ScriptAsset::onAssetRefresh()
{ {
mScriptPath = expandAssetFilePath(mScriptFile); mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath)) if (Torque::FS::IsScriptFile(mScriptPath))
{ {
@ -170,14 +170,14 @@ void ScriptAsset::setScriptFile(const char* pScriptFile)
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
// Fetch image file. // Fetch image file.
pScriptFile = StringTable->insert(pScriptFile); pScriptFile = StringTable->insert(pScriptFile, true);
// Ignore no change, // Ignore no change,
if (pScriptFile == mScriptFile) if (pScriptFile == mScriptFile)
return; return;
// Update. // Update.
mScriptFile = StringTable->insert(pScriptFile); mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();

View file

@ -147,7 +147,7 @@ void ShapeAnimationAsset::initializeAsset(void)
if (!mIsEmbedded) if (!mIsEmbedded)
{ {
//If we're not embedded, we need to load in our initial shape and do some prepwork //If we're not embedded, we need to load in our initial shape and do some prepwork
mFilePath = expandAssetFilePath(mFileName); mFilePath = getOwned() ? expandAssetFilePath(mFileName) : mFilePath;
mSourceShape = ResourceManager::get().load(mFilePath); mSourceShape = ResourceManager::get().load(mFilePath);
@ -177,14 +177,14 @@ void ShapeAnimationAsset::setAnimationFile(const char* pAnimationFile)
AssertFatal(pAnimationFile != NULL, "Cannot use a NULL animation file."); AssertFatal(pAnimationFile != NULL, "Cannot use a NULL animation file.");
// Fetch image file. // Fetch image file.
pAnimationFile = StringTable->insert(pAnimationFile); pAnimationFile = StringTable->insert(pAnimationFile, true);
// Ignore no change, // Ignore no change,
if (pAnimationFile == mFileName) if (pAnimationFile == mFileName)
return; return;
// Update. // Update.
mFileName = StringTable->insert(pAnimationFile); mFileName = getOwned() ? expandAssetFilePath(pAnimationFile) : pAnimationFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();

View file

@ -50,7 +50,7 @@
#include "ts/tsLastDetail.h" #include "ts/tsLastDetail.h"
#endif #endif
StringTableEntry ShapeAsset::smNoShapeAssetFallback(StringTable->insert(Con::getVariable("$Core::NoShapeAssetFallback"))); StringTableEntry ShapeAsset::smNoShapeAssetFallback = NULL;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -146,6 +146,8 @@ void ShapeAsset::consoleInit()
Con::addVariable("$Core::NoShapeAssetFallback", TypeString, &smNoShapeAssetFallback, Con::addVariable("$Core::NoShapeAssetFallback", TypeString, &smNoShapeAssetFallback,
"The assetId of the shape to display when the requested shape asset is missing.\n" "The assetId of the shape to display when the requested shape asset is missing.\n"
"@ingroup GFX\n"); "@ingroup GFX\n");
smNoShapeAssetFallback = StringTable->insert(Con::getVariable("$Core::NoShapeAssetFallback"));
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -186,10 +188,9 @@ void ShapeAsset::initializeAsset()
ResourceManager::get().getChangedSignal().notify(this, &ShapeAsset::_onResourceChanged); ResourceManager::get().getChangedSignal().notify(this, &ShapeAsset::_onResourceChanged);
//Ensure our path is expando'd if it isn't already //Ensure our path is expando'd if it isn't already
if (!Platform::isFullPath(mFilePath)) mFilePath = getOwned() ? expandAssetFilePath(mFileName) : mFilePath;
mFilePath = getOwned() ? expandAssetFilePath(mFileName) : mFilePath;
mConstructorFilePath = expandAssetFilePath(mConstructorFilePath); mConstructorFilePath = getOwned() ? expandAssetFilePath(mConstructorFilePath) : mConstructorFilePath;
loadShape(); loadShape();
} }
@ -200,13 +201,13 @@ void ShapeAsset::setShapeFile(const char* pShapeFile)
AssertFatal(pShapeFile != NULL, "Cannot use a NULL shape file."); AssertFatal(pShapeFile != NULL, "Cannot use a NULL shape file.");
// Fetch image file. // Fetch image file.
pShapeFile = StringTable->insert(pShapeFile); pShapeFile = StringTable->insert(pShapeFile, true);
// Ignore no change, // Ignore no change,
if (pShapeFile == mFileName) if (pShapeFile == mFileName)
return; return;
mFileName = pShapeFile; mFileName = getOwned() ? expandAssetFilePath(pShapeFile) : pShapeFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();
@ -218,13 +219,13 @@ void ShapeAsset::setShapeConstructorFile(const char* pShapeConstructorFile)
AssertFatal(pShapeConstructorFile != NULL, "Cannot use a NULL shape constructor file."); AssertFatal(pShapeConstructorFile != NULL, "Cannot use a NULL shape constructor file.");
// Fetch image file. // Fetch image file.
pShapeConstructorFile = StringTable->insert(pShapeConstructorFile); pShapeConstructorFile = StringTable->insert(pShapeConstructorFile, true);
// Ignore no change, // Ignore no change,
if (pShapeConstructorFile == mConstructorFileName) if (pShapeConstructorFile == mConstructorFileName)
return; return;
mConstructorFileName = pShapeConstructorFile; mConstructorFileName = getOwned() ? expandAssetFilePath(pShapeConstructorFile) : pShapeConstructorFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();

View file

@ -184,8 +184,7 @@ void SoundAsset::initializeAsset(void)
//ResourceManager::get().getChangedSignal.notify(this, &SoundAsset::_onResourceChanged); //ResourceManager::get().getChangedSignal.notify(this, &SoundAsset::_onResourceChanged);
//Ensure our path is expando'd if it isn't already //Ensure our path is expando'd if it isn't already
if (!Platform::isFullPath(mSoundPath)) mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath;
mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath;
mSoundPath = expandAssetFilePath(mSoundPath); mSoundPath = expandAssetFilePath(mSoundPath);
@ -208,8 +207,7 @@ void SoundAsset::onAssetRefresh(void)
return; return;
//Update //Update
if (!Platform::isFullPath(mSoundFile)) mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath;
mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath;
loadSound(); loadSound();
} }
@ -243,14 +241,14 @@ void SoundAsset::setSoundFile(const char* pSoundFile)
AssertFatal(pSoundFile != NULL, "Cannot use a NULL sound file."); AssertFatal(pSoundFile != NULL, "Cannot use a NULL sound file.");
// Fetch sound file. // Fetch sound file.
pSoundFile = StringTable->insert(pSoundFile); pSoundFile = StringTable->insert(pSoundFile, true);
// Ignore no change, // Ignore no change,
if (pSoundFile == mSoundFile) if (pSoundFile == mSoundFile)
return; return;
// Update. // Update.
mSoundFile = pSoundFile; mSoundFile = getOwned() ? expandAssetFilePath(pSoundFile) : pSoundFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();

View file

@ -161,14 +161,14 @@ void TerrainAsset::initializeAsset()
// Call parent. // Call parent.
Parent::initializeAsset(); Parent::initializeAsset();
mTerrainFilePath = expandAssetFilePath(mTerrainFileName); mTerrainFilePath = getOwned() ? expandAssetFilePath(mTerrainFileName) : mTerrainFilePath;
loadTerrain(); loadTerrain();
} }
void TerrainAsset::onAssetRefresh() void TerrainAsset::onAssetRefresh()
{ {
mTerrainFilePath = expandAssetFilePath(mTerrainFileName); mTerrainFilePath = getOwned() ? expandAssetFilePath(mTerrainFileName) : mTerrainFilePath;
loadTerrain(); loadTerrain();
} }
@ -176,13 +176,16 @@ void TerrainAsset::onAssetRefresh()
void TerrainAsset::setTerrainFileName(const char* pScriptFile) void TerrainAsset::setTerrainFileName(const char* pScriptFile)
{ {
// Sanity! // Sanity!
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); AssertFatal(pScriptFile != NULL, "Cannot use a NULL terrain file.");
// Fetch image file. pScriptFile = StringTable->insert(pScriptFile, true);
pScriptFile = StringTable->insert(pScriptFile);
// Ignore no change,
if (pScriptFile == mTerrainFileName)
return;
// Update. // Update.
mTerrainFileName = pScriptFile; mTerrainFileName = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();

View file

@ -119,7 +119,7 @@ void TerrainMaterialAsset::initializeAsset()
// Call parent. // Call parent.
Parent::initializeAsset(); Parent::initializeAsset();
mScriptPath = expandAssetFilePath(mScriptFile); mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath)) if (Torque::FS::IsScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false); Con::executeFile(mScriptPath, false, false);
@ -127,7 +127,7 @@ void TerrainMaterialAsset::initializeAsset()
void TerrainMaterialAsset::onAssetRefresh() void TerrainMaterialAsset::onAssetRefresh()
{ {
mScriptPath = expandAssetFilePath(mScriptFile); mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath)) if (Torque::FS::IsScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false); Con::executeFile(mScriptPath, false, false);
@ -150,11 +150,14 @@ void TerrainMaterialAsset::setScriptFile(const char* pScriptFile)
// Sanity! // Sanity!
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
// Fetch image file. pScriptFile = StringTable->insert(pScriptFile, true);
pScriptFile = StringTable->insert(pScriptFile);
// Ignore no change,
if (pScriptFile == mScriptFile)
return;
// Update. // Update.
mScriptFile = pScriptFile; mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();

View file

@ -126,15 +126,14 @@ void StateMachineAsset::setStateMachineFile(const char* pStateMachineFile)
// Sanity! // Sanity!
AssertFatal(pStateMachineFile != NULL, "Cannot use a NULL state machine file."); AssertFatal(pStateMachineFile != NULL, "Cannot use a NULL state machine file.");
// Fetch image file. pStateMachineFile = StringTable->insert(pStateMachineFile, true);
pStateMachineFile = StringTable->insert(pStateMachineFile);
// Ignore no change, // Ignore no change,
if (pStateMachineFile == mStateMachineFile) if (pStateMachineFile == mStateMachineFile)
return; return;
// Update. // Update.
mStateMachineFile = StringTable->insert(pStateMachineFile); mStateMachineFile = getOwned() ? expandAssetFilePath(pStateMachineFile) : pStateMachineFile;
// Refresh the asset. // Refresh the asset.
refreshAsset(); refreshAsset();
@ -142,12 +141,12 @@ void StateMachineAsset::setStateMachineFile(const char* pStateMachineFile)
void StateMachineAsset::initializeAsset() void StateMachineAsset::initializeAsset()
{ {
mStateMachinePath = expandAssetFilePath(mStateMachineFile); mStateMachinePath = getOwned() ? expandAssetFilePath(mStateMachineFile) : mStateMachinePath;
} }
void StateMachineAsset::onAssetRefresh() void StateMachineAsset::onAssetRefresh()
{ {
mStateMachinePath = expandAssetFilePath(mStateMachineFile); mStateMachinePath = getOwned() ? expandAssetFilePath(mStateMachineFile) : mStateMachinePath;
} }

View file

@ -202,7 +202,7 @@ void DecalData::initPersistFields()
"grid; use #textureCoords to manually specify UV coordinates for " "grid; use #textureCoords to manually specify UV coordinates for "
"irregular sized frames." ); "irregular sized frames." );
addField( "textureCoords", TypeRectF, Offset( texRect, DecalData ), MAX_TEXCOORD_COUNT, addField( "textureCoords", TypeRectUV, Offset( texRect, DecalData ), MAX_TEXCOORD_COUNT,
"@brief An array of RectFs (topleft.x topleft.y extent.x extent.y) " "@brief An array of RectFs (topleft.x topleft.y extent.x extent.y) "
"representing the UV coordinates for each frame in the imagemap.\n\n" "representing the UV coordinates for each frame in the imagemap.\n\n"
"@note This field should only be set if the imagemap frames are " "@note This field should only be set if the imagemap frames are "
@ -313,7 +313,9 @@ void DecalData::_initMaterial()
{ {
SAFE_DELETE( matInst ); SAFE_DELETE( matInst );
if (mMaterialAsset.notNull()) _setMaterial(getMaterial());
if (mMaterialAsset.notNull() && mMaterialAsset->getStatus() == MaterialAsset::Ok)
{ {
matInst = getMaterialResource()->createMatInstance(); matInst = getMaterialResource()->createMatInstance();
} }

View file

@ -278,7 +278,7 @@ class ParticleEmitter : public GameBase
// code to expose the necessary members and methods. // code to expose the necessary members and methods.
void update( U32 ms ); void update( U32 ms );
protected: protected:
inline void updateKeyData( Particle *part ); void updateKeyData( Particle *part );
private: private:

View file

@ -71,6 +71,8 @@ Prefab::Prefab()
mNetFlags.clear(Ghostable); mNetFlags.clear(Ghostable);
mTypeMask |= StaticObjectType; mTypeMask |= StaticObjectType;
mFilename = StringTable->EmptyString();
} }
Prefab::~Prefab() Prefab::~Prefab()
@ -558,6 +560,7 @@ bool Prefab::buildExportPolyList(ColladaUtils::ExportData* exportData, const Box
void Prefab::getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList) void Prefab::getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList)
{ {
if (!mChildGroup) return;
Vector<SceneObject*> foundObjects; Vector<SceneObject*> foundObjects;
mChildGroup->findObjectByType(foundObjects); mChildGroup->findObjectByType(foundObjects);

View file

@ -141,7 +141,7 @@ U32 Projectile::smProjectileWarpTicks = 5;
// //
afxMagicMissileData::afxMagicMissileData() afxMagicMissileData::afxMagicMissileData()
{ {
projectileShapeName = ST_NULLSTRING; INIT_SHAPEASSET(ProjectileShape);
sound = NULL; sound = NULL;
@ -246,7 +246,7 @@ afxMagicMissileData::afxMagicMissileData()
afxMagicMissileData::afxMagicMissileData(const afxMagicMissileData& other, bool temp_clone) : GameBaseData(other, temp_clone) afxMagicMissileData::afxMagicMissileData(const afxMagicMissileData& other, bool temp_clone) : GameBaseData(other, temp_clone)
{ {
projectileShapeName = other.projectileShapeName; CLONE_SHAPEASSET(ProjectileShape);
projectileShape = other.projectileShape; // -- TSShape loads using projectileShapeName projectileShape = other.projectileShape; // -- TSShape loads using projectileShapeName
sound = other.sound; sound = other.sound;
splash = other.splash; splash = other.splash;
@ -335,7 +335,7 @@ void afxMagicMissileData::initPersistFields()
addField("particleEmitter", TYPEID<ParticleEmitterData>(), Offset(particleEmitter, afxMagicMissileData)); addField("particleEmitter", TYPEID<ParticleEmitterData>(), Offset(particleEmitter, afxMagicMissileData));
addField("particleWaterEmitter", TYPEID<ParticleEmitterData>(), Offset(particleWaterEmitter, afxMagicMissileData)); addField("particleWaterEmitter", TYPEID<ParticleEmitterData>(), Offset(particleWaterEmitter, afxMagicMissileData));
addField("projectileShapeName", TypeFilename, Offset(projectileShapeName, afxMagicMissileData)); INITPERSISTFIELD_SHAPEASSET(ProjectileShape, afxMagicMissileData, "Shape for the projectile");
addField("scale", TypePoint3F, Offset(scale, afxMagicMissileData)); addField("scale", TypePoint3F, Offset(scale, afxMagicMissileData));
addField("sound", TypeSFXTrackName, Offset(sound, afxMagicMissileData)); addField("sound", TypeSFXTrackName, Offset(sound, afxMagicMissileData));
@ -375,7 +375,7 @@ void afxMagicMissileData::initPersistFields()
// FIELDS ADDED BY MAGIC-MISSILE // FIELDS ADDED BY MAGIC-MISSILE
addField("missileShapeName", TypeFilename, myOffset(projectileShapeName)); //addField("missileShapeName", TypeFilename, myOffset(projectileShapeName));
addField("missileShapeScale", TypePoint3F, myOffset(scale)); addField("missileShapeScale", TypePoint3F, myOffset(scale));
addField("startingVelocityVector",TypePoint3F, myOffset(starting_vel_vec)); addField("startingVelocityVector",TypePoint3F, myOffset(starting_vel_vec));
@ -542,12 +542,12 @@ bool afxMagicMissileData::preload(bool server, String &errorStr)
Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet, bad datablockid(lightDesc): %d", lightDescId); Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet, bad datablockid(lightDesc): %d", lightDescId);
} }
if (projectileShapeName != ST_NULLSTRING) if (!mProjectileShapeAsset.isNull())
{ {
projectileShape = ResourceManager::get().load(projectileShapeName); projectileShape = mProjectileShapeAsset->getShapeResource();
if (bool(projectileShape) == false) if (bool(projectileShape) == false)
{ {
errorStr = String::ToString("afxMagicMissileData::load: Couldn't load shape \"%s\"", projectileShapeName); errorStr = String::ToString("afxMagicMissileData::load: Couldn't load shape \"%s\"", mProjectileShapeAssetId);
return false; return false;
} }
/* From stock Projectile code... /* From stock Projectile code...
@ -599,7 +599,8 @@ void afxMagicMissileData::packData(BitStream* stream)
{ {
Parent::packData(stream); Parent::packData(stream);
stream->writeString(projectileShapeName); PACKDATA_SHAPEASSET(ProjectileShape);
/* From stock Projectile code... /* From stock Projectile code...
stream->writeFlag(faceViewer); stream->writeFlag(faceViewer);
*/ */
@ -709,7 +710,7 @@ void afxMagicMissileData::unpackData(BitStream* stream)
{ {
Parent::unpackData(stream); Parent::unpackData(stream);
projectileShapeName = stream->readSTString(); UNPACKDATA_SHAPEASSET(ProjectileShape);
/* From stock Projectile code... /* From stock Projectile code...
faceViewer = stream->readFlag(); faceViewer = stream->readFlag();
*/ */

View file

@ -65,11 +65,15 @@ protected:
public: public:
enum { MaxLifetimeTicks = 4095 }; enum { MaxLifetimeTicks = 4095 };
void onShapeChanged() {}
public: public:
// variables set in datablock definition: // variables set in datablock definition:
// Shape related // Shape related
StringTableEntry projectileShapeName; DECLARE_SHAPEASSET(afxMagicMissileData, ProjectileShape, onShapeChanged);
DECLARE_SHAPEASSET_SETGET(afxMagicMissileData, ProjectileShape);
//StringTableEntry projectileShapeName;
//bool hasLight; //bool hasLight;
//F32 lightRadius; //F32 lightRadius;

View file

@ -51,7 +51,7 @@ ConsoleDocClass( afxBillboardData,
afxBillboardData::afxBillboardData() afxBillboardData::afxBillboardData()
{ {
color.set(1.0f, 1.0f, 1.0f, 1.0f); color.set(1.0f, 1.0f, 1.0f, 1.0f);
txr_name = ST_NULLSTRING; INIT_IMAGEASSET(Texture);
dimensions.set(1.0f, 1.0f); dimensions.set(1.0f, 1.0f);
texCoords[0].set(0.0f, 0.0f); texCoords[0].set(0.0f, 0.0f);
texCoords[1].set(0.0f, 1.0f); texCoords[1].set(0.0f, 1.0f);
@ -66,8 +66,7 @@ afxBillboardData::afxBillboardData(const afxBillboardData& other, bool temp_clon
: GameBaseData(other, temp_clone) : GameBaseData(other, temp_clone)
{ {
color = other.color; color = other.color;
txr_name = other.txr_name; CLONE_IMAGEASSET(Texture);
txr = other.txr;
dimensions = other.dimensions; dimensions = other.dimensions;
texCoords[0] = other.texCoords[0]; texCoords[0] = other.texCoords[0];
texCoords[1] = other.texCoords[1]; texCoords[1] = other.texCoords[1];
@ -95,8 +94,9 @@ void afxBillboardData::initPersistFields()
addField("color", TypeColorF, myOffset(color), addField("color", TypeColorF, myOffset(color),
"The color assigned to the quadrangle geometry. The way it combines with the given " "The color assigned to the quadrangle geometry. The way it combines with the given "
"texture varies according to the setting of the textureFunction field."); "texture varies according to the setting of the textureFunction field.");
addField("texture", TypeFilename, myOffset(txr_name),
"An image to use as the billboard's texture."); INITPERSISTFIELD_IMAGEASSET(Texture, afxBillboardData, "An image to use as the billboard's texture.");
addField("dimensions", TypePoint2F, myOffset(dimensions), addField("dimensions", TypePoint2F, myOffset(dimensions),
"A value-pair that specifies the horizontal and vertical dimensions of the billboard " "A value-pair that specifies the horizontal and vertical dimensions of the billboard "
"in scene units."); "in scene units.");
@ -123,7 +123,8 @@ void afxBillboardData::packData(BitStream* stream)
Parent::packData(stream); Parent::packData(stream);
stream->write(color); stream->write(color);
stream->writeString(txr_name); PACKDATA_IMAGEASSET(Texture);
mathWrite(*stream, dimensions); mathWrite(*stream, dimensions);
mathWrite(*stream, texCoords[0]); mathWrite(*stream, texCoords[0]);
mathWrite(*stream, texCoords[1]); mathWrite(*stream, texCoords[1]);
@ -139,8 +140,7 @@ void afxBillboardData::unpackData(BitStream* stream)
Parent::unpackData(stream); Parent::unpackData(stream);
stream->read(&color); stream->read(&color);
txr_name = stream->readSTString(); UNPACKDATA_IMAGEASSET(Texture);
txr = GFXTexHandle();
mathRead(*stream, &dimensions); mathRead(*stream, &dimensions);
mathRead(*stream, &texCoords[0]); mathRead(*stream, &texCoords[0]);
mathRead(*stream, &texCoords[1]); mathRead(*stream, &texCoords[1]);
@ -156,14 +156,6 @@ bool afxBillboardData::preload(bool server, String &errorStr)
if (!Parent::preload(server, errorStr)) if (!Parent::preload(server, errorStr))
return false; return false;
if (!server)
{
if (txr_name && txr_name[0] != '\0')
{
txr.set(txr_name, &GFXStaticTextureSRGBProfile, "Billboard Texture");
}
}
// if blend-style is set to User, check for defined blend-factors // if blend-style is set to User, check for defined blend-factors
if (blendStyle == BlendUser && (srcBlendFactor == BLEND_UNDEFINED || dstBlendFactor == BLEND_UNDEFINED)) if (blendStyle == BlendUser && (srcBlendFactor == BLEND_UNDEFINED || dstBlendFactor == BLEND_UNDEFINED))
{ {

View file

@ -47,8 +47,9 @@ public:
}; };
public: public:
StringTableEntry txr_name; DECLARE_IMAGEASSET(afxBillboardData, Texture, onChangeTexture, GFXStaticTextureSRGBProfile);
GFXTexHandle txr; DECLARE_IMAGEASSET_SETGET(afxBillboardData, Texture);
LinearColorF color; LinearColorF color;
Point2F texCoords[4]; Point2F texCoords[4];
@ -70,6 +71,8 @@ public:
static void initPersistFields(); static void initPersistFields();
void onChangeTexture() {}
DECLARE_CONOBJECT(afxBillboardData); DECLARE_CONOBJECT(afxBillboardData);
DECLARE_CATEGORY("AFX"); DECLARE_CATEGORY("AFX");
}; };

View file

@ -87,7 +87,7 @@ void afxBillboard::_renderBillboard(ObjectRenderInst *ri, SceneRenderState* stat
GFXTransformSaver saver; GFXTransformSaver saver;
GFX->multWorld(getRenderTransform()); GFX->multWorld(getRenderTransform());
GFX->setTexture(0, mDataBlock->txr); GFX->setTexture(0, mDataBlock->mTexture);
MatrixF worldmod = GFX->getWorldMatrix(); MatrixF worldmod = GFX->getWorldMatrix();
MatrixF viewmod = GFX->getViewMatrix(); MatrixF viewmod = GFX->getViewMatrix();

View file

@ -54,7 +54,7 @@ ConsoleDocClass( afxModelData,
afxModelData::afxModelData() afxModelData::afxModelData()
{ {
shapeName = ST_NULLSTRING; INIT_SHAPEASSET(Shape);
sequence = ST_NULLSTRING; sequence = ST_NULLSTRING;
seq_rate = 1.0f; seq_rate = 1.0f;
seq_offset = 0.0f; seq_offset = 0.0f;
@ -84,8 +84,7 @@ afxModelData::afxModelData()
afxModelData::afxModelData(const afxModelData& other, bool temp_clone) : GameBaseData(other, temp_clone) afxModelData::afxModelData(const afxModelData& other, bool temp_clone) : GameBaseData(other, temp_clone)
{ {
shapeName = other.shapeName; CLONE_SHAPEASSET(Shape);
shape = other.shape; // --
sequence = other.sequence; sequence = other.sequence;
seq_rate = other.seq_rate; seq_rate = other.seq_rate;
seq_offset = other.seq_offset; seq_offset = other.seq_offset;
@ -127,12 +126,11 @@ bool afxModelData::preload(bool server, String &errorStr)
if (server) if (server)
return true; return true;
if (shapeName != ST_NULLSTRING && !shape) if (mShapeAsset.notNull())
{ {
shape = ResourceManager::get().load(shapeName); if (!mShape)
if (!shape)
{ {
errorStr = String::ToString("afxModelData::load: Failed to load shape \"%s\"", shapeName); errorStr = String::ToString("afxModelData::load: Failed to load shape \"%s\"", mShapeAssetId);
return false; return false;
} }
@ -164,7 +162,7 @@ bool afxModelData::preload(bool server, String &errorStr)
if (txr_tag_remappings.size() == 0) if (txr_tag_remappings.size() == 0)
{ {
// this little hack forces the textures to preload // this little hack forces the textures to preload
TSShapeInstance* pDummy = new TSShapeInstance(shape); TSShapeInstance* pDummy = new TSShapeInstance(mShape);
delete pDummy; delete pDummy;
} }
} }
@ -176,9 +174,8 @@ bool afxModelData::preload(bool server, String &errorStr)
void afxModelData::initPersistFields() void afxModelData::initPersistFields()
{ {
addField("shapeFile", TypeFilename, myOffset(shapeName), INITPERSISTFIELD_SHAPEASSET(Shape, afxModelData, "The name of a .dts format file to use for the model.");
"The name of a .dts format file to use for the model."); addField("sequence", TypeString, myOffset(sequence),
addField("sequence", TypeFilename, myOffset(sequence),
"The name of an animation sequence to play in the model."); "The name of an animation sequence to play in the model.");
addField("sequenceRate", TypeF32, myOffset(seq_rate), addField("sequenceRate", TypeF32, myOffset(seq_rate),
"The rate of playback for the sequence."); "The rate of playback for the sequence.");
@ -256,7 +253,7 @@ void afxModelData::packData(BitStream* stream)
{ {
Parent::packData(stream); Parent::packData(stream);
stream->writeString(shapeName); PACKDATA_SHAPEASSET(Shape);
stream->writeString(sequence); stream->writeString(sequence);
stream->write(seq_rate); stream->write(seq_rate);
stream->write(seq_offset); stream->write(seq_offset);
@ -288,7 +285,7 @@ void afxModelData::unpackData(BitStream* stream)
{ {
Parent::unpackData(stream); Parent::unpackData(stream);
shapeName = stream->readSTString(); UNPACKDATA_SHAPEASSET(Shape);
sequence = stream->readSTString(); sequence = stream->readSTString();
stream->read(&seq_rate); stream->read(&seq_rate);
stream->read(&seq_offset); stream->read(&seq_offset);
@ -316,19 +313,24 @@ void afxModelData::unpackData(BitStream* stream)
stream->read(&shadowSphereAdjust); stream->read(&shadowSphereAdjust);
} }
void afxModelData::onPerformSubstitutions() void afxModelData::onPerformSubstitutions()
{ {
if (shapeName != ST_NULLSTRING) if (mShapeAssetId != StringTable->EmptyString())
{ {
shape = ResourceManager::get().load(shapeName); mShapeAsset = mShapeAssetId;
if (!shape) if (mShapeAsset.notNull())
{ {
Con::errorf("afxModelData::onPerformSubstitutions: Failed to load shape \"%s\"", shapeName); mShape = mShapeAsset->getShapeResource();
return; }
}
// REMAP-TEXTURE-TAGS ISSUES? if (!mShape)
} {
Con::errorf("afxModelData::onPerformSubstitutions: Failed to load shape \"%s\"", mShapeAssetId);
return;
}
// REMAP-TEXTURE-TAGS ISSUES?
}
} }
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
@ -401,18 +403,18 @@ bool afxModel::onAdd()
return false; return false;
// setup our bounding box // setup our bounding box
if (mDataBlock->shape) if (mDataBlock->mShape)
mObjBox = mDataBlock->shape->mBounds; mObjBox = mDataBlock->mShape->mBounds;
else else
mObjBox = Box3F(Point3F(-1, -1, -1), Point3F(1, 1, 1)); mObjBox = Box3F(Point3F(-1, -1, -1), Point3F(1, 1, 1));
// setup the shape instance and sequence // setup the shape instance and sequence
if (mDataBlock->shape) if (mDataBlock->mShape)
{ {
if (/*isClientObject() && */mDataBlock->txr_tag_remappings.size() > 0) if (/*isClientObject() && */mDataBlock->txr_tag_remappings.size() > 0)
{ {
// temporarily substitute material tags with alternates // temporarily substitute material tags with alternates
TSMaterialList* mat_list = mDataBlock->shape->materialList; TSMaterialList* mat_list = mDataBlock->mShape->materialList;
if (mat_list) if (mat_list)
{ {
for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++) for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++)
@ -433,7 +435,7 @@ bool afxModel::onAdd()
} }
} }
shape_inst = new TSShapeInstance(mDataBlock->shape); shape_inst = new TSShapeInstance(mDataBlock->mShape);
if (true) // isClientObject()) if (true) // isClientObject())
{ {
@ -442,7 +444,7 @@ bool afxModel::onAdd()
// restore the material tags to original form // restore the material tags to original form
if (mDataBlock->txr_tag_remappings.size() > 0) if (mDataBlock->txr_tag_remappings.size() > 0)
{ {
TSMaterialList* mat_list = mDataBlock->shape->materialList; TSMaterialList* mat_list = mDataBlock->mShape->materialList;
if (mat_list) if (mat_list)
{ {
for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++) for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++)
@ -508,14 +510,14 @@ bool afxModel::onAdd()
resetWorldBox(); resetWorldBox();
if (mDataBlock->shape) if (mDataBlock->mShape)
{ {
// Scan out the collision hulls... // Scan out the collision hulls...
static const String sCollisionStr( "collision-" ); static const String sCollisionStr( "collision-" );
for (U32 i = 0; i < mDataBlock->shape->details.size(); i++) for (U32 i = 0; i < mDataBlock->mShape->details.size(); i++)
{ {
const String &name = mDataBlock->shape->names[mDataBlock->shape->details[i].nameIndex]; const String &name = mDataBlock->mShape->names[mDataBlock->mShape->details[i].nameIndex];
if (name.compare( sCollisionStr, sCollisionStr.length(), String::NoCase ) == 0) if (name.compare( sCollisionStr, sCollisionStr.length(), String::NoCase ) == 0)
{ {
@ -529,7 +531,7 @@ bool afxModel::onAdd()
char buff[128]; char buff[128];
dSprintf(buff, sizeof(buff), "LOS-%d", i + 1 + 8/*MaxCollisionShapes*/); dSprintf(buff, sizeof(buff), "LOS-%d", i + 1 + 8/*MaxCollisionShapes*/);
U32 los = mDataBlock->shape->findDetail(buff); U32 los = mDataBlock->mShape->findDetail(buff);
if (los == -1) if (los == -1)
mLOSDetails.last() = i; mLOSDetails.last() = i;
else else
@ -540,9 +542,9 @@ bool afxModel::onAdd()
// Snag any "unmatched" LOS details // Snag any "unmatched" LOS details
static const String sLOSStr( "LOS-" ); static const String sLOSStr( "LOS-" );
for (U32 i = 0; i < mDataBlock->shape->details.size(); i++) for (U32 i = 0; i < mDataBlock->mShape->details.size(); i++)
{ {
const String &name = mDataBlock->shape->names[mDataBlock->shape->details[i].nameIndex]; const String &name = mDataBlock->mShape->names[mDataBlock->mShape->details[i].nameIndex];
if (name.compare( sLOSStr, sLOSStr.length(), String::NoCase ) == 0) if (name.compare( sLOSStr, sLOSStr.length(), String::NoCase ) == 0)
{ {

View file

@ -27,6 +27,7 @@
#define _AFX_MODEL_H_ #define _AFX_MODEL_H_
#include "renderInstance/renderPassManager.h" #include "renderInstance/renderPassManager.h"
#include "T3D/assets/ShapeAsset.h"
class ParticleEmitterData; class ParticleEmitterData;
class ParticleEmitter; class ParticleEmitter;
@ -42,8 +43,11 @@ struct afxModelData : public GameBaseData
{ {
typedef GameBaseData Parent; typedef GameBaseData Parent;
StringTableEntry shapeName; DECLARE_SHAPEASSET(afxModelData, Shape, onShapeChanged);
DECLARE_SHAPEASSET_SETGET(afxModelData, Shape);
StringTableEntry sequence; StringTableEntry sequence;
F32 seq_rate; F32 seq_rate;
F32 seq_offset; F32 seq_offset;
F32 alpha_mult; F32 alpha_mult;
@ -63,8 +67,6 @@ struct afxModelData : public GameBaseData
StringTableEntry remap_txr_tags; StringTableEntry remap_txr_tags;
Resource<TSShape> shape;
bool overrideLightingOptions; bool overrideLightingOptions;
bool receiveSunLight; bool receiveSunLight;
bool receiveLMLighting; bool receiveLMLighting;
@ -93,6 +95,9 @@ public:
static void initPersistFields(); static void initPersistFields();
void onShapeChanged() {}
void onSequenceChanged() {}
DECLARE_CONOBJECT(afxModelData); DECLARE_CONOBJECT(afxModelData);
DECLARE_CATEGORY("AFX"); DECLARE_CATEGORY("AFX");
}; };
@ -148,9 +153,9 @@ public:
void setSequenceRateFactor(F32 factor); void setSequenceRateFactor(F32 factor);
void setSortPriority(S8 priority) { sort_priority = priority; } void setSortPriority(S8 priority) { sort_priority = priority; }
const char* getShapeFileName() const { return mDataBlock->shapeName; } const char* getShapeFileName() const { return mDataBlock->getShape(); }
void setVisibility(bool flag) { is_visible = flag; } void setVisibility(bool flag) { is_visible = flag; }
TSShape* getTSShape() { return mDataBlock->shape; } TSShape* getTSShape() { return mDataBlock->getShapeResource(); }
TSShapeInstance* getTSShapeInstance() { return shape_inst; } TSShapeInstance* getTSShapeInstance() { return shape_inst; }
U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans); U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans);

View file

@ -70,7 +70,7 @@ afxStaticShapeData::afxStaticShapeData(const afxStaticShapeData& other, bool tem
void afxStaticShapeData::initPersistFields() void afxStaticShapeData::initPersistFields()
{ {
addField("sequence", TypeFilename, myOffset(sequence), addField("sequence", TypeString, myOffset(sequence),
"An animation sequence in the StaticShape to play."); "An animation sequence in the StaticShape to play.");
addField("ignoreSceneAmbient", TypeBool, myOffset(ignore_scene_amb), addField("ignoreSceneAmbient", TypeBool, myOffset(ignore_scene_amb),
"..."); "...");

View file

@ -78,7 +78,8 @@ bool afxZodiacData::sPreferDestinationGradients = false;
afxZodiacData::afxZodiacData() afxZodiacData::afxZodiacData()
{ {
txr_name = ST_NULLSTRING; INIT_IMAGEASSET(Texture);
radius_xy = 1; radius_xy = 1;
vert_range.set(0.0f, 0.0f); vert_range.set(0.0f, 0.0f);
start_ang = 0; start_ang = 0;
@ -119,8 +120,8 @@ afxZodiacData::afxZodiacData()
afxZodiacData::afxZodiacData(const afxZodiacData& other, bool temp_clone) : GameBaseData(other, temp_clone) afxZodiacData::afxZodiacData(const afxZodiacData& other, bool temp_clone) : GameBaseData(other, temp_clone)
{ {
txr_name = other.txr_name; CLONE_IMAGEASSET(Texture);
txr = other.txr;
radius_xy = other.radius_xy; radius_xy = other.radius_xy;
vert_range = other.vert_range; vert_range = other.vert_range;
start_ang = other.start_ang; start_ang = other.start_ang;
@ -155,8 +156,7 @@ EndImplementEnumType;
void afxZodiacData::initPersistFields() void afxZodiacData::initPersistFields()
{ {
addField("texture", TypeFilename, Offset(txr_name, afxZodiacData), INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacData, "An image to use as the zodiac's texture.");
"An image to use as the zodiac's texture.");
addField("radius", TypeF32, Offset(radius_xy, afxZodiacData), addField("radius", TypeF32, Offset(radius_xy, afxZodiacData),
"The zodiac's radius in scene units."); "The zodiac's radius in scene units.");
addField("verticalRange", TypePoint2F, Offset(vert_range, afxZodiacData), addField("verticalRange", TypePoint2F, Offset(vert_range, afxZodiacData),
@ -269,7 +269,7 @@ void afxZodiacData::packData(BitStream* stream)
merge_zflags(); merge_zflags();
stream->writeString(txr_name); PACKDATA_IMAGEASSET(Texture);
stream->write(radius_xy); stream->write(radius_xy);
stream->write(vert_range.x); stream->write(vert_range.x);
stream->write(vert_range.y); stream->write(vert_range.y);
@ -294,8 +294,7 @@ void afxZodiacData::unpackData(BitStream* stream)
{ {
Parent::unpackData(stream); Parent::unpackData(stream);
txr_name = stream->readSTString(); UNPACKDATA_IMAGEASSET(Texture);
txr = GFXTexHandle();
stream->read(&radius_xy); stream->read(&radius_xy);
stream->read(&vert_range.x); stream->read(&vert_range.x);
stream->read(&vert_range.y); stream->read(&vert_range.y);
@ -323,14 +322,6 @@ bool afxZodiacData::preload(bool server, String &errorStr)
if (!Parent::preload(server, errorStr)) if (!Parent::preload(server, errorStr))
return false; return false;
if (!server)
{
if (txr_name && txr_name[0] != '\0')
{
txr.set(txr_name, &AFX_GFXZodiacTextureProfile, "Zodiac Texture");
}
}
if (vert_range.x == 0.0f && vert_range.y == 0.0f) if (vert_range.x == 0.0f && vert_range.y == 0.0f)
vert_range.x = vert_range.y = radius_xy; vert_range.x = vert_range.y = radius_xy;
@ -349,11 +340,23 @@ void afxZodiacData::onStaticModified(const char* slot, const char* newValue)
} }
void afxZodiacData::onPerformSubstitutions() void afxZodiacData::onPerformSubstitutions()
{ {
if (txr_name && txr_name[0] != '\0') if (mTextureAssetId != StringTable->EmptyString())
{ {
txr.set(txr_name, &AFX_GFXZodiacTextureProfile, "Zodiac Texture"); mTextureAsset = mTextureAssetId;
} if (mTextureAsset.notNull())
{
if (getTexture() != StringTable->EmptyString() && mTextureName != StringTable->insert("texhandle"))
{
if (mTextureAsset.notNull())
{
mTextureAsset->getChangedSignal().notify(this, &afxZodiacData::onImageChanged);
}
mTexture.set(getTexture(), mTextureProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__));
}
}
}
} }
F32 afxZodiacData::calcRotationAngle(F32 elapsed, F32 rate_factor) F32 afxZodiacData::calcRotationAngle(F32 elapsed, F32 rate_factor)

View file

@ -35,6 +35,8 @@
#include "console/typeValidators.h" #include "console/typeValidators.h"
GFX_DeclareTextureProfile(AFX_GFXZodiacTextureProfile);
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// afxZodiacData // afxZodiacData
@ -54,9 +56,12 @@ public:
static void convertGradientRangeFromDegrees(Point2F& gradrange, const Point2F& gradrange_deg); static void convertGradientRangeFromDegrees(Point2F& gradrange, const Point2F& gradrange_deg);
void onImageChanged() {}
public: public:
StringTableEntry txr_name; DECLARE_IMAGEASSET(afxZodiacData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile);
GFXTexHandle txr; DECLARE_IMAGEASSET_SETGET(afxZodiacData, Texture);
F32 radius_xy; F32 radius_xy;
Point2F vert_range; Point2F vert_range;
F32 start_ang; F32 start_ang;
@ -125,8 +130,6 @@ public:
typedef afxZodiacData::BlendType afxZodiac_BlendType; typedef afxZodiacData::BlendType afxZodiac_BlendType;
DefineEnumType( afxZodiac_BlendType ); DefineEnumType( afxZodiac_BlendType );
GFX_DeclareTextureProfile(AFX_GFXZodiacTextureProfile);
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#endif // _AFX_ZODIAC_H_ #endif // _AFX_ZODIAC_H_

View file

@ -61,7 +61,7 @@ void afxZodiacMgr::addTerrainZodiac(Point3F& pos, F32 radius, LinearColorF& colo
z.color = color.toColorI(); z.color = color.toColorI();
z.angle = mDegToRad(angle); z.angle = mDegToRad(angle);
z.zflags = zode->zflags; z.zflags = zode->zflags;
z.txr = &zode->txr; z.txr = &zode->mTexture;
z.distance_max = zode->distance_max*zode->distance_max; z.distance_max = zode->distance_max*zode->distance_max;
z.distance_falloff = zode->distance_falloff*zode->distance_falloff; z.distance_falloff = zode->distance_falloff*zode->distance_falloff;
@ -84,7 +84,7 @@ void afxZodiacMgr::addInteriorZodiac(Point3F& pos, F32 radius, Point2F& vert_ran
z.color = color.toColorI(); z.color = color.toColorI();
z.angle = mDegToRad(angle); z.angle = mDegToRad(angle);
z.zflags = zode->zflags; z.zflags = zode->zflags;
z.txr = &zode->txr; z.txr = &zode->mTexture;
z.distance_max = zode->distance_max*zode->distance_max; z.distance_max = zode->distance_max*zode->distance_max;
z.distance_falloff = zode->distance_falloff*zode->distance_falloff; z.distance_falloff = zode->distance_falloff*zode->distance_falloff;

View file

@ -51,7 +51,8 @@ ConsoleDocClass( afxZodiacPlaneData,
afxZodiacPlaneData::afxZodiacPlaneData() afxZodiacPlaneData::afxZodiacPlaneData()
{ {
txr_name = ST_NULLSTRING; INIT_IMAGEASSET(Texture);
radius_xy = 1; radius_xy = 1;
start_ang = 0; start_ang = 0;
ang_per_sec = 0; ang_per_sec = 0;
@ -70,8 +71,8 @@ afxZodiacPlaneData::afxZodiacPlaneData()
afxZodiacPlaneData::afxZodiacPlaneData(const afxZodiacPlaneData& other, bool temp_clone) afxZodiacPlaneData::afxZodiacPlaneData(const afxZodiacPlaneData& other, bool temp_clone)
: GameBaseData(other, temp_clone) : GameBaseData(other, temp_clone)
{ {
txr_name = other.txr_name; CLONE_IMAGEASSET(Texture);
txr = other.txr;
radius_xy = other.radius_xy; radius_xy = other.radius_xy;
start_ang = other.start_ang; start_ang = other.start_ang;
ang_per_sec = other.ang_per_sec; ang_per_sec = other.ang_per_sec;
@ -110,8 +111,8 @@ EndImplementEnumType;
void afxZodiacPlaneData::initPersistFields() void afxZodiacPlaneData::initPersistFields()
{ {
addField("texture", TypeFilename, myOffset(txr_name), INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacPlaneData, "An image to use as the zodiac's texture.");
"An image to use as the zodiac's texture.");
addField("radius", TypeF32, myOffset(radius_xy), addField("radius", TypeF32, myOffset(radius_xy),
"The zodiac's radius in scene units."); "The zodiac's radius in scene units.");
addField("startAngle", TypeF32, myOffset(start_ang), addField("startAngle", TypeF32, myOffset(start_ang),
@ -164,7 +165,8 @@ void afxZodiacPlaneData::packData(BitStream* stream)
merge_zflags(); merge_zflags();
stream->writeString(txr_name); PACKDATA_IMAGEASSET(Texture);
stream->write(radius_xy); stream->write(radius_xy);
stream->write(start_ang); stream->write(start_ang);
stream->write(ang_per_sec); stream->write(ang_per_sec);
@ -182,8 +184,8 @@ void afxZodiacPlaneData::unpackData(BitStream* stream)
{ {
Parent::unpackData(stream); Parent::unpackData(stream);
txr_name = stream->readSTString(); UNPACKDATA_IMAGEASSET(Texture);
txr = GFXTexHandle();
stream->read(&radius_xy); stream->read(&radius_xy);
stream->read(&start_ang); stream->read(&start_ang);
stream->read(&ang_per_sec); stream->read(&ang_per_sec);
@ -204,14 +206,6 @@ bool afxZodiacPlaneData::preload(bool server, String &errorStr)
if (!Parent::preload(server, errorStr)) if (!Parent::preload(server, errorStr))
return false; return false;
if (!server)
{
if (txr_name && txr_name[0] != '\0')
{
txr.set(txr_name, &AFX_GFXZodiacTextureProfile, "Zodiac Texture");
}
}
return true; return true;
} }

View file

@ -28,6 +28,10 @@
#include "afx/ce/afxZodiacDefs.h" #include "afx/ce/afxZodiacDefs.h"
#ifndef _AFX_ZODIAC_H_
#include "afx/ce/afxZodiac.h"
#endif
class afxZodiacPlaneData : public GameBaseData, public afxZodiacDefs class afxZodiacPlaneData : public GameBaseData, public afxZodiacDefs
{ {
typedef GameBaseData Parent; typedef GameBaseData Parent;
@ -52,9 +56,12 @@ public:
FACES_BITS = 3 FACES_BITS = 3
}; };
void onImageChanged() {}
public: public:
StringTableEntry txr_name; DECLARE_IMAGEASSET(afxZodiacPlaneData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile);
GFXTexHandle txr; DECLARE_IMAGEASSET_SETGET(afxZodiacPlaneData, Texture);
F32 radius_xy; F32 radius_xy;
F32 start_ang; F32 start_ang;
F32 ang_per_sec; F32 ang_per_sec;

View file

@ -207,7 +207,7 @@ void afxZodiacPlane::_renderZodiacPlane(ObjectRenderInst *ri, SceneRenderState*
GFXTransformSaver saver; GFXTransformSaver saver;
GFX->multWorld(getRenderTransform()); GFX->multWorld(getRenderTransform());
GFX->setTexture(0, mDataBlock->txr); GFX->setTexture(0, mDataBlock->mTexture);
PrimBuild::begin(GFXTriangleStrip, 4); PrimBuild::begin(GFXTriangleStrip, 4);
{ {

View file

@ -98,23 +98,23 @@ public:
/// Asset configuration. /// Asset configuration.
inline void setAssetName(const char* pAssetName) { if (mpOwningAssetManager == NULL) mpAssetDefinition->mAssetName = StringTable->insert(pAssetName); } inline void setAssetName(const char* pAssetName) { if (mpOwningAssetManager == NULL) mpAssetDefinition->mAssetName = StringTable->insert(pAssetName); }
inline StringTableEntry getAssetName(void) const { return mpAssetDefinition->mAssetName; } inline StringTableEntry getAssetName(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetName : StringTable->EmptyString(); }
void setAssetDescription(const char* pAssetDescription); void setAssetDescription(const char* pAssetDescription);
inline StringTableEntry getAssetDescription(void) const { return mpAssetDefinition->mAssetDescription; } inline StringTableEntry getAssetDescription(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetDescription : StringTable->EmptyString(); }
void setAssetCategory(const char* pAssetCategory); void setAssetCategory(const char* pAssetCategory);
inline StringTableEntry getAssetCategory(void) const { return mpAssetDefinition->mAssetCategory; } inline StringTableEntry getAssetCategory(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetCategory : StringTable->EmptyString(); }
void setAssetAutoUnload(const bool autoUnload); void setAssetAutoUnload(const bool autoUnload);
inline bool getAssetAutoUnload(void) const { return mpAssetDefinition->mAssetAutoUnload; } inline bool getAssetAutoUnload(void) const { return mpAssetDefinition->mAssetAutoUnload; }
void setAssetInternal(const bool assetInternal); void setAssetInternal(const bool assetInternal);
inline bool getAssetInternal(void) const { return mpAssetDefinition->mAssetInternal; } inline bool getAssetInternal(void) const { return mpAssetDefinition->mAssetInternal; }
inline bool getAssetPrivate(void) const { return mpAssetDefinition->mAssetPrivate; } inline bool getAssetPrivate(void) const { return mpAssetDefinition->mAssetPrivate; }
inline StringTableEntry getAssetType(void) const { return mpAssetDefinition->mAssetType; } inline StringTableEntry getAssetType(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetType: StringTable->EmptyString(); }
inline S32 getAcquiredReferenceCount(void) const { return mAcquireReferenceCount; } inline S32 getAcquiredReferenceCount(void) const { return mAcquireReferenceCount; }
inline bool getOwned(void) const { return mpOwningAssetManager != NULL; } inline bool getOwned(void) const { return mpOwningAssetManager != NULL; }
// Asset Id is only available once registered with the asset manager. // Asset Id is only available once registered with the asset manager.
inline StringTableEntry getAssetId(void) const { return mpAssetDefinition->mAssetId; } inline StringTableEntry getAssetId(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetId : StringTable->EmptyString(); }
/// Expanding/Collapsing asset paths is only available once registered with the asset manager. /// Expanding/Collapsing asset paths is only available once registered with the asset manager.
StringTableEntry expandAssetFilePath(const char* pAssetFilePath) const; StringTableEntry expandAssetFilePath(const char* pAssetFilePath) const;

View file

@ -72,7 +72,7 @@ ConsoleSetType( TypeAssetLooseFilePath )
StringTableEntry* assetLooseFilePath = (StringTableEntry*)(dptr); StringTableEntry* assetLooseFilePath = (StringTableEntry*)(dptr);
// Update asset loose file-path value. // Update asset loose file-path value.
*assetLooseFilePath = StringTable->insert(pFieldValue); *assetLooseFilePath = StringTable->insert(pFieldValue, true);
return; return;
} }

View file

@ -975,13 +975,16 @@ ConsoleSetType( TypePID )
else else
{ {
Torque::UUID uuid; Torque::UUID uuid;
if( !uuid.fromString( argv[ 0 ] ) )
{ if( !uuid.fromString( argv[ 0 ] ) )
{
Con::errorf( "Error parsing UUID in PID: '%s'", argv[ 0 ] ); Con::errorf( "Error parsing UUID in PID: '%s'", argv[ 0 ] );
*pid = NULL; *pid = NULL;
} }
else else
*pid = SimPersistID::findOrCreate( uuid ); {
*pid = SimPersistID::findOrCreate(uuid);
}
} }
} }
else else

View file

@ -68,32 +68,15 @@
#include <ctype.h> #include <ctype.h>
#include "core/util/md5.h" #include "core/util/md5.h"
#include "core/util/uuid.h"
#include "console/enginePrimitives.h" #include "console/enginePrimitives.h"
#if defined (TORQUE_OS_MAC) && (defined(TORQUE_CPU_X64) || defined(TORQUE_CPU_ARM64))
typedef unsigned int unsigned32;
#else
typedef unsigned long unsigned32;
#endif
typedef unsigned short unsigned16;
typedef unsigned char unsigned8;
typedef struct { typedef struct {
char nodeID[6]; char nodeID[6];
} uuid_node_t; } uuid_node_t;
#undef xuuid_t #undef xuuid_t
typedef struct _uuid_t
{
unsigned32 time_low;
unsigned16 time_mid;
unsigned16 time_hi_and_version;
unsigned8 clock_seq_hi_and_reserved;
unsigned8 clock_seq_low;
unsigned8 node[6];
} xuuid_t;
/* data type for UUID generator persistent state */ /* data type for UUID generator persistent state */
typedef struct { typedef struct {

View file

@ -28,11 +28,27 @@
#endif #endif
#include "console/engineTypeInfo.h" #include "console/engineTypeInfo.h"
typedef unsigned int unsigned32;
typedef unsigned short unsigned16;
typedef unsigned char unsigned8;
class xuuid_t
{
public:
unsigned32 time_low;
unsigned16 time_mid;
unsigned16 time_hi_and_version;
unsigned8 clock_seq_hi_and_reserved;
unsigned8 clock_seq_low;
unsigned8 node[6];
};
namespace Torque namespace Torque
{ {
/// A universally unique identifier. /// A universally unique identifier.
class UUID class UUID : public xuuid_t
{ {
friend class UUIDEngineExport; friend class UUIDEngineExport;
public: public:

View file

@ -79,7 +79,8 @@ void NodeListEvent::unpack(NetConnection* conn, BitStream* stream)
stream->read(&mTotalNodes); stream->read(&mTotalNodes);
stream->read(&mLocalListStart); stream->read(&mLocalListStart);
mNodeList->mId = mId; if (mNodeList)
mNodeList->mId = mId;
// NOTE: Child class needs to populate the local node list // NOTE: Child class needs to populate the local node list
} }

View file

@ -83,9 +83,34 @@ bool OSXFont::create( const char* name, dsize_t size, U32 charset )
{ {
// Sanity! // Sanity!
AssertFatal( name != NULL, "Cannot create a NULL font name." ); AssertFatal( name != NULL, "Cannot create a NULL font name." );
bool doBold = false;
bool doItalic = false;
String nameStr = name;
nameStr = nameStr.trim();
bool haveModifier;
do
{
haveModifier = false;
if( nameStr.compare( "Bold", 4, String::NoCase | String::Right ) == 0 )
{
doBold = true;
nameStr = nameStr.substr( 0, nameStr.length() - 4 ).trim();
haveModifier = true;
}
if( nameStr.compare( "Italic", 6, String::NoCase | String::Right ) == 0 )
{
doItalic = true;
nameStr = nameStr.substr( 0, nameStr.length() - 6 ).trim();
haveModifier = true;
}
}
while( haveModifier );
// Generate compatible font name. // Generate compatible font name.
CFStringRef fontName = CFStringCreateWithCString( kCFAllocatorDefault, name, kCFStringEncodingUTF8 ); NSString* fontName = [NSString stringWithUTF8String: nameStr.utf8()];
// Sanity! // Sanity!
if ( !fontName ) if ( !fontName )
@ -94,12 +119,22 @@ bool OSXFont::create( const char* name, dsize_t size, U32 charset )
return false; return false;
} }
// Use Windows as a baseline (96 DPI) and adjust accordingly. NSMutableDictionary* fontAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys:
F32 scaledSize = size * (72.0f/96.0f); fontName, (NSString*)kCTFontFamilyNameAttribute,
scaledSize = mRound(scaledSize); [NSNumber numberWithFloat: (float)size], (NSString*)kCTFontSizeAttribute,
nil];
// Create the font reference. CTFontSymbolicTraits traits = 0x0;
mFontRef = CTFontCreateWithName( fontName, scaledSize, NULL ); if (doBold)
traits |= kCTFontBoldTrait;
if (doItalic)
traits |= kCTFontItalicTrait;
CTFontDescriptorRef descriptor =
CTFontDescriptorCreateWithAttributes((CFDictionaryRef)fontAttributes);
mFontRef = CTFontCreateWithFontDescriptor(descriptor, 0.0, NULL);
CFRelease(descriptor);
// Sanity! // Sanity!
if ( !mFontRef ) if ( !mFontRef )
@ -108,6 +143,10 @@ bool OSXFont::create( const char* name, dsize_t size, U32 charset )
return false; return false;
} }
// Apply font traits if we have any by creating a copy of the font
if (traits != 0x0)
mFontRef = CTFontCreateCopyWithSymbolicTraits(mFontRef, (float)size, NULL, traits, traits);
// Fetch font metrics. // Fetch font metrics.
CGFloat ascent = CTFontGetAscent( mFontRef ); CGFloat ascent = CTFontGetAscent( mFontRef );
CGFloat descent = CTFontGetDescent( mFontRef ); CGFloat descent = CTFontGetDescent( mFontRef );
@ -227,17 +266,8 @@ PlatformFont::CharInfo& OSXFont::getCharInfo(const UTF16 character) const
CGPoint renderOrigin; CGPoint renderOrigin;
renderOrigin.x = -characterInfo.xOrigin; renderOrigin.x = -characterInfo.xOrigin;
renderOrigin.y = -characterInfo.yOrigin; renderOrigin.y = -characterInfo.yOrigin;
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
CTFontDrawGlyphs( mFontRef, &characterGlyph, &renderOrigin, 1, bitmapContext ); CTFontDrawGlyphs( mFontRef, &characterGlyph, &renderOrigin, 1, bitmapContext );
#else
CGFontRef cgFont = CTFontCopyGraphicsFont(mFontRef, NULL);
CGContextSetFont(bitmapContext, cgFont);
CGContextSetFontSize(bitmapContext, CTFontGetSize(mFontRef));
CGContextShowGlyphsAtPositions(bitmapContext, &characterGlyph, &renderOrigin, 1);
CFRelease(cgFont);
#endif
#if 0 #if 0
Con::printf("Width:%f, Height:%f, OriginX:%f, OriginY:%f", Con::printf("Width:%f, Height:%f, OriginX:%f, OriginY:%f",
@ -255,4 +285,4 @@ PlatformFont::CharInfo& OSXFont::getCharInfo(const UTF16 character) const
// Return character information. // Return character information.
return characterInfo; return characterInfo;
} }

View file

@ -55,7 +55,7 @@ void AccuTexFeatGLSL::processPix(Vector<ShaderComponent*> &componentList,
output = meta; output = meta;
// OUT.col // OUT.col
Var *color = (Var*) LangElement::find( "col1" ); Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1));
if (!color) if (!color)
{ {
output = new GenOp(" //NULL COLOR!"); output = new GenOp(" //NULL COLOR!");
@ -236,4 +236,4 @@ Var* AccuTexFeatGLSL::addOutAccuVec(Vector<ShaderComponent*> &componentList, Mul
} }
return outAccuVec; return outAccuVec;
} }

View file

@ -452,7 +452,7 @@ void NormalsOutFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
} }
LangElement *normalOut; LangElement *normalOut;
Var *outColor = (Var*)LangElement::find( "col" ); Var *outColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( outColor && !fd.features[MFT_AlphaTest] ) if ( outColor && !fd.features[MFT_AlphaTest] )
normalOut = new GenOp( "float4( ( -@ + 1 ) * 0.5, @.a )", wsNormal, outColor ); normalOut = new GenOp( "float4( ( -@ + 1 ) * 0.5, @.a )", wsNormal, outColor );
else else

View file

@ -30,7 +30,7 @@ void DebugVizGLSL::processPix(Vector<ShaderComponent*>& componentList,
if (surface && (vizDisplayMode == 0 || vizDisplayMode == 1)) if (surface && (vizDisplayMode == 0 || vizDisplayMode == 1))
{ {
Var* color = (Var*)LangElement::find("col"); Var* color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if (color) if (color)
{ {
Var* specularColor = (Var*)LangElement::find("specularColor"); Var* specularColor = (Var*)LangElement::find("specularColor");

View file

@ -1181,13 +1181,13 @@ void DiffuseFeatureGLSL::processPix( Vector<ShaderComponent*> &componentList,
diffuseMaterialColor->constSortPos = cspPotentialPrimitive; diffuseMaterialColor->constSortPos = cspPotentialPrimitive;
MultiLine* meta = new MultiLine; MultiLine* meta = new MultiLine;
Var *col = (Var*)LangElement::find("col"); Var *col = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
ShaderFeature::OutputTarget targ = ShaderFeature::DefaultTarget; ShaderFeature::OutputTarget targ = ShaderFeature::DefaultTarget;
if (fd.features[MFT_isDeferred]) if (fd.features[MFT_isDeferred])
{ {
targ = ShaderFeature::RenderTarget1; targ = ShaderFeature::RenderTarget1;
col = (Var*)LangElement::find("col1"); col = (Var*)LangElement::find(getOutputTargetVarName(targ));
meta = new MultiLine; meta = new MultiLine;
if (!col) if (!col)
{ {
@ -1196,7 +1196,7 @@ void DiffuseFeatureGLSL::processPix( Vector<ShaderComponent*> &componentList,
col->setType("vec4"); col->setType("vec4");
col->setName(getOutputTargetVarName(targ)); col->setName(getOutputTargetVarName(targ));
col->setStructName("OUT"); col->setStructName("OUT");
meta->addStatement(new GenOp(" @ = vec4(1.0);\r\n", col)); meta->addStatement(new GenOp(" @ = vec4(1.0,1.0,1.0,1.0);\r\n", col));
} }
} }
@ -2334,7 +2334,7 @@ void FogFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
fogColor->constSortPos = cspPass; fogColor->constSortPos = cspPass;
// Get the out color. // Get the out color.
Var *color = (Var*) LangElement::find( "col" ); Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( !color ) if ( !color )
{ {
color = new Var; color = new Var;
@ -2466,7 +2466,7 @@ void VisibilityFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
// Translucent objects do a simple alpha fade. // Translucent objects do a simple alpha fade.
if ( fd.features[ MFT_IsTranslucent ] ) if ( fd.features[ MFT_IsTranslucent ] )
{ {
Var *color = (Var*) LangElement::find( "col" ); Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
meta->addStatement( new GenOp( " @.a *= @;\r\n", color, visibility ) ); meta->addStatement( new GenOp( " @.a *= @;\r\n", color, visibility ) );
return; return;
} }
@ -2507,9 +2507,9 @@ void AlphaTestGLSL::processPix( Vector<ShaderComponent*> &componentList,
} }
// If we don't have a color var then we cannot do an alpha test. // If we don't have a color var then we cannot do an alpha test.
Var *color = (Var*)LangElement::find( "col1" ); Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1) );
if ( !color ) if ( !color )
color = (Var*)LangElement::find("col"); color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( !color ) if ( !color )
{ {
output = NULL; output = NULL;
@ -2542,7 +2542,7 @@ void GlowMaskGLSL::processPix( Vector<ShaderComponent*> &componentList,
// //
// The shader compiler will optimize out all the other // The shader compiler will optimize out all the other
// code above that doesn't contribute to the alpha mask. // code above that doesn't contribute to the alpha mask.
Var *color = (Var*)LangElement::find( "col" ); Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( color ) if ( color )
output = new GenOp( " @.rgb = vec3(0);\r\n", color ); output = new GenOp( " @.rgb = vec3(0);\r\n", color );
} }
@ -2574,7 +2574,7 @@ void HDROutGLSL::processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd ) const MaterialFeatureData &fd )
{ {
// Let the helper function do the work. // Let the helper function do the work.
Var *color = (Var*)LangElement::find( "col" ); Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( color ) if ( color )
output = new GenOp( " @ = hdrEncode( @ );\r\n", color, color ); output = new GenOp( " @ = hdrEncode( @ );\r\n", color, color );
} }

View file

@ -55,7 +55,7 @@ void AccuTexFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
output = meta; output = meta;
// OUT.col // OUT.col
Var *color = (Var*) LangElement::find( "col1" ); Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1));
if (!color) if (!color)
{ {
output = new GenOp(" //NULL COLOR!"); output = new GenOp(" //NULL COLOR!");

View file

@ -460,7 +460,7 @@ void NormalsOutFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
} }
LangElement *normalOut; LangElement *normalOut;
Var *outColor = (Var*)LangElement::find( "col" ); Var *outColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( outColor && !fd.features[MFT_AlphaTest] ) if ( outColor && !fd.features[MFT_AlphaTest] )
normalOut = new GenOp( "float4( ( -@ + 1 ) * 0.5, @.a )", wsNormal, outColor ); normalOut = new GenOp( "float4( ( -@ + 1 ) * 0.5, @.a )", wsNormal, outColor );
else else

View file

@ -68,136 +68,6 @@ void CustomFeatureHLSL::processPix(Vector<ShaderComponent*>& componentList,
mOutputState = PixelOutput; mOutputState = PixelOutput;
/*MultiLine *meta = new MultiLine;
output = meta;
// OUT.col
Var *color = (Var*) LangElement::find( "col1" );
if (!color)
{
output = new GenOp(" //NULL COLOR!");
return;
}
// accu map
Var *accuMap = new Var;
accuMap->setType("SamplerState");
accuMap->setName( "accuMap" );
accuMap->uniform = true;
accuMap->sampler = true;
accuMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
// accuColor var
Var *accuColor = new Var;
accuColor->setType( "float4" );
accuColor->setName( "accuColor" );
LangElement *colorAccuDecl = new DecOp( accuColor );
// plc (placement)
Var *accuPlc = new Var;
accuPlc->setType( "float4" );
accuPlc->setName( "plc" );
LangElement *plcAccu = new DecOp( accuPlc );
// accu constants
Var *accuScale = (Var*)LangElement::find( "accuScale" );
if ( !accuScale )
{
accuScale = new Var;
accuScale->setType( "float" );
accuScale->setName( "accuScale" );
accuScale->uniform = true;
accuScale->sampler = false;
accuScale->constSortPos = cspPotentialPrimitive;
}
Var *accuDirection = (Var*)LangElement::find( "accuDirection" );
if ( !accuDirection )
{
accuDirection = new Var;
accuDirection->setType( "float" );
accuDirection->setName( "accuDirection" );
accuDirection->uniform = true;
accuDirection->sampler = false;
accuDirection->constSortPos = cspPotentialPrimitive;
}
Var *accuStrength = (Var*)LangElement::find( "accuStrength" );
if ( !accuStrength )
{
accuStrength = new Var;
accuStrength->setType( "float" );
accuStrength->setName( "accuStrength" );
accuStrength->uniform = true;
accuStrength->sampler = false;
accuStrength->constSortPos = cspPotentialPrimitive;
}
Var *accuCoverage = (Var*)LangElement::find( "accuCoverage" );
if ( !accuCoverage )
{
accuCoverage = new Var;
accuCoverage->setType( "float" );
accuCoverage->setName( "accuCoverage" );
accuCoverage->uniform = true;
accuCoverage->sampler = false;
accuCoverage->constSortPos = cspPotentialPrimitive;
}
Var *accuSpecular = (Var*)LangElement::find( "accuSpecular" );
if ( !accuSpecular )
{
accuSpecular = new Var;
accuSpecular->setType( "float" );
accuSpecular->setName( "accuSpecular" );
accuSpecular->uniform = true;
accuSpecular->sampler = false;
accuSpecular->constSortPos = cspPotentialPrimitive;
}
Var *inTex = getInTexCoord( "texCoord", "float2", componentList );
Var *accuVec = getInTexCoord( "accuVec", "float3", componentList );
Var *bumpNorm = (Var *)LangElement::find( "bumpSample" );
if( bumpNorm == NULL )
{
bumpNorm = (Var *)LangElement::find( "bumpNormal" );
if (!bumpNorm)
return;
}
// get the accu pixel color
Var *accuMapTex = new Var;
accuMapTex->setType("Texture2D");
accuMapTex->setName("accuMapTex");
accuMapTex->uniform = true;
accuMapTex->texture = true;
accuMapTex->constNum = accuMap->constNum;
meta->addStatement(new GenOp(" @ = @.Sample(@, @ * @);\r\n", colorAccuDecl, accuMapTex, accuMap, inTex, accuScale));
// scale up normals
meta->addStatement( new GenOp( " @.xyz = @.xyz * 2.0 - 0.5;\r\n", bumpNorm, bumpNorm ) );
// assign direction
meta->addStatement( new GenOp( " @.z *= @*2.0;\r\n", accuVec, accuDirection ) );
// saturate based on strength
meta->addStatement( new GenOp( " @ = saturate( dot( @.xyz, @.xyz * pow(@, 5) ) );\r\n", plcAccu, bumpNorm, accuVec, accuStrength ) );
// add coverage
meta->addStatement( new GenOp( " @.a += (2 * pow(@/2, 5)) - 0.5;\r\n", accuPlc, accuCoverage ) );
// clamp to a sensible value
meta->addStatement( new GenOp( " @.a = clamp(@.a, 0, 1);\r\n", accuPlc, accuPlc ) );
// light
Var *lightColor = (Var*) LangElement::find( "d_lightcolor" );
if(lightColor != NULL)
meta->addStatement( new GenOp( " @ *= float4(@, 1.0);\r\n\r\n", accuColor, lightColor ) );
// lerp with current pixel - use the accu alpha as well
meta->addStatement( new GenOp( " @ = lerp( @, @, @.a * @.a);\r\n", color, color, accuColor, accuPlc, accuColor ) );
// the result should always be opaque
meta->addStatement( new GenOp( " @.a = 1.0;\r\n", color ) );*/
if (mOwner->isMethod("processPixelHLSL")) if (mOwner->isMethod("processPixelHLSL"))
Con::executef(mOwner, "processPixelHLSL"); Con::executef(mOwner, "processPixelHLSL");

View file

@ -24,7 +24,7 @@ void DebugVizHLSL::processPix(Vector<ShaderComponent*>& componentList,
{ {
MultiLine* meta = new MultiLine; MultiLine* meta = new MultiLine;
Var* surface = (Var*)LangElement::find("surface"); Var* surface = (Var*)LangElement::find("surface");
Var* color = (Var*)LangElement::find("col"); Var* color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if (!surface) if (!surface)
return; return;

View file

@ -1192,13 +1192,13 @@ void DiffuseFeatureHLSL::processPix( Vector<ShaderComponent*> &componentList,
diffuseMaterialColor->constSortPos = cspPotentialPrimitive; diffuseMaterialColor->constSortPos = cspPotentialPrimitive;
MultiLine* meta = new MultiLine; MultiLine* meta = new MultiLine;
Var *col = (Var*)LangElement::find("col"); Var *col = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
ShaderFeature::OutputTarget targ = ShaderFeature::DefaultTarget; ShaderFeature::OutputTarget targ = ShaderFeature::DefaultTarget;
if (fd.features[MFT_isDeferred]) if (fd.features[MFT_isDeferred])
{ {
targ = ShaderFeature::RenderTarget1; targ = ShaderFeature::RenderTarget1;
col = (Var*)LangElement::find("col1"); col = (Var*)LangElement::find(getOutputTargetVarName(targ));
if (!col) if (!col)
{ {
// create color var // create color var
@ -2403,7 +2403,7 @@ void FogFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
fogColor->constSortPos = cspPass; fogColor->constSortPos = cspPass;
// Get the out color. // Get the out color.
Var *color = (Var*) LangElement::find( "col" ); Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( !color ) if ( !color )
{ {
color = new Var; color = new Var;
@ -2535,7 +2535,7 @@ void VisibilityFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
// Translucent objects do a simple alpha fade. // Translucent objects do a simple alpha fade.
if ( fd.features[ MFT_IsTranslucent ] ) if ( fd.features[ MFT_IsTranslucent ] )
{ {
Var *color = (Var*)LangElement::find( "col" ); Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
meta->addStatement( new GenOp( " @.a *= @;\r\n", color, visibility ) ); meta->addStatement( new GenOp( " @.a *= @;\r\n", color, visibility ) );
return; return;
} }
@ -2577,9 +2577,9 @@ void AlphaTestHLSL::processPix( Vector<ShaderComponent*> &componentList,
} }
// If we don't have a color var then we cannot do an alpha test. // If we don't have a color var then we cannot do an alpha test.
Var *color = (Var*)LangElement::find( "col1" ); Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1));
if (!color) if (!color)
color = (Var*)LangElement::find("col"); color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( !color ) if ( !color )
{ {
output = NULL; output = NULL;
@ -2612,7 +2612,7 @@ void GlowMaskHLSL::processPix( Vector<ShaderComponent*> &componentList,
// //
// The shader compiler will optimize out all the other // The shader compiler will optimize out all the other
// code above that doesn't contribute to the alpha mask. // code above that doesn't contribute to the alpha mask.
Var *color = (Var*)LangElement::find( "col" ); Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( color ) if ( color )
output = new GenOp( " @.rgb = 0;\r\n", color ); output = new GenOp( " @.rgb = 0;\r\n", color );
} }
@ -2644,7 +2644,7 @@ void HDROutHLSL::processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd ) const MaterialFeatureData &fd )
{ {
// Let the helper function do the work. // Let the helper function do the work.
Var *color = (Var*)LangElement::find( "col" ); Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( color ) if ( color )
output = new GenOp( " @ = hdrEncode( @ );\r\n", color, color ); output = new GenOp( " @ = hdrEncode( @ );\r\n", color, color );
} }

View file

@ -59,8 +59,9 @@ function AssetBrowser::buildDatablockPreview(%this, %assetDef, %previewData)
//%previewData.assetFriendlyName = %assetDef.assetName; //%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef; %previewData.assetDesc = %assetDef;
%previewData.tooltip = "Datablock Name: " @ %assetDef @ "\n" @ %previewData.tooltip = "\nDatablock Name: " @ %assetDef @
"Datablock Type: " @ %assetDef.getClassName(); "\nDatablock Type: " @ %assetDef.getClassName() @
"\nDefinition Path: " @ %assetDef.getFilename();
%previewData.doubleClickCommand = "AssetBrowser.schedule(10, \"spawnDatablockObject\",\""@ %assetDef @"\");";//browseTo %assetDef.dirPath / %assetDef.assetName %previewData.doubleClickCommand = "AssetBrowser.schedule(10, \"spawnDatablockObject\",\""@ %assetDef @"\");";//browseTo %assetDef.dirPath / %assetDef.assetName
} }

View file

@ -269,7 +269,7 @@ function AssetBrowser::buildGameObjectAssetPreview(%this, %assetDef, %previewDat
%previewData.assetFriendlyName = %assetDef.gameObjectName; %previewData.assetFriendlyName = %assetDef.gameObjectName;
%previewData.assetDesc = %assetDef.description; %previewData.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.gameObjectName; %previewData.tooltip = "Asset Name: " @ %assetDef.gameObjectName @ "\nDefinition Path: " @ %assetDef.getFilename();
} }
function GuiInspectorTypeGameObjectAssetPtr::onClick( %this, %fieldName ) function GuiInspectorTypeGameObjectAssetPtr::onClick( %this, %fieldName )

View file

@ -175,5 +175,5 @@ function AssetBrowser::buildGUIAssetPreview(%this, %assetDef, %previewData)
%previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description; %previewData.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.assetName; %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getScriptPath();
} }

View file

@ -494,9 +494,10 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
else else
%previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );"; %previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );";
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\n" @ %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @
"Asset Type: Material Asset\n" @ "\nAsset Type: Material Asset" @
"Asset Definition ID: " @ %assetDef; "\nAsset Definition ID: " @ %assetDef @
"\nDefinition Path: " @ %assetDef.getScriptPath();
} }
function AssetBrowser::onMaterialAssetEditorDropped(%this, %assetDef, %position) function AssetBrowser::onMaterialAssetEditorDropped(%this, %assetDef, %position)

View file

@ -165,5 +165,5 @@ function AssetBrowser::buildPostEffectAssetPreview(%this, %assetDef, %previewDat
%previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description; %previewData.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.assetName; %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename();
} }

View file

@ -102,7 +102,7 @@ function AssetBrowser::buildTScriptPreview(%this, %assetDef, %previewData)
%previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description; %previewData.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.assetName; %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename();
} }
function GuiInspectorTypeScriptAssetPtr::onClick( %this, %fieldName ) function GuiInspectorTypeScriptAssetPtr::onClick( %this, %fieldName )

View file

@ -51,5 +51,5 @@ function AssetBrowser::buildShapeAnimationAssetPreview(%this, %assetDef, %previe
%previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description; %previewData.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.friendlyName @ "\n" @ %assetDef; %previewData.tooltip = %assetDef.friendlyName @ "\n" @ %assetDef @ "\nShape File path: " @ %assetDef.getShapeFile();
} }

View file

@ -13,7 +13,7 @@ function AssetBrowser::buildSoundAssetPreview(%this, %assetDef, %previewData)
%previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description; %previewData.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.assetName; %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename();
} }
function AssetBrowser::onSoundAssetEditorDropped(%this, %assetDef, %position) function AssetBrowser::onSoundAssetEditorDropped(%this, %assetDef, %position)

View file

@ -166,9 +166,10 @@ function AssetBrowser::buildTerrainAssetPreview(%this, %assetDef, %previewData)
%previewData.assetFriendlyName = %assetDef.gameObjectName; %previewData.assetFriendlyName = %assetDef.gameObjectName;
%previewData.assetDesc = %assetDef.description; %previewData.assetDesc = %assetDef.description;
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\n" @ %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @
"Asset Type: Terrain Asset\n" @ "\nAsset Type: Terrain Asset" @
"Asset Definition ID: " @ %assetDef; "\nAsset Definition ID: " @ %assetDef @
"\nDefinition Path: " @ %assetPath @ %assetDef.getTerrainFilePath();
} }
function GuiInspectorTypeTerrainAssetPtr::onClick( %this, %fieldName ) function GuiInspectorTypeTerrainAssetPtr::onClick( %this, %fieldName )

View file

@ -1059,7 +1059,6 @@ function MaterialEditorGui::guiSync( %this, %material )
%this.getRoughChan((%material).RoughnessChan[%layer]); %this.getRoughChan((%material).RoughnessChan[%layer]);
%this.getAOChan((%material).AOChan[%layer]); %this.getAOChan((%material).AOChan[%layer]);
%this.getMetalChan((%material).metalChan[%layer]); %this.getMetalChan((%material).metalChan[%layer]);
%this.getGlowChan((%material).glowChan[%layer]);
%this.preventUndo = false; %this.preventUndo = false;
} }
@ -1081,11 +1080,7 @@ function MaterialEditorGui::getMetalChan(%this, %channel)
%guiElement = metalChanBtn @ %channel; %guiElement = metalChanBtn @ %channel;
%guiElement.setStateOn(true); %guiElement.setStateOn(true);
} }
function MaterialEditorGui::getGlowChan(%this, %channel)
{
%guiElement = glowChanBtn @ %channel;
%guiElement.setStateOn(true);
}
//======================================= //=======================================
// Material Update Functionality // Material Update Functionality
@ -2421,12 +2416,6 @@ function MaterialEditorGui::setMetalChan(%this, %value)
MaterialEditorGui.guiSync( materialEd_previewMaterial ); MaterialEditorGui.guiSync( materialEd_previewMaterial );
} }
function MaterialEditorGui::setGlowChan(%this, %value)
{
MaterialEditorGui.updateActiveMaterial("glowChan[" @ MaterialEditorGui.currentLayer @ "]", %value);
MaterialEditorGui.guiSync( materialEd_previewMaterial );
}
function MaterialEditorGui::saveCompositeMap(%this) function MaterialEditorGui::saveCompositeMap(%this)
{ {
%saveAs = ""; %saveAs = "";
@ -2455,7 +2444,6 @@ function MaterialEditorGui::saveCompositeMap(%this)
%roughMap = %material.getRoughMap(%layer); %roughMap = %material.getRoughMap(%layer);
%aoMap = %material.getAOMap(%layer); %aoMap = %material.getAOMap(%layer);
%metalMap = %material.getMetalMap(%layer); %metalMap = %material.getMetalMap(%layer);
%glowMap = %material.getGlowMap(%layer);
%roughness = %material.RoughnessChan[%layer]; %roughness = %material.RoughnessChan[%layer];
%ao = %material.AOChan[%layer]; %ao = %material.AOChan[%layer];

View file

@ -214,7 +214,7 @@ $guiContent = new GuiWindowCollapseCtrl(PE_Window) {
groupNum = "-1"; groupNum = "-1";
buttonType = "PushButton"; buttonType = "PushButton";
useMouseEvents = "0"; useMouseEvents = "0";
bitmap = "ToolsModule:new_image"; bitmapAsset = "ToolsModule:new_image";
tooltip = "Create New Emitter"; tooltip = "Create New Emitter";
}; };
new GuiBitmapButtonCtrl() { new GuiBitmapButtonCtrl() {

View file

@ -831,6 +831,11 @@ T3Dpre4ProjectImporter::genProcessor("LevelInfo", "accuTexture accuTextureAsset"
T3Dpre4ProjectImporter::genProcessor("TSStatic", "shape shapeAsset shapeName shapeAsset"); T3Dpre4ProjectImporter::genProcessor("TSStatic", "shape shapeAsset shapeName shapeAsset");
T3Dpre4ProjectImporter::genProcessor("TSForestItemData", "shape shapeAsset shapeName shapeAsset shapeFile shapeAsset"); T3Dpre4ProjectImporter::genProcessor("TSForestItemData", "shape shapeAsset shapeName shapeAsset shapeFile shapeAsset");
T3Dpre4ProjectImporter::genProcessor("TerrainBlock", "terrainFile terrainAsset"); T3Dpre4ProjectImporter::genProcessor("TerrainBlock", "terrainFile terrainAsset");
T3Dpre4ProjectImporter::genProcessor("afxMagicMissileData", "projectileShapeName projectileShapeAsset");
T3Dpre4ProjectImporter::genProcessor("afxBillboardData", "texture textureAsset");
T3Dpre4ProjectImporter::genProcessor("afxModelData", "shapeName shapeAsset shapeFile shapeAsset");
T3Dpre4ProjectImporter::genProcessor("afxZodiacData", "texture textureAsset");
T3Dpre4ProjectImporter::genProcessor("afxZodiacPlaneData", "texture textureAsset");
//============================================================================== //==============================================================================
// Levels // Levels
//============================================================================== //==============================================================================