1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
#ifndef CULLING_PARAMETERS_H
#define CULLING_PARAMETERS_H
#include "Runtime/Geometry/Plane.h"
#include "Runtime/BaseClasses/Tags.h"
#include "Runtime/Math/Matrix4x4.h"
#include "Runtime/Utilities/dynamic_array.h"
#include "Runtime/Math/Simd/math.h"
#include "Runtime/Geometry/Intersection.h"
#include "UmbraTomeData.h"
struct SceneNode;
class AABB;
namespace Umbra { class DebugRenderer; class Visibility; class Tome; class QueryExt; }
enum CullingType { kNoOcclusionCulling = 0, kOcclusionCulling = 1, kShadowCasterOcclusionCulling = 2 };
enum CullFiltering { kFilterModeOff = 0, kFilterModeShowFiltered = 1, kFilterModeShowRest = 2 };
struct IndexList
{
int* indices;
int size;
int reservedSize;
int& operator [] (int index)
{
DebugAssert(index < reservedSize);
return indices[index];
}
int operator [] (int index) const
{
DebugAssert(index < reservedSize);
return indices[index];
}
IndexList ()
{
indices = NULL;
reservedSize = size = 0;
}
IndexList (int* i, int sz, int rs)
{
indices = i;
size = sz;
reservedSize = rs;
}
};
enum
{
kStaticRenderers = 0,
kDynamicRenderer,
kSceneIntermediate,
kCameraIntermediate,
#if ENABLE_TERRAIN
kTreeRenderer,
#endif
kVisibleListCount
};
// Output for all culling operations.
// simple index list indexing into the different places where renderers can be found.
struct CullingOutput
{
IndexList visible[kVisibleListCount];
Umbra::Visibility* umbraVisibility;
CullingOutput () : umbraVisibility (NULL) { }
};
struct RendererCullData
{
const AABB* bounds;
const SceneNode* nodes;
size_t rendererCount;
RendererCullData () { bounds = NULL; nodes = NULL; rendererCount = 0; }
};
struct CullingParameters
{
enum { kMaxPlanes = 10 };
enum LayerCull
{
kLayerCullNone,
kLayerCullPlanar,
kLayerCullSpherical
};
Vector3f lodPosition;
float lodFieldOfView;
float orthoSize;
int cameraPixelHeight;
Plane cullingPlanes[kMaxPlanes];
int cullingPlaneCount;
UInt32 cullingMask;
float layerFarCullDistances[kNumLayers];
LayerCull layerCull;
bool isOrthographic;
Vector3f lightDir;
// Used for Umbra
Matrix4x4f worldToClipMatrix;
Vector3f position;
};
struct SceneCullingParameters : CullingParameters
{
RendererCullData renderers[kVisibleListCount];
UInt8* lodMasks;
size_t lodGroupCount;
bool useOcclusionCulling;
bool useShadowCasterCulling;
bool useLightOcclusionCulling;
bool excludeLightmappedShadowCasters;
bool cullPerObjectLights;
bool cullLights;
int renderPath;
CullFiltering filterMode;
/// This stores the visibility of previous culling operations.
/// For example, shadow caster culling uses the visibility of the visible objects from the camera.
const CullingOutput* sceneVisbilityForShadowCulling;
UmbraTomeData umbraTome;
Umbra::DebugRenderer* umbraDebugRenderer;
Umbra::QueryExt* umbraQuery;
UInt32 umbraDebugFlags;
};
#endif
|