4acf1d821d
- AppHandler::render now receives the current &Frame; its default implementation renders the whole scene automatically via app.render_scene(frame.view()) (Option A). Users can simply not implement render for full auto-rendering. - Add Renderer::render_scene: batch-renders every scene entity in a single render pass. Factored per-mesh draw logic into a private draw_entity helper shared with Renderer::render. - Add App::render_scene(view) delegating to the Renderer. - Fill simple.rs with a real quad (mesh/material/entity) without importing wgpu; the scene now auto-renders via the trait default.
29 lines
993 B
Rust
29 lines
993 B
Rust
//! # Geometry Module
|
|
//!
|
|
//! Defines the `Geometry` struct for storing vertex data of 3D meshes.
|
|
//! This module handles the core geometric representation used by meshes.
|
|
//!
|
|
//! ## Usage
|
|
//! - Stores vertex attributes (positions, normals, UVs)
|
|
//! - Used by `Mesh` to define its vertex data
|
|
//! - Passed to shaders for rendering
|
|
//!
|
|
//! ## Related Types
|
|
//! - `Geometry`: Main struct for vertex data storage
|
|
//! - Fields: positions, normals, uvs, indices
|
|
|
|
/// Represents the geometric data of a 3D mesh.
|
|
///
|
|
/// This struct stores the core vertex attributes that define a mesh's shape.
|
|
#[derive(Debug, Clone)]
|
|
pub struct Geometry {
|
|
/// Vertex positions as an array of 3D coordinates
|
|
pub positions: Vec<[f32; 3]>,
|
|
/// Optional vertex normals for lighting calculations
|
|
pub normals: Option<Vec<[f32; 3]>>,
|
|
/// Optional texture coordinates for UV mapping
|
|
pub uvs: Option<Vec<[f32; 2]>>,
|
|
/// Optional indices for indexed rendering
|
|
pub indices: Option<Vec<u16>>,
|
|
}
|