// Checks if buffer isn't full at 80% (or something like that). If is, we start fadeing-out first 20% triangles (or something like that). But always all triangles of a decal. void CheckIfBufferIsFull() { if (m_status == MyDecalsBufferState.FADING_OUT_ALL) { return; } else if (m_status == MyDecalsBufferState.FADING_OUT_ONLY_BEGINNING) { if ((MyMinerGame.TotalGamePlayTimeInMilliseconds - m_fadingOutStartTime) > MyDecalsConstants.DECALS_FADE_OUT_INTERVAL_MILISECONDS) { // If fading-out phase finished, we change state and remove faded-out triangles for (int i = 0; i < m_fadingOutRealTriangleCount; i++) { MyDecalTriangle fadedoutTriangle = m_trianglesQueue.Dequeue(); fadedoutTriangle.Close(); m_freeTriangles.Push(fadedoutTriangle); } m_status = MyDecalsBufferState.READY; } } else { if (m_trianglesQueue.Count >= m_fadingOutStartLimit) { // If we get here, buffer is close to be full, so we start fade-out phase m_fadingOutRealTriangleCount = GetFadingOutRealTriangleCount(); m_status = MyDecalsBufferState.FADING_OUT_ONLY_BEGINNING; m_fadingOutStartTime = MyMinerGame.TotalGamePlayTimeInMilliseconds; } } }
// We can't just erase decal triangles. We need to push them back into 'free triangles stack'. So we do it here. public void Clear(bool destroy = false) { while (m_trianglesQueue.Count > 0) { MyDecalTriangle fadedoutTriangle = m_trianglesQueue.Dequeue(); fadedoutTriangle.Close(); m_freeTriangles.Push(fadedoutTriangle); } if (destroy) { VoxelMap = null; } }
// We can just erase decal triangles, because here we don't have 'free triangles stack' as voxel decals do. public void Clear(bool destroy = false) { while (m_trianglesQueue.Count > 0) { MyDecalTriangle triangle = m_trianglesQueue.Dequeue(); triangle.Close(); m_freeTriangles.Push(triangle); } if (destroy) { Entity = null; } }