mesh.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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. #include "scene/resources/material.h"
  36. #include "servers/rendering_server.h"
  37. class ConcavePolygonShape3D;
  38. class ConvexPolygonShape3D;
  39. class MeshConvexDecompositionSettings;
  40. class Shape3D;
  41. class Mesh : public Resource {
  42. GDCLASS(Mesh, Resource);
  43. mutable Ref<TriangleMesh> triangle_mesh; //cached
  44. mutable Vector<Ref<TriangleMesh>> surface_triangle_meshes; //cached
  45. mutable Vector<Vector3> debug_lines;
  46. Size2i lightmap_size_hint;
  47. Vector<Vector3> _get_faces() const;
  48. public:
  49. enum PrimitiveType {
  50. PRIMITIVE_POINTS = RenderingServer::PRIMITIVE_POINTS,
  51. PRIMITIVE_LINES = RenderingServer::PRIMITIVE_LINES,
  52. PRIMITIVE_LINE_STRIP = RenderingServer::PRIMITIVE_LINE_STRIP,
  53. PRIMITIVE_TRIANGLES = RenderingServer::PRIMITIVE_TRIANGLES,
  54. PRIMITIVE_TRIANGLE_STRIP = RenderingServer::PRIMITIVE_TRIANGLE_STRIP,
  55. PRIMITIVE_MAX = RenderingServer::PRIMITIVE_MAX,
  56. };
  57. protected:
  58. static void _bind_methods();
  59. GDVIRTUAL0RC(int, _get_surface_count)
  60. GDVIRTUAL1RC(int, _surface_get_array_len, int)
  61. GDVIRTUAL1RC(int, _surface_get_array_index_len, int)
  62. GDVIRTUAL1RC(Array, _surface_get_arrays, int)
  63. GDVIRTUAL1RC(TypedArray<Array>, _surface_get_blend_shape_arrays, int)
  64. GDVIRTUAL1RC(Dictionary, _surface_get_lods, int)
  65. GDVIRTUAL1RC(uint32_t, _surface_get_format, int)
  66. GDVIRTUAL1RC(uint32_t, _surface_get_primitive_type, int)
  67. GDVIRTUAL2(_surface_set_material, int, Ref<Material>)
  68. GDVIRTUAL1RC(Ref<Material>, _surface_get_material, int)
  69. GDVIRTUAL0RC(int, _get_blend_shape_count)
  70. GDVIRTUAL1RC(StringName, _get_blend_shape_name, int)
  71. GDVIRTUAL2(_set_blend_shape_name, int, StringName)
  72. GDVIRTUAL0RC(AABB, _get_aabb)
  73. public:
  74. enum {
  75. NO_INDEX_ARRAY = RenderingServer::NO_INDEX_ARRAY,
  76. ARRAY_WEIGHTS_SIZE = RenderingServer::ARRAY_WEIGHTS_SIZE
  77. };
  78. enum BlendShapeMode {
  79. BLEND_SHAPE_MODE_NORMALIZED = RS::BLEND_SHAPE_MODE_NORMALIZED,
  80. BLEND_SHAPE_MODE_RELATIVE = RS::BLEND_SHAPE_MODE_RELATIVE,
  81. };
  82. enum ArrayType {
  83. ARRAY_VERTEX = RenderingServer::ARRAY_VERTEX,
  84. ARRAY_NORMAL = RenderingServer::ARRAY_NORMAL,
  85. ARRAY_TANGENT = RenderingServer::ARRAY_TANGENT,
  86. ARRAY_COLOR = RenderingServer::ARRAY_COLOR,
  87. ARRAY_TEX_UV = RenderingServer::ARRAY_TEX_UV,
  88. ARRAY_TEX_UV2 = RenderingServer::ARRAY_TEX_UV2,
  89. ARRAY_CUSTOM0 = RenderingServer::ARRAY_CUSTOM0,
  90. ARRAY_CUSTOM1 = RenderingServer::ARRAY_CUSTOM1,
  91. ARRAY_CUSTOM2 = RenderingServer::ARRAY_CUSTOM2,
  92. ARRAY_CUSTOM3 = RenderingServer::ARRAY_CUSTOM3,
  93. ARRAY_BONES = RenderingServer::ARRAY_BONES,
  94. ARRAY_WEIGHTS = RenderingServer::ARRAY_WEIGHTS,
  95. ARRAY_INDEX = RenderingServer::ARRAY_INDEX,
  96. ARRAY_MAX = RenderingServer::ARRAY_MAX
  97. };
  98. enum ArrayCustomFormat {
  99. ARRAY_CUSTOM_RGBA8_UNORM,
  100. ARRAY_CUSTOM_RGBA8_SNORM,
  101. ARRAY_CUSTOM_RG_HALF,
  102. ARRAY_CUSTOM_RGBA_HALF,
  103. ARRAY_CUSTOM_R_FLOAT,
  104. ARRAY_CUSTOM_RG_FLOAT,
  105. ARRAY_CUSTOM_RGB_FLOAT,
  106. ARRAY_CUSTOM_RGBA_FLOAT,
  107. ARRAY_CUSTOM_MAX
  108. };
  109. enum ArrayFormat : uint64_t {
  110. ARRAY_FORMAT_VERTEX = RS::ARRAY_FORMAT_VERTEX,
  111. ARRAY_FORMAT_NORMAL = RS::ARRAY_FORMAT_NORMAL,
  112. ARRAY_FORMAT_TANGENT = RS::ARRAY_FORMAT_TANGENT,
  113. ARRAY_FORMAT_COLOR = RS::ARRAY_FORMAT_COLOR,
  114. ARRAY_FORMAT_TEX_UV = RS::ARRAY_FORMAT_TEX_UV,
  115. ARRAY_FORMAT_TEX_UV2 = RS::ARRAY_FORMAT_TEX_UV2,
  116. ARRAY_FORMAT_CUSTOM0 = RS::ARRAY_FORMAT_CUSTOM0,
  117. ARRAY_FORMAT_CUSTOM1 = RS::ARRAY_FORMAT_CUSTOM1,
  118. ARRAY_FORMAT_CUSTOM2 = RS::ARRAY_FORMAT_CUSTOM2,
  119. ARRAY_FORMAT_CUSTOM3 = RS::ARRAY_FORMAT_CUSTOM3,
  120. ARRAY_FORMAT_BONES = RS::ARRAY_FORMAT_BONES,
  121. ARRAY_FORMAT_WEIGHTS = RS::ARRAY_FORMAT_WEIGHTS,
  122. ARRAY_FORMAT_INDEX = RS::ARRAY_FORMAT_INDEX,
  123. ARRAY_FORMAT_BLEND_SHAPE_MASK = RS::ARRAY_FORMAT_BLEND_SHAPE_MASK,
  124. ARRAY_FORMAT_CUSTOM_BASE = RS::ARRAY_FORMAT_CUSTOM_BASE,
  125. ARRAY_FORMAT_CUSTOM_BITS = RS::ARRAY_FORMAT_CUSTOM_BITS,
  126. ARRAY_FORMAT_CUSTOM0_SHIFT = RS::ARRAY_FORMAT_CUSTOM0_SHIFT,
  127. ARRAY_FORMAT_CUSTOM1_SHIFT = RS::ARRAY_FORMAT_CUSTOM1_SHIFT,
  128. ARRAY_FORMAT_CUSTOM2_SHIFT = RS::ARRAY_FORMAT_CUSTOM2_SHIFT,
  129. ARRAY_FORMAT_CUSTOM3_SHIFT = RS::ARRAY_FORMAT_CUSTOM3_SHIFT,
  130. ARRAY_FORMAT_CUSTOM_MASK = RS::ARRAY_FORMAT_CUSTOM_MASK,
  131. ARRAY_COMPRESS_FLAGS_BASE = RS::ARRAY_COMPRESS_FLAGS_BASE,
  132. ARRAY_FLAG_USE_2D_VERTICES = RS::ARRAY_FLAG_USE_2D_VERTICES,
  133. ARRAY_FLAG_USE_DYNAMIC_UPDATE = RS::ARRAY_FLAG_USE_DYNAMIC_UPDATE,
  134. ARRAY_FLAG_USE_8_BONE_WEIGHTS = RS::ARRAY_FLAG_USE_8_BONE_WEIGHTS,
  135. ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY = RS::ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY,
  136. ARRAY_FLAG_COMPRESS_ATTRIBUTES = RS::ARRAY_FLAG_COMPRESS_ATTRIBUTES,
  137. ARRAY_FLAG_FORMAT_VERSION_BASE = RS::ARRAY_FLAG_FORMAT_VERSION_BASE,
  138. ARRAY_FLAG_FORMAT_VERSION_SHIFT = RS::ARRAY_FLAG_FORMAT_VERSION_SHIFT,
  139. ARRAY_FLAG_FORMAT_VERSION_1 = RS::ARRAY_FLAG_FORMAT_VERSION_1,
  140. ARRAY_FLAG_FORMAT_VERSION_2 = (uint64_t)RS::ARRAY_FLAG_FORMAT_VERSION_2,
  141. ARRAY_FLAG_FORMAT_CURRENT_VERSION = (uint64_t)RS::ARRAY_FLAG_FORMAT_CURRENT_VERSION,
  142. ARRAY_FLAG_FORMAT_VERSION_MASK = RS::ARRAY_FLAG_FORMAT_VERSION_MASK,
  143. };
  144. virtual int get_surface_count() const;
  145. virtual int surface_get_array_len(int p_idx) const;
  146. virtual int surface_get_array_index_len(int p_idx) const;
  147. virtual Array surface_get_arrays(int p_surface) const;
  148. virtual TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const;
  149. virtual Dictionary surface_get_lods(int p_surface) const;
  150. virtual BitField<ArrayFormat> surface_get_format(int p_idx) const;
  151. virtual PrimitiveType surface_get_primitive_type(int p_idx) const;
  152. virtual void surface_set_material(int p_idx, const Ref<Material> &p_material);
  153. virtual Ref<Material> surface_get_material(int p_idx) const;
  154. virtual int get_blend_shape_count() const;
  155. virtual StringName get_blend_shape_name(int p_index) const;
  156. virtual void set_blend_shape_name(int p_index, const StringName &p_name);
  157. virtual AABB get_aabb() const;
  158. Vector<Face3> get_faces() const;
  159. Vector<Face3> get_surface_faces(int p_surface) const;
  160. Ref<TriangleMesh> generate_triangle_mesh() const;
  161. Ref<TriangleMesh> generate_surface_triangle_mesh(int p_surface) const;
  162. void generate_debug_mesh_lines(Vector<Vector3> &r_lines);
  163. void generate_debug_mesh_indices(Vector<Vector3> &r_points);
  164. Ref<Mesh> create_outline(float p_margin) const;
  165. void set_lightmap_size_hint(const Size2i &p_size);
  166. Size2i get_lightmap_size_hint() const;
  167. void clear_cache() const;
  168. 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);
  169. static ConvexDecompositionFunc convex_decomposition_function;
  170. Vector<Ref<Shape3D>> convex_decompose(const Ref<MeshConvexDecompositionSettings> &p_settings) const;
  171. Ref<ConvexPolygonShape3D> create_convex_shape(bool p_clean = true, bool p_simplify = false) const;
  172. Ref<ConcavePolygonShape3D> create_trimesh_shape() const;
  173. virtual int get_builtin_bind_pose_count() const;
  174. virtual Transform3D get_builtin_bind_pose(int p_index) const;
  175. virtual Ref<Resource> create_placeholder() const;
  176. Mesh();
  177. };
  178. class MeshConvexDecompositionSettings : public RefCounted {
  179. GDCLASS(MeshConvexDecompositionSettings, RefCounted);
  180. public:
  181. enum Mode : int {
  182. CONVEX_DECOMPOSITION_MODE_VOXEL = 0,
  183. CONVEX_DECOMPOSITION_MODE_TETRAHEDRON = 1
  184. };
  185. private:
  186. Mode mode = CONVEX_DECOMPOSITION_MODE_VOXEL;
  187. /// Maximum concavity. [Range: 0.0 -> 1.0]
  188. real_t max_concavity = 1.0;
  189. /// Controls the bias toward clipping along symmetry planes. [Range: 0.0 -> 1.0]
  190. real_t symmetry_planes_clipping_bias = 0.05;
  191. /// Controls the bias toward clipping along revolution axes. [Range: 0.0 -> 1.0]
  192. real_t revolution_axes_clipping_bias = 0.05;
  193. real_t min_volume_per_convex_hull = 0.0001;
  194. /// Maximum number of voxels generated during the voxelization stage.
  195. uint32_t resolution = 10'000;
  196. uint32_t max_num_vertices_per_convex_hull = 32;
  197. /// Controls the granularity of the search for the "best" clipping plane.
  198. /// [Range: 1 -> 16]
  199. uint32_t plane_downsampling = 4;
  200. /// Controls the precision of the convex-hull generation process during the
  201. /// clipping plane selection stage.
  202. /// [Range: 1 -> 16]
  203. uint32_t convex_hull_downsampling = 4;
  204. /// enable/disable normalizing the mesh before applying the convex decomposition.
  205. bool normalize_mesh = false;
  206. bool convex_hull_approximation = true;
  207. /// This is the maximum number of convex hulls to produce from the merge operation.
  208. uint32_t max_convex_hulls = 1;
  209. bool project_hull_vertices = true;
  210. protected:
  211. static void _bind_methods();
  212. public:
  213. void set_max_concavity(real_t p_max_concavity);
  214. real_t get_max_concavity() const;
  215. void set_symmetry_planes_clipping_bias(real_t p_symmetry_planes_clipping_bias);
  216. real_t get_symmetry_planes_clipping_bias() const;
  217. void set_revolution_axes_clipping_bias(real_t p_revolution_axes_clipping_bias);
  218. real_t get_revolution_axes_clipping_bias() const;
  219. void set_min_volume_per_convex_hull(real_t p_min_volume_per_convex_hull);
  220. real_t get_min_volume_per_convex_hull() const;
  221. void set_resolution(uint32_t p_resolution);
  222. uint32_t get_resolution() const;
  223. void set_max_num_vertices_per_convex_hull(uint32_t p_max_num_vertices_per_convex_hull);
  224. uint32_t get_max_num_vertices_per_convex_hull() const;
  225. void set_plane_downsampling(uint32_t p_plane_downsampling);
  226. uint32_t get_plane_downsampling() const;
  227. void set_convex_hull_downsampling(uint32_t p_convex_hull_downsampling);
  228. uint32_t get_convex_hull_downsampling() const;
  229. void set_normalize_mesh(bool p_normalize_mesh);
  230. bool get_normalize_mesh() const;
  231. void set_mode(Mode p_mode);
  232. Mode get_mode() const;
  233. void set_convex_hull_approximation(bool p_convex_hull_approximation);
  234. bool get_convex_hull_approximation() const;
  235. void set_max_convex_hulls(uint32_t p_max_convex_hulls);
  236. uint32_t get_max_convex_hulls() const;
  237. void set_project_hull_vertices(bool p_project_hull_vertices);
  238. bool get_project_hull_vertices() const;
  239. };
  240. VARIANT_ENUM_CAST(MeshConvexDecompositionSettings::Mode);
  241. class ArrayMesh : public Mesh {
  242. GDCLASS(ArrayMesh, Mesh);
  243. RES_BASE_EXTENSION("mesh");
  244. PackedStringArray _get_blend_shape_names() const;
  245. void _set_blend_shape_names(const PackedStringArray &p_names);
  246. Array _get_surfaces() const;
  247. void _set_surfaces(const Array &p_data);
  248. Ref<ArrayMesh> shadow_mesh;
  249. private:
  250. struct Surface {
  251. uint64_t format = 0;
  252. int array_length = 0;
  253. int index_array_length = 0;
  254. PrimitiveType primitive = PrimitiveType::PRIMITIVE_MAX;
  255. String name;
  256. AABB aabb;
  257. Ref<Material> material;
  258. bool is_2d = false;
  259. };
  260. Vector<Surface> surfaces;
  261. mutable RID mesh;
  262. AABB aabb;
  263. BlendShapeMode blend_shape_mode = BLEND_SHAPE_MODE_RELATIVE;
  264. Vector<StringName> blend_shapes;
  265. AABB custom_aabb;
  266. _FORCE_INLINE_ void _create_if_empty() const;
  267. void _recompute_aabb();
  268. protected:
  269. virtual bool _is_generated() const { return false; }
  270. bool _set(const StringName &p_name, const Variant &p_value);
  271. bool _get(const StringName &p_name, Variant &r_ret) const;
  272. void _get_property_list(List<PropertyInfo> *p_list) const;
  273. bool surface_index_0 = false;
  274. virtual void reset_state() override;
  275. static void _bind_methods();
  276. public:
  277. 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);
  278. 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());
  279. Array surface_get_arrays(int p_surface) const override;
  280. TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const override;
  281. Dictionary surface_get_lods(int p_surface) const override;
  282. void add_blend_shape(const StringName &p_name);
  283. int get_blend_shape_count() const override;
  284. StringName get_blend_shape_name(int p_index) const override;
  285. void set_blend_shape_name(int p_index, const StringName &p_name) override;
  286. void clear_blend_shapes();
  287. void set_blend_shape_mode(BlendShapeMode p_mode);
  288. BlendShapeMode get_blend_shape_mode() const;
  289. void surface_update_vertex_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data);
  290. void surface_update_attribute_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data);
  291. void surface_update_skin_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data);
  292. int get_surface_count() const override;
  293. void clear_surfaces();
  294. void surface_set_custom_aabb(int p_idx, const AABB &p_aabb); //only recognized by driver
  295. int surface_get_array_len(int p_idx) const override;
  296. int surface_get_array_index_len(int p_idx) const override;
  297. BitField<ArrayFormat> surface_get_format(int p_idx) const override;
  298. PrimitiveType surface_get_primitive_type(int p_idx) const override;
  299. virtual void surface_set_material(int p_idx, const Ref<Material> &p_material) override;
  300. virtual Ref<Material> surface_get_material(int p_idx) const override;
  301. int surface_find_by_name(const String &p_name) const;
  302. void surface_set_name(int p_idx, const String &p_name);
  303. String surface_get_name(int p_idx) const;
  304. void set_custom_aabb(const AABB &p_custom);
  305. AABB get_custom_aabb() const;
  306. AABB get_aabb() const override;
  307. virtual RID get_rid() const override;
  308. void regen_normal_maps();
  309. Error lightmap_unwrap(const Transform3D &p_base_transform = Transform3D(), float p_texel_size = 0.05);
  310. 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);
  311. virtual void reload_from_file() override;
  312. void set_shadow_mesh(const Ref<ArrayMesh> &p_mesh);
  313. Ref<ArrayMesh> get_shadow_mesh() const;
  314. ArrayMesh();
  315. ~ArrayMesh();
  316. };
  317. VARIANT_ENUM_CAST(Mesh::ArrayType);
  318. VARIANT_BITFIELD_CAST(Mesh::ArrayFormat);
  319. VARIANT_ENUM_CAST(Mesh::ArrayCustomFormat);
  320. VARIANT_ENUM_CAST(Mesh::PrimitiveType);
  321. VARIANT_ENUM_CAST(Mesh::BlendShapeMode);
  322. class PlaceholderMesh : public Mesh {
  323. GDCLASS(PlaceholderMesh, Mesh);
  324. RID rid;
  325. AABB aabb;
  326. protected:
  327. static void _bind_methods();
  328. public:
  329. virtual int get_surface_count() const override { return 0; }
  330. virtual int surface_get_array_len(int p_idx) const override { return 0; }
  331. virtual int surface_get_array_index_len(int p_idx) const override { return 0; }
  332. virtual Array surface_get_arrays(int p_surface) const override { return Array(); }
  333. virtual TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const override { return TypedArray<Array>(); }
  334. virtual Dictionary surface_get_lods(int p_surface) const override { return Dictionary(); }
  335. virtual BitField<ArrayFormat> surface_get_format(int p_idx) const override { return 0; }
  336. virtual PrimitiveType surface_get_primitive_type(int p_idx) const override { return PRIMITIVE_TRIANGLES; }
  337. virtual void surface_set_material(int p_idx, const Ref<Material> &p_material) override {}
  338. virtual Ref<Material> surface_get_material(int p_idx) const override { return Ref<Material>(); }
  339. virtual int get_blend_shape_count() const override { return 0; }
  340. virtual StringName get_blend_shape_name(int p_index) const override { return StringName(); }
  341. virtual void set_blend_shape_name(int p_index, const StringName &p_name) override {}
  342. virtual RID get_rid() const override { return rid; }
  343. virtual AABB get_aabb() const override { return aabb; }
  344. void set_aabb(const AABB &p_aabb) { aabb = p_aabb; }
  345. virtual int get_builtin_bind_pose_count() const override { return 0; }
  346. virtual Transform3D get_builtin_bind_pose(int p_index) const override { return Transform3D(); }
  347. PlaceholderMesh();
  348. ~PlaceholderMesh();
  349. };
  350. #endif // MESH_H