mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-18 06:03:48 +00:00
Merge branch 'Preview4_0' of https://github.com/Areloch/Torque3D into alph40_pbrConfig_BREAKINGWip
This commit is contained in:
commit
ba69f2fe2b
95 changed files with 4237 additions and 2024 deletions
|
|
@ -87,6 +87,10 @@ LevelAsset::LevelAsset() : AssetBase(), mIsSubLevel(false)
|
|||
mLevelName = StringTable->EmptyString();
|
||||
mLevelFile = StringTable->EmptyString();
|
||||
mPreviewImage = StringTable->EmptyString();
|
||||
mPostFXPresetFile = StringTable->EmptyString();
|
||||
mDecalsFile = StringTable->EmptyString();
|
||||
mForestFile = StringTable->EmptyString();
|
||||
mNavmeshFile = StringTable->EmptyString();
|
||||
|
||||
mGamemodeName = StringTable->EmptyString();
|
||||
mMainLevelAsset = StringTable->EmptyString();
|
||||
|
|
@ -115,6 +119,15 @@ void LevelAsset::initPersistFields()
|
|||
addProtectedField("PreviewImage", TypeAssetLooseFilePath, Offset(mPreviewImage, LevelAsset),
|
||||
&setPreviewImageFile, &getPreviewImageFile, "Path to the image used for selection preview.");
|
||||
|
||||
addProtectedField("PostFXPresetFile", TypeAssetLooseFilePath, Offset(mPostFXPresetFile, LevelAsset),
|
||||
&setLevelFile, &getLevelFile, "Path to the level's postFXPreset.");
|
||||
addProtectedField("DecalsFile", TypeAssetLooseFilePath, Offset(mDecalsFile, LevelAsset),
|
||||
&setLevelFile, &getLevelFile, "Path to the decals cache file.");
|
||||
addProtectedField("ForestFile", TypeAssetLooseFilePath, Offset(mForestFile, LevelAsset),
|
||||
&setLevelFile, &getLevelFile, "Path to the Forest cache file.");
|
||||
addProtectedField("NavmeshFile", TypeAssetLooseFilePath, Offset(mNavmeshFile, LevelAsset),
|
||||
&setLevelFile, &getLevelFile, "Path to the navmesh file.");
|
||||
|
||||
addField("isSubScene", TypeBool, Offset(mIsSubLevel, LevelAsset), "Is this a sublevel to another Scene");
|
||||
addField("gameModeName", TypeString, Offset(mGamemodeName, LevelAsset), "Name of the Game Mode to be used with this level");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ class LevelAsset : public AssetBase
|
|||
|
||||
StringTableEntry mLevelName;
|
||||
StringTableEntry mLevelFile;
|
||||
StringTableEntry mPostFXPresetFile;
|
||||
StringTableEntry mDecalsFile;
|
||||
StringTableEntry mForestFile;
|
||||
StringTableEntry mNavmeshFile;
|
||||
StringTableEntry mPreviewImage;
|
||||
|
||||
bool mIsSubLevel;
|
||||
|
|
@ -66,6 +70,14 @@ public:
|
|||
|
||||
void setLevelFile(const char* pImageFile);
|
||||
inline StringTableEntry getLevelFile(void) const { return mLevelFile; };
|
||||
void setPostFXPresetFile(const char* pPostFXPresetFile);
|
||||
inline StringTableEntry getPostFXPresetFile(void) const { return mPostFXPresetFile; };
|
||||
void setDecalsFile(const char* pDecalsFile);
|
||||
inline StringTableEntry getDecalsFile(void) const { return mDecalsFile; };
|
||||
void setForestFile(const char* pForestFile);
|
||||
inline StringTableEntry getForestFile(void) const { return mForestFile; };
|
||||
void setNavmeshFile(const char* pNavmeshFile);
|
||||
inline StringTableEntry getNavmeshFile(void) const { return mNavmeshFile; };
|
||||
void setImageFile(const char* pImageFile);
|
||||
inline StringTableEntry getImageFile(void) const { return mPreviewImage; };
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@
|
|||
#include "assets/assetPtr.h"
|
||||
#endif
|
||||
|
||||
#include "T3D/assets/TerrainMaterialAsset.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CONOBJECT(TerrainAsset);
|
||||
|
|
@ -89,7 +91,7 @@ ConsoleSetType(TypeTerrainAssetPtr)
|
|||
|
||||
TerrainAsset::TerrainAsset()
|
||||
{
|
||||
mTerrainFile = StringTable->EmptyString();
|
||||
mTerrainFilePath = StringTable->EmptyString();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -106,8 +108,22 @@ void TerrainAsset::initPersistFields()
|
|||
Parent::initPersistFields();
|
||||
|
||||
//addField("shaderGraph", TypeRealString, Offset(mShaderGraphFile, TerrainAsset), "");
|
||||
addProtectedField("terrainFile", TypeAssetLooseFilePath, Offset(mTerrainFile, TerrainAsset),
|
||||
&setTerrainFile, &getTerrainFile, "Path to the file containing the terrain data.");
|
||||
addProtectedField("terrainFile", TypeAssetLooseFilePath, Offset(mTerrainFilePath, TerrainAsset),
|
||||
&setTerrainFilePath, &getTerrainFilePath, "Path to the file containing the terrain data.");
|
||||
}
|
||||
|
||||
void TerrainAsset::setDataField(StringTableEntry slotName, const char* array, const char* value)
|
||||
{
|
||||
Parent::setDataField(slotName, array, value);
|
||||
|
||||
//Now, if it's a material slot of some fashion, set it up
|
||||
StringTableEntry matSlotName = StringTable->insert("terrainMaterialAsset");
|
||||
if (String(slotName).startsWith(matSlotName))
|
||||
{
|
||||
StringTableEntry matId = StringTable->insert(value);
|
||||
|
||||
mTerrMaterialAssetIds.push_back(matId);
|
||||
}
|
||||
}
|
||||
|
||||
void TerrainAsset::initializeAsset()
|
||||
|
|
@ -115,22 +131,20 @@ void TerrainAsset::initializeAsset()
|
|||
// Call parent.
|
||||
Parent::initializeAsset();
|
||||
|
||||
if (!Platform::isFullPath(mTerrainFile))
|
||||
mTerrainFile = getOwned() ? expandAssetFilePath(mTerrainFile) : mTerrainFile;
|
||||
if (!Platform::isFullPath(mTerrainFilePath))
|
||||
mTerrainFilePath = getOwned() ? expandAssetFilePath(mTerrainFilePath) : mTerrainFilePath;
|
||||
|
||||
//if (Platform::isFile(mTerrainFile))
|
||||
// Con::executeFile(mScriptFile, false, false);
|
||||
loadTerrain();
|
||||
}
|
||||
|
||||
void TerrainAsset::onAssetRefresh()
|
||||
{
|
||||
mTerrainFile = expandAssetFilePath(mTerrainFile);
|
||||
mTerrainFilePath = expandAssetFilePath(mTerrainFilePath);
|
||||
|
||||
//if (Platform::isFile(mScriptFile))
|
||||
// Con::executeFile(mScriptFile, false, false);
|
||||
loadTerrain();
|
||||
}
|
||||
|
||||
void TerrainAsset::setTerrainFile(const char* pScriptFile)
|
||||
void TerrainAsset::setTerrainFilePath(const char* pScriptFile)
|
||||
{
|
||||
// Sanity!
|
||||
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
|
||||
|
|
@ -139,12 +153,52 @@ void TerrainAsset::setTerrainFile(const char* pScriptFile)
|
|||
pScriptFile = StringTable->insert(pScriptFile);
|
||||
|
||||
// Update.
|
||||
mTerrainFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
|
||||
mTerrainFilePath = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
|
||||
|
||||
// Refresh the asset.
|
||||
refreshAsset();
|
||||
}
|
||||
|
||||
bool TerrainAsset::loadTerrain()
|
||||
{
|
||||
mTerrMaterialAssets.clear();
|
||||
mTerrMaterialAssetIds.clear();
|
||||
|
||||
//First, load any material, animation, etc assets we may be referencing in our asset
|
||||
// Find any asset dependencies.
|
||||
AssetManager::typeAssetDependsOnHash::Iterator assetDependenciesItr = mpOwningAssetManager->getDependedOnAssets()->find(mpAssetDefinition->mAssetId);
|
||||
|
||||
// Does the asset have any dependencies?
|
||||
if (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end())
|
||||
{
|
||||
// Iterate all dependencies.
|
||||
while (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end() && assetDependenciesItr->key == mpAssetDefinition->mAssetId)
|
||||
{
|
||||
StringTableEntry assetType = mpOwningAssetManager->getAssetType(assetDependenciesItr->value);
|
||||
|
||||
if (assetType == StringTable->insert("TerrainMaterialAsset"))
|
||||
{
|
||||
mTerrMaterialAssetIds.push_front(assetDependenciesItr->value);
|
||||
|
||||
//Force the asset to become initialized if it hasn't been already
|
||||
AssetPtr<TerrainMaterialAsset> matAsset = assetDependenciesItr->value;
|
||||
|
||||
mTerrMaterialAssets.push_front(matAsset);
|
||||
}
|
||||
|
||||
// Next dependency.
|
||||
assetDependenciesItr++;
|
||||
}
|
||||
}
|
||||
|
||||
mTerrainFile = ResourceManager::get().load(mTerrainFilePath);
|
||||
|
||||
if (mTerrainFile)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void TerrainAsset::copyTo(SimObject* object)
|
||||
|
|
@ -190,7 +244,7 @@ GuiControl* GuiInspectorTypeTerrainAssetPtr::constructEditControl()
|
|||
|
||||
TerrainAsset* matAsset = AssetDatabase.acquireAsset< TerrainAsset>(matAssetId);
|
||||
|
||||
TerrainMaterial* materialDef = nullptr;
|
||||
//TerrainMaterial* materialDef = nullptr;
|
||||
|
||||
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
|
||||
|
||||
|
|
@ -268,23 +322,3 @@ bool GuiInspectorTypeTerrainAssetPtr::updateRects()
|
|||
|
||||
return resized;
|
||||
}
|
||||
|
||||
void GuiInspectorTypeTerrainAssetPtr::setMaterialAsset(String assetId)
|
||||
{
|
||||
mTargetObject->setDataField(mCaption, "", assetId);
|
||||
|
||||
//force a refresh
|
||||
SimObject* obj = mInspector->getInspectObject();
|
||||
mInspector->inspectObject(obj);
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiInspectorTypeTerrainAssetPtr, setMaterialAsset, void, (String assetId), (""),
|
||||
"Gets a particular shape animation asset for this shape.\n"
|
||||
"@param animation asset index.\n"
|
||||
"@return Shape Animation Asset.\n")
|
||||
{
|
||||
if (assetId == String::EmptyString)
|
||||
return;
|
||||
|
||||
return object->setMaterialAsset(assetId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#pragma once
|
||||
#ifndef TERRAINASSET_H
|
||||
#define TERRAINASSET_H
|
||||
|
||||
|
|
@ -46,14 +47,23 @@
|
|||
#include "gui/editor/guiInspectorTypes.h"
|
||||
#endif
|
||||
|
||||
#include "terrain/terrData.h"
|
||||
//#include "terrain/terrData.h"
|
||||
#include "assets/assetPtr.h"
|
||||
#include "terrain/terrFile.h"
|
||||
|
||||
class TerrainMaterialAsset;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
class TerrainAsset : public AssetBase
|
||||
{
|
||||
typedef AssetBase Parent;
|
||||
|
||||
StringTableEntry mTerrainFile;
|
||||
StringTableEntry mTerrainFilePath;
|
||||
Resource<TerrainFile> mTerrainFile;
|
||||
|
||||
//Material assets we're dependent on and use
|
||||
Vector<StringTableEntry> mTerrMaterialAssetIds;
|
||||
Vector<AssetPtr<TerrainMaterialAsset>> mTerrMaterialAssets;
|
||||
|
||||
public:
|
||||
TerrainAsset();
|
||||
|
|
@ -63,8 +73,14 @@ public:
|
|||
static void initPersistFields();
|
||||
virtual void copyTo(SimObject* object);
|
||||
|
||||
void setTerrainFile(const char* pTerrainFile);
|
||||
inline StringTableEntry getTerrainFile(void) const { return mTerrainFile; };
|
||||
virtual void setDataField(StringTableEntry slotName, const char* array, const char* value);
|
||||
|
||||
void setTerrainFilePath(const char* pTerrainFile);
|
||||
inline StringTableEntry getTerrainFilePath(void) const { return mTerrainFilePath; };
|
||||
|
||||
inline Resource<TerrainFile> getTerrainResource(void) const { return mTerrainFile; };
|
||||
|
||||
bool loadTerrain();
|
||||
|
||||
/// Declare Console Object.
|
||||
DECLARE_CONOBJECT(TerrainAsset);
|
||||
|
|
@ -73,8 +89,8 @@ protected:
|
|||
virtual void initializeAsset();
|
||||
virtual void onAssetRefresh(void);
|
||||
|
||||
static bool setTerrainFile(void *obj, const char *index, const char *data) { static_cast<TerrainAsset*>(obj)->setTerrainFile(data); return false; }
|
||||
static const char* getTerrainFile(void* obj, const char* data) { return static_cast<TerrainAsset*>(obj)->getTerrainFile(); }
|
||||
static bool setTerrainFilePath(void *obj, const char *index, const char *data) { static_cast<TerrainAsset*>(obj)->setTerrainFilePath(data); return false; }
|
||||
static const char* getTerrainFilePath(void* obj, const char* data) { return static_cast<TerrainAsset*>(obj)->getTerrainFilePath(); }
|
||||
};
|
||||
|
||||
DefineConsoleType(TypeTerrainAssetPtr, TerrainAsset)
|
||||
|
|
@ -96,7 +112,6 @@ public:
|
|||
|
||||
virtual GuiControl* constructEditControl();
|
||||
virtual bool updateRects();
|
||||
void setMaterialAsset(String assetId);
|
||||
};
|
||||
|
||||
#endif // _ASSET_BASE_H_
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#pragma once
|
||||
#ifndef TERRAINMATERIALASSET_H
|
||||
#define TERRAINMATERIALASSET_H
|
||||
|
||||
|
|
|
|||
|
|
@ -240,9 +240,15 @@ LightningData::LightningData()
|
|||
{
|
||||
strikeSound = NULL;
|
||||
|
||||
dMemset( strikeTextureNames, 0, sizeof( strikeTextureNames ) );
|
||||
dMemset( strikeTextures, 0, sizeof( strikeTextures ) );
|
||||
dMemset( thunderSounds, 0, sizeof( thunderSounds ) );
|
||||
for (S32 i = 0; i < MaxThunders; i++)
|
||||
thunderSounds[i] = NULL;
|
||||
|
||||
for (S32 i = 0; i < MaxTextures; i++)
|
||||
{
|
||||
strikeTextureNames[i] = NULL;
|
||||
strikeTextures[i] = NULL;
|
||||
}
|
||||
|
||||
mNumStrikeTextures = 0;
|
||||
}
|
||||
|
||||
|
|
@ -282,9 +288,10 @@ bool LightningData::preload(bool server, String &errorStr)
|
|||
if (Parent::preload(server, errorStr) == false)
|
||||
return false;
|
||||
|
||||
dQsort(thunderSounds, MaxThunders, sizeof(SFXTrack*), cmpSounds);
|
||||
for (numThunders = 0; numThunders < MaxThunders && thunderSounds[numThunders] != NULL; numThunders++) {
|
||||
//
|
||||
//dQsort(thunderSounds, MaxThunders, sizeof(SFXTrack*), cmpSounds);
|
||||
|
||||
for (S32 i = 0; i < MaxThunders; i++) {
|
||||
if (thunderSounds[i]!= NULL) numThunders++;
|
||||
}
|
||||
|
||||
if (server == false)
|
||||
|
|
@ -321,14 +328,15 @@ void LightningData::packData(BitStream* stream)
|
|||
|
||||
U32 i;
|
||||
for (i = 0; i < MaxThunders; i++)
|
||||
sfxWrite( stream, thunderSounds[ i ] );
|
||||
{
|
||||
if (stream->writeFlag(thunderSounds[i]))
|
||||
sfxWrite(stream, thunderSounds[i]);
|
||||
}
|
||||
|
||||
stream->writeInt(mNumStrikeTextures, 4);
|
||||
|
||||
for (i = 0; i < MaxTextures; i++)
|
||||
{
|
||||
for (i = 0; i < MaxTextures; i++)
|
||||
stream->writeString(strikeTextureNames[i]);
|
||||
}
|
||||
|
||||
sfxWrite( stream, strikeSound );
|
||||
}
|
||||
|
|
@ -339,14 +347,17 @@ void LightningData::unpackData(BitStream* stream)
|
|||
|
||||
U32 i;
|
||||
for (i = 0; i < MaxThunders; i++)
|
||||
sfxRead( stream, &thunderSounds[ i ] );
|
||||
{
|
||||
if (stream->readFlag())
|
||||
sfxRead(stream, &thunderSounds[i]);
|
||||
else
|
||||
thunderSounds[i] = NULL;
|
||||
}
|
||||
|
||||
mNumStrikeTextures = stream->readInt(4);
|
||||
|
||||
for (i = 0; i < MaxTextures; i++)
|
||||
{
|
||||
for (i = 0; i < MaxTextures; i++)
|
||||
strikeTextureNames[i] = stream->readSTString();
|
||||
}
|
||||
|
||||
sfxRead( stream, &strikeSound );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -963,7 +963,8 @@ void ReflectionProbe::_onRenderViz(ObjectRenderInst *ri,
|
|||
desc.setZReadWrite(true, false);
|
||||
desc.setCullMode(GFXCullNone);
|
||||
desc.setBlend(true);
|
||||
desc.fillMode = GFXFillWireframe;
|
||||
//desc.fillMode = GFXFillWireframe;
|
||||
|
||||
// Base the sphere color on the light color.
|
||||
ColorI color = ColorI(255, 0, 255, 63);
|
||||
|
||||
|
|
|
|||
|
|
@ -284,6 +284,78 @@ void AssetBase::refreshAsset(void)
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
S32 AssetBase::getAssetDependencyFieldCount(const char* pFieldName)
|
||||
{
|
||||
S32 matchedFieldCount = 0;
|
||||
SimFieldDictionary* fieldDictionary = getFieldDictionary();
|
||||
for (SimFieldDictionaryIterator itr(fieldDictionary); *itr; ++itr)
|
||||
{
|
||||
SimFieldDictionary::Entry* entry = *itr;
|
||||
|
||||
if (String(entry->slotName).startsWith(pFieldName))
|
||||
{
|
||||
matchedFieldCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return matchedFieldCount;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void AssetBase::clearAssetDependencyFields(const char* pFieldName)
|
||||
{
|
||||
SimFieldDictionary* fieldDictionary = getFieldDictionary();
|
||||
for (SimFieldDictionaryIterator itr(fieldDictionary); *itr; ++itr)
|
||||
{
|
||||
SimFieldDictionary::Entry* entry = *itr;
|
||||
|
||||
if (String(entry->slotName).startsWith(pFieldName))
|
||||
{
|
||||
setDataField(entry->slotName, NULL, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void AssetBase::addAssetDependencyField(const char* pFieldName, const char* pAssetId)
|
||||
{
|
||||
U32 existingFieldCount = getAssetDependencyFieldCount(pFieldName);
|
||||
|
||||
//we have a match!
|
||||
char depSlotName[50];
|
||||
dSprintf(depSlotName, sizeof(depSlotName), "%s%d", pFieldName, existingFieldCount);
|
||||
|
||||
char depValue[255];
|
||||
dSprintf(depValue, sizeof(depValue), "@Asset=%s", pAssetId);
|
||||
|
||||
setDataField(StringTable->insert(depSlotName), NULL, StringTable->insert(depValue));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool AssetBase::saveAsset()
|
||||
{
|
||||
// Set the format mode.
|
||||
Taml taml;
|
||||
|
||||
// Yes, so set it.
|
||||
taml.setFormatMode(Taml::getFormatModeEnum("xml"));
|
||||
|
||||
// Turn-off auto-formatting.
|
||||
taml.setAutoFormat(false);
|
||||
|
||||
// Read object.
|
||||
bool success = taml.write(this, AssetDatabase.getAssetFilePath(getAssetId()));
|
||||
|
||||
if (!success)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void AssetBase::acquireAssetReference(void)
|
||||
{
|
||||
// Acquired the acquired reference count.
|
||||
|
|
|
|||
|
|
@ -104,6 +104,12 @@ public:
|
|||
|
||||
void refreshAsset(void);
|
||||
|
||||
S32 getAssetDependencyFieldCount(const char* pFieldName);
|
||||
void clearAssetDependencyFields(const char* pFieldName);
|
||||
void addAssetDependencyField(const char* pFieldName, const char* pAssetId);
|
||||
|
||||
bool saveAsset();
|
||||
|
||||
/// Declare Console Object.
|
||||
DECLARE_CONOBJECT(AssetBase);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2013 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
|
@ -39,3 +39,31 @@ DefineEngineMethod(AssetBase, getAssetId, String, (), ,
|
|||
{
|
||||
return object->getAssetId();
|
||||
}
|
||||
|
||||
DefineEngineMethod(AssetBase, getAssetDependencyFieldCount, S32, (const char* pFieldName), (""),
|
||||
"Gets the assets' Asset Id. This is only available if the asset was acquired from the asset manager.\n"
|
||||
"@return The assets' Asset Id.\n")
|
||||
{
|
||||
return object->getAssetDependencyFieldCount(pFieldName);
|
||||
}
|
||||
|
||||
DefineEngineMethod(AssetBase, clearAssetDependencyFields, void, (const char* pFieldName), (""),
|
||||
"Gets the assets' Asset Id. This is only available if the asset was acquired from the asset manager.\n"
|
||||
"@return The assets' Asset Id.\n")
|
||||
{
|
||||
object->clearAssetDependencyFields(pFieldName);
|
||||
}
|
||||
|
||||
DefineEngineMethod(AssetBase, addAssetDependencyField, void, (const char* pFieldName, const char* pAssetId), ("", ""),
|
||||
"Gets the assets' Asset Id. This is only available if the asset was acquired from the asset manager.\n"
|
||||
"@return The assets' Asset Id.\n")
|
||||
{
|
||||
object->addAssetDependencyField(pFieldName, pAssetId);
|
||||
}
|
||||
|
||||
DefineEngineMethod(AssetBase, saveAsset, bool, (), ,
|
||||
"Gets the assets' Asset Id. This is only available if the asset was acquired from the asset manager.\n"
|
||||
"@return The assets' Asset Id.\n")
|
||||
{
|
||||
return object->saveAsset();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ private:
|
|||
std::tie(std::get<I + (sizeof...(ArgTs) - sizeof...(TailTs))>(args)...) = defaultArgs;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1910)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1910) && (_MSC_VER < 1920)
|
||||
template<typename ...TailTs>
|
||||
struct DodgyVCHelper
|
||||
{
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ VolumetricFogRTManager::~VolumetricFogRTManager()
|
|||
void VolumetricFogRTManager::onSceneRemove()
|
||||
{
|
||||
if (mIsInitialized)
|
||||
mPlatformWindow->getScreenResChangeSignal().remove(this, &VolumetricFogRTManager::ResizeRT);
|
||||
mPlatformWindow->resizeEvent.remove(this, &VolumetricFogRTManager::ResizeRT);
|
||||
}
|
||||
|
||||
void VolumetricFogRTManager::onRemove()
|
||||
|
|
@ -148,7 +148,7 @@ bool VolumetricFogRTManager::Init()
|
|||
}
|
||||
|
||||
mPlatformWindow = cv->getPlatformWindow();
|
||||
mPlatformWindow->getScreenResChangeSignal().notify(this,&VolumetricFogRTManager::ResizeRT);
|
||||
mPlatformWindow->resizeEvent.notify(this,&VolumetricFogRTManager::ResizeRT);
|
||||
|
||||
if (mTargetScale < 1 || GFX->getAdapterType() == Direct3D11)
|
||||
mTargetScale = 1;
|
||||
|
|
@ -205,22 +205,17 @@ U32 VolumetricFogRTManager::DecFogObjects()
|
|||
return mNumFogObjects;
|
||||
}
|
||||
|
||||
void VolumetricFogRTManager::ResizeRT(PlatformWindow* win,bool resize)
|
||||
void VolumetricFogRTManager::ResizeRT( WindowId did, S32 width, S32 height )
|
||||
{
|
||||
mFogHasAnswered = 0;
|
||||
smVolumetricFogRTMResizeSignal.trigger(this, true);
|
||||
}
|
||||
|
||||
void VolumetricFogRTManager::FogAnswered()
|
||||
{
|
||||
mFogHasAnswered++;
|
||||
if (mFogHasAnswered == mNumFogObjects)
|
||||
{
|
||||
if (Resize())
|
||||
smVolumetricFogRTMResizeSignal.trigger(this, false);
|
||||
else
|
||||
Con::errorf("VolumetricFogRTManager::FogAnswered - Error resizing rendertargets!");
|
||||
}
|
||||
if (Resize())
|
||||
smVolumetricFogRTMResizeSignal.trigger(this, false);
|
||||
else
|
||||
Con::errorf("VolumetricFogRTManager::FogAnswered - Error resizing rendertargets!");
|
||||
}
|
||||
|
||||
bool VolumetricFogRTManager::Resize()
|
||||
|
|
@ -279,7 +274,6 @@ S32 VolumetricFogRTManager::setQuality(U32 Quality)
|
|||
|
||||
mTargetScale = Quality;
|
||||
|
||||
mFogHasAnswered = 0;
|
||||
smVolumetricFogRTMResizeSignal.trigger(this, true);
|
||||
|
||||
return mTargetScale;
|
||||
|
|
|
|||
|
|
@ -59,13 +59,12 @@ class VolumetricFogRTManager : public SceneObject
|
|||
static S32 mTargetScale;
|
||||
bool mIsInitialized;
|
||||
U32 mNumFogObjects;
|
||||
U32 mFogHasAnswered;
|
||||
U32 mWidth;
|
||||
U32 mHeight;
|
||||
|
||||
void onRemove();
|
||||
void onSceneRemove();
|
||||
void ResizeRT(PlatformWindow *win, bool resize);
|
||||
void ResizeRT(WindowId did, S32 width, S32 height);
|
||||
|
||||
static VolumetricFogRTMResizeSignal smVolumetricFogRTMResizeSignal;
|
||||
|
||||
|
|
|
|||
|
|
@ -862,7 +862,10 @@ U8 GBitmap::getChanelValueAt(U32 x, U32 y, U32 chan)
|
|||
{
|
||||
ColorI pixelColor = ColorI(255,255,255,255);
|
||||
getColor(x, y, pixelColor);
|
||||
|
||||
if (mInternalFormat == GFXFormatL16)
|
||||
{
|
||||
chan = 0;
|
||||
}
|
||||
switch (chan) {
|
||||
case 0: return pixelColor.red;
|
||||
case 1: return pixelColor.green;
|
||||
|
|
@ -1323,7 +1326,7 @@ U32 GBitmap::getSurfaceSize(const U32 mipLevel) const
|
|||
if (mInternalFormat >= GFXFormatBC1 && mInternalFormat <= GFXFormatBC3)
|
||||
{
|
||||
// From the directX docs:
|
||||
// max(1, width ÷ 4) x max(1, height ÷ 4) x 8(DXT1) or 16(DXT2-5)
|
||||
// max(1, width ÷ 4) x max(1, height ÷ 4) x 8(DXT1) or 16(DXT2-5)
|
||||
|
||||
U32 sizeMultiple = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -1176,6 +1176,10 @@ void GuiTreeViewCtrl::_buildItem( Item* item, U32 tabLevel, bool bForceFullUpdat
|
|||
else
|
||||
item->mState.clear( Item::Filtered );
|
||||
|
||||
//If the item should be hidden from view, check now
|
||||
if (mHiddenItemsList.contains(item->mId))
|
||||
item->mState.set(Item::Filtered);
|
||||
|
||||
// Is this the root item?
|
||||
const bool isRoot = item == mRoot;
|
||||
|
||||
|
|
@ -4477,6 +4481,18 @@ void GuiTreeViewCtrl::setItemFilterException(U32 item, bool isExempted)
|
|||
}
|
||||
}
|
||||
|
||||
void GuiTreeViewCtrl::setItemHidden(U32 item, bool isHidden)
|
||||
{
|
||||
if (isHidden)
|
||||
{
|
||||
mHiddenItemsList.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
mHiddenItemsList.remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
void GuiTreeViewCtrl::reparentItems(Vector<Item*> selectedItems, Item* newParent)
|
||||
{
|
||||
for (S32 i = 0; i < selectedItems.size(); i++)
|
||||
|
|
@ -5651,6 +5667,26 @@ DefineEngineMethod(GuiTreeViewCtrl, setItemFilterException, void, (U32 item, boo
|
|||
{
|
||||
object->setItemFilterException(item, isExempt);
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiTreeViewCtrl, setItemHidden, void, (U32 item, bool hidden), (0, true),
|
||||
"Set the pattern by which to filter items in the tree. Only items in the tree whose text "
|
||||
"matches this pattern are displayed.\n\n"
|
||||
"@param pattern New pattern based on which visible items in the tree should be filtered. If empty, all items become visible.\n\n"
|
||||
"@see getFilterText\n"
|
||||
"@see clearFilterText")
|
||||
{
|
||||
object->setItemHidden(item, hidden);
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiTreeViewCtrl, clearHiddenItems, void, (),,
|
||||
"Set the pattern by which to filter items in the tree. Only items in the tree whose text "
|
||||
"matches this pattern are displayed.\n\n"
|
||||
"@param pattern New pattern based on which visible items in the tree should be filtered. If empty, all items become visible.\n\n"
|
||||
"@see getFilterText\n"
|
||||
"@see clearFilterText")
|
||||
{
|
||||
object->clearHiddenItems();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( GuiTreeViewCtrl, clearFilterText, void, (),,
|
||||
|
|
|
|||
|
|
@ -360,6 +360,7 @@ class GuiTreeViewCtrl : public GuiArrayCtrl
|
|||
bool mDoFilterChildren;
|
||||
|
||||
Vector<U32> mItemFilterExceptionList;
|
||||
Vector<U32> mHiddenItemsList;
|
||||
|
||||
/// If true, a trace of actions taken by the control is logged to the console. Can
|
||||
/// be turned on with the setDebug() script method.
|
||||
|
|
@ -578,6 +579,8 @@ class GuiTreeViewCtrl : public GuiArrayCtrl
|
|||
|
||||
void setFilterChildren(bool doFilter) { mDoFilterChildren = doFilter; }
|
||||
void setItemFilterException(U32 item, bool isExempt);
|
||||
void setItemHidden(U32 item, bool isHidden);
|
||||
void clearHiddenItems() { mHiddenItemsList.clear(); }
|
||||
|
||||
/// Clear the current item filtering pattern.
|
||||
void clearFilterText() { setFilterText( String::EmptyString ); }
|
||||
|
|
|
|||
|
|
@ -447,10 +447,6 @@ AdvancedLightBinManager::LightMaterialInfo* AdvancedLightBinManager::_getLightMa
|
|||
if ( smPSSMDebugRender )
|
||||
shadowMacros.push_back( GFXShaderMacro( "PSSM_DEBUG_RENDER" ) );
|
||||
|
||||
// If its a vector light see if we can enable SSAO.
|
||||
if ( lightType == LightInfo::Vector && smUseSSAOMask )
|
||||
shadowMacros.push_back( GFXShaderMacro( "USE_SSAO_MASK" ) );
|
||||
|
||||
// Now create the material info object.
|
||||
info = new LightMaterialInfo( lightMatName, smLightMatVertex[ lightType ], shadowMacros );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ Material::Material()
|
|||
dMemset(mCellLayout, 0, sizeof(mCellLayout));
|
||||
dMemset(mCellSize, 0, sizeof(mCellSize));
|
||||
dMemset(mNormalMapAtlas, 0, sizeof(mNormalMapAtlas));
|
||||
dMemset(mUseAnisotropic, 0, sizeof(mUseAnisotropic));
|
||||
dMemset(mUseAnisotropic, 1, sizeof(mUseAnisotropic));
|
||||
|
||||
mImposterLimits = Point4F::Zero;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,9 +38,16 @@
|
|||
#include "console/consoleTypes.h"
|
||||
#endif
|
||||
|
||||
#ifndef _MODULE_DEFINITION_H
|
||||
#include "module/moduleDefinition.h"
|
||||
#endif
|
||||
|
||||
#ifndef _STRINGFUNCTIONS_H_
|
||||
#include "core/strings/stringFunctions.h"
|
||||
#endif
|
||||
|
||||
// Script bindings.
|
||||
#include "moduleManager_ScriptBinding.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CONOBJECT( ModuleManager );
|
||||
|
|
@ -65,6 +72,25 @@ S32 QSORT_CALLBACK moduleDefinitionVersionIdSort( const void* a, const void* b )
|
|||
return versionId1 > versionId2 ? -1 : versionId1 < versionId2 ? 1 : 0;
|
||||
}
|
||||
|
||||
S32 QSORT_CALLBACK moduleDependencySort(const void* a, const void* b)
|
||||
{
|
||||
// Fetch module definitions.
|
||||
ModuleDefinition* pDefinition1 = *(ModuleDefinition * *)a;
|
||||
ModuleDefinition* pDefinition2 = *(ModuleDefinition * *)b;
|
||||
|
||||
// Fetch version Ids.
|
||||
ModuleDefinition::typeModuleDependencyVector moduleDependencies = pDefinition1->getDependencies();
|
||||
bool foundDependant = false;
|
||||
for (ModuleDefinition::typeModuleDependencyVector::const_iterator dependencyItr = moduleDependencies.begin(); dependencyItr != moduleDependencies.end(); ++dependencyItr)
|
||||
{
|
||||
if (dStrcmp(dependencyItr->mModuleId, pDefinition2->getModuleId())
|
||||
&& (dependencyItr->mVersionId == pDefinition2->getVersionId()))
|
||||
foundDependant = true;
|
||||
}
|
||||
|
||||
return foundDependant ? 1 : -1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ModuleManager::ModuleManager() :
|
||||
|
|
@ -1087,6 +1113,7 @@ void ModuleManager::findModules( const bool loadedOnly, typeConstModuleDefinitio
|
|||
moduleDefinitions.push_back( pModuleDefinition );
|
||||
}
|
||||
}
|
||||
dQsort(moduleDefinitions.address(), moduleDefinitions.size(), sizeof(ModuleDefinition*), moduleDependencySort);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -314,3 +314,76 @@ S32 PostEffectManager::_effectPrioritySort( PostEffect* const *e1, PostEffect* c
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PostEffectManager::dumpActivePostFX()
|
||||
{
|
||||
EffectVector effects;
|
||||
|
||||
for (U32 i = 0; i < mEndOfFrameList.size(); i++)
|
||||
{
|
||||
PostEffect* effect = mEndOfFrameList[i];
|
||||
|
||||
if(effect->isEnabled())
|
||||
effects.push_back(effect);
|
||||
}
|
||||
|
||||
for (U32 i = 0; i < mAfterDiffuseList.size(); i++)
|
||||
{
|
||||
PostEffect* effect = mAfterDiffuseList[i];
|
||||
|
||||
if (effect->isEnabled())
|
||||
effects.push_back(effect);
|
||||
}
|
||||
|
||||
|
||||
// Now check the bin maps.
|
||||
EffectMap::Iterator mapIter = mAfterBinMap.begin();
|
||||
for (; mapIter != mAfterBinMap.end(); mapIter++)
|
||||
{
|
||||
EffectVector& ef = mapIter->value;
|
||||
|
||||
for (U32 i = 0; i < ef.size(); i++)
|
||||
{
|
||||
PostEffect* effect = ef[i];
|
||||
|
||||
if (effect->isEnabled())
|
||||
effects.push_back(effect);
|
||||
}
|
||||
}
|
||||
|
||||
mapIter = mBeforeBinMap.begin();
|
||||
for (; mapIter != mBeforeBinMap.end(); mapIter++)
|
||||
{
|
||||
EffectVector& ef = mapIter->value;
|
||||
|
||||
for (U32 i = 0; i < ef.size(); i++)
|
||||
{
|
||||
PostEffect* effect = ef[i];
|
||||
|
||||
if (effect->isEnabled())
|
||||
effects.push_back(effect);
|
||||
}
|
||||
}
|
||||
|
||||
// Resort the effects by priority.
|
||||
effects.sort(&_effectPrioritySort);
|
||||
|
||||
Con::printf("PostEffectManager::dumpActivePostFX() - Beginning Dump");
|
||||
|
||||
for (U32 i = 0; i < effects.size(); i++)
|
||||
{
|
||||
PostEffect* effect = effects[i];
|
||||
|
||||
if (effect->isEnabled())
|
||||
{
|
||||
Con::printf("%s", effect->getName());
|
||||
}
|
||||
}
|
||||
|
||||
Con::printf("PostEffectManager::dumpActivePostFX() - Ending Dump");
|
||||
}
|
||||
|
||||
DefineEngineFunction(dumpActivePostFX, void, (),, "")
|
||||
{
|
||||
PFXMGR->dumpActivePostFX();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,9 +132,11 @@ public:
|
|||
|
||||
// For ManagedSingleton.
|
||||
static const char* getSingletonName() { return "PostEffectManager"; }
|
||||
|
||||
void dumpActivePostFX();
|
||||
};
|
||||
|
||||
/// Returns the PostEffectManager singleton.
|
||||
#define PFXMGR ManagedSingleton<PostEffectManager>::instance()
|
||||
|
||||
#endif // _POSTEFFECTMANAGER_H_
|
||||
#endif // _POSTEFFECTMANAGER_H_
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include "renderInstance/renderDeferredMgr.h"
|
||||
#include "math/mPolyhedron.impl.h"
|
||||
#include "gfx/gfxTransformSaver.h"
|
||||
|
||||
#include "lighting/advanced/advancedLightBinManager.h" //for ssao
|
||||
#include "gfx/gfxDebugEvent.h"
|
||||
#include "shaderGen/shaderGenVars.h"
|
||||
#include "materials/shaderData.h"
|
||||
|
|
@ -752,6 +752,24 @@ void RenderProbeMgr::render( SceneRenderState *state )
|
|||
mProbeArrayEffect->setShaderMacro("SKYLIGHT_ONLY", "1");
|
||||
else
|
||||
mProbeArrayEffect->setShaderMacro("SKYLIGHT_ONLY", "0");
|
||||
|
||||
//ssao mask
|
||||
if (AdvancedLightBinManager::smUseSSAOMask)
|
||||
{
|
||||
//find ssaoMask
|
||||
NamedTexTargetRef ssaoTarget = NamedTexTarget::find("ssaoMask");
|
||||
GFXTextureObject* pTexObj = ssaoTarget->getTexture();
|
||||
if (pTexObj)
|
||||
{
|
||||
mProbeArrayEffect->setShaderMacro("USE_SSAO_MASK");
|
||||
mProbeArrayEffect->setTexture(6, pTexObj);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mProbeArrayEffect->setTexture(6, NULL);
|
||||
}
|
||||
|
||||
mProbeArrayEffect->setTexture(3, mBRDFTexture);
|
||||
mProbeArrayEffect->setCubemapArrayTexture(4, mPrefilterArray);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
#include "T3D/physics/physicsCollision.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
#include "console/engineAPI.h"
|
||||
#include "T3D/assets/TerrainMaterialAsset.h"
|
||||
using namespace Torque;
|
||||
|
||||
IMPLEMENT_CO_NETOBJECT_V1(TerrainBlock);
|
||||
|
|
@ -207,6 +207,9 @@ TerrainBlock::TerrainBlock()
|
|||
mNetFlags.set(Ghostable | ScopeAlways);
|
||||
mIgnoreZodiacs = false;
|
||||
zode_primBuffer = 0;
|
||||
|
||||
mTerrainAsset = StringTable->EmptyString();
|
||||
mTerrainAssetId = StringTable->EmptyString();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -352,17 +355,90 @@ void TerrainBlock::setFile(const Resource<TerrainFile>& terr)
|
|||
mTerrFileName = terr.getPath();
|
||||
}
|
||||
|
||||
bool TerrainBlock::setTerrainAsset(const StringTableEntry terrainAssetId)
|
||||
{
|
||||
mTerrainAssetId = terrainAssetId;
|
||||
mTerrainAsset = mTerrainAssetId;
|
||||
|
||||
if (mTerrainAsset.isNull())
|
||||
{
|
||||
Con::errorf("[TerrainBlock] Failed to load terrain asset.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Resource<TerrainFile> file = mTerrainAsset->getTerrainResource();
|
||||
if (!file)
|
||||
return false;
|
||||
|
||||
setFile(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TerrainBlock::save(const char *filename)
|
||||
{
|
||||
return mFile->save(filename);
|
||||
}
|
||||
|
||||
bool TerrainBlock::saveAsset()
|
||||
{
|
||||
if (!mTerrainAsset.isNull() && mTerrainAsset->isAssetValid())
|
||||
{
|
||||
mTerrainAsset->clearAssetDependencyFields("terrainMaterailAsset");
|
||||
|
||||
AssetQuery* pAssetQuery = new AssetQuery();
|
||||
AssetDatabase.findAssetType(pAssetQuery, "TerrainMaterialAsset");
|
||||
|
||||
TerrainBlock* clientTerr = static_cast<TerrainBlock*>(getClientObject());
|
||||
|
||||
for (U32 i = 0; i < pAssetQuery->mAssetList.size(); i++)
|
||||
{
|
||||
//Acquire it so we can check it for matches
|
||||
AssetPtr<TerrainMaterialAsset> terrMatAsset = pAssetQuery->mAssetList[i];
|
||||
|
||||
for (U32 m = 0; m < clientTerr->mFile->mMaterials.size(); m++)
|
||||
{
|
||||
StringTableEntry intMatName = clientTerr->mFile->mMaterials[m]->getInternalName();
|
||||
|
||||
StringTableEntry assetMatDefName = terrMatAsset->getMaterialDefinitionName();
|
||||
if (assetMatDefName == intMatName)
|
||||
{
|
||||
mTerrainAsset->addAssetDependencyField("terrainMaterailAsset", terrMatAsset.getAssetId());
|
||||
}
|
||||
}
|
||||
|
||||
terrMatAsset.clear();
|
||||
}
|
||||
|
||||
pAssetQuery->destroySelf();
|
||||
|
||||
bool saveAssetSuccess = mTerrainAsset->saveAsset();
|
||||
|
||||
if (!saveAssetSuccess)
|
||||
return false;
|
||||
|
||||
return mFile->save(mTerrainAsset->getTerrainFilePath());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TerrainBlock::_setTerrainFile( void *obj, const char *index, const char *data )
|
||||
{
|
||||
static_cast<TerrainBlock*>( obj )->setFile( FileName( data ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TerrainBlock::_setTerrainAsset(void* obj, const char* index, const char* data)
|
||||
{
|
||||
TerrainBlock* terr = static_cast<TerrainBlock*>(obj);// ->setFile(FileName(data));
|
||||
|
||||
terr->setTerrainAsset(StringTable->insert(data));
|
||||
|
||||
terr->setMaskBits(FileMask | HeightMapChangeMask);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void TerrainBlock::_updateBounds()
|
||||
{
|
||||
if ( !mFile )
|
||||
|
|
@ -901,31 +977,50 @@ bool TerrainBlock::onAdd()
|
|||
if(!Parent::onAdd())
|
||||
return false;
|
||||
|
||||
if ( mTerrFileName.isEmpty() )
|
||||
Resource<TerrainFile> terr;
|
||||
|
||||
if (!mTerrainAsset.isNull())
|
||||
{
|
||||
mTerrFileName = Con::getVariable( "$Client::MissionFile" );
|
||||
String terrainDirectory( Con::getVariable( "$pref::Directories::Terrain" ) );
|
||||
if ( terrainDirectory.isEmpty() )
|
||||
terr = mTerrainAsset->getTerrainResource();
|
||||
|
||||
if (terr == NULL)
|
||||
{
|
||||
terrainDirectory = "art/terrains/";
|
||||
if (isClientObject())
|
||||
NetConnection::setLastError("Unable to load terrain asset: %s", mTerrainAsset.getAssetId());
|
||||
return false;
|
||||
}
|
||||
mTerrFileName.replace("tools/levels/", terrainDirectory);
|
||||
mTerrFileName.replace("levels/", terrainDirectory);
|
||||
|
||||
Vector<String> materials;
|
||||
materials.push_back( "warning_material" );
|
||||
TerrainFile::create( &mTerrFileName, 256, materials );
|
||||
mFile = terr;
|
||||
}
|
||||
|
||||
Resource<TerrainFile> terr = ResourceManager::get().load( mTerrFileName );
|
||||
if(terr == NULL)
|
||||
else
|
||||
{
|
||||
if(isClientObject())
|
||||
NetConnection::setLastError("You are missing a file needed to play this mission: %s", mTerrFileName.c_str());
|
||||
return false;
|
||||
}
|
||||
if (mTerrFileName.isEmpty())
|
||||
{
|
||||
mTerrFileName = Con::getVariable("$Client::MissionFile");
|
||||
String terrainDirectory(Con::getVariable("$pref::Directories::Terrain"));
|
||||
if (terrainDirectory.isEmpty())
|
||||
{
|
||||
terrainDirectory = "art/terrains/";
|
||||
}
|
||||
mTerrFileName.replace("tools/levels/", terrainDirectory);
|
||||
mTerrFileName.replace("levels/", terrainDirectory);
|
||||
|
||||
setFile( terr );
|
||||
Vector<String> materials;
|
||||
materials.push_back("warning_material");
|
||||
TerrainFile::create(&mTerrFileName, 256, materials);
|
||||
}
|
||||
|
||||
terr = ResourceManager::get().load(mTerrFileName);
|
||||
|
||||
if (terr == NULL)
|
||||
{
|
||||
if (isClientObject())
|
||||
NetConnection::setLastError("You are missing a file needed to play this mission: %s", mTerrFileName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
setFile(terr);
|
||||
}
|
||||
|
||||
if ( terr->mNeedsResaving )
|
||||
{
|
||||
|
|
@ -1125,7 +1220,11 @@ void TerrainBlock::setScale( const VectorF &scale )
|
|||
void TerrainBlock::initPersistFields()
|
||||
{
|
||||
addGroup( "Media" );
|
||||
|
||||
|
||||
addProtectedField("terrainAsset", TypeTerrainAssetPtr, Offset(mTerrainAsset, TerrainBlock),
|
||||
&TerrainBlock::_setTerrainAsset, &defaultProtectedGetFn,
|
||||
"The source terrain data asset.");
|
||||
|
||||
addProtectedField( "terrainFile", TypeStringFilename, Offset( mTerrFileName, TerrainBlock ),
|
||||
&TerrainBlock::_setTerrainFile, &defaultProtectedGetFn,
|
||||
"The source terrain data file." );
|
||||
|
|
@ -1310,6 +1409,16 @@ DefineEngineMethod( TerrainBlock, save, bool, ( const char* fileName),,
|
|||
return static_cast<TerrainBlock*>(object)->save(filename);
|
||||
}
|
||||
|
||||
DefineEngineMethod(TerrainBlock, saveAsset, bool, (), ,
|
||||
"@brief Saves the terrain block's terrain file to the specified file name.\n\n"
|
||||
|
||||
"@param fileName Name and path of file to save terrain data to.\n\n"
|
||||
|
||||
"@return True if file save was successful, false otherwise")
|
||||
{
|
||||
return static_cast<TerrainBlock*>(object)->saveAsset();
|
||||
}
|
||||
|
||||
//ConsoleMethod(TerrainBlock, save, bool, 3, 3, "(string fileName) - saves the terrain block's terrain file to the specified file name.")
|
||||
//{
|
||||
// char filename[256];
|
||||
|
|
|
|||
|
|
@ -50,7 +50,12 @@
|
|||
#include "gfx/gfxPrimitiveBuffer.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _ASSET_PTR_H_
|
||||
#include "assets/assetPtr.h"
|
||||
#endif
|
||||
#ifndef TERRAINASSET_H
|
||||
#include "T3D/assets/TerrainAsset.h"
|
||||
#endif
|
||||
|
||||
class GBitmap;
|
||||
class TerrainBlock;
|
||||
|
|
@ -120,6 +125,9 @@ protected:
|
|||
|
||||
///
|
||||
FileName mTerrFileName;
|
||||
|
||||
AssetPtr<TerrainAsset> mTerrainAsset;
|
||||
StringTableEntry mTerrainAssetId;
|
||||
|
||||
/// The maximum detail distance found in the material list.
|
||||
F32 mMaxDetailDistance;
|
||||
|
|
@ -241,6 +249,7 @@ protected:
|
|||
|
||||
// Protected fields
|
||||
static bool _setTerrainFile( void *obj, const char *index, const char *data );
|
||||
static bool _setTerrainAsset(void* obj, const char* index, const char* data);
|
||||
static bool _setSquareSize( void *obj, const char *index, const char *data );
|
||||
static bool _setBaseTexSize(void *obj, const char *index, const char *data);
|
||||
static bool _setBaseTexFormat(void *obj, const char *index, const char *data);
|
||||
|
|
@ -418,7 +427,10 @@ public:
|
|||
|
||||
void setFile(const Resource<TerrainFile>& file);
|
||||
|
||||
bool setTerrainAsset(const StringTableEntry terrainAssetId);
|
||||
|
||||
bool save(const char* filename);
|
||||
bool saveAsset();
|
||||
|
||||
F32 getSquareSize() const { return mSquareSize; }
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ void TerrainMaterial::initPersistFields()
|
|||
addField( "parallaxScale", TypeF32, Offset( mParallaxScale, TerrainMaterial ), "Used to scale the height from the normal map to give some self "
|
||||
"occlusion effect (aka parallax) to the terrain material" );
|
||||
|
||||
addField("compositeMap", TypeStringFilename, Offset(mCompositeMap, TerrainMaterial), "Composite map for the material");
|
||||
addField("pbrConfigMap", TypeStringFilename, Offset(mCompositeMap, TerrainMaterial), "Composite map for the material");
|
||||
Parent::initPersistFields();
|
||||
|
||||
// Gotta call this at least once or it won't get created!
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ void PlatformWindowManagerSDL::_process()
|
|||
|
||||
char* fileName = evt.drop.file;
|
||||
|
||||
if (!Platform::isFile(fileName))
|
||||
if (!Platform::isDirectory(fileName) && !Platform::isFile(fileName))
|
||||
break;
|
||||
|
||||
Con::executef("onDropFile", StringTable->insert(fileName));
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ void Win32Window::setVideoMode( const GFXVideoMode &mode )
|
|||
mOwningManager->raiseCurtain();
|
||||
|
||||
SetForegroundWindow( getHWND() );
|
||||
getScreenResChangeSignal().trigger( this, true );
|
||||
resizeEvent.trigger( this, true );
|
||||
}
|
||||
|
||||
bool Win32Window::clearFullscreen()
|
||||
|
|
@ -806,7 +806,7 @@ LRESULT PASCAL Win32Window::WindowProc( HWND hWnd, UINT message, WPARAM wParam,
|
|||
window->getGFXTarget()->resetMode();
|
||||
}
|
||||
|
||||
window->getScreenResChangeSignal().trigger(window, true);
|
||||
window->resizeEvent.trigger(window, true);
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue