28 lines
602 B
C++
28 lines
602 B
C++
#pragma once
|
|
|
|
#include "macros.h"
|
|
#include "scene/3d/mesh_instance_3d.h"
|
|
#include "scene/resources/surface_tool.h"
|
|
class Terrain;
|
|
|
|
class TerrainChunkMesh : public MeshInstance3D {
|
|
GDCLASS(TerrainChunkMesh, MeshInstance3D);
|
|
static void _bind_methods();
|
|
void generate_vertices();
|
|
void generate_faces();
|
|
|
|
public:
|
|
void update_mesh();
|
|
size_t points_per_side() const;
|
|
|
|
private:
|
|
Ref<SurfaceTool> surface{ memnew(SurfaceTool) };
|
|
Terrain *terrain{ nullptr };
|
|
size_t detail{ 1 };
|
|
size_t size{ 1 };
|
|
|
|
public:
|
|
GET_SET_FNS(Terrain *, terrain);
|
|
GET_SET_FNS(size_t, detail);
|
|
GET_SET_FNS(size_t, size);
|
|
};
|