mesh.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. /**************************************************************************/
  2. /* mesh.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef MESH_H
  31. #define MESH_H
  32. #include "core/io/resource.h"
  33. #include "core/math/face3.h"
  34. #include "core/math/triangle_mesh.h"
  35. #ifndef _3D_DISABLED
  36. #include "scene/resources/3d/shape_3d.h"
  37. #endif // _3D_DISABLED
  38. #include "scene/resources/material.h"
  39. #include "servers/rendering_server.h"
  40. class ConcavePolygonShape3D;
  41. class ConvexPolygonShape3D;
  42. class MeshConvexDecompositionSettings;
  43. class Shape3D;
  44. class Mesh : public Resource {
  45. GDCLASS(Mesh, Resource);
  46. mutable Ref<TriangleMesh> triangle_mesh; //cached
  47. mutable Vector<Ref<TriangleMesh>> surface_triangle_meshes; //cached
  48. mutable Vector<Vector3> debug_lines;
  49. Size2i lightmap_size_hint;
  50. Vector<Vector3> _get_faces() const;
  51. public:
  52. enum PrimitiveType {
  53. PRIMITIVE_POINTS = RenderingServer::PRIMITIVE_POINTS,
  54. PRIMITIVE_LINES = RenderingServer::PRIMITIVE_LINES,
  55. PRIMITIVE_LINE_STRIP = RenderingServer::PRIMITIVE_LINE_STRIP,
  56. PRIMITIVE_TRIANGLES = RenderingServer::PRIMITIVE_TRIANGLES,
  57. PRIMITIVE_TRIANGLE_STRIP = RenderingServer::PRIMITIVE_TRIANGLE_STRIP,
  58. PRIMITIVE_MAX = RenderingServer::PRIMITIVE_MAX,
  59. };
  60. protected:
  61. static void _bind_methods();
  62. GDVIRTUAL0RC_REQUIRED(int, _get_surface_count)
  63. GDVIRTUAL1RC_REQUIRED(int, _surface_get_array_len, int)
  64. GDVIRTUAL1RC_REQUIRED(int, _surface_get_array_index_len, int)
  65. GDVIRTUAL1RC_REQUIRED(Array, _surface_get_arrays, int)
  66. GDVIRTUAL1RC_REQUIRED(TypedArray<Array>, _surface_get_blend_shape_arrays, int)
  67. GDVIRTUAL1RC_REQUIRED(Dictionary, _surface_get_lods, int)
  68. GDVIRTUAL1RC_REQUIRED(uint32_t, _surface_get_format, int)
  69. GDVIRTUAL1RC_REQUIRED(uint32_t, _surface_get_primitive_type, int)
  70. GDVIRTUAL2_REQUIRED(_surface_set_material, int, Ref<Material>)
  71. GDVIRTUAL1RC_REQUIRED(Ref<Material>, _surface_get_material, int)
  72. GDVIRTUAL0RC_REQUIRED(int, _get_blend_shape_count)
  73. GDVIRTUAL1RC_REQUIRED(StringName, _get_blend_shape_name, int)
  74. GDVIRTUAL2_REQUIRED(_set_blend_shape_name, int, StringName)
  75. GDVIRTUAL0RC_REQUIRED(AABB, _get_aabb)
  76. public:
  77. enum {
  78. NO_INDEX_ARRAY = RenderingServer::NO_INDEX_ARRAY,
  79. ARRAY_WEIGHTS_SIZE = RenderingServer::ARRAY_WEIGHTS_SIZE
  80. };
  81. enum BlendShapeMode {
  82. BLEND_SHAPE_MODE_NORMALIZED = RS::BLEND_SHAPE_MODE_NORMALIZED,
  83. BLEND_SHAPE_MODE_RELATIVE = RS::BLEND_SHAPE_MODE_RELATIVE,
  84. };
  85. enum ArrayType {
  86. ARRAY_VERTEX = RenderingServer::ARRAY_VERTEX,
  87. ARRAY_NORMAL = RenderingServer::ARRAY_NORMAL,
  88. ARRAY_TANGENT = RenderingServer::ARRAY_TANGENT,
  89. ARRAY_COLOR = RenderingServer::ARRAY_COLOR,
  90. ARRAY_TEX_UV = RenderingServer::ARRAY_TEX_UV,
  91. ARRAY_TEX_UV2 = RenderingServer::ARRAY_TEX_UV2,
  92. ARRAY_CUSTOM0 = RenderingServer::ARRAY_CUSTOM0,
  93. ARRAY_CUSTOM1 = RenderingServer::ARRAY_CUSTOM1,
  94. ARRAY_CUSTOM2 = RenderingServer::ARRAY_CUSTOM2,
  95. ARRAY_CUSTOM3 = RenderingServer::ARRAY_CUSTOM3,
  96. ARRAY_BONES = RenderingServer::ARRAY_BONES,
  97. ARRAY_WEIGHTS = RenderingServer::ARRAY_WEIGHTS,
  98. ARRAY_INDEX = RenderingServer::ARRAY_INDEX,
  99. ARRAY_MAX = RenderingServer::ARRAY_MAX
  100. };
  101. enum ArrayCustomFormat {
  102. ARRAY_CUSTOM_RGBA8_UNORM,
  103. ARRAY_CUSTOM_RGBA8_SNORM,
  104. ARRAY_CUSTOM_RG_HALF,
  105. ARRAY_CUSTOM_RGBA_HALF,
  106. ARRAY_CUSTOM_R_FLOAT,
  107. ARRAY_CUSTOM_RG_FLOAT,
  108. ARRAY_CUSTOM_RGB_FLOAT,
  109. ARRAY_CUSTOM_RGBA_FLOAT,
  110. ARRAY_CUSTOM_MAX
  111. };
  112. enum ArrayFormat : uint64_t {
  113. ARRAY_FORMAT_VERTEX = RS::ARRAY_FORMAT_VERTEX,
  114. ARRAY_FORMAT_NORMAL = RS::ARRAY_FORMAT_NORMAL,
  115. ARRAY_FORMAT_TANGENT = RS::ARRAY_FORMAT_TANGENT,
  116. ARRAY_FORMAT_COLOR = RS::ARRAY_FORMAT_COLOR,
  117. ARRAY_FORMAT_TEX_UV = RS::ARRAY_FORMAT_TEX_UV,
  118. ARRAY_FORMAT_TEX_UV2 = RS::ARRAY_FORMAT_TEX_UV2,
  119. ARRAY_FORMAT_CUSTOM0 = RS::ARRAY_FORMAT_CUSTOM0,
  120. ARRAY_FORMAT_CUSTOM1 = RS::ARRAY_FORMAT_CUSTOM1,
  121. ARRAY_FORMAT_CUSTOM2 = RS::ARRAY_FORMAT_CUSTOM2,
  122. ARRAY_FORMAT_CUSTOM3 = RS::ARRAY_FORMAT_CUSTOM3,
  123. ARRAY_FORMAT_BONES = RS::ARRAY_FORMAT_BONES,
  124. ARRAY_FORMAT_WEIGHTS = RS::ARRAY_FORMAT_WEIGHTS,
  125. ARRAY_FORMAT_INDEX = RS::ARRAY_FORMAT_INDEX,
  126. ARRAY_FORMAT_BLEND_SHAPE_MASK = RS::ARRAY_FORMAT_BLEND_SHAPE_MASK,
  127. ARRAY_FORMAT_CUSTOM_BASE = RS::ARRAY_FORMAT_CUSTOM_BASE,
  128. ARRAY_FORMAT_CUSTOM_BITS = RS::ARRAY_FORMAT_CUSTOM_BITS,
  129. ARRAY_FORMAT_CUSTOM0_SHIFT = RS::ARRAY_FORMAT_CUSTOM0_SHIFT,
  130. ARRAY_FORMAT_CUSTOM1_SHIFT = RS::ARRAY_FORMAT_CUSTOM1_SHIFT,
  131. ARRAY_FORMAT_CUSTOM2_SHIFT = RS::ARRAY_FORMAT_CUSTOM2_SHIFT,
  132. ARRAY_FORMAT_CUSTOM3_SHIFT = RS::ARRAY_FORMAT_CUSTOM3_SHIFT,
  133. ARRAY_FORMAT_CUSTOM_MASK = RS::ARRAY_FORMAT_CUSTOM_MASK,
  134. ARRAY_COMPRESS_FLAGS_BASE = RS::ARRAY_COMPRESS_FLAGS_BASE,
  135. ARRAY_FLAG_USE_2D_VERTICES = RS::ARRAY_FLAG_USE_2D_VERTICES,
  136. ARRAY_FLAG_USE_DYNAMIC_UPDATE = RS::ARRAY_FLAG_USE_DYNAMIC_UPDATE,
  137. ARRAY_FLAG_USE_8_BONE_WEIGHTS = RS::ARRAY_FLAG_USE_8_BONE_WEIGHTS,
  138. ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY = RS::ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY,
  139. ARRAY_FLAG_COMPRESS_ATTRIBUTES = RS::ARRAY_FLAG_COMPRESS_ATTRIBUTES,
  140. ARRAY_FLAG_FORMAT_VERSION_BASE = RS::ARRAY_FLAG_FORMAT_VERSION_BASE,
  141. ARRAY_FLAG_FORMAT_VERSION_SHIFT = RS::ARRAY_FLAG_FORMAT_VERSION_SHIFT,
  142. ARRAY_FLAG_FORMAT_VERSION_1 = RS::ARRAY_FLAG_FORMAT_VERSION_1,
  143. ARRAY_FLAG_FORMAT_VERSION_2 = (uint64_t)RS::ARRAY_FLAG_FORMAT_VERSION_2,
  144. ARRAY_FLAG_FORMAT_CURRENT_VERSION = (uint64_t)RS::ARRAY_FLAG_FORMAT_CURRENT_VERSION,
  145. ARRAY_FLAG_FORMAT_VERSION_MASK = RS::ARRAY_FLAG_FORMAT_VERSION_MASK,
  146. };
  147. virtual int get_surface_count() const;
  148. virtual int surface_get_array_len(int p_idx) const;
  149. virtual int surface_get_array_index_len(int p_idx) const;
  150. virtual Array surface_get_arrays(int p_surface) const;
  151. virtual TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const;
  152. virtual Dictionary surface_get_lods(int p_surface) const;
  153. virtual BitField<ArrayFormat> surface_get_format(int p_idx) const;
  154. virtual PrimitiveType surface_get_primitive_type(int p_idx) const;
  155. virtual void surface_set_material(int p_idx, const Ref<Material> &p_material);
  156. virtual Ref<Material> surface_get_material(int p_idx) const;
  157. virtual int get_blend_shape_count() const;
  158. virtual StringName get_blend_shape_name(int p_index) const;
  159. virtual void set_blend_shape_name(int p_index, const StringName &p_name);
  160. virtual AABB get_aabb() const;
  161. Vector<Face3> get_faces() const;
  162. Vector<Face3> get_surface_faces(int p_surface) const;
  163. Ref<TriangleMesh> generate_triangle_mesh() const;
  164. Ref<TriangleMesh> generate_surface_triangle_mesh(int p_surface) const;
  165. void generate_debug_mesh_lines(Vector<Vector3> &r_lines);
  166. void generate_debug_mesh_indices(Vector<Vector3> &r_points);
  167. Ref<Mesh> create_outline(float p_margin) const;
  168. void set_lightmap_size_hint(const Size2i &p_size);
  169. Size2i get_lightmap_size_hint() const;
  170. void clear_cache() const;
  171. typedef Vector<Vector<Vector3>> (*ConvexDecompositionFunc)(const real_t *p_vertices, int p_vertex_count, const uint32_t *p_triangles, int p_triangle_count, const Ref<MeshConvexDecompositionSettings> &p_settings, Vector<Vector<uint32_t>> *r_convex_indices);
  172. static ConvexDecompositionFunc convex_decomposition_function;
  173. #ifndef _3D_DISABLED
  174. Vector<Ref<Shape3D>> convex_decompose(const Ref<MeshConvexDecompositionSettings> &p_settings) const;
  175. Ref<ConvexPolygonShape3D> create_convex_shape(bool p_clean = true, bool p_simplify = false) const;
  176. Ref<ConcavePolygonShape3D> create_trimesh_shape() const;
  177. #endif // _3D_DISABLED
  178. virtual int get_builtin_bind_pose_count() const;
  179. virtual Transform3D get_builtin_bind_pose(int p_index) const;
  180. virtual Ref<Resource> create_placeholder() const;
  181. Mesh();
  182. };
  183. class MeshConvexDecompositionSettings : public RefCounted {
  184. GDCLASS(MeshConvexDecompositionSettings, RefCounted);
  185. public:
  186. enum Mode : int {
  187. CONVEX_DECOMPOSITION_MODE_VOXEL = 0,
  188. CONVEX_DECOMPOSITION_MODE_TETRAHEDRON = 1
  189. };
  190. private:
  191. Mode mode = CONVEX_DECOMPOSITION_MODE_VOXEL;
  192. /// Maximum concavity. [Range: 0.0 -> 1.0]
  193. real_t max_concavity = 1.0;
  194. /// Controls the bias toward clipping along symmetry planes. [Range: 0.0 -> 1.0]
  195. real_t symmetry_planes_clipping_bias = 0.05;
  196. /// Controls the bias toward clipping along revolution axes. [Range: 0.0 -> 1.0]
  197. real_t revolution_axes_clipping_bias = 0.05;
  198. real_t min_volume_per_convex_hull = 0.0001;
  199. /// Maximum number of voxels generated during the voxelization stage.
  200. uint32_t resolution = 10'000;
  201. uint32_t max_num_vertices_per_convex_hull = 32;
  202. /// Controls the granularity of the search for the "best" clipping plane.
  203. /// [Range: 1 -> 16]
  204. uint32_t plane_downsampling = 4;
  205. /// Controls the precision of the convex-hull generation process during the
  206. /// clipping plane selection stage.
  207. /// [Range: 1 -> 16]
  208. uint32_t convex_hull_downsampling = 4;
  209. /// enable/disable normalizing the mesh before applying the convex decomposition.
  210. bool normalize_mesh = false;
  211. bool convex_hull_approximation = true;
  212. /// This is the maximum number of convex hulls to produce from the merge operation.
  213. uint32_t max_convex_hulls = 1;
  214. bool project_hull_vertices = true;
  215. protected:
  216. static void _bind_methods();
  217. public:
  218. void set_max_concavity(real_t p_max_concavity);
  219. real_t get_max_concavity() const;
  220. void set_symmetry_planes_clipping_bias(real_t p_symmetry_planes_clipping_bias);
  221. real_t get_symmetry_planes_clipping_bias() const;
  222. void set_revolution_axes_clipping_bias(real_t p_revolution_axes_clipping_bias);
  223. real_t get_revolution_axes_clipping_bias() const;
  224. void set_min_volume_per_convex_hull(real_t p_min_volume_per_convex_hull);
  225. real_t get_min_volume_per_convex_hull() const;
  226. void set_resolution(uint32_t p_resolution);
  227. uint32_t get_resolution() const;
  228. void set_max_num_vertices_per_convex_hull(uint32_t p_max_num_vertices_per_convex_hull);
  229. uint32_t get_max_num_vertices_per_convex_hull() const;
  230. void set_plane_downsampling(uint32_t p_plane_downsampling);
  231. uint32_t get_plane_downsampling() const;
  232. void set_convex_hull_downsampling(uint32_t p_convex_hull_downsampling);
  233. uint32_t get_convex_hull_downsampling() const;
  234. void set_normalize_mesh(bool p_normalize_mesh);
  235. bool get_normalize_mesh() const;
  236. void set_mode(Mode p_mode);
  237. Mode get_mode() const;
  238. void set_convex_hull_approximation(bool p_convex_hull_approximation);
  239. bool get_convex_hull_approximation() const;
  240. void set_max_convex_hulls(uint32_t p_max_convex_hulls);
  241. uint32_t get_max_convex_hulls() const;
  242. void set_project_hull_vertices(bool p_project_hull_vertices);
  243. bool get_project_hull_vertices() const;
  244. };
  245. VARIANT_ENUM_CAST(MeshConvexDecompositionSettings::Mode);
  246. class ArrayMesh : public Mesh {
  247. GDCLASS(ArrayMesh, Mesh);
  248. RES_BASE_EXTENSION("mesh");
  249. PackedStringArray _get_blend_shape_names() const;
  250. void _set_blend_shape_names(const PackedStringArray &p_names);
  251. Array _get_surfaces() const;
  252. void _set_surfaces(const Array &p_data);
  253. Ref<ArrayMesh> shadow_mesh;
  254. private:
  255. struct Surface {
  256. uint64_t format = 0;
  257. int array_length = 0;
  258. int index_array_length = 0;
  259. PrimitiveType primitive = PrimitiveType::PRIMITIVE_MAX;
  260. String name;
  261. AABB aabb;
  262. Ref<Material> material;
  263. bool is_2d = false;
  264. };
  265. Vector<Surface> surfaces;
  266. mutable RID mesh;
  267. AABB aabb;
  268. BlendShapeMode blend_shape_mode = BLEND_SHAPE_MODE_RELATIVE;
  269. Vector<StringName> blend_shapes;
  270. AABB custom_aabb;
  271. _FORCE_INLINE_ void _create_if_empty() const;
  272. void _recompute_aabb();
  273. protected:
  274. virtual bool _is_generated() const { return false; }
  275. bool _set(const StringName &p_name, const Variant &p_value);
  276. bool _get(const StringName &p_name, Variant &r_ret) const;
  277. void _get_property_list(List<PropertyInfo> *p_list) const;
  278. bool surface_index_0 = false;
  279. virtual void reset_state() override;
  280. static void _bind_methods();
  281. public:
  282. void add_surface_from_arrays(PrimitiveType p_primitive, const Array &p_arrays, const TypedArray<Array> &p_blend_shapes = TypedArray<Array>(), const Dictionary &p_lods = Dictionary(), BitField<ArrayFormat> p_flags = 0);
  283. void 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 = Vector<uint8_t>(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>(), const Vector<RS::SurfaceData::LOD> &p_lods = Vector<RS::SurfaceData::LOD>(), const Vector4 p_uv_scale = Vector4());
  284. Array surface_get_arrays(int p_surface) const override;
  285. TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const override;
  286. Dictionary surface_get_lods(int p_surface) const override;
  287. void add_blend_shape(const StringName &p_name);
  288. int get_blend_shape_count() const override;
  289. StringName get_blend_shape_name(int p_index) const override;
  290. void set_blend_shape_name(int p_index, const StringName &p_name) override;
  291. void clear_blend_shapes();
  292. void set_blend_shape_mode(BlendShapeMode p_mode);
  293. BlendShapeMode get_blend_shape_mode() const;
  294. void surface_update_vertex_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data);
  295. void surface_update_attribute_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data);
  296. void surface_update_skin_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data);
  297. int get_surface_count() const override;
  298. void clear_surfaces();
  299. void surface_set_custom_aabb(int p_idx, const AABB &p_aabb); //only recognized by driver
  300. int surface_get_array_len(int p_idx) const override;
  301. int surface_get_array_index_len(int p_idx) const override;
  302. BitField<ArrayFormat> surface_get_format(int p_idx) const override;
  303. PrimitiveType surface_get_primitive_type(int p_idx) const override;
  304. virtual void surface_set_material(int p_idx, const Ref<Material> &p_material) override;
  305. virtual Ref<Material> surface_get_material(int p_idx) const override;
  306. int surface_find_by_name(const String &p_name) const;
  307. void surface_set_name(int p_idx, const String &p_name);
  308. String surface_get_name(int p_idx) const;
  309. void set_custom_aabb(const AABB &p_custom);
  310. AABB get_custom_aabb() const;
  311. AABB get_aabb() const override;
  312. virtual RID get_rid() const override;
  313. void regen_normal_maps();
  314. Error lightmap_unwrap(const Transform3D &p_base_transform = Transform3D(), float p_texel_size = 0.05);
  315. Error 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 = true);
  316. virtual void reload_from_file() override;
  317. void set_shadow_mesh(const Ref<ArrayMesh> &p_mesh);
  318. Ref<ArrayMesh> get_shadow_mesh() const;
  319. ArrayMesh();
  320. ~ArrayMesh();
  321. };
  322. VARIANT_ENUM_CAST(Mesh::ArrayType);
  323. VARIANT_BITFIELD_CAST(Mesh::ArrayFormat);
  324. VARIANT_ENUM_CAST(Mesh::ArrayCustomFormat);
  325. VARIANT_ENUM_CAST(Mesh::PrimitiveType);
  326. VARIANT_ENUM_CAST(Mesh::BlendShapeMode);
  327. class PlaceholderMesh : public Mesh {
  328. GDCLASS(PlaceholderMesh, Mesh);
  329. RID rid;
  330. AABB aabb;
  331. protected:
  332. static void _bind_methods();
  333. public:
  334. virtual int get_surface_count() const override { return 0; }
  335. virtual int surface_get_array_len(int p_idx) const override { return 0; }
  336. virtual int surface_get_array_index_len(int p_idx) const override { return 0; }
  337. virtual Array surface_get_arrays(int p_surface) const override { return Array(); }
  338. virtual TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const override { return TypedArray<Array>(); }
  339. virtual Dictionary surface_get_lods(int p_surface) const override { return Dictionary(); }
  340. virtual BitField<ArrayFormat> surface_get_format(int p_idx) const override { return 0; }
  341. virtual PrimitiveType surface_get_primitive_type(int p_idx) const override { return PRIMITIVE_TRIANGLES; }
  342. virtual void surface_set_material(int p_idx, const Ref<Material> &p_material) override {}
  343. virtual Ref<Material> surface_get_material(int p_idx) const override { return Ref<Material>(); }
  344. virtual int get_blend_shape_count() const override { return 0; }
  345. virtual StringName get_blend_shape_name(int p_index) const override { return StringName(); }
  346. virtual void set_blend_shape_name(int p_index, const StringName &p_name) override {}
  347. virtual RID get_rid() const override { return rid; }
  348. virtual AABB get_aabb() const override { return aabb; }
  349. void set_aabb(const AABB &p_aabb) { aabb = p_aabb; }
  350. virtual int get_builtin_bind_pose_count() const override { return 0; }
  351. virtual Transform3D get_builtin_bind_pose(int p_index) const override { return Transform3D(); }
  352. PlaceholderMesh();
  353. ~PlaceholderMesh();
  354. };
  355. #endif // MESH_H