pub struct Geometry { /* private fields */ }
Expand description
An interface that allows the setup and modification of geometry for occlusion.
Implementations§
Source§impl Geometry
impl Geometry
Sourcepub fn add_polygon(
&self,
direct_occlusion: c_float,
reverb_occlusion: c_float,
double_sided: bool,
vertices: &[Vector],
) -> Result<c_int>
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
.
Sourcepub fn set_active(&self, active: bool) -> Result<()>
pub fn set_active(&self, active: bool) -> Result<()>
Sets whether an object is processed by the geometry engine.
Sourcepub fn get_active(&self) -> Result<bool>
pub fn get_active(&self) -> Result<bool>
Retrieves whether an object is processed by the geometry engine.
Sourcepub fn get_max_polygons(&self) -> Result<(c_int, c_int)>
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
.
Sourcepub fn get_polygon_count(&self) -> Result<c_int>
pub fn get_polygon_count(&self) -> Result<c_int>
Retrieves the number of polygons in this object.
Sourcepub fn get_userdata(&self) -> Result<*mut c_void>
pub fn get_userdata(&self) -> Result<*mut c_void>
Retrieves user data.
Source§impl Geometry
impl Geometry
Sourcepub fn set_polygon_attributes(
&self,
index: c_int,
direct_occlusion: c_float,
reverb_occlusion: c_float,
double_sided: bool,
) -> Result<()>
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.
Sourcepub fn get_polygon_attributes(
&self,
index: c_int,
) -> Result<(c_float, c_float, bool)>
pub fn get_polygon_attributes( &self, index: c_int, ) -> Result<(c_float, c_float, bool)>
Retrieves the attributes for a polygon.
Sourcepub fn get_polygon_vertex_count(&self, index: c_int) -> Result<c_int>
pub fn get_polygon_vertex_count(&self, index: c_int) -> Result<c_int>
Gets the number of vertices in a polygon.
Sourcepub fn set_polygon_vertex(
&self,
index: c_int,
vertex_index: c_int,
vertex: Vector,
) -> Result<()>
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
.
Sourcepub fn get_polygon_vertex(
&self,
index: c_int,
vertex_index: c_int,
) -> Result<Vector>
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
impl Geometry
Sourcepub fn set_position(&self, position: Vector) -> Result<()>
pub fn set_position(&self, position: Vector) -> Result<()>
Sets the 3D position of the object.
Position is in world space.
Sourcepub fn get_position(&self) -> Result<Vector>
pub fn get_position(&self) -> Result<Vector>
Retrieves the 3D position of the object.
Position is in world space.
Sourcepub fn set_rotation(&self, forward: Vector, up: Vector) -> Result<()>
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.
Sourcepub fn get_rotation(&self) -> Result<(Vector, Vector)>
pub fn get_rotation(&self) -> Result<(Vector, Vector)>
Retrieves the 3D orientation of the object.
Source§impl Geometry
impl Geometry
Sourcepub unsafe fn from_ffi(value: *mut FMOD_GEOMETRY) -> Self
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.
Sourcepub fn as_ptr(self) -> *mut FMOD_GEOMETRY
pub fn as_ptr(self) -> *mut FMOD_GEOMETRY
Converts self
into its raw representation.
Trait Implementations§
impl Copy for Geometry
impl Eq for Geometry
impl Send for Geometry
thread-unsafe
only.impl StructuralPartialEq for Geometry
impl Sync for Geometry
thread-unsafe
only.