Skip to content

Commit d814cbe

Browse files
committed
Fiw SmallLeafOctree finalization
1 parent d6885f0 commit d814cbe

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

Readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ Advantages of this implementation:
119119
In practice measurements tends to agree to this around 33% memory saving.
120120

121121
Drawbacks of this implementation:
122-
- Maybe slower. A bit of bitwise arithmetic is needed to work with the leaves at full
123-
depth which in theory slow down a bit. In practice, no significant slow down has been measured.
122+
- Slower than `PACKED` octree. The use of a bit of bitwise arithmetic is needed to work with the leaves at full
123+
depth. According to some measurement, this incurs a slowdown of about 15%.
124124

125125

126126
[chunky]: https://chunky.llbit.se/

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ apply plugin: 'application'
1212
mainClassName = 'dev.ferrand.chunky.octree.OctreePlugin'
1313

1414
group 'dev.ferrand'
15-
version '0.4.0'
15+
version '0.4.1'
1616

1717
compileJava {
1818
sourceCompatibility = JavaVersion.VERSION_1_8

src/main/java/dev/ferrand/chunky/octree/implementations/SmallLeafOctree.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -482,17 +482,18 @@ private void finalizationNode(int nodeIndex, int currentDepth) {
482482
int mergedType = SMALL_ANY_TYPE;
483483
for(int i = 0; i < 4; ++i) {
484484
int childIndex = treeData[nodeIndex] + i;
485+
int combinedType = treeData[childIndex];
485486
if(mergedType == SMALL_ANY_TYPE) {
486-
mergedType = treeData[childIndex] >>> 16;
487-
} else if(!((treeData[childIndex] >>> 16) != SMALL_ANY_TYPE || ((treeData[childIndex] >>> 16) == mergedType))) {
487+
mergedType = combinedType >>> 16;
488+
} else if(!((combinedType >>> 16) == SMALL_ANY_TYPE || ((combinedType >>> 16) == mergedType))) {
488489
canMerge = false;
490+
break;
489491
}
490-
if(canMerge) {
491-
if(mergedType == SMALL_ANY_TYPE) {
492-
mergedType = treeData[childIndex] & 0xFFFF;
493-
} else if(!((treeData[childIndex] & 0xFFFF) != SMALL_ANY_TYPE || ((treeData[childIndex] & 0xFFFF) == mergedType))) {
494-
canMerge = false;
495-
}
492+
if(mergedType == SMALL_ANY_TYPE) {
493+
mergedType = combinedType & 0xFFFF;
494+
} else if(!((combinedType & 0xFFFF) == SMALL_ANY_TYPE || ((combinedType & 0xFFFF) == mergedType))) {
495+
canMerge = false;
496+
break;
496497
}
497498
}
498499
if(canMerge) {

src/main/resources/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "OctreePlugin",
33
"author": "a_Tom",
44
"main": "dev.ferrand.chunky.octree.OctreePlugin",
5-
"version": "0.4.0",
5+
"version": "0.4.1",
66
"targetVersion": "2.3.0",
77
"description": "Add more octree implementations."
88
}

0 commit comments

Comments
 (0)