Class SotaMesh
Defined in File mesh.h
Inheritance Relationships
Base Type
public PrimitiveMesh
Derived Types
public sota::HexMesh(Class HexMesh)public sota::PentMesh(Class PentMesh)
Class Documentation
-
class SotaMesh : public PrimitiveMesh
Base class for all meshes.
Since PrimitiveMesh is used as super-class there are mandatory parts like vertices, normals, indices, etc.
Subclassed by sota::HexMesh, sota::PentMesh
Public Functions
-
inline SotaMesh(std::unique_ptr<RegularPolygon> base_polygon)
-
void set_divisions(const int p_divisions)
Property shared with Godot inspector.
- Parameters:
p_divisions –
-
int get_divisions() const
-
inline void set_id(int p_id)
-
inline int get_id() const
-
void init()
-
void update()
-
inline const RegularPolygon &base() const
-
inline void set_base(std::unique_ptr<RegularPolygon> base)
-
void _create_mesh_array(Array &result) const override
Mandatory method to define after subclassing from PrimitiveMesh.
- Returns:
Array of vertices, normals, indices, etc. See Godot docs
-
void recalculate_all_except_vertices()
Method is useful e.g. if vertices are (re)calculated from scratch or their order is changed.
-
void calculate_normals()
Calculate normals. Usually used when positions of vertices are changed but order remains the same.
-
Vector3Array get_vertices() const
-
void set_vertices(Vector3Array vertices)
-
inline void set_orientation(Orientation p_orientation)
-
inline void set_tesselation_mode(TesselationMode p_tesselation_mode)
-
inline Orientation get_orientation() const
-
inline TesselationMode get_tesselation_mode() const
-
inline float get_R() const
-
inline float get_r() const
Protected Functions
-
virtual void init_impl() = 0
-
void calculate_tangents()
-
void calculate_colors()
-
virtual void calculate_tex_uv1() = 0
Mapping of texture is a mandatory method to define by subclass.
-
virtual void calculate_tex_uv2()
-
void calculate_indices()
-
void calculate_color_custom()
-
void calculate_bones_weights()
-
void tesselate_into_triangles(Vector3 a, Vector3 b, Vector3 c, int level)
Recursively splits triangle into 4 smaller triangles and appends to vertices.
- Parameters:
a – - vertice of triangle
b – - vertice of triangle
c – - vertice of triangle
level – - required levels of recursion. Level 1 means no recursion, i.e. 1 triangle will be added. On level 2
4 triangles. Level 3 - 16 triangles and so on
-
inline void add_faces(float offset)
Protected Attributes
-
int _id = {0}
-
int _divisions = {1}
Opaque field to define tesselation level of particular shape. For different shapes may have different meaning.
-
std::unique_ptr<RegularPolygon> _base_ngon
Object to store base polygon.
-
Orientation _orientation = {Orientation::Plane}
-
TesselationMode _tesselation_mode = {TesselationMode::Iterative}
-
Vector3Array vertices_
-
TangentsArray tangents_
-
ColorsArray colors_
-
Vector2Array tex_uv1_
-
Vector2Array tex_uv2_
-
WeightsArray weights_
Protected Static Functions
-
static void _bind_methods()
-
inline SotaMesh(std::unique_ptr<RegularPolygon> base_polygon)