|
@@ -33,7 +33,7 @@
|
|
|
#include "BsRendererExtension.h"
|
|
#include "BsRendererExtension.h"
|
|
|
#include "BsLightProbeCache.h"
|
|
#include "BsLightProbeCache.h"
|
|
|
#include "BsReflectionProbe.h"
|
|
#include "BsReflectionProbe.h"
|
|
|
-#include "BsReflectionProbes.h"
|
|
|
|
|
|
|
+#include "BsIBLUtility.h"
|
|
|
#include "BsMeshData.h"
|
|
#include "BsMeshData.h"
|
|
|
#include "BsLightGrid.h"
|
|
#include "BsLightGrid.h"
|
|
|
#include "BsSkybox.h"
|
|
#include "BsSkybox.h"
|
|
@@ -803,7 +803,7 @@ namespace bs { namespace ct
|
|
|
FrameInfo frameInfo(delta, animData);
|
|
FrameInfo frameInfo(delta, animData);
|
|
|
|
|
|
|
|
// Update reflection probes
|
|
// Update reflection probes
|
|
|
- updateReflectionProbes(frameInfo);
|
|
|
|
|
|
|
+ updateLightProbes(frameInfo);
|
|
|
|
|
|
|
|
// Gather all views
|
|
// Gather all views
|
|
|
Vector<RendererCamera*> views;
|
|
Vector<RendererCamera*> views;
|
|
@@ -1222,7 +1222,7 @@ namespace bs { namespace ct
|
|
|
element.morphVertexDeclaration);
|
|
element.morphVertexDeclaration);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void RenderBeast::updateReflectionProbes(const FrameInfo& frameInfo)
|
|
|
|
|
|
|
+ void RenderBeast::updateLightProbes(const FrameInfo& frameInfo)
|
|
|
{
|
|
{
|
|
|
UINT32 numProbes = (UINT32)mReflProbes.size();
|
|
UINT32 numProbes = (UINT32)mReflProbes.size();
|
|
|
|
|
|
|
@@ -1239,8 +1239,8 @@ namespace bs { namespace ct
|
|
|
TEXTURE_DESC cubeMapDesc;
|
|
TEXTURE_DESC cubeMapDesc;
|
|
|
cubeMapDesc.type = TEX_TYPE_CUBE_MAP;
|
|
cubeMapDesc.type = TEX_TYPE_CUBE_MAP;
|
|
|
cubeMapDesc.format = PF_FLOAT_R11G11B10;
|
|
cubeMapDesc.format = PF_FLOAT_R11G11B10;
|
|
|
- cubeMapDesc.width = ReflectionProbes::REFLECTION_CUBEMAP_SIZE;
|
|
|
|
|
- cubeMapDesc.height = ReflectionProbes::REFLECTION_CUBEMAP_SIZE;
|
|
|
|
|
|
|
+ cubeMapDesc.width = IBLUtility::REFLECTION_CUBEMAP_SIZE;
|
|
|
|
|
+ cubeMapDesc.height = IBLUtility::REFLECTION_CUBEMAP_SIZE;
|
|
|
cubeMapDesc.numMips = PixelUtil::getMaxMipmaps(cubeMapDesc.width, cubeMapDesc.height, 1, cubeMapDesc.format);
|
|
cubeMapDesc.numMips = PixelUtil::getMaxMipmaps(cubeMapDesc.width, cubeMapDesc.height, 1, cubeMapDesc.format);
|
|
|
cubeMapDesc.numArraySlices = std::min(MaxReflectionCubemaps, numProbes + 4); // Keep a few empty entries
|
|
cubeMapDesc.numArraySlices = std::min(MaxReflectionCubemaps, numProbes + 4); // Keep a few empty entries
|
|
|
|
|
|
|
@@ -1254,8 +1254,8 @@ namespace bs { namespace ct
|
|
|
TEXTURE_DESC cubemapDesc;
|
|
TEXTURE_DESC cubemapDesc;
|
|
|
cubemapDesc.type = TEX_TYPE_CUBE_MAP;
|
|
cubemapDesc.type = TEX_TYPE_CUBE_MAP;
|
|
|
cubemapDesc.format = PF_FLOAT_R11G11B10;
|
|
cubemapDesc.format = PF_FLOAT_R11G11B10;
|
|
|
- cubemapDesc.width = ReflectionProbes::REFLECTION_CUBEMAP_SIZE;
|
|
|
|
|
- cubemapDesc.height = ReflectionProbes::REFLECTION_CUBEMAP_SIZE;
|
|
|
|
|
|
|
+ cubemapDesc.width = IBLUtility::REFLECTION_CUBEMAP_SIZE;
|
|
|
|
|
+ cubemapDesc.height = IBLUtility::REFLECTION_CUBEMAP_SIZE;
|
|
|
cubemapDesc.numMips = PixelUtil::getMaxMipmaps(cubemapDesc.width, cubemapDesc.height, 1, cubemapDesc.format);
|
|
cubemapDesc.numMips = PixelUtil::getMaxMipmaps(cubemapDesc.width, cubemapDesc.height, 1, cubemapDesc.format);
|
|
|
cubemapDesc.usage = TU_STATIC | TU_RENDERTARGET;
|
|
cubemapDesc.usage = TU_STATIC | TU_RENDERTARGET;
|
|
|
|
|
|
|
@@ -1287,10 +1287,10 @@ namespace bs { namespace ct
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
SPtr<Texture> customTexture = probeInfo.probe->getCustomTexture();
|
|
SPtr<Texture> customTexture = probeInfo.probe->getCustomTexture();
|
|
|
- ReflectionProbes::scaleCubemap(customTexture, 0, probeInfo.texture, 0);
|
|
|
|
|
|
|
+ IBLUtility::scaleCubemap(customTexture, 0, probeInfo.texture, 0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- ReflectionProbes::filterCubemapForSpecular(probeInfo.texture, scratchCubemap);
|
|
|
|
|
|
|
+ IBLUtility::filterCubemapForSpecular(probeInfo.texture, scratchCubemap);
|
|
|
LightProbeCache::instance().setCachedRadianceTexture(probeInfo.probe->getUUID(), probeInfo.texture);
|
|
LightProbeCache::instance().setCachedRadianceTexture(probeInfo.probe->getUUID(), probeInfo.texture);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1300,8 +1300,8 @@ namespace bs { namespace ct
|
|
|
if(probeInfo.probe->getType() != ReflectionProbeType::Plane && (probeInfo.arrayDirty || forceArrayUpdate))
|
|
if(probeInfo.probe->getType() != ReflectionProbeType::Plane && (probeInfo.arrayDirty || forceArrayUpdate))
|
|
|
{
|
|
{
|
|
|
auto& srcProps = probeInfo.texture->getProperties();
|
|
auto& srcProps = probeInfo.texture->getProperties();
|
|
|
- bool isValid = srcProps.getWidth() == ReflectionProbes::REFLECTION_CUBEMAP_SIZE &&
|
|
|
|
|
- srcProps.getHeight() == ReflectionProbes::REFLECTION_CUBEMAP_SIZE &&
|
|
|
|
|
|
|
+ bool isValid = srcProps.getWidth() == IBLUtility::REFLECTION_CUBEMAP_SIZE &&
|
|
|
|
|
+ srcProps.getHeight() == IBLUtility::REFLECTION_CUBEMAP_SIZE &&
|
|
|
srcProps.getNumMipmaps() == cubemapArrayProps.getNumMipmaps() &&
|
|
srcProps.getNumMipmaps() == cubemapArrayProps.getNumMipmaps() &&
|
|
|
srcProps.getTextureType() == TEX_TYPE_CUBE_MAP;
|
|
srcProps.getTextureType() == TEX_TYPE_CUBE_MAP;
|
|
|
|
|
|
|
@@ -1311,7 +1311,7 @@ namespace bs { namespace ct
|
|
|
{
|
|
{
|
|
|
String errMsg = StringUtil::format("Cubemap texture invalid to use as a reflection cubemap. "
|
|
String errMsg = StringUtil::format("Cubemap texture invalid to use as a reflection cubemap. "
|
|
|
"Check texture size (must be {0}x{0}) and mip-map count",
|
|
"Check texture size (must be {0}x{0}) and mip-map count",
|
|
|
- ReflectionProbes::REFLECTION_CUBEMAP_SIZE);
|
|
|
|
|
|
|
+ IBLUtility::REFLECTION_CUBEMAP_SIZE);
|
|
|
|
|
|
|
|
LOGERR(errMsg);
|
|
LOGERR(errMsg);
|
|
|
probeInfo.errorFlagged = true;
|
|
probeInfo.errorFlagged = true;
|
|
@@ -1342,8 +1342,8 @@ namespace bs { namespace ct
|
|
|
{
|
|
{
|
|
|
mSkyboxFilteredReflections = Texture::create(cubemapDesc);
|
|
mSkyboxFilteredReflections = Texture::create(cubemapDesc);
|
|
|
|
|
|
|
|
- ReflectionProbes::scaleCubemap(mSkyboxTexture, 0, mSkyboxFilteredReflections, 0);
|
|
|
|
|
- ReflectionProbes::filterCubemapForSpecular(mSkyboxFilteredReflections, scratchCubemap);
|
|
|
|
|
|
|
+ IBLUtility::scaleCubemap(mSkyboxTexture, 0, mSkyboxFilteredReflections, 0);
|
|
|
|
|
+ IBLUtility::filterCubemapForSpecular(mSkyboxFilteredReflections, scratchCubemap);
|
|
|
LightProbeCache::instance().setCachedRadianceTexture(mSkybox->getUUID(), mSkyboxFilteredReflections);
|
|
LightProbeCache::instance().setCachedRadianceTexture(mSkybox->getUUID(), mSkyboxFilteredReflections);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1357,14 +1357,14 @@ namespace bs { namespace ct
|
|
|
TEXTURE_DESC irradianceCubemapDesc;
|
|
TEXTURE_DESC irradianceCubemapDesc;
|
|
|
irradianceCubemapDesc.type = TEX_TYPE_CUBE_MAP;
|
|
irradianceCubemapDesc.type = TEX_TYPE_CUBE_MAP;
|
|
|
irradianceCubemapDesc.format = PF_FLOAT_R11G11B10;
|
|
irradianceCubemapDesc.format = PF_FLOAT_R11G11B10;
|
|
|
- irradianceCubemapDesc.width = 32;
|
|
|
|
|
- irradianceCubemapDesc.height = 32;
|
|
|
|
|
|
|
+ irradianceCubemapDesc.width = IBLUtility::IRRADIANCE_CUBEMAP_SIZE;
|
|
|
|
|
+ irradianceCubemapDesc.height = IBLUtility::IRRADIANCE_CUBEMAP_SIZE;
|
|
|
irradianceCubemapDesc.numMips = 0;
|
|
irradianceCubemapDesc.numMips = 0;
|
|
|
irradianceCubemapDesc.usage = TU_STATIC | TU_RENDERTARGET;
|
|
irradianceCubemapDesc.usage = TU_STATIC | TU_RENDERTARGET;
|
|
|
|
|
|
|
|
mSkyboxIrradiance = Texture::create(irradianceCubemapDesc);
|
|
mSkyboxIrradiance = Texture::create(irradianceCubemapDesc);
|
|
|
|
|
|
|
|
- ReflectionProbes::filterCubemapForIrradiance(mSkyboxFilteredReflections, mSkyboxIrradiance);
|
|
|
|
|
|
|
+ IBLUtility::filterCubemapForIrradiance(mSkyboxFilteredReflections, mSkyboxIrradiance);
|
|
|
LightProbeCache::instance().setCachedIrradianceTexture(mSkybox->getUUID(), mSkyboxFilteredReflections);
|
|
LightProbeCache::instance().setCachedIrradianceTexture(mSkybox->getUUID(), mSkyboxFilteredReflections);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|