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.

Data

log

API

simvx.core.graphics.material.log[source]

‘getLogger(…)’

class simvx.core.graphics.material.Material(colour: 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 | bytes | None = None, normal_map: str | bytes | None = None, metallic_roughness_map: str | bytes | None = None, emissive_map: str | bytes | None = None, ao_map: str | bytes | None = None, emissive_colour: tuple[float, ...] | None = None)[source]

Pure material data for rendering. Backend-agnostic.

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

Initialization

Initialize material with colour and properties.

Args: colour: 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 colour) albedo_map: Path or embedded bytes for albedo/diffuse texture (optional) normal_map: Path or embedded bytes for normal map texture (optional) metallic_roughness_map: Path or embedded bytes for metallic-roughness texture (optional) emissive_map: Path or embedded bytes for emissive texture (optional) ao_map: Path or embedded bytes for ambient occlusion texture (optional)

__slots__

(‘_uid’, ‘colour’, ‘metallic’, ‘roughness’, ‘blend’, ‘wireframe’, ‘double_sided’, ‘unlit’, ‘albedo_u…

property content_key: tuple

Hashable key representing all rendering-relevant properties.

Two materials with the same content_key are visually identical and can share a single GPU material slot.

property colour_bytes: bytes

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

to_dict() dict[source]

Serialize to dict for JSON/pickle.

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

Deserialize from dict.