scene.SceneDescription¶
-
moderngl_window.meta.scene.
SceneDescription
[source]¶ Describes a scene to load.
The correct loader is resolved by looking at the file extension. This can be overridden by specifying a
kind
that maps directly to a specific loader class.# Wavefront/obj file SceneDescription(path='scenes/cube.obj') # stl file SceneDescription(path='scenes/crater.stl') # GLTF 2 file SceneDescription(path='scenes/sponza.gltf')
The user can also override what buffer/attribute names should be used by specifying
attr_names
.A
cache
option is also available as some scene loaders supports converting the file into a different format on the fly to speed up loading.
Methods¶
-
SceneDescription.
__init__
(path=None, kind=None, cache=False, attr_names=<class 'moderngl_window.geometry.attributes.AttributeNames'>, **kwargs)[source]¶ Create a scene description.
- Keyword Arguments
path (str) – Path to resource
kind (str) – Loader kind
cache (str) – Use the loader caching system if present
attr_names (AttributeNames) – Attrib name config
**kwargs – Optional custom attributes
Attributes¶
-
SceneDescription.
attr_names
¶ Attribute name config
- Type
AttributeNames
-
SceneDescription.
cache
¶ Use cache feature in scene loader
- Type
bool
Inherited Attributes¶
-
SceneDescription.
path
¶ The path to a resource when a single file is specified
- Type
str
-
SceneDescription.
resolved_path
¶ The resolved path by a finder.
The absolute path to the resource can optionally be assigned by a loader class.
- Type
pathlib.Path
-
SceneDescription.
attrs
¶ All keywords arguments passed to the resource
- Type
dict
-
SceneDescription.
label
¶ optional name for the resource
Assigning a label is not mandatory but can help when aliasing resources. Some prefer to preload all needed resources and fetch them later by the label. This can he a lot less chaotic in larger applications.
- Type
str
-
SceneDescription.
kind
¶ default resource kind.
The resource
kind
is directly matched with thekind
in loader classes.This property also supports assignment and is useful if the
kind
is detected based in the the attribute values.description.kind = 'something'
- Type
str
-
SceneDescription.
loader_cls
¶ The loader class for this resource.
This property is assigned to during the loading stage were a loader class is assigned based on the kind.
- Type
Type
-
SceneDescription.
default_kind
= None¶
-
SceneDescription.
resource_type
= 'scenes'¶