#ifndef VOXEL_MESHER #define VOXEL_MESHER #include #include #include #include "voxel.h" #include "voxel_buffer.h" #include "voxel_library.h" class VoxelMesher : public Reference { GDCLASS(VoxelMesher, Reference) public: static const unsigned int MAX_MATERIALS = 8; // Arbitrary. Tweak if needed. VoxelMesher(); void set_material(Ref material, unsigned int id); Ref get_material(unsigned int id) const; void set_library(Ref library); Ref get_library() const { return _library; } void set_occlusion_darkness(float darkness); float get_occlusion_darkness() const { return _baked_occlusion_darkness; } void set_occlusion_enabled(bool enable); bool get_occlusion_enabled() const { return _bake_occlusion; } Ref build(const VoxelBuffer & buffer_ref); Ref build_ref(Ref buffer_ref); protected: static void _bind_methods(); private: Ref _library; Ref _materials[MAX_MATERIALS]; SurfaceTool _surface_tool[MAX_MATERIALS]; float _baked_occlusion_darkness; bool _bake_occlusion; }; #endif // VOXEL_MESHER