Improvements and fixes to occluders
Improvements: * Occluder3D is now an abstract type inherited by: ArrayOccluder3D, QuadOccluder3D, BoxOccluder3D, SphereOccluder3D and PolygonOccluder3D. ArrayOccluder3D serves the same purpose as the old Occluder3D (triangle mesh occluder) while the rest are primitives that can be used to manually place simple occluders. * Occluder baking can now apply simplification. The "bake_simplification_distance" property can be used to set a world-space distance as the desired maximum error, set to 0.1 by default. * Occluders can now be generated on import. Using the "occ" and "occonly" keywords (similar to "col" and "colonly" for colliders) or by enabling on MeshInstance3Ds in the scene's import window. Fixes: * Fixed saving of occluder files after bake. * Fixed a small error where occluders didn't correctly update in the rendering server. Bonus content: * Generalized "CollisionPolygon3DEditor" so it can also be used to edit Resources. Renamed it to "Polygon3DEditor" since it was already being used by other things, not just colliders. * Fixed a small bug in "EditorPropertyArray" where a call to "remove" was left after the "remove_at" rename.
This commit is contained in:
@@ -84,12 +84,24 @@ public:
|
||||
static SimplifyScaleFunc simplify_scale_func;
|
||||
typedef size_t (*SimplifySloppyFunc)(unsigned int *destination, const unsigned int *indices, size_t index_count, const float *vertex_positions_data, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float *out_result_error);
|
||||
static SimplifySloppyFunc simplify_sloppy_func;
|
||||
typedef size_t (*GenerateRemapFunc)(unsigned int *destination, const unsigned int *indices, size_t index_count, const void *vertices, size_t vertex_count, size_t vertex_size);
|
||||
static GenerateRemapFunc generate_remap_func;
|
||||
typedef void (*RemapVertexFunc)(void *destination, const void *vertices, size_t vertex_count, size_t vertex_size, const unsigned int *remap);
|
||||
static RemapVertexFunc remap_vertex_func;
|
||||
typedef void (*RemapIndexFunc)(unsigned int *destination, const unsigned int *indices, size_t index_count, const unsigned int *remap);
|
||||
static RemapIndexFunc remap_index_func;
|
||||
static void strip_mesh_arrays(PackedVector3Array &r_vertices, PackedInt32Array &r_indices);
|
||||
|
||||
private:
|
||||
struct VertexHasher {
|
||||
static _FORCE_INLINE_ uint32_t hash(const Vertex &p_vtx);
|
||||
};
|
||||
|
||||
struct TriangleHasher {
|
||||
static _FORCE_INLINE_ uint32_t hash(const int *p_triangle);
|
||||
static _FORCE_INLINE_ bool compare(const int *p_lhs, const int *p_rhs);
|
||||
};
|
||||
|
||||
struct WeightSort {
|
||||
int index = 0;
|
||||
float weight = 0.0;
|
||||
|
||||
Reference in New Issue
Block a user