|
|
|
|
|
|
Mesh m_DecalMesh; |
|
|
|
CullingGroup m_CullingGroup; |
|
|
|
private BoundingSphere[] m_BoundingSpheres; |
|
|
|
private int[] m_ResultIndices; |
|
|
|
private int m_NumResults = 0; |
|
|
|
|
|
|
|
public DecalSystem() |
|
|
|
{ |
|
|
|
|
|
|
void UpdateCulling() |
|
|
|
{ |
|
|
|
m_BoundingSpheres = new BoundingSphere[m_Decals.Count]; |
|
|
|
m_ResultIndices = new int[m_Decals.Count]; |
|
|
|
int cullIndex = 0; |
|
|
|
foreach (var decal in m_Decals) |
|
|
|
{ |
|
|
|
|
|
|
m_CullingGroup.SetBoundingSpheres(m_BoundingSpheres); |
|
|
|
} |
|
|
|
|
|
|
|
public int QueryCullResults() |
|
|
|
{ |
|
|
|
m_NumResults = m_CullingGroup.QueryIndices(true, m_ResultIndices, 0); |
|
|
|
return m_NumResults; |
|
|
|
} |
|
|
|
|
|
|
|
int numResults = 0; |
|
|
|
int[] resultIndices = new int[m_Decals.Count]; |
|
|
|
numResults = m_CullingGroup.QueryIndices(true, resultIndices, 0); |
|
|
|
|
|
|
|
for (int resultIndex = 0; resultIndex < numResults; resultIndex++) |
|
|
|
for (int resultIndex = 0; resultIndex < m_NumResults; resultIndex++) |
|
|
|
int decalIndex = resultIndices[resultIndex]; |
|
|
|
int decalIndex = m_ResultIndices[resultIndex]; |
|
|
|
|
|
|
|
// If no decal material assigned, don't draw it
|
|
|
|
if (m_Decals[decalIndex].m_Material == null) |
|
|
|