Resonance Audio Unity SDK API Reference
ResonanceAudioAcousticMesh
A class to hold the duplicated mesh of a mesh filter or a terrain, as well as the surface materials assigned to the triangles.
Summary
Properties |
|
---|---|
mesh
|
Mesh
The duplicated mesh.
|
sourceObject
|
GameObject
The source object from which this acoustic mesh is generated.
|
Public attributes |
|
---|---|
isIncludedByObjectFiltering = false
|
bool
Whether the source object of this acoustic mesh is included by the material mapper's object filtering mechanism.
|
Public static functions |
|
---|---|
GenerateFromMeshFilter(MeshFilter meshFilter, Shader surfaceMaterialShader)
|
Generates an acoustic mesh from a source object's mesh filter.
|
GenerateFromTerrain(Terrain terrain, Shader surfaceMaterialShader)
|
Generates an acoustic mesh from a terrain.
|
Public functions |
|
---|---|
GetSurfaceMaterialIndicesFromTriangle()
|
int[]
Gets the mapping from triangles to surface material indices.
|
IsIncluded()
|
bool
Whether this acoustic mesh is included in reverb computation.
|
Render()
|
bool
Renders the acoustic mesh. Returns false if the mesh does not exist.
|
SetSurfaceMaterialToAllSubMeshes(ResonanceAudioRoomManager.SurfaceMaterial surfaceMaterial)
|
void
Sets the surface material to all sub-meshes.
|
SetSurfaceMaterialToSubMesh(ResonanceAudioRoomManager.SurfaceMaterial surfaceMaterial, int subMeshIndex)
|
void
Sets the surface material to a sub-mesh.
|
Properties
mesh
Mesh mesh
The duplicated mesh.
Note:The vertices are in world space.
sourceObject
GameObject sourceObject
The source object from which this acoustic mesh is generated.
Can be
- A game object with a mesh filter, or
- A terrain object.
Public attributes
isIncludedByObjectFiltering
bool isIncludedByObjectFiltering = false
Whether the source object of this acoustic mesh is included by the material mapper's object filtering mechanism.
Combined with other criteria such as whether the game object is activated, the final verdict of whether this acoustic mesh should be included in reverb computation can be computed (se IsIncluded() below).
Public static functions
GenerateFromMeshFilter
ResonanceAudioAcousticMesh GenerateFromMeshFilter( MeshFilter meshFilter, Shader surfaceMaterialShader )
Generates an acoustic mesh from a source object's mesh filter.
Returns null if the generation failed.
GenerateFromTerrain
ResonanceAudioAcousticMesh GenerateFromTerrain( Terrain terrain, Shader surfaceMaterialShader )
Generates an acoustic mesh from a terrain.
Public functions
GetSurfaceMaterialIndicesFromTriangle
int[] GetSurfaceMaterialIndicesFromTriangle()
Gets the mapping from triangles to surface material indices.
This will be passed to the ray-tracing engine to model sound reflecting from a surface.
IsIncluded
bool IsIncluded()
Whether this acoustic mesh is included in reverb computation.
Render
bool Render()
Renders the acoustic mesh. Returns false if the mesh does not exist.
SetSurfaceMaterialToAllSubMeshes
void SetSurfaceMaterialToAllSubMeshes( ResonanceAudioRoomManager.SurfaceMaterial surfaceMaterial )
Sets the surface material to all sub-meshes.
This is particularly useful for assigning surface materials to terrains, because we model a terrain as a uniform surface.
SetSurfaceMaterialToSubMesh
void SetSurfaceMaterialToSubMesh( ResonanceAudioRoomManager.SurfaceMaterial surfaceMaterial, int subMeshIndex )
Sets the surface material to a sub-mesh.
This is useful for assigning surface materials to game objects with a mesh filter. Because in a mesh filter, a sub-mesh contains triangles sharing a common Unity Material, which will eventually be assigned to the same surface material.