-
Notifications
You must be signed in to change notification settings - Fork 12
/
slicer.h
36 lines (29 loc) · 1.21 KB
/
slicer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef SLICER_H
#define SLICER_H
#include "scene/3d/spatial.h"
#include "scene/3d/mesh_instance.h"
#include "sliced_mesh.h"
/**
* Helper for cutting a convex mesh along a plane and returning
* two new meshes representing both sides of the cut
*/
class Slicer : public Spatial {
GDCLASS(Slicer, Spatial);
protected:
static void _bind_methods();
public:
/**
* Slice the passed in mesh along the passed in plane, setting the interrior cut surface to the passed in material
*/
Ref<SlicedMesh> slice_by_plane(const Ref<Mesh> mesh, const Plane plane, const Ref<Material> cross_section_material);
/**
* Generates a plane based on the given position and normal and perform a cut along that plane
*/
Ref<SlicedMesh> slice_mesh(const Ref<Mesh> mesh, const Vector3 position, const Vector3 normal, const Ref<Material> cross_section_material);
/**
* Generates a plane based on the given position and normal and offsets it by the given Transform before applying the slice
*/
Ref<SlicedMesh> slice(const Ref<Mesh> mesh, const Transform mesh_transform, const Vector3 position, const Vector3 normal, const Ref<Material> cross_section_material);
Slicer() {};
};
#endif // SLICER_H