Draw inside surface of transition offset by transition thickness.

Note the offset is perpendicular to the axis of the rocket, not normal
to the transition surface, so it is not a perfect render, but closer to
correct than before.
This commit is contained in:
bkuker 2013-03-30 10:37:55 -04:00
parent c9652d851c
commit 9fd739b4a8
2 changed files with 4 additions and 4 deletions

View File

@ -128,7 +128,7 @@ public class ComponentRenderer {
if (which == Surface.INSIDE) {
gl.glFrontFace(GL.GL_CCW);
}
TransitionRenderer.drawTransition(gl, t, LOD, t.getType() == Shape.CONICAL ? 4 : LOD / 2);
TransitionRenderer.drawTransition(gl, t, LOD, t.getType() == Shape.CONICAL ? 4 : LOD / 2, which == Surface.INSIDE ? -t.getThickness() : 0);
if (which == Surface.INSIDE) {
gl.glFrontFace(GL.GL_CW);
}

View File

@ -126,7 +126,7 @@ final class TransitionRenderer {
}
static final void drawTransition(final GL2 gl, final Transition tr,
final int slices, final int stacks) {
final int slices, final int stacks, final double offsetRadius) {
double da, r, dzBase;
double x, y, z, nz, lnz = 0;
@ -145,8 +145,8 @@ final class TransitionRenderer {
double dz = t < 0.025 ? dzBase / 8.0 : dzBase;
double zNext = Math.min(z + dz, tr.getLength());
r = tr.getRadius(z);
double rNext = tr.getRadius(zNext);
r = Math.max(0, tr.getRadius(z) + offsetRadius);
double rNext = Math.max(0, tr.getRadius(zNext) + offsetRadius);
// Z component of normal vectors