// 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; } } }
public void FadeOutAll() { if (m_status != MyDecalsBufferState.FADING_OUT_ONLY_BEGINNING) { m_fadingOutStartTime = MyMinerGame.TotalGamePlayTimeInMilliseconds; } m_status = MyDecalsBufferState.FADING_OUT_ALL; }
public void FadeOutAll() { if (m_status != MyDecalsBufferState.FADING_OUT_ONLY_BEGINNING) { m_fadingOutStartTime = (int)MyRender.RenderTimeInMS; } m_status = MyDecalsBufferState.FADING_OUT_ALL; }
// Because this class is reused in buffers, it isn't really initialized by constructor. We make real initialization here. public void Start(MyEntity entity, MyDecalTexturesEnum decalTexture) { Entity = entity; DecalTexture = decalTexture; m_status = MyDecalsBufferState.READY; m_fadingOutStartTime = 0; if (MyDecals.IsLargeTexture(decalTexture) == true) { //m_capacityAfterStart = MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER_LARGE; m_fadingOutStartLimit = (int)(m_capacity * MyDecalsConstants.TEXTURE_LARGE_FADING_OUT_START_LIMIT_PERCENT); m_fadingOutMinimalTriangleCount = (int)(m_capacity * MyDecalsConstants.TEXTURE_LARGE_FADING_OUT_MINIMAL_TRIANGLE_COUNT_PERCENT); MaxNeighbourTriangles = MyDecalsConstants.TEXTURE_LARGE_MAX_NEIGHBOUR_TRIANGLES; } else { //m_capacityAfterStart = MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER_SMALL; m_fadingOutStartLimit = (int)(m_capacity * MyDecalsConstants.TEXTURE_SMALL_FADING_OUT_START_LIMIT_PERCENT); m_fadingOutMinimalTriangleCount = (int)(m_capacity * MyDecalsConstants.TEXTURE_SMALL_FADING_OUT_MINIMAL_TRIANGLE_COUNT_PERCENT); MaxNeighbourTriangles = MyDecalsConstants.TEXTURE_SMALL_MAX_NEIGHBOUR_TRIANGLES; } }
// Because this class is reused in buffers, it isn't really initialized by constructor. We make real initialization here. public void Start(MyEntity entity, MyDecalTexturesEnum decalTexture) { Entity = entity; DecalTexture = decalTexture; m_status = MyDecalsBufferState.READY; m_fadingOutStartTime = 0; if (MyDecals.IsLargeTexture(decalTexture) == true) { //m_capacityAfterStart = MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER_LARGE; m_fadingOutStartLimit = (int)(m_capacity * MyDecalsConstants.TEXTURE_LARGE_FADING_OUT_START_LIMIT_PERCENT); m_fadingOutMinimalTriangleCount = (int)(m_capacity * MyDecalsConstants.TEXTURE_LARGE_FADING_OUT_MINIMAL_TRIANGLE_COUNT_PERCENT); MaxNeighbourTriangles = MyDecalsConstants.TEXTURE_LARGE_MAX_NEIGHBOUR_TRIANGLES; } else { //m_capacityAfterStart = MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER_SMALL; m_fadingOutStartLimit = (int)(m_capacity * MyDecalsConstants.TEXTURE_SMALL_FADING_OUT_START_LIMIT_PERCENT); m_fadingOutMinimalTriangleCount = (int)(m_capacity * MyDecalsConstants.TEXTURE_SMALL_FADING_OUT_MINIMAL_TRIANGLE_COUNT_PERCENT); MaxNeighbourTriangles = MyDecalsConstants.TEXTURE_SMALL_MAX_NEIGHBOUR_TRIANGLES; } }
// Because this class is reused in buffers, it isn't really initialized by constructor. We make real initialization here. public void Start(MyRenderVoxelCell voxelMap, MyDecalTexturesEnum decalTexture) { VoxelCell = voxelMap; DecalTexture = decalTexture; m_status = MyDecalsBufferState.READY; m_fadingOutStartTime = 0; /* * if (MyDecals.IsLargeTexture(decalTexture) == true) * { * m_capacityAfterStart = MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER_LARGE; * m_fadingOutStartLimit = (int)(m_capacityAfterStart * MyDecalsConstants.TEXTURE_LARGE_FADING_OUT_START_LIMIT_PERCENT); * m_fadingOutMinimalTriangleCount = (int)(m_capacityAfterStart * MyDecalsConstants.TEXTURE_LARGE_FADING_OUT_MINIMAL_TRIANGLE_COUNT_PERCENT); * MaxNeighbourTriangles = MyDecalsConstants.TEXTURE_LARGE_MAX_NEIGHBOUR_TRIANGLES; * } * else*/ { m_capacityAfterStart = MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER_SMALL; m_fadingOutStartLimit = (int)(m_capacityAfterStart * MyDecalsConstants.TEXTURE_SMALL_FADING_OUT_START_LIMIT_PERCENT); m_fadingOutMinimalTriangleCount = (int)(m_capacityAfterStart * MyDecalsConstants.TEXTURE_SMALL_FADING_OUT_MINIMAL_TRIANGLE_COUNT_PERCENT); MaxNeighbourTriangles = MyDecalsConstants.TEXTURE_SMALL_MAX_NEIGHBOUR_TRIANGLES; } }
// Because this class is reused in buffers, it isn't really initialized by constructor. We make real initialization here. public void Start(MyVoxelMap voxelMap, ref MyMwcVector3Int renderCellCoord, MyDecalTexturesEnum decalTexture, ref BoundingBox renderCellBoundingBox) { VoxelMap = voxelMap; RenderCellCoord = renderCellCoord; DecalTexture = decalTexture; m_status = MyDecalsBufferState.READY; m_fadingOutStartTime = 0; RenderCellBoundingBox = renderCellBoundingBox; if (MyDecals.IsLargeTexture(decalTexture) == true) { m_capacityAfterStart = MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER_LARGE; m_fadingOutStartLimit = (int)(m_capacityAfterStart * MyDecalsConstants.TEXTURE_LARGE_FADING_OUT_START_LIMIT_PERCENT); m_fadingOutMinimalTriangleCount = (int)(m_capacityAfterStart * MyDecalsConstants.TEXTURE_LARGE_FADING_OUT_MINIMAL_TRIANGLE_COUNT_PERCENT); MaxNeighbourTriangles = MyDecalsConstants.TEXTURE_LARGE_MAX_NEIGHBOUR_TRIANGLES; } else { m_capacityAfterStart = MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER_SMALL; m_fadingOutStartLimit = (int)(m_capacityAfterStart * MyDecalsConstants.TEXTURE_SMALL_FADING_OUT_START_LIMIT_PERCENT); m_fadingOutMinimalTriangleCount = (int)(m_capacityAfterStart * MyDecalsConstants.TEXTURE_SMALL_FADING_OUT_MINIMAL_TRIANGLE_COUNT_PERCENT); MaxNeighbourTriangles = MyDecalsConstants.TEXTURE_SMALL_MAX_NEIGHBOUR_TRIANGLES; } }
// Because this class is reused in buffers, it isn't really initialized by constructor. We make real initialization here. public void Start(MyVoxelMap voxelMap, ref MyMwcVector3Int renderCellCoord, MyDecalTexturesEnum decalTexture, ref BoundingBox renderCellBoundingBox) { VoxelMap = voxelMap; RenderCellCoord = renderCellCoord; DecalTexture = decalTexture; m_status = MyDecalsBufferState.READY; m_fadingOutStartTime = 0; RenderCellBoundingBox = renderCellBoundingBox; if (MyDecals.IsLargeTexture(decalTexture) == true) { m_capacityAfterStart = MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER_LARGE; m_fadingOutStartLimit = (int)(m_capacityAfterStart * MyDecalsConstants.TEXTURE_LARGE_FADING_OUT_START_LIMIT_PERCENT); m_fadingOutMinimalTriangleCount = (int)(m_capacityAfterStart * MyDecalsConstants.TEXTURE_LARGE_FADING_OUT_MINIMAL_TRIANGLE_COUNT_PERCENT); MaxNeighbourTriangles = MyDecalsConstants.TEXTURE_LARGE_MAX_NEIGHBOUR_TRIANGLES; } else { m_capacityAfterStart = MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER_SMALL; m_fadingOutStartLimit = (int)(m_capacityAfterStart * MyDecalsConstants.TEXTURE_SMALL_FADING_OUT_START_LIMIT_PERCENT); m_fadingOutMinimalTriangleCount = (int)(m_capacityAfterStart * MyDecalsConstants.TEXTURE_SMALL_FADING_OUT_MINIMAL_TRIANGLE_COUNT_PERCENT); MaxNeighbourTriangles = MyDecalsConstants.TEXTURE_SMALL_MAX_NEIGHBOUR_TRIANGLES; } }
// 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 triangle = m_trianglesQueue.Dequeue(); triangle.Close(); m_freeTriangles.Push(triangle); } 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; } } }
public void FadeOutAll() { if (m_status != MyDecalsBufferState.FADING_OUT_ONLY_BEGINNING) { m_fadingOutStartTime = MyMinerGame.TotalGamePlayTimeInMilliseconds; } m_status = MyDecalsBufferState.FADING_OUT_ALL; }
public void FadeOutAll() { if (m_status != MyDecalsBufferState.FADING_OUT_ONLY_BEGINNING) { m_fadingOutStartTime = (int)MyRender.RenderTimeInMS; } m_status = MyDecalsBufferState.FADING_OUT_ALL; }