mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
cut down on some of that per-frame allocation via prepping our vector 'registers' during the constructor
This commit is contained in:
parent
7529864942
commit
a3e4ce5146
2 changed files with 48 additions and 41 deletions
|
|
@ -246,6 +246,36 @@ RenderProbeMgr::RenderProbeMgr()
|
||||||
{
|
{
|
||||||
String brdfPath = Con::getVariable("$Core::BRDFTexture", "core/art/pbr/brdfTexture.dds");
|
String brdfPath = Con::getVariable("$Core::BRDFTexture", "core/art/pbr/brdfTexture.dds");
|
||||||
mBrdfTexture = TEXMGR->createTexture(brdfPath, &GFXTexturePersistentProfile);
|
mBrdfTexture = TEXMGR->createTexture(brdfPath, &GFXTexturePersistentProfile);
|
||||||
|
|
||||||
|
probePositions.setSize(MAXPROBECOUNT);
|
||||||
|
probePositions.fill(Point3F::Zero);
|
||||||
|
|
||||||
|
probeWorldToObj.setSize(MAXPROBECOUNT);
|
||||||
|
probeWorldToObj.fill(MatrixF::Identity);
|
||||||
|
|
||||||
|
probeBBMin.setSize(MAXPROBECOUNT);
|
||||||
|
probeBBMin.fill(Point3F::Zero);
|
||||||
|
|
||||||
|
probeBBMax.setSize(MAXPROBECOUNT);
|
||||||
|
probeBBMax.fill(Point3F::Zero);
|
||||||
|
|
||||||
|
probeUseSphereMode.setSize(MAXPROBECOUNT);
|
||||||
|
probeUseSphereMode.fill(0.0f);
|
||||||
|
|
||||||
|
probeRadius.setSize(MAXPROBECOUNT);
|
||||||
|
probeRadius.fill(0.0f);
|
||||||
|
|
||||||
|
probeAttenuation.setSize(MAXPROBECOUNT);
|
||||||
|
probeAttenuation.fill(0.0f);
|
||||||
|
|
||||||
|
cubeMaps.setSize(MAXPROBECOUNT);
|
||||||
|
cubeMaps.fill(NULL);
|
||||||
|
|
||||||
|
irradMaps.setSize(MAXPROBECOUNT);
|
||||||
|
irradMaps.fill(NULL);
|
||||||
|
|
||||||
|
GFXCubemapArrayHandle mCubemapArray;
|
||||||
|
GFXCubemapArrayHandle mIrradArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderProbeMgr::RenderProbeMgr(RenderInstType riType, F32 renderOrder, F32 processAddOrder)
|
RenderProbeMgr::RenderProbeMgr(RenderInstType riType, F32 renderOrder, F32 processAddOrder)
|
||||||
|
|
@ -662,44 +692,7 @@ void RenderProbeMgr::render( SceneRenderState *state )
|
||||||
return;
|
return;
|
||||||
MatrixF trans = MatrixF::Identity;
|
MatrixF trans = MatrixF::Identity;
|
||||||
sgData.objTrans = &trans;
|
sgData.objTrans = &trans;
|
||||||
|
|
||||||
Vector<Point3F> probePositions;
|
|
||||||
Vector<MatrixF> probeWorldToObj;
|
|
||||||
Vector<Point3F> probeBBMin;
|
|
||||||
Vector<Point3F> probeBBMax;
|
|
||||||
Vector<float> probeUseSphereMode;
|
|
||||||
Vector<float> probeRadius;
|
|
||||||
Vector<float> probeAttenuation;
|
|
||||||
Vector<GFXCubemapHandle> cubeMaps;
|
|
||||||
Vector<GFXCubemapHandle> irradMaps;
|
|
||||||
|
|
||||||
probePositions.setSize(MAXPROBECOUNT);
|
|
||||||
probePositions.fill(Point3F::Zero);
|
|
||||||
|
|
||||||
probeWorldToObj.setSize(MAXPROBECOUNT);
|
|
||||||
probeWorldToObj.fill(MatrixF::Identity);
|
|
||||||
|
|
||||||
probeBBMin.setSize(MAXPROBECOUNT);
|
|
||||||
probeBBMin.fill(Point3F::Zero);
|
|
||||||
|
|
||||||
probeBBMax.setSize(MAXPROBECOUNT);
|
|
||||||
probeBBMax.fill(Point3F::Zero);
|
|
||||||
|
|
||||||
probeUseSphereMode.setSize(MAXPROBECOUNT);
|
|
||||||
probeUseSphereMode.fill(0.0f);
|
|
||||||
|
|
||||||
probeRadius.setSize(MAXPROBECOUNT);
|
|
||||||
probeRadius.fill(0.0f);
|
|
||||||
|
|
||||||
probeAttenuation.setSize(MAXPROBECOUNT);
|
|
||||||
probeAttenuation.fill(0.0f);
|
|
||||||
|
|
||||||
cubeMaps.setSize(MAXPROBECOUNT);
|
|
||||||
cubeMaps.fill(NULL);
|
|
||||||
|
|
||||||
irradMaps.setSize(MAXPROBECOUNT);
|
|
||||||
irradMaps.fill(NULL);
|
|
||||||
|
|
||||||
U32 effectiveProbeCount = 0;
|
U32 effectiveProbeCount = 0;
|
||||||
|
|
||||||
for (U32 i = 0; i < probeCount; i++)
|
for (U32 i = 0; i < probeCount; i++)
|
||||||
|
|
@ -748,10 +741,7 @@ void RenderProbeMgr::render( SceneRenderState *state )
|
||||||
U32 count = effectiveProbeCount;
|
U32 count = effectiveProbeCount;
|
||||||
matParams->setSafe(numProbesSC, (float)effectiveProbeCount);
|
matParams->setSafe(numProbesSC, (float)effectiveProbeCount);
|
||||||
|
|
||||||
GFXCubemapArrayHandle mCubemapArray;
|
|
||||||
mCubemapArray = GFXCubemapArrayHandle(GFX->createCubemapArray());
|
mCubemapArray = GFXCubemapArrayHandle(GFX->createCubemapArray());
|
||||||
|
|
||||||
GFXCubemapArrayHandle mIrradArray;
|
|
||||||
mIrradArray = GFXCubemapArrayHandle(GFX->createCubemapArray());
|
mIrradArray = GFXCubemapArrayHandle(GFX->createCubemapArray());
|
||||||
|
|
||||||
mCubemapArray->initStatic(cubeMaps.address(), count);
|
mCubemapArray->initStatic(cubeMaps.address(), count);
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,8 @@
|
||||||
#include "postFx/postEffectCommon.h"
|
#include "postFx/postEffectCommon.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static U32 MAXPROBECOUNT = 50;
|
||||||
|
|
||||||
struct ProbeRenderInst : public SystemInterface<ProbeRenderInst>
|
struct ProbeRenderInst : public SystemInterface<ProbeRenderInst>
|
||||||
{
|
{
|
||||||
LinearColorF mAmbient;
|
LinearColorF mAmbient;
|
||||||
|
|
@ -282,6 +284,21 @@ protected:
|
||||||
GFXShaderConstBuffer *shaderConsts);
|
GFXShaderConstBuffer *shaderConsts);
|
||||||
|
|
||||||
GFXTextureObject * mBrdfTexture;
|
GFXTextureObject * mBrdfTexture;
|
||||||
|
|
||||||
|
//Array rendering
|
||||||
|
|
||||||
|
Vector<Point3F> probePositions;
|
||||||
|
Vector<MatrixF> probeWorldToObj;
|
||||||
|
Vector<Point3F> probeBBMin;
|
||||||
|
Vector<Point3F> probeBBMax;
|
||||||
|
Vector<float> probeUseSphereMode;
|
||||||
|
Vector<float> probeRadius;
|
||||||
|
Vector<float> probeAttenuation;
|
||||||
|
Vector<GFXCubemapHandle> cubeMaps;
|
||||||
|
Vector<GFXCubemapHandle> irradMaps;
|
||||||
|
|
||||||
|
GFXCubemapArrayHandle mCubemapArray;
|
||||||
|
GFXCubemapArrayHandle mIrradArray;
|
||||||
public:
|
public:
|
||||||
RenderProbeMgr();
|
RenderProbeMgr();
|
||||||
RenderProbeMgr(RenderInstType riType, F32 renderOrder, F32 processAddOrder);
|
RenderProbeMgr(RenderInstType riType, F32 renderOrder, F32 processAddOrder);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue