Obj

Struct Obj 

Source
pub struct Obj {
    pub id: ID,
    pub name: String,
    pub parent: ParentWrapper,
    pub visible: bool,
    pub subspace: Space,
    pub triangle_mesh: Vec<Arc<TriangleMesh>>,
    pub script: Option<Box<Script<Self>>>,
    pub children: Vec<Arc<RwLock<dyn GameObject>>>,
}

Fields§

§id: ID§name: String§parent: ParentWrapper§visible: bool§subspace: Space§triangle_mesh: Vec<Arc<TriangleMesh>>§script: Option<Box<Script<Self>>>§children: Vec<Arc<RwLock<dyn GameObject>>>

Implementations§

Source§

impl Obj

Source

pub fn new_empty( name: Option<&str>, parent: Option<Arc<RwLock<dyn GameObject>>>, position: Option<Vector3<f32>>, rotation: Option<Quaternion<f32>>, scale_factor: Option<Vector3<f32>>, visible: bool, engine_globals: EngineGlobals, script: Option<Box<Script<Self>>>, ) -> Arc<RwLock<Self>>

Source

pub fn from_triangle_mesh_vec( name: Option<&str>, triangle_mesh_vec: Vec<Arc<TriangleMesh>>, parent: Option<Arc<RwLock<dyn GameObject>>>, position: Option<Vector3<f32>>, rotation: Option<Quaternion<f32>>, scale_factor: Option<Vector3<f32>>, visible: bool, engine_globals: EngineGlobals, script: Option<Box<Script<Self>>>, ) -> Arc<RwLock<Self>>

Source

pub fn from_obj<'a>( name: Option<&str>, path: &str, parent: Option<Arc<RwLock<dyn GameObject>>>, position: Option<Vector3<f32>>, rotation: Option<Quaternion<f32>>, scale_factor: Option<Vector3<f32>>, visible: bool, engine_globals: EngineGlobals, script: Option<Box<Script<Self>>>, ) -> Result<Arc<RwLock<Self>>, &'a str>

Trait Implementations§

Source§

impl Child for Obj

Source§

fn get_parent(&self) -> ParentWrapper

Source§

unsafe fn set_parent(&mut self, parent: ParentWrapper)

Safety Read more
Source§

impl Clone for Obj

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Obj

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drawable for Obj

Source§

fn add_to_draw_pass_manager(&self, draw_pass_manager: &mut DrawPassManager)

Adds self’s visible characteristics and its children to the draw pass.
Source§

fn load_into_managers( &self, this: ParentWrapper, draw_pass_manager: &mut DrawPassManager, lighting_pass_manager: &mut LightingPassManager, )

Adds self’s relevant characteristics and its children to the pass managers.
Source§

fn add_triangle_mesh(&mut self, mesh: Arc<TriangleMesh>) -> Result<(), ()>

Adds a triangle mesh to the Drawable struct
Source§

fn get_visible(&self) -> bool

Checks if an object is visible
Source§

fn get_triangle_mesh(&self) -> Vec<Arc<TriangleMesh>>

Source§

fn get_vertex_buffer(&self) -> Vec<Option<Arc<CpuAccessibleBuffer<[Vertex]>>>>

Source§

fn get_normals_buffer(&self) -> Vec<Option<Arc<CpuAccessibleBuffer<[Normal]>>>>

Source§

fn get_texture_indices_buffer( &self, ) -> Vec<Option<Arc<CpuAccessibleBuffer<[TextureIndex]>>>>

Source§

impl GameObject for Obj

Source§

impl Named for Obj

Source§

fn get_name(&self) -> &str

Source§

impl Parent for Obj

Source§

fn get_children(&self) -> Vec<Arc<RwLock<dyn GameObject>>>

Source§

fn add_child(&mut self, child: Arc<RwLock<dyn GameObject>>)

Source§

unsafe fn remove_child( &mut self, child: Arc<RwLock<dyn GameObject>>, ) -> Result<(), ()>

Safety Read more
Source§

unsafe fn replace_child( &mut self, old: Arc<RwLock<dyn GameObject>>, new: Arc<RwLock<dyn GameObject>>, ) -> Result<(), ()>

Safety Read more
Source§

fn get_child_by_name( &self, name: &str, ) -> Result<Arc<RwLock<dyn GameObject>>, &str>

Source§

impl PartialEq for Obj

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Scriptable for Obj

Source§

fn spawn_script_core( &mut self, this: Arc<RwLock<dyn GameObject>>, spawner: Spawner, )

Source§

fn spawn_script_handler<'a>( &mut self, this: Arc<RwLock<dyn GameObject>>, spawner: Spawner, event: Event<'static, UserEvent<Arc<dyn Any + Send + Sync>>>, )

Source§

fn get_globals(&self) -> Result<Box<dyn Global>, &'static str>

Source§

fn set_globals(&mut self, globals: Box<dyn Global>) -> Result<(), &'static str>

Auto Trait Implementations§

§

impl Freeze for Obj

§

impl !RefUnwindSafe for Obj

§

impl Send for Obj

§

impl Sync for Obj

§

impl Unpin for Obj

§

impl !UnwindSafe for Obj

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Content for T

Source§

fn ref_from_ptr<'a>(ptr: *mut c_void, size: usize) -> Option<*mut T>

Builds a pointer to this type from a raw pointer.
Source§

fn is_size_suitable(size: usize) -> bool

Returns true if the size is suitable to store a type like this.
Source§

fn indiv_size() -> usize

Returns the size of an individual element.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GameObjectBoxClone for T
where T: 'static + GameObject + Clone,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> SafeBorrow<T> for T

Source§

impl<T, A> Typed<T> for A
where T: Construct<A>,