Material

Qualified name: algan.rendering.shaders.materials.Material

class Material(color=None, *, opacity=1.0, transparent=False, visible=True, side=Side.FRONT, flat_shading=False, vertex_colors=False, wireframe=False, tone_mapped=True, **texture_kwargs)[source]

Bases: object

Base class holding the Three.js shared material properties + defaults.

Subclasses set shader, list their animatable shader parameters and implement get_shader_param_values().

Methods

emit_warnings

Warn (once per call) about properties Algan's renderer cannot honour.

get_shader_param_values

Map of {shader_param_name: value} matching this material's shader signature.

shader

MeshBasicMaterial: unlit, returns the flat base color unchanged.

Attributes

applies_color

Whether the material's color should drive the mob's base color.

applies_color = True

Whether the material’s color should drive the mob’s base color. Even then, the default color=None means “keep the mob’s existing color” – unlike Three.js, where an unset material color is white – so Sphere(color=RED).set_material(MeshPhysicalMaterial()) stays red.

emit_warnings(forwarded=None)[source]

Warn (once per call) about properties Algan’s renderer cannot honour.

Parameters:

forwarded – What set_material managed to hand to the geometry, as {slot_name: is_animatable} (the union over the Mobs it was applied to). A slot that reached a geometry is sampled, so it is reported as static rather than ignored – or not reported at all when the geometry it landed on made it animatable. None means nothing was forwarded, which is what a bare Material(...).emit_warnings() describes.

get_shader_param_values()[source]

Map of {shader_param_name: value} matching this material’s shader signature. Base materials expose no extra parameters.

static shader(memory, vertex_location, vertex_normal, albedo_color, camera_location, light_origin, light_color, light_intensity, ambient_light_intensity)

Lighting shader backing this material (a plain function).

Parameters:
  • light_intensity (float)

  • ambient_light_intensity (float)