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.");
// Fetch image file.
pCppFile = StringTable->insert(pCppFile);
pCppFile = StringTable->insert(pCppFile, true);
// Ignore no change,
if (pCppFile == mCodeFile)
return;
// Update.
mCodeFile = /*getOwned() ? expandAssetFilePath(pCppFile) : */StringTable->insert(pCppFile);
mCodeFile = getOwned() ? expandAssetFilePath(pCppFile) : pCppFile;
// Refresh the asset.
refreshAsset();
@ -158,7 +158,7 @@ void CppAsset::setHeaderFile(const char* pHeaderFile)
return;
// Update.
mHeaderFile = /*getOwned() ? expandAssetFilePath(pHeaderFile) :*/ StringTable->insert(pHeaderFile);
mHeaderFile = getOwned() ? expandAssetFilePath(pHeaderFile) : pHeaderFile;
// Refresh the asset.
refreshAsset();

View file

@ -134,18 +134,21 @@ void CubemapAsset::copyTo(SimObject* object)
void CubemapAsset::initializeAsset()
{
mScriptFile = expandAssetFilePath(mScriptFile);
// Call parent.
Parent::initializeAsset();
if(Torque::FS::IsScriptFile(mScriptFile))
Con::executeFile(mScriptFile, false, false);
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false);
}
void CubemapAsset::onAssetRefresh()
{
mScriptFile = expandAssetFilePath(mScriptFile);
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptFile))
Con::executeFile(mScriptFile, false, false);
if (Torque::FS::IsScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false);
}
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.");
// Fetch image file.
pScriptFile = StringTable->insert(pScriptFile);
pScriptFile = StringTable->insert(pScriptFile, true);
// Ignore no change,
if (pScriptFile == mScriptFile)
return;
// Update.
mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : StringTable->insert(pScriptFile);
mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
// Refresh the asset.
refreshAsset();

View file

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

View file

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

View file

@ -156,10 +156,10 @@ void GameObjectAsset::setScriptFile(const char* pScriptFile)
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
// Fetch image file.
pScriptFile = StringTable->insert(pScriptFile);
pScriptFile = StringTable->insert(pScriptFile, true);
// Ignore no change,
if (pScriptFile == mScriptFile)
if (pScriptFile == mTAMLFile)
return;
// Update.
@ -176,7 +176,7 @@ void GameObjectAsset::setTAMLFile(const char* pTAMLFile)
AssertFatal(pTAMLFile != NULL, "Cannot use a NULL TAML file.");
// Fetch image file.
pTAMLFile = StringTable->insert(pTAMLFile);
pTAMLFile = StringTable->insert(pTAMLFile, true);
// Ignore no change,
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,
"The assetId of the texture to display when the requested image asset is missing.\n"
"@ingroup GFX\n");
smNoImageAssetFallback = StringTable->insert(Con::getVariable("$Core::NoImageAssetFallback"));
}
//-----------------------------------------------------------------------------
@ -296,21 +298,15 @@ void ImageAsset::loadImage()
void ImageAsset::initializeAsset()
{
if (mImageFileName == StringTable->insert("z.png"))
{
Con::printf("Loaded z");
}
ResourceManager::get().getChangedSignal().notify(this, &ImageAsset::_onResourceChanged);
mImagePath = expandAssetFilePath(mImageFileName);
mImagePath = getOwned() ? expandAssetFilePath(mImageFileName) : mImagePath;
loadImage();
}
void ImageAsset::onAssetRefresh()
{
mImagePath = expandAssetFilePath(mImageFileName);
mImagePath = getOwned() ? expandAssetFilePath(mImageFileName) : mImagePath;
loadImage();
}
@ -321,7 +317,7 @@ void ImageAsset::_onResourceChanged(const Torque::Path& path)
refreshAsset();
loadImage();
//loadImage();
}
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.");
// Update.
mImageFileName = StringTable->insert(pScriptFile);
mImageFileName = StringTable->insert(pScriptFile, true);
// Refresh the asset.
refreshAsset();
}
const GBitmap& ImageAsset::getImage()

View file

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

View file

