Core API Reference | Geometry

7. Core API Reference | Geometry

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

Polygons:

Object Spatialization:

Object General:

Geometry::addPolygon

Adds a polygon.

C
C++
C#
JS

FMOD_RESULT Geometry::addPolygon(
  float directocclusion,
  float reverbocclusion,
  bool doublesided,
  int numvertices,
  const FMOD_VECTOR *vertices,
  int *polygonindex
);
directocclusion

Occlusion factor of the polygon for the direct path where 0 represents no occlusion and 1 represents full occlusion.

  • Range: [0, 1]
  • Default: 0
reverbocclusion

Occlusion factor of the polygon for the reverb path where 0 represents no occlusion and 1 represents full occlusion.

  • Range: [0, 1]
  • Default: 0
doublesided

True: Polygon is double sided.
False: 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.

  • Units: Boolean
numvertices
Number of vertices in this polygon. This must be at least 3.
vertices
Array of vertices located in object space of length numvertices. (FMOD_VECTOR)
polygonindex OutOpt
Polygon index. Use this with other per polygon based functions as a handle.

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

See Also: Geometry::setPolygonAttributes, Geometry::getNumPolygons, Geometry::getMaxPolygons

Geometry::getActive

Retrieves whether an object is processed by the geometry engine.

C
C++
C#
JS

FMOD_RESULT Geometry::getActive(
  bool *active
);
active Out

Object is allowed to be processed by the geometry engine.

  • Units: Boolean
  • Default: True

See Also: Geometry::setActive

Geometry::getMaxPolygons

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

C
C++
C#
JS

FMOD_RESULT Geometry::getMaxPolygons(
  int *maxpolygons,
  int *maxvertices
);
maxpolygons OutOpt
Maximum possible number of polygons in this object.
maxvertices OutOpt
Maximum possible number of vertices in this object.

The maximum number was set with System::createGeometry.

See Also: System::loadGeometry

Geometry::getNumPolygons

Retrieves the number of polygons in this object.

C
C++
C#
JS

FMOD_RESULT Geometry::getNumPolygons(
  int *numpolygons
);
numpolygons Out
Number of polygons.

See Also: Geometry::AddPolygon

Geometry::getPolygonAttributes

Retrieves the attributes for a polygon.

C
C++
C#
JS

FMOD_RESULT Geometry::getPolygonAttributes(
  int index,
  float *directocclusion,
  float *reverbocclusion,
  bool *doublesided
);
index

Polygon index.

directocclusion OutOpt

Occlusion factor for the direct path where 0 represents no occlusion and 1 represents full occlusion.

  • Range: [0, 1]
  • Default: 0
  • Units: Linear
reverbocclusion OutOpt

Occlusion factor for the reverb path where 0 represents no occlusion and 1 represents full occlusion.

  • Range: [0, 1]
  • Default: 0
  • Units: Linear
doublesided OutOpt

True: Polygon is double sided.
False: 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.

  • Units: Boolean

See Also: Geometry::setPolygonAttributes

Geometry::getPolygonNumVertices

Gets the number of vertices in a polygon.

C
C++
C#
JS

FMOD_RESULT Geometry::getPolygonNumVertices(
  int index,
  int *numvertices
);
index

Polygon index.

numvertices OutOpt
Number of vertices.

Geometry::getPolygonVertex

Retrieves the position of a vertex.

C
C++
C#
JS

FMOD_RESULT Geometry::getPolygonVertex(
  int index,
  int vertexindex,
  FMOD_VECTOR *vertex
);
index

Polygon index.

vertexindex

Polygon vertex index.

vertex Out

3D Position of the vertex. (FMOD_VECTOR)

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

See Also: Geometry::setPolygonVertex

Geometry::getPosition

Retrieves the 3D position of the object.

C
C++
C#
JS

FMOD_RESULT Geometry::getPosition(
  FMOD_VECTOR *position
);
position Out

3D position. (FMOD_VECTOR)

Position is in world space.

See Also: Geometry::setPosition

Geometry::getRotation

Retrieves the 3D orientation of the object.

C
C++
C#
JS

FMOD_RESULT Geometry::getRotation(
  FMOD_VECTOR *forward,
  FMOD_VECTOR *up
);
forward OutOpt
Forwards orientation. This vector must be of unit length and perpendicular to the up vector. (FMOD_VECTOR)
up OutOpt
Upwards orientation. This vector must be of unit length and perpendicular to the forwards vector. (FMOD_VECTOR)

See Also: Geometry::setRotation

Geometry::getScale

