Expand description
§Material Creation and Management
This module provides utilities for creating and configuring materials in the glTF format. Materials in glTF use the Physically Based Rendering (PBR) model which simulates how light interacts with surfaces in a physically accurate way.
The core of this module is the MaterialBuilder
struct which provides a builder pattern
for creating materials with various properties:
- Base color (diffuse color)
- Metallic and roughness factors
- Normal, occlusion, and emissive textures
- Transparency settings
- Double-sided rendering
§Example
use mesh_tools::material;
// Create a red metallic material
let red_metal = material::create_metallic_material(
Some("RedMetal".to_string()),
[1.0, 0.0, 0.0, 1.0], // Red color
0.9, // High metallic
0.2 // Low roughness (shiny)
);
Structs§
- Material
Builder - Builder for creating and configuring glTF materials with PBR properties
Functions§
- create_
basic_ material - Create a basic material with the specified color
- create_
metallic_ material - Create a metallic material
- create_
textured_ material - Create a textured material with additional options