godot/scene/resources/mesh.cpp

/**************************************************************************/
/*  mesh.cpp                                                              */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
/*                                                                        */
/* Permission is hereby granted, free of charge, to any person obtaining  */
/* a copy of this software and associated documentation files (the        */
/* "Software"), to deal in the Software without restriction, including    */
/* without limitation the rights to use, copy, modify, merge, publish,    */
/* distribute, sublicense, and/or sell copies of the Software, and to     */
/* permit persons to whom the Software is furnished to do so, subject to  */
/* the following conditions:                                              */
/*                                                                        */
/* The above copyright notice and this permission notice shall be         */
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

#include "mesh.h"

#include "core/math/convex_hull.h"
#include "core/templates/pair.h"
#include "scene/resources/surface_tool.h"

#ifndef _3D_DISABLED
#include "scene/resources/3d/concave_polygon_shape_3d.h"
#include "scene/resources/3d/convex_polygon_shape_3d.h"
#endif // _3D_DISABLED

void MeshConvexDecompositionSettings::set_max_concavity(real_t p_max_concavity) {}

real_t MeshConvexDecompositionSettings::get_max_concavity() const {
	return max_concavity;
};

void MeshConvexDecompositionSettings::set_symmetry_planes_clipping_bias(real_t p_symmetry_planes_clipping_bias) {
	symmetry_planes_clipping_bias = CLAMP(p_symmetry_planes_clipping_bias, 0.0, 1.0);
};

real_t MeshConvexDecompositionSettings::get_symmetry_planes_clipping_bias() const {
	return symmetry_planes_clipping_bias;
};

void MeshConvexDecompositionSettings::set_revolution_axes_clipping_bias(real_t p_revolution_axes_clipping_bias) {
	revolution_axes_clipping_bias = CLAMP(p_revolution_axes_clipping_bias, 0.0, 1.0);
};

real_t MeshConvexDecompositionSettings::get_revolution_axes_clipping_bias() const {
	return revolution_axes_clipping_bias;
};

void MeshConvexDecompositionSettings::set_min_volume_per_convex_hull(real_t p_min_volume_per_convex_hull) {}

real_t MeshConvexDecompositionSettings::get_min_volume_per_convex_hull() const {}

void MeshConvexDecompositionSettings::set_resolution(uint32_t p_resolution) {}

uint32_t MeshConvexDecompositionSettings::get_resolution() const {}

void MeshConvexDecompositionSettings::set_max_num_vertices_per_convex_hull(uint32_t p_max_num_vertices_per_convex_hull) {}

uint32_t MeshConvexDecompositionSettings::get_max_num_vertices_per_convex_hull() const {}

void MeshConvexDecompositionSettings::set_plane_downsampling(uint32_t p_plane_downsampling) {}

uint32_t MeshConvexDecompositionSettings::get_plane_downsampling() const {}

void MeshConvexDecompositionSettings::set_convex_hull_downsampling(uint32_t p_convex_hull_downsampling) {}

uint32_t MeshConvexDecompositionSettings::get_convex_hull_downsampling() const {}

void MeshConvexDecompositionSettings::set_normalize_mesh(bool p_normalize_mesh) {}

bool MeshConvexDecompositionSettings::get_normalize_mesh() const {}

void MeshConvexDecompositionSettings::set_mode(Mode p_mode) {}

MeshConvexDecompositionSettings::Mode MeshConvexDecompositionSettings::get_mode() const {}

void MeshConvexDecompositionSettings::set_convex_hull_approximation(bool p_convex_hull_approximation) {}

bool MeshConvexDecompositionSettings::get_convex_hull_approximation() const {}

void MeshConvexDecompositionSettings::set_max_convex_hulls(uint32_t p_max_convex_hulls) {}

uint32_t MeshConvexDecompositionSettings::get_max_convex_hulls() const {}

void MeshConvexDecompositionSettings::set_project_hull_vertices(bool p_project_hull_vertices) {}

bool MeshConvexDecompositionSettings::get_project_hull_vertices() const {}

