public void RenderThread() { VertexIndexGenerator gen = new VertexIndexGenerator(); while (true) { _queueNotifier.WaitOne(); while (chunkQueue.Count != 0) { Chunk chunk; if (chunkQueue.TryDequeue(out chunk)) { chunk.UpdateMesh(gen, (GraphicsDevice)gd); } } _queueNotifier.Reset(); } }
public void UpdateMesh(VertexIndexGenerator gen, GraphicsDevice gd) { Mesh[] meshes = gen.Generate(this, gd); if (meshes != null) { if (meshes.Length > 0) _opaqueMesh = meshes[0]; if (meshes.Length > 1) _waterMesh = meshes[1]; } }