Fix transparent blocks
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { BlockRegistry } from "$/common/everything_registry.ts";
|
||||
import type { SpriteRegion } from "$/common/constants.ts";
|
||||
import type { OreJson } from "$/common/mod_data.ts";
|
||||
import type { SortType } from "./translucent_sort.ts";
|
||||
|
||||
// messages between the main thread and the chunk workers
|
||||
|
||||
@@ -17,7 +18,30 @@ export type ToChunkWorker =
|
||||
ores: OreJson[];
|
||||
}
|
||||
| { type: "generate"; chunk_x: number; chunk_z: number; seed: string }
|
||||
| { type: "mesh"; chunk_x: number; chunk_z: number; version: number; padded_chunk: Uint32Array };
|
||||
| {
|
||||
type: "mesh";
|
||||
chunk_x: number;
|
||||
chunk_z: number;
|
||||
version: number;
|
||||
padded_chunk: Uint32Array;
|
||||
// where the camera is, to sort the translucent quads
|
||||
camera: number[];
|
||||
}
|
||||
| {
|
||||
type: "sort";
|
||||
chunk_x: number;
|
||||
chunk_z: number;
|
||||
version: number;
|
||||
sort_version: number;
|
||||
centers: Float32Array;
|
||||
camera: number[];
|
||||
};
|
||||
|
||||
// 4 vertices per quad
|
||||
export interface LayerMesh {
|
||||
vertices: Float32Array;
|
||||
quad_count: number;
|
||||
}
|
||||
|
||||
export type FromChunkWorker =
|
||||
| {
|
||||
@@ -33,8 +57,23 @@ export type FromChunkWorker =
|
||||
chunk_x: number;
|
||||
chunk_z: number;
|
||||
version: number;
|
||||
opaque_vertices: Float32Array;
|
||||
opaque_count: number;
|
||||
transparent_vertices: Float32Array;
|
||||
transparent_count: number;
|
||||
solid: LayerMesh;
|
||||
cutout: LayerMesh;
|
||||
translucent: LayerMesh & {
|
||||
// sorted back to front for the camera the mesh was requested with
|
||||
indices: Uint32Array;
|
||||
sort_type: SortType;
|
||||
// what resorting needs, see translucent_sort.ts
|
||||
centers: Float32Array;
|
||||
planes: [Float32Array, Float32Array, Float32Array];
|
||||
};
|
||||
camera: number[];
|
||||
}
|
||||
| {
|
||||
type: "sorted";
|
||||
chunk_x: number;
|
||||
chunk_z: number;
|
||||
version: number;
|
||||
sort_version: number;
|
||||
indices: Uint32Array;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user