Struct Geometry

Source
pub struct Geometry { /* private fields */ }
Expand description

An interface that allows the setup and modification of geometry for occlusion.

Implementations§

Source§

impl Geometry

Source

pub fn add_polygon( &self, direct_occlusion: c_float, reverb_occlusion: c_float, double_sided: bool, vertices: &[Vector], ) -> Result<c_int>

Adds a polygon.

All vertices must lay in the same plane otherwise behavior may be unpredictable. The polygon is assumed to be convex. A non convex polygon will produce unpredictable behavior. Polygons with zero area will be ignored.

Polygons cannot be added if already at the maximum number of polygons or if the addition of their verticies would result in exceeding the maximum number of vertices.

Vertices of an object are in object space, not world space, and so are relative to the position, or center of the object. See Geometry::set_position.

Source

pub fn set_active(&self, active: bool) -> Result<()>

Sets whether an object is processed by the geometry engine.

Source

pub fn get_active(&self) -> Result<bool>

Retrieves whether an object is processed by the geometry engine.

Source

pub fn get_max_polygons(&self) -> Result<(c_int, c_int)>

Retrieves the maximum number of polygons and vertices allocatable for this object.

The maximum number was set with crate::System::create_geometry.

Source

pub fn get_polygon_count(&self) -> Result<c_int>

Retrieves the number of polygons in this object.

Source

pub fn set_userdata(&self, userdata: *mut c_void) -> Result<()>

Sets the user data.

Source

pub fn get_userdata(&self) -> Result<*mut c_void>

Retrieves user data.

Source

pub fn release(&self) -> Result<()>

Frees a geometry object and releases its memory.

Source

pub fn save(&self) -> Result<Vec<u8>>

Saves the geometry object as a serialized binary block to a Vec.

The data can be saved to a file if required and loaded later with crate::System::load_geometry.

Source§

impl Geometry

Source

pub fn set_polygon_attributes( &self, index: c_int, direct_occlusion: c_float, reverb_occlusion: c_float, double_sided: bool, ) -> Result<()>

Sets individual attributes for a polygon inside a geometry object.

Source

pub fn get_polygon_attributes( &self, index: c_int, ) -> Result<(c_float, c_float, bool)>

Retrieves the attributes for a polygon.

Source

pub fn get_polygon_vertex_count(&self, index: c_int) -> Result<c_int>

Gets the number of vertices in a polygon.

Source

pub fn set_polygon_vertex( &self, index: c_int, vertex_index: c_int, vertex: Vector, ) -> Result<()>

Alters the position of a polygon’s vertex inside a geometry object.

Vertices are relative to the position of the object. See Geometry::set_position.

There may be some significant overhead with this function as it may cause some reconfiguration of internal data structures used to speed up sound-ray testing.

You may get better results if you want to modify your object by using Geometry::set_position, Geometry::set_scale and Geometry::set_rotation.

Source

pub fn get_polygon_vertex( &self, index: c_int, vertex_index: c_int, ) -> Result<Vector>

Retrieves the position of a vertex.

Vertices are relative to the position of the object. See Geometry::set_position.

Source§

impl Geometry

Source

pub fn set_position(&self, position: Vector) -> Result<()>

Sets the 3D position of the object.

Position is in world space.

Source

pub fn get_position(&self) -> Result<Vector>

Retrieves the 3D position of the object.

Position is in world space.

Source

pub fn set_rotation(&self, forward: Vector, up: Vector) -> Result<()>

Sets the 3D orientation of the object.

See remarks in crate::System::set_3d_listener_attributes for more description on forward and up vectors.

Source

pub fn get_rotation(&self) -> Result<(Vector, Vector)>

Retrieves the 3D orientation of the object.

Source

pub fn set_scale(&self, scale: Vector) -> Result<()>

Sets the 3D scale of the object.

An object can be scaled/warped in all 3 dimensions separately using this function without having to modify polygon data.

Source

pub fn get_scale(&self) -> Result<Vector>

Retrieves the 3D scale of the object.

Source§

impl Geometry

Source

pub unsafe fn from_ffi(value: *mut FMOD_GEOMETRY) -> Self

§Safety

value must be a valid pointer either aquired from Self::as_ptr or FMOD.

§Panics

Panics if value is null.

Source

pub fn as_ptr(self) -> *mut FMOD_GEOMETRY

Converts self into its raw representation.

Trait Implementations§

Source§

impl Clone for Geometry

Source§

fn clone(&self) -> Geometry

Returns a copy 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 Geometry

Source§

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

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

impl From<Geometry> for *mut FMOD_GEOMETRY

Source§

fn from(value: Geometry) -> Self

Converts to this type from the input type.
Source§

impl Hash for Geometry

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Geometry

Source§

fn eq(&self, other: &Geometry) -> 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 Copy for Geometry

Source§

impl Eq for Geometry

Source§

impl Send for Geometry

Available on non-crate feature thread-unsafe only.
Source§

impl StructuralPartialEq for Geometry

Source§

impl Sync for Geometry

Available on non-crate feature thread-unsafe only.

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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.