| 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 |
#pragma once |
| 32 |
|
| 33 |
#include "core/io/resource.h" |
| 34 |
#include "core/math/face3.h" |
| 35 |
#include "core/math/triangle_mesh.h" |
| 36 |
#include "scene/resources/material.h" |
| 37 |
#include "servers/rendering/rendering_server.h" |
| 38 |
|
| 39 |
#ifndef PHYSICS_3D_DISABLED |
| 40 |
#include "scene/resources/3d/shape_3d.h" |
| 41 |
|
| 42 |
class ConcavePolygonShape3D; |
| 43 |
class ConvexPolygonShape3D; |
| 44 |
class Shape3D; |
| 45 |
#endif |
| 46 |
class MeshConvexDecompositionSettings; |
| 47 |
|
| 48 |
class Mesh : public Resource { |
| 49 |
GDCLASS(Mesh, Resource); |
| 50 |
|
| 51 |
mutable Ref<TriangleMesh> triangle_mesh; |
| 52 |
mutable Vector<Ref<TriangleMesh>> surface_triangle_meshes; |
| 53 |
mutable Vector<Vector3> debug_lines; |
| 54 |
Size2i lightmap_size_hint; |
| 55 |
|
| 56 |
Vector<Vector3> _get_faces() const; |
| 57 |
|
| 58 |
public: |
| 59 |
enum PrimitiveType { |
| 60 |
PRIMITIVE_POINTS = RenderingServer::PRIMITIVE_POINTS, |
| 61 |
PRIMITIVE_LINES = RenderingServer::PRIMITIVE_LINES, |
| 62 |
PRIMITIVE_LINE_STRIP = RenderingServer::PRIMITIVE_LINE_STRIP, |
| 63 |
PRIMITIVE_TRIANGLES = RenderingServer::PRIMITIVE_TRIANGLES, |
| 64 |
PRIMITIVE_TRIANGLE_STRIP = RenderingServer::PRIMITIVE_TRIANGLE_STRIP, |
| 65 |
PRIMITIVE_MAX = RenderingServer::PRIMITIVE_MAX, |
| 66 |
}; |
| 67 |
|
| 68 |
protected: |
| 69 |
static void _bind_methods(); |
| 70 |
|
| 71 |
GDVIRTUAL0RC_REQUIRED(int, _get_surface_count) |
| 72 |
GDVIRTUAL1RC_REQUIRED(int, _surface_get_array_len, int) |
| 73 |
GDVIRTUAL1RC_REQUIRED(int, _surface_get_array_index_len, int) |
| 74 |
GDVIRTUAL1RC_REQUIRED(Array, _surface_get_arrays, int) |
| 75 |
GDVIRTUAL1RC_REQUIRED(TypedArray<Array>, _surface_get_blend_shape_arrays, int) |
| 76 |
GDVIRTUAL1RC_REQUIRED(Dictionary, _surface_get_lods, int) |
| 77 |
GDVIRTUAL1RC_REQUIRED(uint32_t, _surface_get_format, int) |
| 78 |
GDVIRTUAL1RC_REQUIRED(uint32_t, _surface_get_primitive_type, int) |
| 79 |
GDVIRTUAL2_REQUIRED(_surface_set_material, int, Ref<Material>) |
| 80 |
GDVIRTUAL1RC_REQUIRED(Ref<Material>, _surface_get_material, int) |
| 81 |
GDVIRTUAL0RC_REQUIRED(int, _get_blend_shape_count) |
| 82 |
GDVIRTUAL1RC_REQUIRED(StringName, _get_blend_shape_name, int) |
| 83 |
GDVIRTUAL2_REQUIRED(_set_blend_shape_name, int, StringName) |
| 84 |
GDVIRTUAL0RC_REQUIRED(AABB, _get_aabb) |
| 85 |
|
| 86 |
public: |
| 87 |
enum { |
| 88 |
NO_INDEX_ARRAY = RenderingServer::NO_INDEX_ARRAY, |
| 89 |
ARRAY_WEIGHTS_SIZE = RenderingServer::ARRAY_WEIGHTS_SIZE |
| 90 |
}; |
| 91 |
enum BlendShapeMode { |
| 92 |
BLEND_SHAPE_MODE_NORMALIZED = RS::BLEND_SHAPE_MODE_NORMALIZED, |
| 93 |
BLEND_SHAPE_MODE_RELATIVE = RS::BLEND_SHAPE_MODE_RELATIVE, |
| 94 |
}; |
| 95 |
enum ArrayType { |
| 96 |
ARRAY_VERTEX = RenderingServer::ARRAY_VERTEX, |
| 97 |
ARRAY_NORMAL = RenderingServer::ARRAY_NORMAL, |
| 98 |
ARRAY_TANGENT = RenderingServer::ARRAY_TANGENT, |
| 99 |
ARRAY_COLOR = RenderingServer::ARRAY_COLOR, |
| 100 |
ARRAY_TEX_UV = RenderingServer::ARRAY_TEX_UV, |
| 101 |
ARRAY_TEX_UV2 = RenderingServer::ARRAY_TEX_UV2, |
| 102 |
ARRAY_CUSTOM0 = RenderingServer::ARRAY_CUSTOM0, |
| 103 |
ARRAY_CUSTOM1 = RenderingServer::ARRAY_CUSTOM1, |
| 104 |
ARRAY_CUSTOM2 = RenderingServer::ARRAY_CUSTOM2, |
| 105 |
ARRAY_CUSTOM3 = RenderingServer::ARRAY_CUSTOM3, |
| 106 |
ARRAY_BONES = RenderingServer::ARRAY_BONES, |
| 107 |
ARRAY_WEIGHTS = RenderingServer::ARRAY_WEIGHTS, |
| 108 |
ARRAY_INDEX = RenderingServer::ARRAY_INDEX, |
| 109 |
ARRAY_MAX = RenderingServer::ARRAY_MAX |
| 110 |
|
| 111 |
}; |
| 112 |
|
| 113 |
enum ArrayCustomFormat { |
| 114 |
ARRAY_CUSTOM_RGBA8_UNORM, |
| 115 |
ARRAY_CUSTOM_RGBA8_SNORM, |
| 116 |
ARRAY_CUSTOM_RG_HALF, |
| 117 |
ARRAY_CUSTOM_RGBA_HALF, |
| 118 |
ARRAY_CUSTOM_R_FLOAT, |
| 119 |
ARRAY_CUSTOM_RG_FLOAT, |
| 120 |
ARRAY_CUSTOM_RGB_FLOAT, |
| 121 |
ARRAY_CUSTOM_RGBA_FLOAT, |
| 122 |
ARRAY_CUSTOM_MAX |
| 123 |
}; |
| 124 |
|
| 125 |
enum ArrayFormat : uint64_t { |
| 126 |
ARRAY_FORMAT_VERTEX = RS::ARRAY_FORMAT_VERTEX, |
| 127 |
ARRAY_FORMAT_NORMAL = RS::ARRAY_FORMAT_NORMAL, |
| 128 |
ARRAY_FORMAT_TANGENT = RS::ARRAY_FORMAT_TANGENT, |
| 129 |
ARRAY_FORMAT_COLOR = RS::ARRAY_FORMAT_COLOR, |
| 130 |
ARRAY_FORMAT_TEX_UV = RS::ARRAY_FORMAT_TEX_UV, |
| 131 |
ARRAY_FORMAT_TEX_UV2 = RS::ARRAY_FORMAT_TEX_UV2, |
| 132 |
ARRAY_FORMAT_CUSTOM0 = RS::ARRAY_FORMAT_CUSTOM0, |
| 133 |
ARRAY_FORMAT_CUSTOM1 = RS::ARRAY_FORMAT_CUSTOM1, |
| 134 |
ARRAY_FORMAT_CUSTOM2 = RS::ARRAY_FORMAT_CUSTOM2, |
| 135 |
ARRAY_FORMAT_CUSTOM3 = RS::ARRAY_FORMAT_CUSTOM3, |
| 136 |
ARRAY_FORMAT_BONES = RS::ARRAY_FORMAT_BONES, |
| 137 |
ARRAY_FORMAT_WEIGHTS = RS::ARRAY_FORMAT_WEIGHTS, |
| 138 |
ARRAY_FORMAT_INDEX = RS::ARRAY_FORMAT_INDEX, |
| 139 |
|
| 140 |
ARRAY_FORMAT_BLEND_SHAPE_MASK = RS::ARRAY_FORMAT_BLEND_SHAPE_MASK, |
| 141 |
|
| 142 |
ARRAY_FORMAT_CUSTOM_BASE = RS::ARRAY_FORMAT_CUSTOM_BASE, |
| 143 |
ARRAY_FORMAT_CUSTOM_BITS = RS::ARRAY_FORMAT_CUSTOM_BITS, |
| 144 |
ARRAY_FORMAT_CUSTOM0_SHIFT = RS::ARRAY_FORMAT_CUSTOM0_SHIFT, |
| 145 |
ARRAY_FORMAT_CUSTOM1_SHIFT = RS::ARRAY_FORMAT_CUSTOM1_SHIFT, |
| 146 |
ARRAY_FORMAT_CUSTOM2_SHIFT = RS::ARRAY_FORMAT_CUSTOM2_SHIFT, |
| 147 |
ARRAY_FORMAT_CUSTOM3_SHIFT = RS::ARRAY_FORMAT_CUSTOM3_SHIFT, |
| 148 |
|
| 149 |
ARRAY_FORMAT_CUSTOM_MASK = RS::ARRAY_FORMAT_CUSTOM_MASK, |
| 150 |
ARRAY_COMPRESS_FLAGS_BASE = RS::ARRAY_COMPRESS_FLAGS_BASE, |
| 151 |
|
| 152 |
ARRAY_FLAG_USE_2D_VERTICES = RS::ARRAY_FLAG_USE_2D_VERTICES, |
| 153 |
ARRAY_FLAG_USE_DYNAMIC_UPDATE = RS::ARRAY_FLAG_USE_DYNAMIC_UPDATE, |
| 154 |
ARRAY_FLAG_USE_8_BONE_WEIGHTS = RS::ARRAY_FLAG_USE_8_BONE_WEIGHTS, |
| 155 |
|
| 156 |
ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY = RS::ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY, |
| 157 |
ARRAY_FLAG_COMPRESS_ATTRIBUTES = RS::ARRAY_FLAG_COMPRESS_ATTRIBUTES, |
| 158 |
|
| 159 |
ARRAY_FLAG_FORMAT_VERSION_BASE = RS::ARRAY_FLAG_FORMAT_VERSION_BASE, |
| 160 |
ARRAY_FLAG_FORMAT_VERSION_SHIFT = RS::ARRAY_FLAG_FORMAT_VERSION_SHIFT, |
| 161 |
ARRAY_FLAG_FORMAT_VERSION_1 = RS::ARRAY_FLAG_FORMAT_VERSION_1, |
| 162 |
ARRAY_FLAG_FORMAT_VERSION_2 = (uint64_t)RS::ARRAY_FLAG_FORMAT_VERSION_2, |
| 163 |
ARRAY_FLAG_FORMAT_CURRENT_VERSION = (uint64_t)RS::ARRAY_FLAG_FORMAT_CURRENT_VERSION, |
| 164 |
ARRAY_FLAG_FORMAT_VERSION_MASK = RS::ARRAY_FLAG_FORMAT_VERSION_MASK, |
| 165 |
}; |
| 166 |
|
| 167 |
virtual int get_surface_count() const; |
| 168 |
virtual int surface_get_array_len(int p_idx) const; |
| 169 |
virtual int surface_get_array_index_len(int p_idx) const; |
| 170 |
virtual Array surface_get_arrays(int p_surface) const; |
| 171 |
virtual TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const; |
| 172 |
virtual Dictionary surface_get_lods(int p_surface) const; |
| 173 |
virtual BitField<ArrayFormat> surface_get_format(int p_idx) const; |
| 174 |
virtual PrimitiveType surface_get_primitive_type(int p_idx) const; |
| 175 |
virtual void surface_set_material(int p_idx, const Ref<Material> &p_material); |
| 176 |
virtual Ref<Material> surface_get_material(int p_idx) const; |
| 177 |
virtual int get_blend_shape_count() const; |
| 178 |
virtual StringName get_blend_shape_name(int p_index) const; |
| 179 |
virtual void set_blend_shape_name(int p_index, const StringName &p_name); |
| 180 |
virtual AABB get_aabb() const; |
| 181 |
|
| 182 |
Vector<Face3> get_faces() const; |
| 183 |
Vector<Face3> get_surface_faces(int p_surface) const; |
| 184 |
Ref<TriangleMesh> generate_triangle_mesh() const; |
| 185 |
Ref<TriangleMesh> generate_surface_triangle_mesh(int p_surface) const; |
| 186 |
void generate_debug_mesh_lines(Vector<Vector3> &r_lines); |
| 187 |
void generate_debug_mesh_indices(Vector<Vector3> &r_points); |
| 188 |
|
| 189 |
Ref<Mesh> create_outline(float p_margin) const; |
| 190 |
|
| 191 |
void set_lightmap_size_hint(const Size2i &p_size); |
| 192 |
Size2i get_lightmap_size_hint() const; |
| 193 |
void clear_cache() const; |
| 194 |
|
| 195 |
#ifndef PHYSICS_3D_DISABLED |
| 196 |
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); |
| 197 |
|
| 198 |
static ConvexDecompositionFunc convex_decomposition_function; |
| 199 |
|
| 200 |
Vector<Ref<Shape3D>> convex_decompose(const Ref<MeshConvexDecompositionSettings> &p_settings) const; |
| 201 |
Ref<ConvexPolygonShape3D> create_convex_shape(bool p_clean = true, bool p_simplify = false) const; |
| 202 |
Ref<ConcavePolygonShape3D> create_trimesh_shape() const; |
| 203 |
#endif |
| 204 |
|
| 205 |
virtual int get_builtin_bind_pose_count() const; |
| 206 |
virtual Transform3D get_builtin_bind_pose(int p_index) const; |
| 207 |
|
| 208 |
virtual Ref<Resource> create_placeholder() const; |
| 209 |
|
| 210 |
Mesh(); |
| 211 |
}; |
| 212 |
|
| 213 |
class MeshConvexDecompositionSettings : public RefCounted { |
| 214 |
GDCLASS(MeshConvexDecompositionSettings, RefCounted); |
| 215 |
|
| 216 |
public: |
| 217 |
enum Mode : int { |
| 218 |
CONVEX_DECOMPOSITION_MODE_VOXEL = 0, |
| 219 |
CONVEX_DECOMPOSITION_MODE_TETRAHEDRON = 1 |
| 220 |
}; |
| 221 |
|
| 222 |
private: |
| 223 |
Mode mode = CONVEX_DECOMPOSITION_MODE_VOXEL; |
| 224 |
|
| 225 |
|
| 226 |
real_t max_concavity = 1.0; |
| 227 |
|
| 228 |
real_t symmetry_planes_clipping_bias = 0.05; |
| 229 |
|
| 230 |
real_t revolution_axes_clipping_bias = 0.05; |
| 231 |
real_t min_volume_per_convex_hull = 0.0001; |
| 232 |
|
| 233 |
uint32_t resolution = 10'000; |
| 234 |
uint32_t max_num_vertices_per_convex_hull = 32; |
| 235 |
|
| 236 |
|
| 237 |
uint32_t plane_downsampling = 4; |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
uint32_t convex_hull_downsampling = 4; |
| 242 |
|
| 243 |
bool normalize_mesh = false; |
| 244 |
|
| 245 |
bool convex_hull_approximation = true; |
| 246 |
|
| 247 |
uint32_t max_convex_hulls = 1; |
| 248 |
bool project_hull_vertices = true; |
| 249 |
|
| 250 |
protected: |
| 251 |
static void _bind_methods(); |
| 252 |
|
| 253 |
public: |
| 254 |
void set_max_concavity(real_t p_max_concavity); |
| 255 |
real_t get_max_concavity() const; |
| 256 |
|
| 257 |
void set_symmetry_planes_clipping_bias(real_t p_symmetry_planes_clipping_bias); |
| 258 |
real_t get_symmetry_planes_clipping_bias() const; |
| 259 |
|
| 260 |
void set_revolution_axes_clipping_bias(real_t p_revolution_axes_clipping_bias); |
| 261 |
real_t get_revolution_axes_clipping_bias() const; |
| 262 |
|
| 263 |
void set_min_volume_per_convex_hull(real_t p_min_volume_per_convex_hull); |
| 264 |
real_t get_min_volume_per_convex_hull() const; |
| 265 |
|
| 266 |
void set_resolution(uint32_t p_resolution); |
| 267 |
uint32_t get_resolution() const; |
| 268 |
|
| 269 |
void set_max_num_vertices_per_convex_hull(uint32_t p_max_num_vertices_per_convex_hull); |
| 270 |
uint32_t get_max_num_vertices_per_convex_hull() const; |
| 271 |
|
| 272 |
void set_plane_downsampling(uint32_t p_plane_downsampling); |
| 273 |
uint32_t get_plane_downsampling() const; |
| 274 |
|
| 275 |
void set_convex_hull_downsampling(uint32_t p_convex_hull_downsampling); |
| 276 |
uint32_t get_convex_hull_downsampling() const; |
| 277 |
|
| 278 |
void set_normalize_mesh(bool p_normalize_mesh); |
| 279 |
bool get_normalize_mesh() const; |
| 280 |
|
| 281 |
void set_mode(Mode p_mode); |
| 282 |
Mode get_mode() const; |
| 283 |
|
| 284 |
void set_convex_hull_approximation(bool p_convex_hull_approximation); |
| 285 |
bool get_convex_hull_approximation() const; |
| 286 |
|
| 287 |
void set_max_convex_hulls(uint32_t p_max_convex_hulls); |
| 288 |
uint32_t get_max_convex_hulls() const; |
| 289 |
|
| 290 |
void set_project_hull_vertices(bool p_project_hull_vertices); |
| 291 |
bool get_project_hull_vertices() const; |
| 292 |
}; |
| 293 |
|
| 294 |
VARIANT_ENUM_CAST(MeshConvexDecompositionSettings::Mode); |
| 295 |
|
| 296 |
class ArrayMesh : public Mesh { |
| 297 |
GDCLASS(ArrayMesh, Mesh); |
| 298 |
RES_BASE_EXTENSION("mesh"); |
| 299 |
|
| 300 |
PackedStringArray _get_blend_shape_names() const; |
| 301 |
void _set_blend_shape_names(const PackedStringArray &p_names); |
| 302 |
|
| 303 |
Array _get_surfaces() const; |
| 304 |
void _set_surfaces(const Array &p_data); |
| 305 |
Ref<ArrayMesh> shadow_mesh; |
| 306 |
|
| 307 |
private: |
| 308 |
struct Surface { |
| 309 |
uint64_t format = 0; |
| 310 |
int array_length = 0; |
| 311 |
int index_array_length = 0; |
| 312 |
PrimitiveType primitive = PrimitiveType::PRIMITIVE_MAX; |
| 313 |
|
| 314 |
String name; |
| 315 |
AABB aabb; |
| 316 |
Ref<Material> material; |
| 317 |
bool is_2d = false; |
| 318 |
}; |
| 319 |
Vector<Surface> surfaces; |
| 320 |
mutable RID mesh; |
| 321 |
AABB aabb; |
| 322 |
BlendShapeMode blend_shape_mode = BLEND_SHAPE_MODE_RELATIVE; |
| 323 |
Vector<StringName> blend_shapes; |
| 324 |
AABB custom_aabb; |
| 325 |
|
| 326 |
_FORCE_INLINE_ void _create_if_empty() const; |
| 327 |
void _recompute_aabb(); |
| 328 |
|
| 329 |
protected: |
| 330 |
virtual bool _is_generated() const { return false; } |
| 331 |
|
| 332 |
bool _set(const StringName &p_name, const Variant &p_value); |
| 333 |
bool _get(const StringName &p_name, Variant &r_ret) const; |
| 334 |
void _get_property_list(List<PropertyInfo> *p_list) const; |
| 335 |
bool surface_index_0 = false; |
| 336 |
|
| 337 |
virtual void reset_state() override; |
| 338 |
|
| 339 |
static void _bind_methods(); |
| 340 |
|
| 341 |
public: |
| 342 |
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); |
| 343 |
|
| 344 |
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()); |
| 345 |
|
| 346 |
Array surface_get_arrays(int p_surface) const override; |
| 347 |
TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const override; |
| 348 |
Dictionary surface_get_lods(int p_surface) const override; |
| 349 |
|
| 350 |
void add_blend_shape(const StringName &p_name); |
| 351 |
int get_blend_shape_count() const override; |
| 352 |
StringName get_blend_shape_name(int p_index) const override; |
| 353 |
void set_blend_shape_name(int p_index, const StringName &p_name) override; |
| 354 |
void clear_blend_shapes(); |
| 355 |
|
| 356 |
void set_blend_shape_mode(BlendShapeMode p_mode); |
| 357 |
BlendShapeMode get_blend_shape_mode() const; |
| 358 |
|
| 359 |
void surface_update_vertex_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data); |
| 360 |
void surface_update_attribute_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data); |
| 361 |
void surface_update_skin_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data); |
| 362 |
|
| 363 |
int get_surface_count() const override; |
| 364 |
|
| 365 |
void surface_remove(int p_surface); |
| 366 |
void clear_surfaces(); |
| 367 |
|
| 368 |
void surface_set_custom_aabb(int p_idx, const AABB &p_aabb); |
| 369 |
|
| 370 |
int surface_get_array_len(int p_idx) const override; |
| 371 |
int surface_get_array_index_len(int p_idx) const override; |
| 372 |
BitField<ArrayFormat> surface_get_format(int p_idx) const override; |
| 373 |
PrimitiveType surface_get_primitive_type(int p_idx) const override; |
| 374 |
|
| 375 |
virtual void surface_set_material(int p_idx, const Ref<Material> &p_material) override; |
| 376 |
virtual Ref<Material> surface_get_material(int p_idx) const override; |
| 377 |
|
| 378 |
int surface_find_by_name(const String &p_name) const; |
| 379 |
void surface_set_name(int p_idx, const String &p_name); |
| 380 |
String surface_get_name(int p_idx) const; |
| 381 |
|
| 382 |
void set_custom_aabb(const AABB &p_custom); |
| 383 |
AABB get_custom_aabb() const; |
| 384 |
|
| 385 |
AABB get_aabb() const override; |
| 386 |
virtual RID get_rid() const override; |
| 387 |
|
| 388 |
void regen_normal_maps(); |
| 389 |
|
| 390 |
Error lightmap_unwrap(const Transform3D &p_base_transform = Transform3D(), float p_texel_size = 0.05); |
| 391 |
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); |
| 392 |
|
| 393 |
virtual void reload_from_file() override; |
| 394 |
|
| 395 |
void set_shadow_mesh(const Ref<ArrayMesh> &p_mesh); |
| 396 |
Ref<ArrayMesh> get_shadow_mesh() const; |
| 397 |
|
| 398 |
ArrayMesh(); |
| 399 |
|
| 400 |
~ArrayMesh(); |
| 401 |
}; |
| 402 |
|
| 403 |
VARIANT_ENUM_CAST(Mesh::ArrayType); |
| 404 |
VARIANT_BITFIELD_CAST(Mesh::ArrayFormat); |
| 405 |
VARIANT_ENUM_CAST(Mesh::ArrayCustomFormat); |
| 406 |
VARIANT_ENUM_CAST(Mesh::PrimitiveType); |
| 407 |
VARIANT_ENUM_CAST(Mesh::BlendShapeMode); |
| 408 |
|
| 409 |
class PlaceholderMesh : public Mesh { |
| 410 |
GDCLASS(PlaceholderMesh, Mesh); |
| 411 |
|
| 412 |
RID rid; |
| 413 |
AABB aabb; |
| 414 |
|
| 415 |
protected: |
| 416 |
static void _bind_methods(); |
| 417 |
|
| 418 |
public: |
| 419 |
virtual int get_surface_count() const override { return 0; } |
| 420 |
virtual int surface_get_array_len(int p_idx) const override { return 0; } |
| 421 |
virtual int surface_get_array_index_len(int p_idx) const override { return 0; } |
| 422 |
virtual Array surface_get_arrays(int p_surface) const override { return Array(); } |
| 423 |
virtual TypedArray<Array> surface_get_blend_shape_arrays(int p_surface) const override { return TypedArray<Array>(); } |
| 424 |
virtual Dictionary surface_get_lods(int p_surface) const override { return Dictionary(); } |
| 425 |
virtual BitField<ArrayFormat> surface_get_format(int p_idx) const override { return 0; } |
| 426 |
virtual PrimitiveType surface_get_primitive_type(int p_idx) const override { return PRIMITIVE_TRIANGLES; } |
| 427 |
virtual void surface_set_material(int p_idx, const Ref<Material> &p_material) override {} |
| 428 |
virtual Ref<Material> surface_get_material(int p_idx) const override { return Ref<Material>(); } |
| 429 |
virtual int get_blend_shape_count() const override { return 0; } |
| 430 |
virtual StringName get_blend_shape_name(int p_index) const override { return StringName(); } |
| 431 |
virtual void set_blend_shape_name(int p_index, const StringName &p_name) override {} |
| 432 |
virtual RID get_rid() const override { return rid; } |
| 433 |
virtual AABB get_aabb() const override { return aabb; } |
| 434 |
void set_aabb(const AABB &p_aabb) { aabb = p_aabb; } |
| 435 |
|
| 436 |
virtual int get_builtin_bind_pose_count() const override { return 0; } |
| 437 |
virtual Transform3D get_builtin_bind_pose(int p_index) const override { return Transform3D(); } |
| 438 |
|
| 439 |
PlaceholderMesh(); |
| 440 |
~PlaceholderMesh(); |
| 441 |
}; |