|
|
|
|
|
|
|
|
|
|
public class DecalHandle |
|
|
|
{ |
|
|
|
public DecalHandle(int index, Material material) |
|
|
|
public DecalHandle(int index, int materialID) |
|
|
|
m_Material = material; |
|
|
|
m_MaterialID = materialID; |
|
|
|
m_Index = index; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
if (handle.m_Material == null) |
|
|
|
return false; |
|
|
|
public Material m_Material; // identifies decal set
|
|
|
|
public int m_MaterialID; // identifies decal set
|
|
|
|
public int m_Index; // identifies decal within the set
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
m_BoundingSpheres[index] = GetDecalProjectBoundingSphere(m_CachedDecalToWorld[index]); |
|
|
|
} |
|
|
|
|
|
|
|
public DecalHandle AddDecal(Transform transform, float drawDistance, float fadeScale, Material material) |
|
|
|
public DecalHandle AddDecal(Transform transform, float drawDistance, float fadeScale, int materialID) |
|
|
|
{ |
|
|
|
// increase array size if no space left
|
|
|
|
if (m_DecalsCount == m_Handles.Length) |
|
|
|
|
|
|
m_CachedDrawDistances = newCachedDrawDistances; |
|
|
|
} |
|
|
|
|
|
|
|
DecalHandle decalHandle = new DecalHandle(m_DecalsCount, material); |
|
|
|
DecalHandle decalHandle = new DecalHandle(m_DecalsCount, materialID); |
|
|
|
m_Handles[m_DecalsCount] = decalHandle; |
|
|
|
UpdateCachedData(transform, drawDistance, fadeScale, decalHandle); |
|
|
|
m_DecalsCount++; |
|
|
|
|
|
|
decalSet = new DecalSet(material); |
|
|
|
m_DecalSets.Add(key, decalSet); |
|
|
|
} |
|
|
|
return decalSet.AddDecal(transform, drawDistance, fadeScale, material); |
|
|
|
return decalSet.AddDecal(transform, drawDistance, fadeScale, key); |
|
|
|
} |
|
|
|
|
|
|
|
public void AddDecal(DecalProjectorComponent decal) |
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
DecalSet decalSet = null; |
|
|
|
int key = handle.m_Material.GetInstanceID(); |
|
|
|
int key = handle.m_MaterialID; |
|
|
|
if (m_DecalSets.TryGetValue(key, out decalSet)) |
|
|
|
{ |
|
|
|
decalSet.RemoveDecal(handle); |
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
DecalSet decalSet = null; |
|
|
|
int key = handle.m_Material.GetInstanceID(); |
|
|
|
int key = handle.m_MaterialID; |
|
|
|
if (m_DecalSets.TryGetValue(key, out decalSet)) |
|
|
|
{ |
|
|
|
decalSet.UpdateCachedData(transform, drawDistance, fadeScale, handle); |
|
|
|