summaryrefslogtreecommitdiff
path: root/scene/3d/voxelizer.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/voxelizer.h')
-rw-r--r--scene/3d/voxelizer.h48
1 files changed, 19 insertions, 29 deletions
diff --git a/scene/3d/voxelizer.h b/scene/3d/voxelizer.h
index a0b581d625..87f949e7db 100644
--- a/scene/3d/voxelizer.h
+++ b/scene/3d/voxelizer.h
@@ -44,35 +44,25 @@ private:
struct Cell {
uint32_t children[8];
- float albedo[3]; //albedo in RGB24
- float emission[3]; //accumulated light in 16:16 fixed point (needs to be integer for moving lights fast)
- float normal[3];
- uint32_t used_sides;
- float alpha; //used for upsampling
- uint16_t x;
- uint16_t y;
- uint16_t z;
- uint16_t level;
+ float albedo[3] = {}; //albedo in RGB24
+ float emission[3] = {}; //accumulated light in 16:16 fixed point (needs to be integer for moving lights fast)
+ float normal[3] = {};
+ uint32_t used_sides = 0;
+ float alpha = 0.0; //used for upsampling
+ uint16_t x = 0;
+ uint16_t y = 0;
+ uint16_t z = 0;
+ uint16_t level = 0;
Cell() {
for (int i = 0; i < 8; i++) {
children[i] = CHILD_EMPTY;
}
-
- for (int i = 0; i < 3; i++) {
- emission[i] = 0;
- albedo[i] = 0;
- normal[i] = 0;
- }
- alpha = 0;
- used_sides = 0;
- x = y = z = 0;
- level = 0;
}
};
Vector<Cell> bake_cells;
- int cell_subdiv;
+ int cell_subdiv = 0;
struct CellSort {
union {
@@ -82,10 +72,10 @@ private:
uint64_t x : 16;
uint64_t level : 16;
};
- uint64_t key;
+ uint64_t key = 0;
};
- int32_t index;
+ int32_t index = 0;
_FORCE_INLINE_ bool operator<(const CellSort &p_cell_sort) const {
return key < p_cell_sort.key;
@@ -101,16 +91,16 @@ private:
Map<Ref<Material>, MaterialCache> material_cache;
AABB original_bounds;
AABB po2_bounds;
- int axis_cell_size[3];
+ int axis_cell_size[3] = {};
Transform to_cell_space;
- int color_scan_cell_width;
- int bake_texture_size;
- float cell_size;
+ int color_scan_cell_width = 4;
+ int bake_texture_size = 128;
+ float cell_size = 0.0;
- int max_original_cells;
- int leaf_voxel_count;
+ int max_original_cells = 0;
+ int leaf_voxel_count = 0;
Vector<Color> _get_bake_texture(Ref<Image> p_image, const Color &p_color_mul, const Color &p_color_add);
MaterialCache _get_material_cache(Ref<Material> p_material);
@@ -119,7 +109,7 @@ private:
void _fixup_plot(int p_idx, int p_level);
void _debug_mesh(int p_idx, int p_level, const AABB &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx);
- bool sorted;
+ bool sorted = false;
void _sort();
public: