Skip to content

Commit 2ec3766

Browse files
committed
prog
1 parent cb6ad98 commit 2ec3766

89 files changed

Lines changed: 8090 additions & 6054 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/src/rollback/session/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::test_utils::TestConsole;
1010
use crate::rollback::config::SessionConfig;
1111
use crate::rollback::events::{PlayerNetworkStats, SessionError, SessionEvent};
1212
use crate::rollback::player::PlayerSessionConfig;
13-
use super::session::RollbackSession;
13+
use super::RollbackSession;
1414
use super::types::{NetworkInput, SessionType};
1515

1616
// Test input type for unit tests
@@ -59,7 +59,7 @@ fn test_local_session_advance() {
5959
assert_eq!(inputs.len(), 2);
6060
for (input, status) in inputs {
6161
assert_eq!(*input, TestInput::default());
62-
assert_eq!(*status, InputStatus::Confirmed);
62+
assert_eq!(status, &InputStatus::Confirmed);
6363
}
6464
}
6565
_ => panic!("Expected AdvanceFrame request"),

docs/architecture/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ This document describes Nethercore's codebase organization principles, module st
2222
- Create a module directory if multiple related files emerge
2323

2424
**Exceptions:**
25-
- Generated code (e.g., `shader_gen.rs` with template-generated shaders)
25+
- Generated code (e.g., the build-time generated shader tables under `nethercore-zx/src/shader_gen/`)
2626
- Test modules with extensive test cases (keep related tests together)
2727
- Files with clear boundaries that would be awkward to split
2828

docs/architecture/zx/normal-mapping.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ fn skip_normal_map(skip: u32);
414414
- `include/zx.rs``material_normal(texture)` and `skip_normal_map(skip)`.
415415
- `nethercore-zx/src/ffi/material.rs` — binds slot 3 and toggles the skip flag.
416416
- `nethercore-zx/src/graphics/unified_shading_state/shading_state.rs``FLAG_SKIP_NORMAL_MAP` (bit 16) and flag packing.
417-
- `nethercore-zx/shaders/common.wgsl``build_tbn()` + `sample_normal_map()` (slot 3).
417+
- `nethercore-zx/shaders/common/10_unpacking.wgsl``build_tbn()` + `sample_normal_map()` (slot 3).
418418
- `nethercore-zx/shaders/mode1_matcap.wgsl` and `nethercore-zx/shaders/blinnphong_common.wgsl` — consume shading normals.
419419

420420
## Using Normal Maps (Today)

docs/architecture/zx/rendering.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,10 @@ All 40 shader permutations are generated at **compile time** by `build.rs`:
427427

428428
```
429429
Total: 40 shaders
430-
- Mode 0: 16 shaders (all vertex formats)
431-
- Mode 1: 8 shaders (formats with NORMAL)
432-
- Mode 2: 8 shaders (formats with NORMAL)
433-
- Mode 3: 8 shaders (formats with NORMAL)
430+
- Mode 0: 24 shaders (all vertex formats; TANGENT requires NORMAL)
431+
- Mode 1: 16 shaders (formats with NORMAL; optionally TANGENT)
432+
- Mode 2: 16 shaders (formats with NORMAL; optionally TANGENT)
433+
- Mode 3: 16 shaders (formats with NORMAL; optionally TANGENT)
434434
```
435435

436436
**Why compile-time?**
@@ -446,15 +446,16 @@ Shaders are generated from WGSL templates with placeholder replacement:
446446
- `shaders/mode0_lambert.wgsl` — Mode 0 template
447447
- `shaders/mode1_matcap.wgsl` — Mode 1 template
448448
- `shaders/blinnphong_common.wgsl` — Modes 2-3 common code
449-
- `shaders/common.wgsl` — Shared utilities
449+
- `shaders/common/*.wgsl` — Shared bindings/utilities (concatenated in-order by the build script)
450450

451451
**Placeholders replaced:**
452452

453453
Vertex inputs:
454454
- `//VIN_UV``@location(1) uv: vec2<f32>,`
455-
- `//VIN_COLOR``@location(2) color: vec4<f32>,`
456-
- `//VIN_NORMAL``@location(3) normal: u32,`
455+
- `//VIN_COLOR``@location(2) color: vec3<f32>,`
456+
- `//VIN_NORMAL``@location(3) normal_packed: u32,`
457457
- `//VIN_SKINNED` → bone indices/weights
458+
- `//VIN_TANGENT``@location(6) tangent_packed: u32,`
458459

459460
Vertex shader body:
460461
- `//VS_UV` → UV passthrough
@@ -573,10 +574,10 @@ The EPU supports two independent environment layers (base and overlay) that can
573574
// Configure base layer (layer 0)
574575
fn env_gradient(layer: u32, zenith: u32, sky_horizon: u32, ground_horizon: u32,
575576
nadir: u32, azim: f32, shift: f32, elev: f32,
576-
disk: u32, halo: u32, intensity: u32, haze: u32, warmth: u32, cloudiness: u32)
577+
disk: u32, halo: u32, intensity: u32, haze: u32, warmth: u32, cloudiness: u32, cloud_phase: u32)
577578

578579
// Configure overlay layer (layer 1) with a different mode
579-
fn env_scatter(layer: u32, variant: u32, density: u32, ...)
580+
fn env_cells(layer: u32, family: u32, variant: u32, density: u32, ...)
580581

581582
// Set blend mode for overlay compositing
582583
fn env_blend(mode: u32) // 0=alpha, 1=add, 2=multiply, 3=screen
@@ -589,7 +590,7 @@ fn draw_env()
589590
- Layer 0 (base): Primary environment layer
590591
- Layer 1 (overlay): Secondary layer composited on top
591592
- Same mode can be used on both layers with different parameters
592-
- Example: Stars (layer 0) + rain (layer 1), both using scatter mode
593+
- Example: Stars (layer 0) + rain (layer 1), both using Cells mode (family 0, variants 0/1)
593594

594595
**Ambient calculation:**
595596
```
@@ -741,7 +742,7 @@ Invalidate on:
741742
| `nethercore-zx/src/graphics/buffer/mod.rs` | Buffer management |
742743
| `nethercore-zx/src/graphics/command_buffer.rs` | Virtual render pass |
743744
| `nethercore-zx/src/graphics/texture_manager.rs` | Texture loading and VRAM tracking |
744-
| `nethercore-zx/src/shader_gen.rs` | Shader permutation system |
745+
| `nethercore-zx/src/shader_gen/` | Shader permutation system |
745746
| `nethercore-zx/shaders/*.wgsl` | Shader templates |
746747

747748
---

0 commit comments

Comments
 (0)