update demos et docs
This commit is contained in:
+10
-10
@@ -1,11 +1,11 @@
|
||||
//! Step 5 — MVP 3D: a lit unit cube that rotates; **Step 10** — the cube is **textured**
|
||||
//! (procedural checkerboard) via the new diffuse path (bind group `@group(2)`).
|
||||
//! A lit unit cube that rotates, **textured** with a procedural checkerboard via the diffuse path
|
||||
//! (bind group `@group(2)`).
|
||||
//!
|
||||
//! Demonstrates the MVP goal of ROADMAP 1.3 + 1.5: a 3D mesh with Phong lighting on screen.
|
||||
//! A 3D mesh with Phong lighting on screen — the library's 3D showcase.
|
||||
//! Follows the declarative workflow (like `simple`): `AppBuilder` + automatic scene, **no wgpu import**.
|
||||
//! Since Step 7 the scene owns its `PipelineCache`: go through `register_shader` +
|
||||
//! `add_material_shader`/`add_material_texture` + `create_mesh` + `add_entity`. Since Step 8 the mesh
|
||||
//! is declared from a **`Geometry`** (positions, normals, indices). Since Step 10 (D4) a texture is
|
||||
//! The scene owns its `PipelineCache`: go through `register_shader` +
|
||||
//! `add_material_shader`/`add_material_texture` + `create_mesh` + `add_entity`. The mesh
|
||||
//! is declared from a **`Geometry`** (positions, normals, indices). A texture is
|
||||
//! registered by id (`add_texture`) and a textured material bound to it (`add_material_texture`);
|
||||
//! the texture is generated *procedurally* (RGBA 8×8 checkerboard) to stay self-contained, no on-disk asset.
|
||||
//! The default active camera (`Scene::default`, position (0,0,3), fov 45°) frames the cube, and
|
||||
@@ -24,7 +24,7 @@ struct Cube {
|
||||
}
|
||||
|
||||
/// Generates a *procedural* RGBA 8×8 checkerboard (white/brick), no on-disk asset, to texture the
|
||||
/// cube (Step 10, D3/D4). Returned as a raw RGBA8 `Vec<u8>`, loadable via `Texture::from_rgba8`.
|
||||
/// cube. Returned as a raw RGBA8 `Vec<u8>`, loadable via `Texture::from_rgba8`.
|
||||
fn checkerboard_rgba() -> Vec<u8> {
|
||||
const SIZE: u32 = 8;
|
||||
let mut rgba = Vec::with_capacity((SIZE * SIZE * 4) as usize);
|
||||
@@ -40,7 +40,7 @@ fn checkerboard_rgba() -> Vec<u8> {
|
||||
|
||||
impl AppHandler for Cube {
|
||||
fn setup(&mut self, app: &mut wsg_lib::App) {
|
||||
// Phong shader `standard` (carries the frame + object + texture bind groups, Step 10).
|
||||
// Phong shader `standard` (carries the frame + object + texture bind groups).
|
||||
app.scene
|
||||
.register_shader("standard", wsg_lib::utils::STANDARD_SHADER_PATH)
|
||||
.unwrap();
|
||||
@@ -63,7 +63,7 @@ impl AppHandler for Cube {
|
||||
.unwrap();
|
||||
app.scene.add_entity("cube", "cube_mesh").unwrap();
|
||||
|
||||
// Step 12 (Phase 4.2): in addition to the default directional light (+Z), a warm **point** light
|
||||
// In addition to the default directional light (+Z), a warm **point** light
|
||||
// is added in front of the cube. Its halo (linear attenuation over the
|
||||
// radius) is visible on the near face of the cube, on top of the directional lighting.
|
||||
app.scene
|
||||
@@ -75,7 +75,7 @@ impl AppHandler for Cube {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// Step 13 (Phase 4.2): a green **spot** light aimed at the cube from the left.
|
||||
// A green **spot** light aimed at the cube from the left.
|
||||
// The cone (half-angle ~20°) projects a directed beam onto the cube's faces, with a
|
||||
// smoothed penumbra at the edge and linear attenuation over the radius.
|
||||
app.scene
|
||||
|
||||
Reference in New Issue
Block a user