void RequestUpdateBuffer(ChunkVertexBuilder vertexBuilder, ChunkMeshUpdatePriority priority) { for (int z = 0; z < MeshSegments.Z; z++) { for (int y = 0; y < MeshSegments.Y; y++) { for (int x = 0; x < MeshSegments.X; x++) { var opaqueRequest = new UpdateBufferRequest { VertexBuilder = vertexBuilder, Segment = new IntVector3(x, y, z), Translucece = false, Priority = priority, RequestTime = TimeSpan.FromTicks(Environment.TickCount) }; updateBufferRequests.Enqueue(opaqueRequest); var translucentRequest = new UpdateBufferRequest { VertexBuilder = vertexBuilder, Segment = new IntVector3(x, y, z), Translucece = true, Priority = priority, RequestTime = TimeSpan.FromTicks(Environment.TickCount) }; updateBufferRequests.Enqueue(translucentRequest); } } } }
// メッシュ更新は2フェーズ。 // 1. 非同期な頂点構築 // 2. 構築された頂点による同期バッファ更新。 // // 恐らく、バッファ更新は GPU との同期が発生するため、 // 非同期ではなくゲーム スレッドで実行すべきであろうと思われる。 public void RequestUpdateMesh(Chunk chunk, ChunkMeshUpdatePriority priority) { if (chunk == null) { throw new ArgumentNullException("chunk"); } var request = buildVertexRequestPool.Borrow(); request.Initialize(chunk, priority); buildVertexRequests.Enqueue(request); }
internal void Initialize(Chunk chunk, ChunkMeshUpdatePriority priority) { Chunk = chunk; Priority = priority; RequestTime = TimeSpan.FromTicks(Environment.TickCount); }
public void RequestUpdateMesh(Chunk chunk, ChunkMeshUpdatePriority priority) { meshManager.RequestUpdateMesh(chunk, priority); }
public void RequestUpdateMesh(Chunk chunk, ChunkMeshUpdatePriority priority) { meshManager.RequestUpdateMesh(chunk, priority); }