pub struct ObjectTemplate {
    pub name: Option<String>,
    pub parent: Option<usize>,
    pub transform: Transform,
}
Expand description

Common data used by all object types.

All objects (i.e. three-rs types that implement the Object trait) have common data that the user can set at runtime. ObjectTemplate encapsultes these fields, and the various template types have a way to reference an ObjectTemplate to specify the object data for that template.

See the module documentation for more information on how object data is defined in templates.

Fields

name: Option<String>

An optional name for the object.

parent: Option<usize>

The parent Group of the object, given as an index into the [groups] array of the parent Template.

If parent is None, then the object is added to the root Group returned from [Factory::instantiate_template].

transform: Transform

The local transform for the object.

Implementations

Creates a new ObjectTemplate with default values.

The new object template will have no name, no parent (i.e. it will be treated as a root object of the template), and a default transform.

Examples
use three::template::{ObjectTemplate, Template};

let mut template = Template::new();

let mut object = ObjectTemplate::new();
object.name = Some("My Node".into());
object.transform.position = [1.0, 2.0, 3.0].into();

template.objects.push(object);

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Sets value as a parameter of self.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.