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
impl Obj
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>>
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>>
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
impl Child for Obj
fn get_parent(&self) -> ParentWrapper
Source§unsafe fn set_parent(&mut self, parent: ParentWrapper)
unsafe fn set_parent(&mut self, parent: ParentWrapper)
Safety Read more
Source§impl Drawable for Obj
impl Drawable for Obj
Source§fn add_to_draw_pass_manager(&self, draw_pass_manager: &mut DrawPassManager)
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,
)
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<(), ()>
fn add_triangle_mesh(&mut self, mesh: Arc<TriangleMesh>) -> Result<(), ()>
Adds a triangle mesh to the Drawable struct
Source§fn get_visible(&self) -> bool
fn get_visible(&self) -> bool
Checks if an object is visible
fn get_triangle_mesh(&self) -> Vec<Arc<TriangleMesh>>
fn get_vertex_buffer(&self) -> Vec<Option<Arc<CpuAccessibleBuffer<[Vertex]>>>>
fn get_normals_buffer(&self) -> Vec<Option<Arc<CpuAccessibleBuffer<[Normal]>>>>
fn get_texture_indices_buffer( &self, ) -> Vec<Option<Arc<CpuAccessibleBuffer<[TextureIndex]>>>>
Source§impl GameObject for Obj
impl GameObject for Obj
fn as_any(&self) -> &dyn Any
fn cast_camera_arc_rwlock( &self, this: Arc<RwLock<dyn GameObject>>, ) -> Result<Arc<RwLock<dyn Camera>>, ()>
fn cast_light_arc_rwlock( &self, this: Arc<RwLock<dyn GameObject>>, ) -> Result<Arc<RwLock<dyn Light>>, ()>
fn get_id(&self) -> ID
fn get_subspace(&self) -> Space
fn get_inversed_subspace(&self) -> Space
Source§impl Parent for Obj
impl Parent for Obj
fn get_children(&self) -> Vec<Arc<RwLock<dyn GameObject>>>
fn add_child(&mut self, child: Arc<RwLock<dyn GameObject>>)
Source§unsafe fn remove_child(
&mut self,
child: Arc<RwLock<dyn GameObject>>,
) -> Result<(), ()>
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<(), ()>
unsafe fn replace_child( &mut self, old: Arc<RwLock<dyn GameObject>>, new: Arc<RwLock<dyn GameObject>>, ) -> Result<(), ()>
Safety Read more
fn get_child_by_name( &self, name: &str, ) -> Result<Arc<RwLock<dyn GameObject>>, &str>
Source§impl Scriptable for Obj
impl Scriptable for Obj
fn spawn_script_core( &mut self, this: Arc<RwLock<dyn GameObject>>, spawner: Spawner, )
fn spawn_script_handler<'a>( &mut self, this: Arc<RwLock<dyn GameObject>>, spawner: Spawner, event: Event<'static, UserEvent<Arc<dyn Any + Send + Sync>>>, )
fn get_globals(&self) -> Result<Box<dyn Global>, &'static str>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Content for T
impl<T> Content for T
Source§fn ref_from_ptr<'a>(ptr: *mut c_void, size: usize) -> Option<*mut T>
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
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
fn indiv_size() -> usize
Returns the size of an individual element.
Source§impl<T> GameObjectBoxClone for Twhere
T: 'static + GameObject + Clone,
impl<T> GameObjectBoxClone for Twhere
T: 'static + GameObject + Clone,
fn clone_game_object(&self) -> Box<dyn GameObject>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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