69 lines
1.9 KiB
C++
69 lines
1.9 KiB
C++
#ifndef DIRECT_LOD_MULTIMESH_H
|
|
#define DIRECT_LOD_MULTIMESH_H
|
|
#include <scene/resources/mesh.h>
|
|
#include <servers/visual_server.h>
|
|
#include <modules/opensimplex/open_simplex_noise.h>
|
|
class World;
|
|
class LodMultiMesh3D {
|
|
public:
|
|
enum ColorFormat {
|
|
COLOR_NONE = VS::MULTIMESH_COLOR_NONE,
|
|
COLOR_8BIT = VS::MULTIMESH_COLOR_8BIT,
|
|
COLOR_FLOAT = VS::MULTIMESH_COLOR_FLOAT,
|
|
};
|
|
|
|
enum CustomDataFormat {
|
|
CUSTOM_DATA_NONE,
|
|
CUSTOM_DATA_8BIT,
|
|
CUSTOM_DATA_FLOAT,
|
|
};
|
|
protected:
|
|
List<Ref<Mesh> > meshes;
|
|
ColorFormat color_format;
|
|
CustomDataFormat custom_data_format;
|
|
struct multimesh_data {
|
|
RID id, instance;
|
|
int instance_count;
|
|
int visible_instance_count;
|
|
int lod_decimator;
|
|
Ref<OpenSimplexNoise> density_noise;
|
|
};
|
|
List<struct multimesh_data> multimeshes;
|
|
Transform xf;
|
|
bool visible;
|
|
public:
|
|
void add_mesh(Ref<Mesh> mesh);
|
|
int get_mesh_count() const;
|
|
void set_mesh(int id, Ref<Mesh> mesh);
|
|
Ref<Mesh> get_mesh(int id) const;
|
|
|
|
void set_color_format(ColorFormat p_color_format);
|
|
ColorFormat get_color_format() const;
|
|
|
|
void set_custom_data_format(CustomDataFormat p_custom_data_format);
|
|
CustomDataFormat get_custom_data_format() const;
|
|
|
|
void set_density_noise(int id, Ref<OpenSimplexNoise> noise);
|
|
Ref<OpenSimplexNoise> get_density_noise(int id) const;
|
|
|
|
void set_instance_count(int id, int count);
|
|
int get_instance_count(int id) const;
|
|
void set_instance_transform(int id, int instance, const Transform &xform);
|
|
void set_visible_instance_count(int id, int count);
|
|
int get_visible_instance_count(int id) const;
|
|
void set_instance_color(int id, int instance, const Color &color);
|
|
void hide();
|
|
void show();
|
|
void set_global_transform(const Transform &xform);
|
|
Transform get_global_transform() const;
|
|
Color get_instance_color(int id, int instance) const;
|
|
void set_world(const World *world);
|
|
bool is_visible() const;
|
|
AABB get_aabb(int id) const;
|
|
Vector3 get_center() const;
|
|
|
|
LodMultiMesh3D();
|
|
~LodMultiMesh3D();
|
|
};
|
|
#endif
|