mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:09:24 +02:00
fixed crash
This commit is contained in:
parent
facc9e1ee7
commit
23461c2e95
1 changed files with 10 additions and 8 deletions
|
@ -118,17 +118,19 @@ unsigned char * childOctalCode(unsigned char * parentOctalCode, char childNumber
|
||||||
void voxelDetailsForCode(unsigned char * octalCode, VoxelPositionSize& voxelPositionSize) {
|
void voxelDetailsForCode(unsigned char * octalCode, VoxelPositionSize& voxelPositionSize) {
|
||||||
float output[3];
|
float output[3];
|
||||||
memset(&output[0], 0, 3 * sizeof(float));
|
memset(&output[0], 0, 3 * sizeof(float));
|
||||||
|
|
||||||
float currentScale = 1.0;
|
float currentScale = 1.0;
|
||||||
|
|
||||||
for (int i = 0; i < numberOfThreeBitSectionsInCode(octalCode); i++) {
|
if (octalCode) {
|
||||||
currentScale *= 0.5;
|
for (int i = 0; i < numberOfThreeBitSectionsInCode(octalCode); i++) {
|
||||||
int sectionIndex = sectionValue(octalCode + 1 + (3 * i / 8), (3 * i) % 8);
|
currentScale *= 0.5;
|
||||||
|
int sectionIndex = sectionValue(octalCode + 1 + (BITS_IN_OCTAL * i / BITS_IN_BYTE),
|
||||||
|
(BITS_IN_OCTAL * i) % BITS_IN_BYTE);
|
||||||
|
|
||||||
|
for (int j = 0; j < BITS_IN_OCTAL; j++) {
|
||||||
|
output[j] += currentScale * (int)oneAtBit(sectionIndex, (BITS_IN_BYTE - BITS_IN_OCTAL) + j);
|
||||||
|
}
|
||||||
|
|
||||||
for (int j = 0; j < 3; j++) {
|
|
||||||
output[j] += currentScale * (int)oneAtBit(sectionIndex, 5 + j);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
voxelPositionSize.x = output[0];
|
voxelPositionSize.x = output[0];
|
||||||
voxelPositionSize.y = output[1];
|
voxelPositionSize.y = output[1];
|
||||||
|
|
Loading…
Reference in a new issue