void MeshConvexDecompositionSettings::_bind_methods() {}

Mesh::ConvexDecompositionFunc Mesh::convex_decomposition_function =;

int Mesh::get_surface_count() const {}

int Mesh::surface_get_array_len(int p_idx) const {}

int Mesh::surface_get_array_index_len(int p_idx) const {}

Array Mesh::surface_get_arrays(int p_surface) const {}

TypedArray<Array> Mesh::surface_get_blend_shape_arrays(int p_surface) const {}

Dictionary Mesh::surface_get_lods(int p_surface) const {}

BitField<Mesh::ArrayFormat> Mesh::surface_get_format(int p_idx) const {}

Mesh::PrimitiveType Mesh::surface_get_primitive_type(int p_idx) const {}

void Mesh::surface_set_material(int p_idx, const Ref<Material> &p_material) {}

Ref<Material> Mesh::surface_get_material(int p_idx) const {}

int Mesh::get_blend_shape_count() const {}

StringName Mesh::get_blend_shape_name(int p_index) const {}

void Mesh::set_blend_shape_name(int p_index, const StringName &p_name) {}

AABB Mesh::get_aabb() const {}

Ref<TriangleMesh> Mesh::generate_triangle_mesh() const {}

Ref<TriangleMesh> Mesh::generate_surface_triangle_mesh(int p_surface) const {}

void Mesh::generate_debug_mesh_lines(Vector<Vector3> &r_lines) {}

void Mesh::generate_debug_mesh_indices(Vector<Vector3> &r_points) {}

Vector<Vector3> Mesh::_get_faces() const {}

Vector<Face3> Mesh::get_faces() const {}

Vector<Face3> Mesh::get_surface_faces(int p_surface) const {}

#ifndef _3D_DISABLED
Ref<ConvexPolygonShape3D> Mesh::create_convex_shape(bool p_clean, bool p_simplify) const {}

Ref<ConcavePolygonShape3D> Mesh::create_trimesh_shape() const {}
#endif // _3D_DISABLED

Ref<Mesh> Mesh::create_outline(float p_margin) const {}

void Mesh::set_lightmap_size_hint(const Size2i &p_size) {}

Size2i Mesh::get_lightmap_size_hint() const {}

Ref<Resource> Mesh::create_placeholder() const {}

void Mesh::_bind_methods() {}

void Mesh::clear_cache() const {}

#ifndef _3D_DISABLED
Vector<Ref<Shape3D>> Mesh::convex_decompose(const Ref<MeshConvexDecompositionSettings> &p_settings) const {}
#endif // _3D_DISABLED

int Mesh::get_builtin_bind_pose_count() const {}

Transform3D Mesh::get_builtin_bind_pose(int p_index) const {}

Mesh::Mesh() {}

enum OldArrayType {};

enum OldArrayFormat {};

#ifndef DISABLE_DEPRECATED
static Array _convert_old_array(const Array &p_old) {}

static Mesh::PrimitiveType _old_primitives[7] =;
#endif // DISABLE_DEPRECATED

void _fix_array_compatibility(const Vector<uint8_t> &p_src, uint64_t p_old_format, uint64_t p_new_format, uint32_t p_elements, Vector<uint8_t> &vertex_data, Vector<uint8_t> &attribute_data, Vector<uint8_t> &skin_data) {}

bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) {}

void ArrayMesh::_set_blend_shape_names(const PackedStringArray &p_names) {}

PackedStringArray ArrayMesh::_get_blend_shape_names() const {}

Array ArrayMesh::_get_surfaces() const {}

void ArrayMesh::_create_if_empty() const {}

void ArrayMesh::_set_surfaces(const Array &p_surfaces) {}

bool ArrayMesh::_get(const StringName &p_name, Variant &r_ret) const {}

void ArrayMesh::reset_state() {}

void ArrayMesh::_get_property_list(List<PropertyInfo> *p_list) const {}

void ArrayMesh::_recompute_aabb() {}