@ -43,7 +43,7 @@
#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,
"The assetId of the material to display when the requested material asset is missing.\n"
"@ingroup GFX\n");
smNoMaterialAssetFallback = StringTable->insert(Con::getVariable("$Core::NoMaterialAssetFallback"));
}
void MaterialAsset::initPersistFields()
@ -188,7 +190,7 @@ void MaterialAsset::setScriptFile(const char* pScriptFile)
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
// Fetch image file.
pScriptFile = StringTable->insert(pScriptFile);
pScriptFile = StringTable->insert(pScriptFile, true);
// Update.
mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;

View file

@ -109,7 +109,11 @@ protected:
virtual void initializeAsset();
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(); }
};

View file

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

View file

@ -122,7 +122,7 @@ void ScriptAsset::copyTo(SimObject* object)
void ScriptAsset::initializeAsset()
{
mScriptPath = expandAssetFilePath(mScriptFile);
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath))
{
@ -150,7 +150,7 @@ void ScriptAsset::initializeAsset()
void ScriptAsset::onAssetRefresh()
{
mScriptPath = expandAssetFilePath(mScriptFile);
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : 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.");
// Fetch image file.
pScriptFile = StringTable->insert(pScriptFile);
pScriptFile = StringTable->insert(pScriptFile, true);
// Ignore no change,
if (pScriptFile == mScriptFile)
return;
// Update.
mScriptFile = StringTable->insert(pScriptFile);
mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
// Refresh the asset.
refreshAsset();

View file

@ -147,7 +147,7 @@ void ShapeAnimationAsset::initializeAsset(void)
if (!mIsEmbedded)
{
//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);
@ -177,14 +177,14 @@ void ShapeAnimationAsset::setAnimationFile(const char* pAnimationFile)
AssertFatal(pAnimationFile != NULL, "Cannot use a NULL animation file.");
// Fetch image file.
pAnimationFile = StringTable->insert(pAnimationFile);
pAnimationFile = StringTable->insert(pAnimationFile, true);
// Ignore no change,
if (pAnimationFile == mFileName)
return;
// Update.
mFileName = StringTable->insert(pAnimationFile);
mFileName = getOwned() ? expandAssetFilePath(pAnimationFile) : pAnimationFile;
// Refresh the asset.
refreshAsset();

View file

@ -50,7 +50,7 @@
#include "ts/tsLastDetail.h"
#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,
"The assetId of the shape to display when the requested shape asset is missing.\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);
//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();
}
@ -200,13 +201,13 @@ void ShapeAsset::setShapeFile(const char* pShapeFile)
AssertFatal(pShapeFile != NULL, "Cannot use a NULL shape file.");
// Fetch image file.
pShapeFile = StringTable->insert(pShapeFile);
pShapeFile = StringTable->insert(pShapeFile, true);
// Ignore no change,
if (pShapeFile == mFileName)
return;
mFileName = pShapeFile;
mFileName = getOwned() ? expandAssetFilePath(pShapeFile) : pShapeFile;
// Refresh the asset.
refreshAsset();
@ -218,13 +219,13 @@ void ShapeAsset::setShapeConstructorFile(const char* pShapeConstructorFile)
AssertFatal(pShapeConstructorFile != NULL, "Cannot use a NULL shape constructor file.");
// Fetch image file.
pShapeConstructorFile = StringTable->insert(pShapeConstructorFile);
pShapeConstructorFile = StringTable->insert(pShapeConstructorFile, true);
// Ignore no change,
if (pShapeConstructorFile == mConstructorFileName)
return;
mConstructorFileName = pShapeConstructorFile;
mConstructorFileName = getOwned() ? expandAssetFilePath(pShapeConstructorFile) : pShapeConstructorFile;
// Refresh the asset.
refreshAsset();

View file

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

View file

@ -161,14 +161,14 @@ void TerrainAsset::initializeAsset()
// Call parent.
Parent::initializeAsset();
mTerrainFilePath = expandAssetFilePath(mTerrainFileName);
mTerrainFilePath = getOwned() ? expandAssetFilePath(mTerrainFileName) : mTerrainFilePath;
loadTerrain();
}
void TerrainAsset::onAssetRefresh()
{
mTerrainFilePath = expandAssetFilePath(mTerrainFileName);
mTerrainFilePath = getOwned() ? expandAssetFilePath(mTerrainFileName) : mTerrainFilePath;
loadTerrain();
}
@ -176,13 +176,16 @@ void TerrainAsset::onAssetRefresh()
void TerrainAsset::setTerrainFileName(const char* pScriptFile)
{
// 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);
pScriptFile = StringTable->insert(pScriptFile, true);
// Ignore no change,
if (pScriptFile == mTerrainFileName)
return;
// Update.
mTerrainFileName = pScriptFile;
mTerrainFileName = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
// Refresh the asset.
refreshAsset();

View file

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

View file

@ -126,15 +126,14 @@ void StateMachineAsset::setStateMachineFile(const char* pStateMachineFile)
// Sanity!
AssertFatal(pStateMachineFile != NULL, "Cannot use a NULL state machine file.");
// Fetch image file.
pStateMachineFile = StringTable->insert(pStateMachineFile);
pStateMachineFile = StringTable->insert(pStateMachineFile, true);
// Ignore no change,
if (pStateMachineFile == mStateMachineFile)
return;
// Update.
mStateMachineFile = StringTable->insert(pStateMachineFile);
mStateMachineFile = getOwned() ? expandAssetFilePath(pStateMachineFile) : pStateMachineFile;
// Refresh the asset.
refreshAsset();
@ -142,12 +141,12 @@ void StateMachineAsset::setStateMachineFile(const char* pStateMachineFile)
void StateMachineAsset::initializeAsset()
{
mStateMachinePath = expandAssetFilePath(mStateMachineFile);
mStateMachinePath = getOwned() ? expandAssetFilePath(mStateMachineFile) : mStateMachinePath;
}
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 "
"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) "
"representing the UV coordinates for each frame in the imagemap.\n\n"
"@note This field should only be set if the imagemap frames are "
@ -313,7 +313,9 @@ void DecalData::_initMaterial()
{
SAFE_DELETE( matInst );
if (mMaterialAsset.notNull())
_setMaterial(getMaterial());
if (mMaterialAsset.notNull() && mMaterialAsset->getStatus() == MaterialAsset::Ok)
{
matInst = getMaterialResource()->createMatInstance();
}

View file

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

View file

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

View file

@ -141,7 +141,7 @@ U32 Projectile::smProjectileWarpTicks = 5;
//
afxMagicMissileData::afxMagicMissileData()
{
projectileShapeName = ST_NULLSTRING;
INIT_SHAPEASSET(ProjectileShape);
sound = NULL;
@ -246,7 +246,7 @@ afxMagicMissileData::afxMagicMissileData()
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
sound = other.sound;
splash = other.splash;
@ -335,7 +335,7 @@ void afxMagicMissileData::initPersistFields()
addField("particleEmitter", TYPEID<ParticleEmitterData>(), Offset(particleEmitter, 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("sound", TypeSFXTrackName, Offset(sound, afxMagicMissileData));
@ -375,7 +375,7 @@ void afxMagicMissileData::initPersistFields()
// FIELDS ADDED BY MAGIC-MISSILE
addField("missileShapeName", TypeFilename, myOffset(projectileShapeName));
//addField("missileShapeName", TypeFilename, myOffset(projectileShapeName));
addField("missileShapeScale", TypePoint3F, myOffset(scale));
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);
}
if (projectileShapeName != ST_NULLSTRING)
if (!mProjectileShapeAsset.isNull())
{
projectileShape = ResourceManager::get().load(projectileShapeName);
projectileShape = mProjectileShapeAsset->getShapeResource();
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;
}
/* From stock Projectile code...
@ -599,7 +599,8 @@ void afxMagicMissileData::packData(BitStream* stream)
{
Parent::packData(stream);
stream->writeString(projectileShapeName);
PACKDATA_SHAPEASSET(ProjectileShape);
/* From stock Projectile code...
stream->writeFlag(faceViewer);
*/
@ -709,7 +710,7 @@ void afxMagicMissileData::unpackData(BitStream* stream)
{
Parent::unpackData(stream);
projectileShapeName = stream->readSTString();
UNPACKDATA_SHAPEASSET(ProjectileShape);
/* From stock Projectile code...
faceViewer = stream->readFlag();
*/

View file

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

View file

@ -51,7 +51,7 @@ ConsoleDocClass( afxBillboardData,
afxBillboardData::afxBillboardData()
{
color.set(1.0f, 1.0f, 1.0f, 1.0f);
txr_name = ST_NULLSTRING;
INIT_IMAGEASSET(Texture);
dimensions.set(1.0f, 1.0f);
texCoords[0].set(0.0f, 0.0f);
texCoords[1].set(0.0f, 1.0f);
@ -66,8 +66,7 @@ afxBillboardData::afxBillboardData(const afxBillboardData& other, bool temp_clon
: GameBaseData(other, temp_clone)
{
color = other.color;
txr_name = other.txr_name;
txr = other.txr;
CLONE_IMAGEASSET(Texture);
dimensions = other.dimensions;
texCoords[0] = other.texCoords[0];
texCoords[1] = other.texCoords[1];
@ -95,8 +94,9 @@ void afxBillboardData::initPersistFields()
addField("color", TypeColorF, myOffset(color),
"The color assigned to the quadrangle geometry. The way it combines with the given "
"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),
"A value-pair that specifies the horizontal and vertical dimensions of the billboard "
"in scene units.");
@ -123,7 +123,8 @@ void afxBillboardData::packData(BitStream* stream)
Parent::packData(stream);
stream->write(color);
stream->writeString(txr_name);
PACKDATA_IMAGEASSET(Texture);
mathWrite(*stream, dimensions);
mathWrite(*stream, texCoords[0]);
mathWrite(*stream, texCoords[1]);
@ -139,8 +140,7 @@ void afxBillboardData::unpackData(BitStream* stream)
Parent::unpackData(stream);
stream->read(&color);
txr_name = stream->readSTString();
txr = GFXTexHandle();
UNPACKDATA_IMAGEASSET(Texture);
mathRead(*stream, &dimensions);
mathRead(*stream, &texCoords[0]);
mathRead(*stream, &texCoords[1]);
@ -156,14 +156,6 @@ bool afxBillboardData::preload(bool server, String &errorStr)
if (!Parent::preload(server, errorStr))
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 (blendStyle == BlendUser && (srcBlendFactor == BLEND_UNDEFINED || dstBlendFactor == BLEND_UNDEFINED))
{

View file

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

View file

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

View file

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

View file

@ -27,6 +27,7 @@
#define _AFX_MODEL_H_
#include "renderInstance/renderPassManager.h"
#include "T3D/assets/ShapeAsset.h"
class ParticleEmitterData;
class ParticleEmitter;
@ -42,8 +43,11 @@ struct afxModelData : public GameBaseData
{
typedef GameBaseData Parent;
StringTableEntry shapeName;
DECLARE_SHAPEASSET(afxModelData, Shape, onShapeChanged);
DECLARE_SHAPEASSET_SETGET(afxModelData, Shape);
StringTableEntry sequence;
F32 seq_rate;
F32 seq_offset;
F32 alpha_mult;
@ -63,8 +67,6 @@ struct afxModelData : public GameBaseData
StringTableEntry remap_txr_tags;
Resource<TSShape> shape;
bool overrideLightingOptions;
bool receiveSunLight;
bool receiveLMLighting;
@ -93,6 +95,9 @@ public:
static void initPersistFields();
void onShapeChanged() {}
void onSequenceChanged() {}
DECLARE_CONOBJECT(afxModelData);
DECLARE_CATEGORY("AFX");
};
@ -148,9 +153,9 @@ public:
void setSequenceRateFactor(F32 factor);
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; }
TSShape* getTSShape() { return mDataBlock->shape; }
TSShape* getTSShape() { return mDataBlock->getShapeResource(); }
TSShapeInstance* getTSShapeInstance() { return shape_inst; }
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()
{
addField("sequence", TypeFilename, myOffset(sequence),
addField("sequence", TypeString, myOffset(sequence),
"An animation sequence in the StaticShape to play.");
addField("ignoreSceneAmbient", TypeBool, myOffset(ignore_scene_amb),
"...");

View file

@ -78,7 +78,8 @@ bool afxZodiacData::sPreferDestinationGradients = false;
afxZodiacData::afxZodiacData()
{
txr_name = ST_NULLSTRING;
INIT_IMAGEASSET(Texture);
radius_xy = 1;
vert_range.set(0.0f, 0.0f);
start_ang = 0;
@ -119,8 +120,8 @@ afxZodiacData::afxZodiacData()
afxZodiacData::afxZodiacData(const afxZodiacData& other, bool temp_clone) : GameBaseData(other, temp_clone)
{
txr_name = other.txr_name;
txr = other.txr;
CLONE_IMAGEASSET(Texture);
radius_xy = other.radius_xy;
vert_range = other.vert_range;
start_ang = other.start_ang;
@ -155,8 +156,7 @@ EndImplementEnumType;
void afxZodiacData::initPersistFields()
{
addField("texture", TypeFilename, Offset(txr_name, afxZodiacData),
"An image to use as the zodiac's texture.");
INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacData, "An image to use as the zodiac's texture.");
addField("radius", TypeF32, Offset(radius_xy, afxZodiacData),
"The zodiac's radius in scene units.");
addField("verticalRange", TypePoint2F, Offset(vert_range, afxZodiacData),
@ -269,7 +269,7 @@ void afxZodiacData::packData(BitStream* stream)
merge_zflags();
stream->writeString(txr_name);
PACKDATA_IMAGEASSET(Texture);
stream->write(radius_xy);
stream->write(vert_range.x);
stream->write(vert_range.y);
@ -294,8 +294,7 @@ void afxZodiacData::unpackData(BitStream* stream)
{
Parent::unpackData(stream);
txr_name = stream->readSTString();
txr = GFXTexHandle();
UNPACKDATA_IMAGEASSET(Texture);
stream->read(&radius_xy);
stream->read(&vert_range.x);
stream->read(&vert_range.y);
@ -323,14 +322,6 @@ bool afxZodiacData::preload(bool server, String &errorStr)
if (!Parent::preload(server, errorStr))
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)
vert_range.x = vert_range.y = radius_xy;
@ -349,11 +340,23 @@ void afxZodiacData::onStaticModified(const char* slot, const char* newValue)
}
void afxZodiacData::onPerformSubstitutions()
{
if (txr_name && txr_name[0] != '\0')
{
txr.set(txr_name, &AFX_GFXZodiacTextureProfile, "Zodiac Texture");
}
{
if (mTextureAssetId != StringTable->EmptyString())
{
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)

View file

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

View file

@ -61,7 +61,7 @@ void afxZodiacMgr::addTerrainZodiac(Point3F& pos, F32 radius, LinearColorF& colo
z.color = color.toColorI();
z.angle = mDegToRad(angle);
z.zflags = zode->zflags;
z.txr = &zode->txr;
z.txr = &zode->mTexture;
z.distance_max = zode->distance_max*zode->distance_max;
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.angle = mDegToRad(angle);
z.zflags = zode->zflags;
z.txr = &zode->txr;
z.txr = &zode->mTexture;
z.distance_max = zode->distance_max*zode->distance_max;
z.distance_falloff = zode->distance_falloff*zode->distance_falloff;

View file

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

View file

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

View file

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

View file

@ -98,23 +98,23 @@ public:
/// Asset configuration.
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);
inline StringTableEntry getAssetDescription(void) const { return mpAssetDefinition->mAssetDescription; }
inline StringTableEntry getAssetDescription(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetDescription : StringTable->EmptyString(); }
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);
inline bool getAssetAutoUnload(void) const { return mpAssetDefinition->mAssetAutoUnload; }
void setAssetInternal(const bool assetInternal);
inline bool getAssetInternal(void) const { return mpAssetDefinition->mAssetInternal; }
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 bool getOwned(void) const { return mpOwningAssetManager != NULL; }
// 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.
StringTableEntry expandAssetFilePath(const char* pAssetFilePath) const;

View file

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

View file

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

View file

@ -68,32 +68,15 @@
#include <ctype.h>
#include "core/util/md5.h"
#include "core/util/uuid.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 {
char nodeID[6];
} uuid_node_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 */
typedef struct {

View file

@ -28,11 +28,27 @@
#endif
#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
{
/// A universally unique identifier.
class UUID
class UUID : public xuuid_t
{
friend class UUIDEngineExport;
public:

View file

@ -79,7 +79,8 @@ void NodeListEvent::unpack(NetConnection* conn, BitStream* stream)
stream->read(&mTotalNodes);
stream->read(&mLocalListStart);
mNodeList->mId = mId;
if (mNodeList)
mNodeList->mId = mId;
// 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!
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.
CFStringRef fontName = CFStringCreateWithCString( kCFAllocatorDefault, name, kCFStringEncodingUTF8 );
NSString* fontName = [NSString stringWithUTF8String: nameStr.utf8()];
// Sanity!
if ( !fontName )
@ -94,12 +119,22 @@ bool OSXFont::create( const char* name, dsize_t size, U32 charset )
return false;
}
// Use Windows as a baseline (96 DPI) and adjust accordingly.
F32 scaledSize = size * (72.0f/96.0f);
scaledSize = mRound(scaledSize);
NSMutableDictionary* fontAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys:
fontName, (NSString*)kCTFontFamilyNameAttribute,
[NSNumber numberWithFloat: (float)size], (NSString*)kCTFontSizeAttribute,
nil];
// Create the font reference.
mFontRef = CTFontCreateWithName( fontName, scaledSize, NULL );
CTFontSymbolicTraits traits = 0x0;
if (doBold)
traits |= kCTFontBoldTrait;
if (doItalic)
traits |= kCTFontItalicTrait;
CTFontDescriptorRef descriptor =
CTFontDescriptorCreateWithAttributes((CFDictionaryRef)fontAttributes);
mFontRef = CTFontCreateWithFontDescriptor(descriptor, 0.0, NULL);
CFRelease(descriptor);
// Sanity!
if ( !mFontRef )
@ -108,6 +143,10 @@ bool OSXFont::create( const char* name, dsize_t size, U32 charset )
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.
CGFloat ascent = CTFontGetAscent( mFontRef );
CGFloat descent = CTFontGetDescent( mFontRef );
@ -227,17 +266,8 @@ PlatformFont::CharInfo& OSXFont::getCharInfo(const UTF16 character) const
CGPoint renderOrigin;
renderOrigin.x = -characterInfo.xOrigin;
renderOrigin.y = -characterInfo.yOrigin;
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
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
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 characterInfo;
}
}

View file

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

View file

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

View file

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

View file

@ -1181,13 +1181,13 @@ void DiffuseFeatureGLSL::processPix( Vector<ShaderComponent*> &componentList,
diffuseMaterialColor->constSortPos = cspPotentialPrimitive;
MultiLine* meta = new MultiLine;
Var *col = (Var*)LangElement::find("col");
Var *col = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
ShaderFeature::OutputTarget targ = ShaderFeature::DefaultTarget;
if (fd.features[MFT_isDeferred])
{
targ = ShaderFeature::RenderTarget1;
col = (Var*)LangElement::find("col1");
col = (Var*)LangElement::find(getOutputTargetVarName(targ));
meta = new MultiLine;
if (!col)
{
@ -1196,7 +1196,7 @@ void DiffuseFeatureGLSL::processPix( Vector<ShaderComponent*> &componentList,
col->setType("vec4");
col->setName(getOutputTargetVarName(targ));
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;
// Get the out color.
Var *color = (Var*) LangElement::find( "col" );
Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( !color )
{
color = new Var;
@ -2466,7 +2466,7 @@ void VisibilityFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
// Translucent objects do a simple alpha fade.
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 ) );
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.
Var *color = (Var*)LangElement::find( "col1" );
Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1) );
if ( !color )
color = (Var*)LangElement::find("col");
color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( !color )
{
output = NULL;
@ -2542,7 +2542,7 @@ void GlowMaskGLSL::processPix( Vector<ShaderComponent*> &componentList,
//
// The shader compiler will optimize out all the other
// 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 )
output = new GenOp( " @.rgb = vec3(0);\r\n", color );
}
@ -2574,7 +2574,7 @@ void HDROutGLSL::processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
// Let the helper function do the work.
Var *color = (Var*)LangElement::find( "col" );
Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( color )
output = new GenOp( " @ = hdrEncode( @ );\r\n", color, color );
}

View file

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

View file

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

View file

@ -68,136 +68,6 @@ void CustomFeatureHLSL::processPix(Vector<ShaderComponent*>& componentList,
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"))
Con::executef(mOwner, "processPixelHLSL");

View file

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

View file

@ -1192,13 +1192,13 @@ void DiffuseFeatureHLSL::processPix( Vector<ShaderComponent*> &componentList,
diffuseMaterialColor->constSortPos = cspPotentialPrimitive;
MultiLine* meta = new MultiLine;
Var *col = (Var*)LangElement::find("col");
Var *col = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
ShaderFeature::OutputTarget targ = ShaderFeature::DefaultTarget;
if (fd.features[MFT_isDeferred])
{
targ = ShaderFeature::RenderTarget1;
col = (Var*)LangElement::find("col1");
col = (Var*)LangElement::find(getOutputTargetVarName(targ));
if (!col)
{
// create color var
@ -2403,7 +2403,7 @@ void FogFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
fogColor->constSortPos = cspPass;
// Get the out color.
Var *color = (Var*) LangElement::find( "col" );
Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( !color )
{
color = new Var;
@ -2535,7 +2535,7 @@ void VisibilityFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
// Translucent objects do a simple alpha fade.
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 ) );
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.
Var *color = (Var*)LangElement::find( "col1" );
Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1));
if (!color)
color = (Var*)LangElement::find("col");
color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( !color )
{
output = NULL;
@ -2612,7 +2612,7 @@ void GlowMaskHLSL::processPix( Vector<ShaderComponent*> &componentList,
//
// The shader compiler will optimize out all the other
// 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 )
output = new GenOp( " @.rgb = 0;\r\n", color );
}
@ -2644,7 +2644,7 @@ void HDROutHLSL::processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
// Let the helper function do the work.
Var *color = (Var*)LangElement::find( "col" );
Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( 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.assetDesc = %assetDef;
%previewData.tooltip = "Datablock Name: " @ %assetDef @ "\n" @
"Datablock Type: " @ %assetDef.getClassName();
%previewData.tooltip = "\nDatablock Name: " @ %assetDef @
"\nDatablock Type: " @ %assetDef.getClassName() @
"\nDefinition Path: " @ %assetDef.getFilename();
%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.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.gameObjectName;
%previewData.tooltip = "Asset Name: " @ %assetDef.gameObjectName @ "\nDefinition Path: " @ %assetDef.getFilename();
}
function GuiInspectorTypeGameObjectAssetPtr::onClick( %this, %fieldName )

View file

@ -175,5 +175,5 @@ function AssetBrowser::buildGUIAssetPreview(%this, %assetDef, %previewData)
%previewData.assetFriendlyName = %assetDef.assetName;
%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
%previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );";
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\n" @
"Asset Type: Material Asset\n" @
"Asset Definition ID: " @ %assetDef;
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @
"\nAsset Type: Material Asset" @
"\nAsset Definition ID: " @ %assetDef @
"\nDefinition Path: " @ %assetDef.getScriptPath();
}
function AssetBrowser::onMaterialAssetEditorDropped(%this, %assetDef, %position)

View file

@ -165,5 +165,5 @@ function AssetBrowser::buildPostEffectAssetPreview(%this, %assetDef, %previewDat
%previewData.assetFriendlyName = %assetDef.assetName;
%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.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.assetName;
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename();
}
function GuiInspectorTypeScriptAssetPtr::onClick( %this, %fieldName )

View file

@ -51,5 +51,5 @@ function AssetBrowser::buildShapeAnimationAssetPreview(%this, %assetDef, %previe
%previewData.assetFriendlyName = %assetDef.assetName;
%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.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.assetName;
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename();
}
function AssetBrowser::onSoundAssetEditorDropped(%this, %assetDef, %position)

View file

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

View file

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

View file

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

View file

@ -831,6 +831,11 @@ T3Dpre4ProjectImporter::genProcessor("LevelInfo", "accuTexture accuTextureAsset"
T3Dpre4ProjectImporter::genProcessor("TSStatic", "shape shapeAsset shapeName shapeAsset");
T3Dpre4ProjectImporter::genProcessor("TSForestItemData", "shape shapeAsset shapeName shapeAsset shapeFile shapeAsset");
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
//==============================================================================