Make density calculation performed with doubles instead of 32-bit floats

This commit is contained in:
Aaron Franke 2022-07-03 18:11:44 -05:00
parent e6ffc0ad77
commit 8dd25ce242
No known key found for this signature in database
GPG Key ID: 40A1750B977E56BF

View File

@ -99,7 +99,7 @@ void VoxelInstanceGenerator::generate_transforms(std::vector<Transform3D> &out_t
// I had to use `uint64` and clamp it because floats can't contain `0xffffffff` accurately. Instead
// it results in `0x100000000`, one unit above.
const uint32_t density_u32 =
math::min(uint64_t(0xffffffff * (_density / MAX_DENSITY)), uint64_t(0xffffffff));
math::min(uint64_t(double(0xffffffff) * _density / MAX_DENSITY), uint64_t(0xffffffff));
const int size = vertices.size();
for (int i = 0; i < size; ++i) {
// TODO We could actually generate indexes and pick those,