simvx.core.graphics.material

Material — pure data (no GPU dependencies).

Backends (SDL3, Vulkan) extend this to add texture/GPU management.

Module Contents

Classes

Material

Pure material data for rendering. Backend-agnostic.

API

class simvx.core.graphics.material.Material(color: tuple[float, ...] | numpy.ndarray = (1.0, 1.0, 1.0, 1.0), metallic: float = 0.0, roughness: float = 0.5, blend: Literal[opaque, alpha, additive] = 'opaque', wireframe: bool = False, double_sided: bool = False, unlit: bool = False, albedo_map: str | None = None, normal_map: str | None = None, metallic_roughness_map: str | None = None, emissive_map: str | None = None, ao_map: str | None = None, emissive_color: tuple[float, ...] | None = None)

Pure material data for rendering. Backend-agnostic.

Example: mat = Material(color=(1, 0, 0, 1)) # Red mat = Material(color=(0, 1, 0), blend=”alpha”) mat = Material(albedo_map=”textures/brick.png”)

Initialization

Initialize material with color and properties.

Args: color: RGBA (or RGB auto-expanded to 1.0 alpha) in [0-1] metallic: [0-1] metallic factor roughness: [0-1] roughness factor blend: “opaque”, “alpha”, “additive” wireframe: Render as wireframe double_sided: Disable backface culling unlit: Disable lighting (flat color) albedo_map: Path to albedo/diffuse texture (optional) normal_map: Path to normal map texture (optional) metallic_roughness_map: Path to metallic-roughness texture (optional) emissive_map: Path to emissive texture (optional) ao_map: Path to ambient occlusion texture (optional)

__slots__

(‘color’, ‘metallic’, ‘roughness’, ‘blend’, ‘wireframe’, ‘double_sided’, ‘unlit’, ‘albedo_uri’, ‘nor…

property color_bytes: bytes

RGBA as 16 bytes (4x float32) for GPU upload.

to_dict() dict

Serialize to dict for JSON/pickle.

classmethod from_dict(d: dict) simvx.core.graphics.material.Material

Deserialize from dict.