Module material

Source
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§

MaterialBuilder
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