summaryrefslogtreecommitdiff
path: root/indra/newview/llreflectionmapmanager.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llreflectionmapmanager.h')
-rw-r--r--indra/newview/llreflectionmapmanager.h77
1 files changed, 75 insertions, 2 deletions
diff --git a/indra/newview/llreflectionmapmanager.h b/indra/newview/llreflectionmapmanager.h
index 40e925d916..24ac40b264 100644
--- a/indra/newview/llreflectionmapmanager.h
+++ b/indra/newview/llreflectionmapmanager.h
@@ -27,9 +27,20 @@
#pragma once
#include "llreflectionmap.h"
+#include "llrendertarget.h"
+#include "llcubemaparray.h"
-class LLReflectionMapManager
+class LLSpatialGroup;
+
+// number of reflection probes to keep in vram
+#define LL_REFLECTION_PROBE_COUNT 256
+
+// reflection probe resolution
+#define LL_REFLECTION_PROBE_RESOLUTION 256
+
+class alignas(16) LLReflectionMapManager
{
+ LL_ALIGN_NEW
public:
// allocate an environment map of the given resolution
LLReflectionMapManager();
@@ -40,12 +51,74 @@ public:
// drop a reflection probe at the specified position in agent space
void addProbe(const LLVector3& pos);
+ // add a probe for the given spatial group
+ LLReflectionMap* addProbe(LLSpatialGroup* group);
+
// Populate "maps" with the N most relevant Reflection Maps where N is no more than maps.size()
// If less than maps.size() ReflectionMaps are available, will assign trailing elements to nullptr.
// maps -- presized array of Reflection Map pointers
void getReflectionMaps(std::vector<LLReflectionMap*>& maps);
+ // called by LLSpatialGroup constructor
+ // If spatial group should receive a Reflection Probe, will create one for the specified spatial group
+ LLReflectionMap* registerSpatialGroup(LLSpatialGroup* group);
+
+ // force an update of all probes
+ void rebuild();
+
+ // called on region crossing to "shift" probes into new coordinate frame
+ void shift(const LLVector4a& offset);
+
+private:
+ friend class LLPipeline;
+
+ // delete the probe with the given index in mProbes
+ void deleteProbe(U32 i);
+
+ // get a free cube index
+ // if no cube indices are free, free one starting from the back of the probe list
+ S32 allocateCubeIndex();
+
+ // update the neighbors of the given probe
+ void updateNeighbors(LLReflectionMap* probe);
+
+ void setUniforms();
+
+ // render target for cube snapshots
+ // used to generate mipmaps without doing a copy-to-texture
+ LLRenderTarget mRenderTarget;
+
+ std::vector<LLRenderTarget> mMipChain;
+
+ // storage for reflection probes
+ LLPointer<LLCubeMapArray> mTexture;
+
+ // array indicating if a particular cubemap is free
+ bool mCubeFree[LL_REFLECTION_PROBE_COUNT];
+
+ // start tracking the given spatial group
+ void trackGroup(LLSpatialGroup* group);
+
+ // perform an update on the currently updating Probe
+ void doProbeUpdate();
+
// list of active reflection maps
- std::vector<LLReflectionMap> mProbes;
+ std::vector<LLPointer<LLReflectionMap> > mProbes;
+
+ // list of reflection maps to kill
+ std::vector<LLPointer<LLReflectionMap> > mKillList;
+
+ // list of reflection maps to create
+ std::vector<LLPointer<LLReflectionMap> > mCreateList;
+
+ // handle to UBO
+ U32 mUBO = 0;
+
+ // list of maps being used for rendering
+ std::vector<LLReflectionMap*> mReflectionMaps;
+
+ LLReflectionMap* mUpdatingProbe = nullptr;
+ U32 mUpdatingFace = 0;
+
};