MultiMesh

Inherits: Resource < Reference < Object

Category: Core

Brief Description

Provides high performance mesh instancing.

Methods

AABB get_aabb ( ) const
Color get_instance_color ( int instance ) const
Color get_instance_custom_data ( int instance ) const
Transform get_instance_transform ( int instance ) const
void set_instance_color ( int instance, Color color )
void set_instance_custom_data ( int instance, Color custom_data )
void set_instance_transform ( int instance, Transform transform )

Enumerations

enum TransformFormat:

  • TRANSFORM_2D = 0
  • TRANSFORM_3D = 1

enum ColorFormat:

  • COLOR_NONE = 0
  • COLOR_8BIT = 1
  • COLOR_FLOAT = 2

enum CustomDataFormat:

  • CUSTOM_DATA_NONE = 0
  • CUSTOM_DATA_8BIT = 1
  • CUSTOM_DATA_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 AABB used for visibility must be provided by the user.

Property Descriptions

Setter set_color_format(value)
Getter get_color_format()
Setter set_custom_data_format(value)
Getter get_custom_data_format()
  • int instance_count
Setter set_instance_count(value)
Getter get_instance_count()
Setter set_mesh(value)
Getter get_mesh()
Setter set_transform_format(value)
Getter get_transform_format()

Method Descriptions

  • AABB get_aabb ( ) const

Return the visibility AABB.

  • Color get_instance_color ( int instance ) const

Get the color of a specific instance.

  • Color get_instance_custom_data ( int instance ) const

Return the transform of a specific instance.

  • void set_instance_color ( int instance, Color color )

Set the color of a specific instance.

  • void set_instance_custom_data ( int instance, Color custom_data )
  • void set_instance_transform ( int instance, Transform transform )

Set the transform for a specific instance.