// TODO: Need to add binding to add_surface using future MeshSurfaceData object.
void ArrayMesh::add_surface(BitField<ArrayFormat> p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, const Vector<uint8_t> &p_attribute_array, const Vector<uint8_t> &p_skin_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<uint8_t> &p_blend_shape_data, const Vector<AABB> &p_bone_aabbs, const Vector<RS::SurfaceData::LOD> &p_lods, const Vector4 p_uv_scale) {}

void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array &p_arrays, const TypedArray<Array> &p_blend_shapes, const Dictionary &p_lods, BitField<ArrayFormat> p_flags) {}

Array ArrayMesh::surface_get_arrays(int p_surface) const {}

TypedArray<Array> ArrayMesh::surface_get_blend_shape_arrays(int p_surface) const {}

Dictionary ArrayMesh::surface_get_lods(int p_surface) const {}

int ArrayMesh::get_surface_count() const {}

void ArrayMesh::add_blend_shape(const StringName &p_name) {}

int ArrayMesh::get_blend_shape_count() const {}

StringName ArrayMesh::get_blend_shape_name(int p_index) const {}

void ArrayMesh::set_blend_shape_name(int p_index, const StringName &p_name) {}

void ArrayMesh::clear_blend_shapes() {}

void ArrayMesh::set_blend_shape_mode(BlendShapeMode p_mode) {}

ArrayMesh::BlendShapeMode ArrayMesh::get_blend_shape_mode() const {}

int ArrayMesh::surface_get_array_len(int p_idx) const {}

int ArrayMesh::surface_get_array_index_len(int p_idx) const {}

BitField<Mesh::ArrayFormat> ArrayMesh::surface_get_format(int p_idx) const {}

ArrayMesh::PrimitiveType ArrayMesh::surface_get_primitive_type(int p_idx) const {}

void ArrayMesh::surface_set_material(int p_idx, const Ref<Material> &p_material) {}

int ArrayMesh::surface_find_by_name(const String &p_name) const {}

void ArrayMesh::surface_set_name(int p_idx, const String &p_name) {}

String ArrayMesh::surface_get_name(int p_idx) const {}

void ArrayMesh::surface_update_vertex_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data) {}

void ArrayMesh::surface_update_attribute_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data) {}

void ArrayMesh::surface_update_skin_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data) {}

void ArrayMesh::surface_set_custom_aabb(int p_idx, const AABB &p_aabb) {}

Ref<Material> ArrayMesh::surface_get_material(int p_idx) const {}

RID ArrayMesh::get_rid() const {}

AABB ArrayMesh::get_aabb() const {}

void ArrayMesh::clear_surfaces() {}

void ArrayMesh::set_custom_aabb(const AABB &p_custom) {}

AABB ArrayMesh::get_custom_aabb() const {}

void ArrayMesh::regen_normal_maps() {}

//dirty hack
bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, int p_index_count, const uint8_t *p_cache_data, bool *r_use_cache, uint8_t **r_mesh_cache, int *r_mesh_cache_size, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y) =;

struct ArrayMeshLightmapSurface {};

Error ArrayMesh::lightmap_unwrap(const Transform3D &p_base_transform, float p_texel_size) {}

Error ArrayMesh::lightmap_unwrap_cached(const Transform3D &p_base_transform, float p_texel_size, const Vector<uint8_t> &p_src_cache, Vector<uint8_t> &r_dst_cache, bool p_generate_cache) {}

void ArrayMesh::set_shadow_mesh(const Ref<ArrayMesh> &p_mesh) {}

Ref<ArrayMesh> ArrayMesh::get_shadow_mesh() const {}

void ArrayMesh::_bind_methods() {}

void ArrayMesh::reload_from_file() {}

ArrayMesh::ArrayMesh() {}

ArrayMesh::~ArrayMesh() {}
///////////////

void PlaceholderMesh::_bind_methods() {}

PlaceholderMesh::PlaceholderMesh() {}

PlaceholderMesh::~PlaceholderMesh() {}