4#ifndef vtkWebGPUComputeOcclusionCuller_h
5#define vtkWebGPUComputeOcclusionCuller_h
10#include "vtkRenderingWebGPUModule.h"
16VTK_ABI_NAMESPACE_BEGIN
85 vtkRenderer* renderer,
vtkProp** propList,
int& listLength,
int& initialized)
override;
98 void SetupDepthBufferCopyPass();
103 void SetupMipmapsPass();
108 void SetupCullingPass();
123 void CopyDepthBuffer();
143 void UpdateBoundsBuffers(
vtkProp** propList,
int listLength);
149 void AddOcclusionCullingPipelineToRenderer(
vtkRenderer* renderer);
154 void CreateHierarchicalZBuffer();
161 int ComputeMipLevelsSizes(
int width,
int height);
167 void ResizeHierarchicalZBuffer(uint32_t newWidth, uint32_t newHeight);
173 void ResizeHierarchicalZBufferMipmapsChain();
179 void FinishSetupDepthCopyPass();
185 void FinishSetupMipmapsPass();
190 void FinishSetupCullingPass();
195 static void ReadIndicesCountCallback(
const void* mappedData,
void* indicesCount);
206 static void FillObjectsToDrawCallback(
const void* mappedData,
void*
data);
212 static void OutputIndicesCulledCallback(
const void* mappedData,
void*
data);
218 static void WindowResizedCallback(
219 vtkObject* caller,
unsigned long eid,
void* clientdata,
void* calldata);
229 int HierarchicalZBufferTextureIndexCopyPass = -1;
231 int HierarchicalZBufferTextureIndexMipmapsPass = -1;
233 int HierarchicalZBufferTextureIndexCullingPass = -1;
235 std::vector<vtkSmartPointer<vtkWebGPUComputeTextureView>> HierarchicalZBufferMipmapViews;
237 std::vector<int> HierarchicalZBufferMipmapViewsIndices;
239 int HierarchicalZBufferMipmapCount = -1;
241 std::vector<int> MipmapWidths;
243 std::vector<int> MipmapHeights;
255 int CullingPassHierarchicalZBufferView = -1;
257 int CullingPassBoundsBufferIndex = -1;
260 int CullingPassOutputIndicesBufferIndex = -1;
262 int CullingPassOutputIndicesCountBufferIndex = -1;
265 int CullingPassOutputIndicesCulledBufferIndex = -1;
267 int CullingPassOutputIndicesCulledCountBufferIndex = -1;
269 int CullingPassBoundsCountBufferIndex = -1;
271 int CullingPassMVPMatrixBufferIndex = -1;
274 struct FillObjectsToDrawCallbackMapData
278 int* listLength =
nullptr;
288 struct OutputIndicesCulledMapData
298 int culledCount = -1;
303 bool FirstFrame =
true;
305 bool Initialized =
false;
a superclass for prop cullers
a simple class to control print indentation
abstract base class for most VTK objects
abstract superclass for all actors, volumes and annotations
abstract specification for renderers
This culler does both frustum culling and occlusion culling.
double Cull(vtkRenderer *renderer, vtkProp **propList, int &listLength, int &initialized) override
Culls props and returns the number of props that still need to be rendered after the culling.
vtkWebGPUComputeOcclusionCuller()
~vtkWebGPUComputeOcclusionCuller() override
void SetRenderWindow(vtkWebGPURenderWindow *webGpuRenderWindow)
Sets which render window this occlusion culler is going to work on.
static vtkWebGPUComputeOcclusionCuller * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.