Merge branch 'Preview4_0_w_translucencyWIP' of https://github.com/Areloch/Torque3D into Preview4_0_w_translucencyWIP

This commit is contained in:
AzaezelX 2019-08-05 01:34:23 -05:00
commit b3d376d085
50 changed files with 1464 additions and 430 deletions

View file

@ -12,7 +12,7 @@ Scene::Scene() :
mIsEditing(false),
mIsDirty(false)
{
mGameModeName = StringTable->EmptyString();
}
Scene::~Scene()
@ -29,6 +29,10 @@ void Scene::initPersistFields()
addField("isEditing", TypeBool, Offset(mIsEditing, Scene), "", AbstractClassRep::FIELD_HideInInspectors);
addField("isDirty", TypeBool, Offset(mIsDirty, Scene), "", AbstractClassRep::FIELD_HideInInspectors);
endGroup("Internal");
addGroup("Gameplay");
addField("gameModeName", TypeString, Offset(mGameModeName, Scene), "The name of the gamemode that this scene utilizes");
endGroup("Gameplay");
}
bool Scene::onAdd()
@ -186,6 +190,13 @@ DefineEngineFunction(getScene, Scene*, (U32 sceneId), (0),
return Scene::smSceneList[sceneId];
}
DefineEngineFunction(getSceneCount, S32, (),,
"Get the number of active Scene objects that are loaded.\n"
"@return The number of active scenes")
{
return Scene::smSceneList.size();
}
DefineEngineFunction(getRootScene, S32, (), ,
"Get the root Scene object that is loaded.\n"
"@return The id of the Root Scene. Will be 0 if no root scene is loaded")

View file

@ -35,6 +35,8 @@ class Scene : public NetObject, public virtual ITickable
bool mIsDirty;
StringTableEntry mGameModeName;
protected:
static Scene * smRootScene;
@ -76,4 +78,4 @@ public:
}
static Vector<Scene*> smSceneList;
};
};

View file

@ -223,7 +223,6 @@ void GFXD3D11Cubemap::initDynamic(U32 texSize, GFXFormat faceFormat, U32 mipLeve
mMipMapLevels = mipLevels;
bool compressed = ImageUtil::isCompressedFormat(mFaceFormat);
UINT bindFlags = D3D11_BIND_SHADER_RESOURCE;
@ -397,10 +396,19 @@ void GFXD3D11CubemapArray::init(GFXCubemapHandle *cubemaps, const U32 cubemapCou
AssertFatal(cubemaps, "GFXD3D11CubemapArray::initStatic - Got null GFXCubemapHandle!");
AssertFatal(*cubemaps, "GFXD3D11CubemapArray::initStatic - Got empty cubemap!");
U32 downscalePower = GFXTextureManager::smTextureReductionLevel;
U32 scaledSize = cubemaps[0]->getSize();
if (downscalePower != 0)
{
// Otherwise apply the appropriate scale...
scaledSize >>= downscalePower;
}
//all cubemaps must be the same size,format and number of mipmaps. Grab the details from the first cubemap
mSize = cubemaps[0]->getSize();
mSize = scaledSize;
mFormat = cubemaps[0]->getFormat();
mMipMapLevels = cubemaps[0]->getMipMapLevels();
mMipMapLevels = cubemaps[0]->getMipMapLevels() - downscalePower;
mNumCubemaps = cubemapCount;
//create texture object
@ -467,8 +475,16 @@ void GFXD3D11CubemapArray::init(GFXCubemapHandle *cubemaps, const U32 cubemapCou
//Just allocate the cubemap array but we don't upload any data
void GFXD3D11CubemapArray::init(const U32 cubemapCount, const U32 cubemapFaceSize, const GFXFormat format)
{
mSize = cubemapFaceSize;
mMipMapLevels = ImageUtil::getMaxMipCount(cubemapFaceSize, cubemapFaceSize);
U32 downscalePower = GFXTextureManager::smTextureReductionLevel;
U32 scaledSize = cubemapFaceSize;
if (downscalePower != 0)
{
scaledSize >>= downscalePower;
}
mSize = scaledSize;
mMipMapLevels = ImageUtil::getMaxMipCount(cubemapFaceSize, cubemapFaceSize) - downscalePower;
mNumCubemaps = cubemapCount;
mFormat = format;
@ -512,6 +528,9 @@ void GFXD3D11CubemapArray::init(const U32 cubemapCount, const U32 cubemapFaceSiz
void GFXD3D11CubemapArray::updateTexture(const GFXCubemapHandle &cubemap, const U32 slot)
{
U32 cubeMapSz = cubemap->getSize();
U32 cubeMapSize = cubemap->getMipMapLevels();
AssertFatal(slot <= mNumCubemaps, "GFXD3D11CubemapArray::updateTexture - trying to update a cubemap texture that is out of bounds!");
AssertFatal(mFormat == cubemap->getFormat(), "GFXD3D11CubemapArray::updateTexture - Destination format doesn't match");
AssertFatal(mSize == cubemap->getSize(), "GFXD3D11CubemapArray::updateTexture - Destination size doesn't match");

View file

@ -194,8 +194,7 @@ public:
/// Used to remove a cubemap from the cache.
void releaseCubemap( GFXCubemap *cubemap );
protected:
public:
/// The amount of texture mipmaps to skip when loading a
/// texture that allows downscaling.
///
@ -205,6 +204,8 @@ protected:
///
static S32 smTextureReductionLevel;
protected:
/// File path to the missing texture
static String smMissingTexturePath;