So while I was poking around at the documentation holes in jME, I stumbled across this:
for (i = 0; i < radialSamples; i++, index += 6) {
if (true) {
getIndexBuffer().put(i0++);
getIndexBuffer().put(i2);
getIndexBuffer().put(i1);
getIndexBuffer().put(i1++);
getIndexBuffer().put(i2++);
getIndexBuffer().put(i3++);
} else {
getIndexBuffer().put(i0++);
getIndexBuffer().put(i1);
getIndexBuffer().put(i2);
getIndexBuffer().put(i1++);
getIndexBuffer().put(i3++);
getIndexBuffer().put(i2++);
}
}
you'll notice that the last two put's in the if and else are swapped, but the if-else is never going to be called anyway then the conditional is pretty useless.
Here's the fix, plus a description of what a Torus is for those not so familiar with 3D primitives
Index: src/com/jme/scene/shape/Torus.java
===================================================================
--- src/com/jme/scene/shape/Torus.java (revision 4630)
+++ src/com/jme/scene/shape/Torus.java (working copy)
@@ -45,7 +45,8 @@
import com.jme.util.geom.BufferUtils;
/**
- * An ordinary (single holed) torus.
+ * An ordinary (single holed) torus. Similar
+ * in shape to a donut.
* <p>
* The center is by default the origin.
*
@@ -197,21 +198,13 @@
int i2 = connectionStart;
int i3 = i2 + 1;
for (i = 0; i < radialSamples; i++, index += 6) {
- if (true) {
- getIndexBuffer().put(i0++);
- getIndexBuffer().put(i2);
- getIndexBuffer().put(i1);
- getIndexBuffer().put(i1++);
- getIndexBuffer().put(i2++);
- getIndexBuffer().put(i3++);
- } else {
- getIndexBuffer().put(i0++);
- getIndexBuffer().put(i1);
- getIndexBuffer().put(i2);
- getIndexBuffer().put(i1++);
- getIndexBuffer().put(i3++);
- getIndexBuffer().put(i2++);
- }
+ getIndexBuffer().put(i0++);
+ getIndexBuffer().put(i2);
+ getIndexBuffer().put(i1);
+ getIndexBuffer().put(i1++);
+ getIndexBuffer().put(i2++);
+ getIndexBuffer().put(i3++);
+
}
}
}