diffrp.scene.scene#

class diffrp.scene.scene.Scene#

Bases: object

Represents a scene in DiffRP. add_* methods return the scene itself for chaining calls.

lights#

List of light sources in the scene.

objects#

List of objects in the scene. Currently supporting MeshObject only.

metadata#

Dict of arbitrary loader-specific or user-defined metadata.

__init__() None#
add_light(light: Light) Self#
add_mesh_object(mesh_obj: MeshObject) Self#
static_batching() Self#

Batches meshes with the same material into a single pass for faster rendering. Suitable if you have multiple meshes with the same material, and want to render multiple frames of the same scene.

Changes are made in-place. You shall not modify the old mesh objects after calling this method. Local coordinates may change for individual meshes as they are combined. The world space and most renders will remain the same after the operation.

Meshes with the same material are required to have the same set of custom attributes.

Returns:

The scene itself after in-place modification.

Return type:

Scene