HammeriteAudioMaterials
Audio. Inherits RefCounted
What each material does to sound: a table of material names to HammeriteAudioMaterial.
It answers one question - what does OAK do to sound - and deliberately not the other one. Which material a given texture IS is the game's to say, because a texture name is geometry's and what it MEANS belongs to whoever authored the level: see HammeriteAudioRuntime.material_resolver. This table used to answer both, by taking the first material whose name appeared anywhere in the texture name - so textile was tile, environment contained iron, and a plank texture with stone in its specifier was stone (#241). Assign a table of your own as HammeriteAudio.materials and every bake from then on samples rooms against it. Without one the defaults below apply.
Properties
| Type | Name | Default |
|---|---|---|
HammeriteAudioMaterial | default_material |
Methods
| Returns | Method |
|---|---|
HammeriteAudioMaterial | get_material(material_name: StringName) |
HammeriteAudioMaterial | find_material(material_name: StringName) |
bool | has_material(material_name: StringName) |
void | add_material(material: HammeriteAudioMaterial) |
bool | remove_material(material_name: StringName) |
StringName[] | get_material_names() |
Property descriptions
default_material
var default_material: HammeriteAudioMaterial
Fallback for a material the table has never heard of, so that get_material() always answers something a room can be built of.
Method descriptions
get_material()
func get_material(material_name: StringName) -> HammeriteAudioMaterial
What material_name does to sound, or default_material when the table has no such material. Use find_material() to tell the two apart.
find_material()
func find_material(material_name: StringName) -> HammeriteAudioMaterial
What material_name does to sound, or null when the table has no such material. Null rather than the default, so that a caller can tell "the table says oak is like this" from "the table has never heard of oak" - which get_material() cannot.
has_material()
func has_material(material_name: StringName) -> bool
Does the table define material_name?
add_material()
func add_material(material: HammeriteAudioMaterial) -> void
Add material to the table under its own name, replacing whatever was there.
remove_material()
func remove_material(material_name: StringName) -> bool
Take material_name out of the table, so that it falls back to default_material again. Whether there was one to take.
get_material_names()
func get_material_names() -> StringName[]
Every material the table defines, in lower case, in the order they were added.