only support indexed color mode, get rid of enum/branching on color modes
This commit is contained in:
parent
9f657ffcf9
commit
e0a5d34d29
25 changed files with 142 additions and 286 deletions
|
|
@ -174,6 +174,7 @@ pub extern "C" fn main(_argc: i32, _argv: *const *const u8) -> i32 {
|
|||
|
||||
if let Some(pid) = player_id {
|
||||
if let Some(_player) = sim.get_player_position(pid) {
|
||||
let mut burst = false;
|
||||
while let Some(chunk_id) = client_chunks.next_pending() {
|
||||
match chunk_id {
|
||||
ChunkId::Bsp(id) => {
|
||||
|
|
@ -182,13 +183,15 @@ pub extern "C" fn main(_argc: i32, _argv: *const *const u8) -> i32 {
|
|||
let msgs = bsp_to_messages(bsp, id, chunk.version());
|
||||
client_chunks.queue_messages(msgs);
|
||||
client_chunks.mark_sent(chunk_id, chunk.version());
|
||||
burst = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _ in 0..8 {
|
||||
let send_limit = if burst { 256 } else { 8 };
|
||||
for _ in 0..send_limit {
|
||||
if let Some(msg) = client_chunks.next_message() {
|
||||
transport.send_chunk(&msg, sequence);
|
||||
sequence = sequence.wrapping_add(1);
|
||||
|
|
|
|||
|
|
@ -169,7 +169,15 @@ fn build_bsp_node_grid(ctx: &mut BspBuildContext, x0: i32, y0: i32, x1: i32, y1:
|
|||
let plane_idx = ctx.plane_offset;
|
||||
ctx.plane_offset += 1;
|
||||
|
||||
if depth % 2 == 0 {
|
||||
let split_x = if x1 - x0 <= 1 {
|
||||
false
|
||||
} else if y1 - y0 <= 1 {
|
||||
true
|
||||
} else {
|
||||
depth % 2 == 0
|
||||
};
|
||||
|
||||
if split_x {
|
||||
let mid_x = (x0 + x1) / 2;
|
||||
let split_pos = mid_x as f32 * CELL_SIZE;
|
||||
|
||||
|
|
@ -479,6 +487,16 @@ fn compute_vertex_ao(bsp: &BspBuilder, pos: Vec3, normal: Vec3) -> f32 {
|
|||
continue;
|
||||
}
|
||||
|
||||
let cx = offset_pos.x.max(face.aabb_min.x).min(face.aabb_max.x);
|
||||
let cy = offset_pos.y.max(face.aabb_min.y).min(face.aabb_max.y);
|
||||
let cz = offset_pos.z.max(face.aabb_min.z).min(face.aabb_max.z);
|
||||
let dx = offset_pos.x - cx;
|
||||
let dy = offset_pos.y - cy;
|
||||
let dz = offset_pos.z - cz;
|
||||
if dx * dx + dy * dy + dz * dz > AO_RAY_LENGTH * AO_RAY_LENGTH {
|
||||
continue;
|
||||
}
|
||||
|
||||
let mut verts = [Vec3::new(0.0, 0.0, 0.0); 4];
|
||||
let mut num_verts = 0usize;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue