RenderPrimitive

Qualified name: algan.rendering.primitives.primitive.RenderPrimitive

class RenderPrimitive[source]

Bases: object

Base class for batched render primitives.

Subclasses are constructed either from per-mob geometry tensors or from a triangle_collection of already-built primitives (the scene batcher groups primitives by get_batch_identifier() and rebuilds one merged primitive per group). The renderer then calls project_to_screen once per batch to shade and pack the geometry, and the memory-accounting methods to choose the frame window.

Methods

get_batch_identifier

Key used by the scene batcher: primitives with equal keys are merged into one batched primitive of this class.

project_to_screen

slice_time_window

Return a shallow primitive copy restricted to a frame window.

Attributes

frame_dependent_source_attrs

get_batch_identifier()[source]

Key used by the scene batcher: primitives with equal keys are merged into one batched primitive of this class.

slice_time_window(start, end, total_frames)[source]

Return a shallow primitive copy restricted to a frame window.

Only source-geometry attributes declared by the subclass are sliced. Topology, shader objects, texture metadata and scene/memory handles are shared. Packed _rt_* state is deliberately cleared: each candidate is projected and merged independently during arena preflight.

The _rt_ prefix is therefore a CONTRACT, not a spelling: an attribute wearing it must be one a projection rebuilds from what the copy still holds. Anything a primitive resolves once at construction from its collection members – the members are not copied, so nothing can rebuild it – has to be named without the prefix or it is dropped here, silently and only on the renders that slice a window. Surface identity (_obj_counts / _obj_ids / _obj_ids_n, which decide how many mobs a merged collection’s tri_obj can tell apart) is the case that established the rule.