class_multimesh - dragonsoulz/godot GitHub Wiki
MultiMesh
####Inherits: Resource ####Category: Core
Brief Description
Provides high perfomance mesh instancing.
Member Functions
- void set_mesh ( Mesh mesh )
- Mesh get_mesh ( ) const
- void set_instance_count ( int arg0 )
- int get_instance_count ( ) const
- void set_instance_transform ( int arg0, Transform arg1 )
- Transform get_instance_transform ( int arg0 ) const
- void set_instance_color ( int arg0, Color arg1 )
- Color get_instance_color ( int arg0 ) const
- void set_aabb ( AABB arg0 )
- AABB get_aabb ( ) const
- void generate_aabb ( )
Description
MultiMesh provides low level mesh instancing. If the amount of Mesh instances needed goes from hundreds to thousands (and most need to be visible at close proximity) creating such a large amount of MeshInstance nodes may affect performance by using too much CPU or video memory. For this case a MultiMesh becomes very useful, as it can draw thousands of instances with little API overhead. As a drawback, if the instances are too far away of each other, performance may be reduced as every sigle instance will always rendered (they are spatially indexed as one, for the whole object). Since instances may have any behavior, the AABB used for visibility must be provided by the user, or generated with generate_aabb.
Member Function Description
set_mesh
- void set_mesh ( Mesh mesh )
Set the Mesh resource to be drawn in multiple instances.
get_mesh
- Mesh get_mesh ( ) const
Return the Mesh resource drawn as multiple instances.
set_instance_count
- void set_instance_count ( int arg0 )
Set the amount of instnces that is going to be drawn. Changing this number will erase all the existing instance transform and color data.
get_instance_count
- int get_instance_count ( ) const
Return the amount of instnces that is going to be drawn.
set_instance_transform
Set the transform for a specific instance.
get_instance_transform
Return the transform of a specific instance.
set_instance_color
Set the color of a specific instance.
get_instance_color
Get the color of a specific instance.
set_aabb
- void set_aabb ( AABB arg0 )
Set the visibility AABB. If not provided, MultiMesh will not be visible.
get_aabb
- AABB get_aabb ( ) const
Return the visibility AABB.
generate_aabb
- void generate_aabb ( )
Generate a new visibility AABB, using mesh AABB and instance transforms. Since instance information is stored in the VisualServer, this function is VERY SLOW and must NOT be used often.