Skip to content

geometry

Francisco Dias edited this page Nov 22, 2024 · 4 revisions

Geometry

FMOD Object: Geometry


This module holds the functionality for the setup and modification of geometry for occlusion.

Functions

This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.



Back To Top

fmod_geometry_set_polygon_attributes

FMOD Function: Geometry::setPolygonAttributes


This function sets individual attributes for a polygon inside a geometry object.


Syntax:

fmod_geometry_set_polygon_attributes(geometry_ref, polygon_index, direct_occlusion, reverb_occlusion, double_sided)
Argument Type Description
geometry_ref Real A reference to a geometry.
polygon_index Real The polygon index. A value in the range [0, fmod_geometry_get_num_polygons].
direct_occlusion Real The occlusion factor of the polygon for the direct path where 0 represents no occlusion and 1 represents full occlusion.
reverb_occlusion Real The occlusion factor of the polygon for the reverb path where 0 represents no occlusion and 1 represents full occlusion.
double_sided Boolean true: The polygon is double-sided. false: The polygon is single-sided, and the winding of the polygon (which determines the polygon's normal) determines which side of the polygon will cause occlusion.



Returns:

N/A




Back To Top

fmod_geometry_get_polygon_attributes

FMOD Function: Geometry::getPolygonAttributes


This function retrieves the attributes for a polygon.


Syntax:

fmod_geometry_get_polygon_attributes(geometry_ref, polygon_index)
Argument Type Description
geometry_ref Real A reference to a geometry.
polygon_index Real The polygon index. A value in the range [0, fmod_geometry_get_num_polygons].



Returns:

FmodGeometryPolygonAttributes




Back To Top

fmod_geometry_get_polygon_num_vertices

FMOD Function: Geometry::getPolygonNumVertices


This function gets the number of vertices in a polygon.


Syntax:

fmod_geometry_get_polygon_num_vertices(geometry_ref, polygon_index)
Argument Type Description
geometry_ref Real A reference to a geometry.
polygon_index Real The polygon index. A value in the range [0, fmod_geometry_get_num_polygons].



Returns:

Real




Back To Top

fmod_geometry_set_polygon_vertex

FMOD Function: Geometry::setPolygonVertex


This function alters the position of a polygon's vertex inside a geometry object.

Vertices are relative to the position of the object. See fmod_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 fmod_geometry_set_position, fmod_geometry_set_scale and fmod_geometry_set_rotation.


Syntax:

fmod_geometry_set_polygon_vertex(geometry_ref, polygon_index, vertex_index, position)
Argument Type Description
geometry_ref Real A reference to a geometry.
polygon_index Real The polygon index. A value in the range [0, fmod_geometry_get_num_polygons].
vertex_index Real The polygon vertex index. A value in the range [0, fmod_geometry_get_polygon_num_vertices].
position FmodVector



Returns:

N/A




Back To Top

fmod_geometry_get_polygon_vertex

FMOD Function: Geometry::getPolygonVertex


This function retrieves the position of a vertex.


Syntax:

fmod_geometry_get_polygon_vertex(geometry_ref, polygon_index, vertex_index)
Argument Type Description
geometry_ref Real A reference to a geometry.
polygon_index Real The polygon index. A value in the range [0, fmod_geometry_get_num_polygons].
vertex_index Real The polygon vertex index. A value in the range [0, fmod_geometry_get_polygon_num_vertices].



Returns:

FmodVector




Back To Top

fmod_geometry_set_position

FMOD Function: Geometry::setPosition


This function sets the 3D position of the object.

Note

The position is in world space.


Syntax:

fmod_geometry_set_position(geometry_ref, position)
Argument Type Description
geometry_ref Real A reference to a geometry.
position FmodVector The 3D position. Default is {x: 0, y: 0, z: 0}.



Returns:

N/A




Back To Top

fmod_geometry_get_position

FMOD Function: Geometry::getPosition


This function retrieves the 3D position of the object.

Note

The position is in world space.


Syntax:

fmod_geometry_get_position(geometry_ref)
Argument Type Description
geometry_ref Real A reference to a geometry.



Returns:

FmodVector




Back To Top

fmod_geometry_set_rotation

FMOD Function: Geometry::setRotation


This function sets the 3D orientation of the object.

See remarks in fmod_system_set_3d_listener_attributes for a more elaborate description on forward and up vectors.


Syntax:

fmod_geometry_set_rotation(geometry_ref, forward, up)
Argument Type Description
geometry_ref Real A reference to a geometry.
forward FmodVector The forwards orientation. This vector must be of unit length and perpendicular to the up vector. Default is {x: 0, y: 0, z: 1}.
up FmodVector The upwards orientation. This vector must be of unit length and perpendicular to the forwards vector. Default is {x: 0, y: 1, z: 0}.



Returns:

N/A




Back To Top

fmod_geometry_get_rotation

FMOD Function: Geometry::getRotation


This function retrieves the 3D orientation of the object.


Syntax:

fmod_geometry_get_rotation(geometry_ref)
Argument Type Description
geometry_ref Real A reference to a geometry.



Returns:

FmodGeometryRotation




Back To Top

fmod_geometry_set_scale

FMOD Function: Geometry::setScale


This function sets the 3D scale of the object.


Syntax:

fmod_geometry_set_scale(geometry_ref, scale)
Argument Type Description
geometry_ref Real A reference to a geometry.
scale FmodVector The scale value. Default is {x: 1, y: 1, z: 1}.



Returns:

N/A




Back To Top

fmod_geometry_get_scale

FMOD Function: Geometry::getScale


This function retrieves the 3D scale of the object.


Syntax:

fmod_geometry_get_scale(geometry_ref)
Argument Type Description
geometry_ref Real A reference to a geometry.



Returns:

FmodVector




Back To Top

fmod_geometry_add_polygon

FMOD Function: Geometry::addPolygon


This function adds a polygon.

It returns the polygon index that you can use with other per polygon based functions as a handle.

Note

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.

Note

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

Note

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


Syntax:

fmod_geometry_add_polygon(geometry_ref, direct_occlusion, reverb_occlusion, double_sided, vertices)
Argument Type Description
geometry_ref Real A reference to a geometry.
direct_occlusion Real The occlusion factor of the polygon for the direct path where 0 represents no occlusion and 1 represents full occlusion. Default is 0.
reverb_occlusion Real The occlusion factor of the polygon for the reverb path where 0 represents no occlusion and 1 represents full occlusion. Default is 0.
double_sided Boolean true: The polygon is double-sided. false: The polygon is single-sided, and the winding of the polygon (which determines the polygon's normal) determines which side of the polygon will cause occlusion.
vertices Array of FmodVector An array of vertices located in object space.



Returns:

Real




Back To Top

fmod_geometry_set_active

FMOD Function: Geometry::setActive


This function sets whether an object is processed by the geometry engine.


Syntax:

fmod_geometry_set_active(geometry_ref, active)
Argument Type Description
geometry_ref Real A reference to a geometry.
active Real Whether to allow this object to be processed by the geometry engine. Default is true.



Returns:

Boolean




Back To Top

fmod_geometry_get_active

FMOD Function: Geometry::getActive


This function retrieves whether an object is processed by the geometry engine.


Syntax:

fmod_geometry_get_active(geometry_ref)
Argument Type Description
geometry_ref Real A reference to a geometry.



Returns:

Boolean




Back To Top

fmod_geometry_get_max_polygons

FMOD Function: Geometry::getMaxPolygons


This function retrieves the maximum number of polygons and vertices allocatable for this object.

Note

The maximum number is set with fmod_system_create_geometry.


Syntax:

fmod_geometry_get_max_polygons(geometry_ref)
Argument Type Description
geometry_ref Real A reference to a geometry.



Returns:

Real




Back To Top

fmod_geometry_get_num_polygons

FMOD Function: Geometry::getNumPolygons


This function retrieves the number of polygons in this object.


Syntax:

fmod_geometry_get_num_polygons(geometry_ref)
Argument Type Description
geometry_ref Real A reference to a geometry.



Returns:

Real




Back To Top

fmod_geometry_set_user_data

FMOD Function: Geometry::setUserData


This function sets a floating-point user value associated with this object.

Note

While FMOD supports arbitrary User Data, this function only allows you to set a real value (a double-precision floating-point value).


Syntax:

fmod_geometry_set_user_data(geometry_ref, data)
Argument Type Description
geometry_ref Real A reference to a geometry.
data Real The value to be stored on this object.



Returns:

N/A




Back To Top

fmod_geometry_get_user_data

FMOD Function: Geometry::getUserData


This function retrieves a user value associated with this object, as set with an earlier call to fmod_geometry_set_user_data.

Note

While FMOD allows arbitrary User Data, this function only allows you to get a real value (a double-precision floating-point value).


Syntax:

fmod_geometry_get_user_data(geometry_ref)
Argument Type Description
geometry_ref Real A reference to a geometry.



Returns:

Real




Back To Top

fmod_geometry_release

FMOD Function: Geometry::release


This function frees a geometry object and releases its memory.


Syntax:

fmod_geometry_release(geometry_ref)
Argument Type Description
geometry_ref Real A reference to a geometry.



Returns:

N/A




Back To Top

fmod_geometry_save

FMOD Function: Geometry::save


This function saves the geometry object as a serialized binary block to a Buffer.

The function returns the size of the data written to the buffer, in bytes.

Note

The data can be saved to a file if required and loaded later with fmod_system_load_geometry.


Syntax:

fmod_geometry_save(geometry_ref, buff)
Argument Type Description
geometry_ref Real A reference to a geometry.
buff Buffer The address of the Buffer to write the data to.



Returns:

Real