Struct three::template::ObjectTemplate
source · 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
sourceimpl ObjectTemplate
impl ObjectTemplate
sourcepub fn new() -> ObjectTemplate
pub fn new() -> ObjectTemplate
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
sourceimpl Clone for ObjectTemplate
impl Clone for ObjectTemplate
sourcefn clone(&self) -> ObjectTemplate
fn clone(&self) -> ObjectTemplate
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for ObjectTemplate
impl Debug for ObjectTemplate
sourceimpl Default for ObjectTemplate
impl Default for ObjectTemplate
sourcefn default() -> ObjectTemplate
fn default() -> ObjectTemplate
Auto Trait Implementations
impl RefUnwindSafe for ObjectTemplate
impl Send for ObjectTemplate
impl Sync for ObjectTemplate
impl Unpin for ObjectTemplate
impl UnwindSafe for ObjectTemplate
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
value
as a parameter of self
.