MultiMesh¶
Inherits: Resource < Reference < Object
Category: Core
Brief Description¶
Provides high performance mesh instancing.
Member Functions¶
Rect3 | get_aabb ( ) const |
int | get_color_format ( ) const |
Color | get_instance_color ( int instance ) const |
int | get_instance_count ( ) const |
Transform | get_instance_transform ( int instance ) const |
Mesh | get_mesh ( ) const |
int | get_transform_format ( ) const |
void | set_color_format ( int format ) |
void | set_instance_color ( int instance, Color color ) |
void | set_instance_count ( int count ) |
void | set_instance_transform ( int instance, Transform transform ) |
void | set_mesh ( Mesh mesh ) |
void | set_transform_format ( int format ) |
Member Variables¶
- PoolColorArray color_array
- int color_format
- int instance_count
- Mesh mesh
- PoolVector3Array transform_array
- int transform_format
Numeric Constants¶
- TRANSFORM_2D = 0
- TRANSFORM_3D = 1
- COLOR_NONE = 0
- COLOR_8BIT = 1
- COLOR_FLOAT = 2
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 single instance will always rendered (they are spatially indexed as one, for the whole object).
Since instances may have any behavior, the Rect3 used for visibility must be provided by the user.
Member Function Description¶
- Rect3 get_aabb ( ) const
Return the visibility Rect3.
- int get_color_format ( ) const
Get the color of a specific instance.
- int get_instance_count ( ) const
Return the amount of instances that is going to be drawn.
Return the transform of a specific instance.
- Mesh get_mesh ( ) const
Return the Mesh resource drawn as multiple instances.
- int get_transform_format ( ) const
- void set_color_format ( int format )
Set the color of a specific instance.
- void set_instance_count ( int count )
Set the amount of instances that is going to be drawn. Changing this number will erase all the existing instance transform and color data.
Set the transform for a specific instance.
- void set_mesh ( Mesh mesh )
Set the Mesh resource to be drawn in multiple instances.
- void set_transform_format ( int format )