Retrieves the 3D scale of the object.

C
C++
C#
JS

FMOD_RESULT Geometry::getScale(
  FMOD_VECTOR *scale
);
scale Out

Scale value. (FMOD_VECTOR)

  • Units: Linear
  • Default: (1, 1, 1)

See Also: Geometry::setScale

Geometry::getUserData

Retrieves a user value associated with this object.

C
C++
C#
JS

FMOD_RESULT Geometry::getUserData(
  void **userdata
);
userdata Out
Value stored on this object.

See Also: Geometry::setUserData

Geometry::release

Frees a geometry object and releases its memory.

C
C++
C#
JS

FMOD_RESULT Geometry::release();

Geometry::save

Saves the geometry object as a serialized binary block to a user memory buffer.

C
C++
C#
JS

FMOD_RESULT Geometry::save(
  void *data,
  int *datasize
);
data OutOpt
Serialized geometry object. Specify null to have the datasize parameter return the size of the memory required for this saved object.
datasize Out

Size required to save this object when 'data' parameter is null. Otherwise ignored.

  • Units: Bytes

Typical usage of this function is to call it twice - once to get the size of the data, then again to write the data to your pointer.

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

See Also: System::createGeometry

Geometry::setActive

Sets whether an object is processed by the geometry engine.

C
C++
C#
JS

FMOD_RESULT Geometry::setActive(
  bool active
);
active

Allow object to be processed by the geometry engine.

  • Units: Boolean
  • Default: True

See Also: Geometry::getActive

Geometry::setPolygonAttributes

Sets individual attributes for a polygon inside a geometry object.

C
C++
C#
JS

FMOD_RESULT Geometry::setPolygonAttributes(
  int index,
  float directocclusion,
  float reverbocclusion,
  bool doublesided
);
index

Polygon index.

directocclusion

Occlusion factor of the polygon for the direct path where 0 represents no occlusion and 1 represents full occlusion.

  • Range: [0, 1]
  • Default: 0
  • Units: Linear
reverbocclusion

Occlusion factor of the polygon for the reverb path where 0 represents no occlusion and 1 represents full occlusion.

  • Range: [0, 1]
  • Default: 0
  • Units: Linear
doublesided

True: Polygon is double sided.
False: 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.

  • Units: Boolean

See Also: Geometry::getPolygonAttributes, Geometry::getNumPolygons

Geometry::setPolygonVertex

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

C
C++
C#
JS

FMOD_RESULT Geometry::setPolygonVertex(
  int index,
  int vertexindex,
  const FMOD_VECTOR *vertex
);
index

Polygon index.

vertexindex

Polygon vertex index.

vertex

3D Position of the vertex. (FMOD_VECTOR)

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

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::setPosition, Geometry::setScale and Geometry::setRotation.

See Also: Geometry::getPolygonNumVertices, Geometry::getPolygonNumVertices, Geometry::getNumPolygons

Geometry::setPosition

Sets the 3D position of the object.

C
C++
C#
JS

FMOD_RESULT Geometry::setPosition(
  const FMOD_VECTOR *position
);
position

3D position. (FMOD_VECTOR)

Position is in world space.

See Also: Geometry::getPosition, Geometry::setRotation, Geometry::setScale

Geometry::setRotation

Sets the 3D orientation of the object.

C
C++
C#
JS

FMOD_RESULT Geometry::setRotation(
  const FMOD_VECTOR *forward,
  const FMOD_VECTOR *up
);
forward Opt

Forwards orientation. This vector must be of unit length and perpendicular to the up vector. (FMOD_VECTOR)

  • Default: (0, 0, 1)
up Opt

Upwards orientation. This vector must be of unit length and perpendicular to the forwards vector. (FMOD_VECTOR)

  • Default: (0, 1, 0)

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

See Also: Geometry::getRotation, Geometry::setPosition, Geometry::setScale

Geometry::setScale

Sets the 3D scale of the object.

C
C++
C#
JS

FMOD_RESULT Geometry::setScale(
  const FMOD_VECTOR *scale
);
scale

Scale value. (FMOD_VECTOR)

  • Units: Linear
  • Default: (1, 1, 1)

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

See Also: Geometry::getScale, Geometry::setPosition, Geometry::setRotation

Geometry::setUserData

Sets a user value associated with this object.

C
C++
C#
JS

FMOD_RESULT Geometry::setUserData(
  void *userdata
);
userdata
Value stored on this object.

Associates some data with this object to give it context, it will be passed back via callbacks but otherwise remain untouched.

See Also: Geometry::getUserData