void DoRedraw(TerrainRendererRedraw r) { idsCount = 0; Chunk c = r.c; if (c.rendered.ids != null) { for (int i = 0; i < c.rendered.idsCount; i++) { int loadedSubmesh = c.rendered.ids[i]; game.d_Batcher.Remove(loadedSubmesh); } } for (int i = 0; i < r.dataCount; i++) { VerticesIndicesToLoad submesh = r.data[i]; if (submesh.modelData.GetIndicesCount() != 0) { float centerVecX = submesh.positionX + chunksize / 2; float centerVecY = submesh.positionZ + chunksize / 2; float centerVecZ = submesh.positionY + chunksize / 2; float radius = sqrt3half * chunksize; ids[idsCount++] = game.d_Batcher.Add(submesh.modelData, submesh.transparent, submesh.texture, centerVecX, centerVecY, centerVecZ, radius); } } int[] idsarr = new int[idsCount]; for (int i = 0; i < idsCount; i++) { idsarr[i] = ids[i]; } c.rendered.ids = idsarr; c.rendered.idsCount = idsCount; }
public ModDrawTerrain() { currentChunk = new int[18 * 18 * 18]; currentChunkShadows = new byte[18 * 18 * 18]; tempnearestpos = new int[3]; ids = new int[1024]; idsCount = 0; redraw = new TerrainRendererRedraw[128]; redrawCount = 0; CalculateShadowslightRadius = new int[GlobalVar.MAX_BLOCKTYPES]; CalculateShadowsisTransparentForLight = new bool[GlobalVar.MAX_BLOCKTYPES]; lightBase = new LightBase(); lightBetweenChunks = new LightBetweenChunks(); lastPerformanceInfoupdateMilliseconds = 0; lastchunkupdates = 0; started = false; }
public ModDrawTerrain() { currentChunk = new int[18 * 18 * 18]; currentChunkShadows = new byte[18 * 18 * 18]; tempnearestpos = new int[3]; ids = new int[1024]; idsCount = 0; redraw = new TerrainRendererRedraw[128]; redrawCount = 0; CalculateShadowslightRadius = new int[GlobalVar.MAX_BLOCKTYPES]; CalculateShadowsisTransparentForLight = new bool[GlobalVar.MAX_BLOCKTYPES]; lightBase = new LightBase(); lightBetweenChunks = new LightBetweenChunks(); lastPerformanceInfoupdateMilliseconds = 0; lastchunkupdates = 0; started = false; }
void RedrawChunk(int x, int y, int z) { #if !CITO unchecked { #endif Chunk c = game.map.chunks[MapUtilCi.Index3d(x, y, z, mapsizexchunks(), mapsizeychunks())]; if (c == null) { return; } if (c.rendered == null) { c.rendered = new RenderedChunk(); } c.rendered.dirty = false; chunkupdates++; GetExtendedChunk(x, y, z); TerrainRendererRedraw r = new TerrainRendererRedraw(); r.c = c; VerticesIndicesToLoad[] a = null; IntRef retCount = new IntRef(); if (!IsSolidChunk(currentChunk, (bufferedChunkSize) * (bufferedChunkSize) * (bufferedChunkSize))) { CalculateShadows(x, y, z); a = game.d_TerrainChunkTesselator.MakeChunk(x, y, z, currentChunk, currentChunkShadows, game.mLightLevels, retCount); } r.data = new VerticesIndicesToLoad[retCount.value]; for (int i = 0; i < retCount.value; i++) { r.data[i] = VerticesIndicesToLoadClone(a[i]); } r.dataCount = retCount.value; redraw[redrawCount++] = r; #if !CITO } #endif }
void RedrawChunk(int x, int y, int z) { #if !CITO unchecked { #endif Chunk c = game.map.chunks[MapUtilCi.Index3d(x, y, z, mapsizexchunks(), mapsizeychunks())]; if (c == null) { return; } if (c.rendered == null) { c.rendered = new RenderedChunk(); } c.rendered.dirty = false; chunkupdates++; GetExtendedChunk(x, y, z); TerrainRendererRedraw r = new TerrainRendererRedraw(); r.c = c; VerticesIndicesToLoad[] a = null; IntRef retCount = new IntRef(); if (!IsSolidChunk(currentChunk, (bufferedChunkSize) * (bufferedChunkSize) * (bufferedChunkSize))) { CalculateShadows(x, y, z); a = game.d_TerrainChunkTesselator.MakeChunk(x, y, z, currentChunk, currentChunkShadows, game.mLightLevels, retCount); } r.data = new VerticesIndicesToLoad[retCount.value]; for (int i = 0; i < retCount.value; i++) { r.data[i] = VerticesIndicesToLoadClone(a[i]); } r.dataCount = retCount.value; redraw[redrawCount++] = r; #if !CITO } #endif }
void DoRedraw(TerrainRendererRedraw r) { #if !CITO unchecked { #endif idsCount = 0; RenderedChunk c = r.c.rendered; if (c.ids != null) { for (int i = 0; i < c.idsCount; i++) { int loadedSubmesh = c.ids[i]; game.d_Batcher.Remove(loadedSubmesh); } } for (int i = 0; i < r.dataCount; i++) { VerticesIndicesToLoad submesh = r.data[i]; if (submesh.modelData.GetIndicesCount() != 0) { float centerVecX = submesh.positionX + chunksize *0.5f; float centerVecY = submesh.positionZ + chunksize *0.5f; float centerVecZ = submesh.positionY + chunksize *0.5f; float radius = sqrt3half * chunksize; ids[idsCount++] = game.d_Batcher.Add(submesh.modelData, submesh.transparent, submesh.texture, centerVecX, centerVecY, centerVecZ, radius); } } int[] idsarr = new int[idsCount]; for (int i = 0; i < idsCount; i++) { idsarr[i] = ids[i]; } c.ids = idsarr; c.idsCount = idsCount; #if !CITO } #endif }