Transition shoulder thickness & factor out tube rendering.
This commit is contained in:
parent
a05e60b78c
commit
145fe35393
@ -120,92 +120,105 @@ public class ComponentRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void renderTransition(GL2 gl, Transition t, Surface which) {
|
private void renderTransition(GL2 gl, Transition t, Surface which) {
|
||||||
//TODO take into account thickness.
|
|
||||||
|
|
||||||
if (which == Surface.INSIDE) {
|
|
||||||
gl.glFrontFace(GL.GL_CCW);
|
|
||||||
}
|
|
||||||
|
|
||||||
gl.glRotated(90, 0, 1.0, 0);
|
|
||||||
|
|
||||||
if (which == Surface.OUTSIDE || which == Surface.INSIDE) {
|
if (which == Surface.OUTSIDE || which == Surface.INSIDE) {
|
||||||
|
gl.glPushMatrix();
|
||||||
|
gl.glRotated(90, 0, 1.0, 0);
|
||||||
|
if (which == Surface.INSIDE) {
|
||||||
|
gl.glFrontFace(GL.GL_CCW);
|
||||||
|
}
|
||||||
if (t.getType() == Transition.Shape.CONICAL) {
|
if (t.getType() == Transition.Shape.CONICAL) {
|
||||||
glu.gluCylinder(q, t.getForeRadius(), t.getAftRadius(),
|
glu.gluCylinder(q, t.getForeRadius(), t.getAftRadius(),
|
||||||
t.getLength(), LOD, 1);
|
t.getLength(), LOD, 1);
|
||||||
} else {
|
} else {
|
||||||
TransitionRenderer.drawTransition(gl, t, LOD, LOD);
|
TransitionRenderer.drawTransition(gl, t, LOD, LOD);
|
||||||
}
|
}
|
||||||
|
if (which == Surface.INSIDE) {
|
||||||
|
gl.glFrontFace(GL.GL_CW);
|
||||||
|
}
|
||||||
|
gl.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (which == Surface.EDGES || which == Surface.INSIDE) {
|
if (which == Surface.EDGES || which == Surface.INSIDE) {
|
||||||
// Render AFT shoulder
|
// Render AFT shoulder
|
||||||
gl.glPushMatrix();
|
{
|
||||||
gl.glTranslated(0, 0, t.getLength());
|
gl.glPushMatrix();
|
||||||
|
gl.glTranslated(t.getLength(), 0, 0);
|
||||||
glu.gluCylinder(q, t.getAftShoulderRadius(), t.getAftShoulderRadius(),
|
double iR = (t.isFilled() || t.isAftShoulderCapped()) ? 0 : t.getAftShoulderRadius() - t.getAftShoulderThickness();
|
||||||
t.getAftShoulderLength(), LOD, 1);
|
if (which == Surface.EDGES) {
|
||||||
|
renderTube(gl, Surface.OUTSIDE, t.getAftShoulderRadius(), iR, t.getAftShoulderLength());
|
||||||
gl.glRotated(180, 0, 1.0, 0);
|
renderTube(gl, Surface.EDGES, t.getAftShoulderRadius(), iR, t.getAftShoulderLength());
|
||||||
|
gl.glPushMatrix();
|
||||||
glu.gluDisk(q, t.getAftRadius(), t.getAftShoulderRadius(), LOD, 2);
|
gl.glRotated(90, 0, 1.0, 0);
|
||||||
|
glu.gluDisk(q, t.getAftShoulderRadius(), t.getAftRadius(), LOD, 2);
|
||||||
gl.glTranslated(0, 0, -t.getAftShoulderLength());
|
gl.glPopMatrix();
|
||||||
|
|
||||||
if (t.isFilled() || t.isAftShoulderCapped()) {
|
} else {
|
||||||
glu.gluDisk(q, t.getAftShoulderRadius(), 0, LOD, 2);
|
renderTube(gl, Surface.INSIDE, t.getAftShoulderRadius(), iR, t.getAftShoulderLength());
|
||||||
|
gl.glPushMatrix();
|
||||||
|
gl.glRotated(270, 0, 1.0, 0);
|
||||||
|
glu.gluDisk(q, t.getAftShoulderRadius(), t.getAftRadius(), LOD, 2);
|
||||||
|
gl.glPopMatrix();
|
||||||
|
}
|
||||||
|
gl.glPopMatrix();
|
||||||
}
|
}
|
||||||
gl.glPopMatrix();
|
|
||||||
|
|
||||||
// Render Fore Shoulder
|
// Render Fore shoulder
|
||||||
gl.glPushMatrix();
|
{
|
||||||
gl.glRotated(180, 0, 1.0, 0);
|
gl.glPushMatrix();
|
||||||
|
gl.glRotated(180, 0, 1.0, 0);
|
||||||
glu.gluCylinder(q, t.getForeShoulderRadius(),
|
//gl.glTranslated(t.getLength(), 0, 0);
|
||||||
t.getForeShoulderRadius(), t.getForeShoulderLength(), LOD, 1);
|
double iR = (t.isFilled() || t.isForeShoulderCapped()) ? 0 : t.getForeShoulderRadius() - t.getForeShoulderThickness();
|
||||||
|
if (which == Surface.EDGES) {
|
||||||
gl.glRotated(180, 0, 1.0, 0);
|
renderTube(gl, Surface.OUTSIDE, t.getForeShoulderRadius(), iR, t.getForeShoulderLength());
|
||||||
|
renderTube(gl, Surface.EDGES, t.getForeShoulderRadius(), iR, t.getForeShoulderLength());
|
||||||
glu.gluDisk(q, t.getForeRadius(), t.getForeShoulderRadius(), LOD, 2);
|
gl.glPushMatrix();
|
||||||
|
gl.glRotated(90, 0, 1.0, 0);
|
||||||
gl.glTranslated(0, 0, -t.getForeShoulderLength());
|
glu.gluDisk(q, t.getForeShoulderRadius(), t.getForeRadius(), LOD, 2);
|
||||||
|
gl.glPopMatrix();
|
||||||
if (t.isFilled() || t.isForeShoulderCapped()) {
|
|
||||||
glu.gluDisk(q, t.getForeShoulderRadius(), 0, LOD, 2);
|
} else {
|
||||||
|
renderTube(gl, Surface.INSIDE, t.getForeShoulderRadius(), iR, t.getForeShoulderLength());
|
||||||
|
gl.glPushMatrix();
|
||||||
|
gl.glRotated(270, 0, 1.0, 0);
|
||||||
|
glu.gluDisk(q, t.getForeShoulderRadius(), t.getForeRadius(), LOD, 2);
|
||||||
|
gl.glPopMatrix();
|
||||||
|
}
|
||||||
|
gl.glPopMatrix();
|
||||||
}
|
}
|
||||||
gl.glPopMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (which == Surface.INSIDE) {
|
|
||||||
gl.glFrontFace(GL.GL_CW);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderTube(GL2 gl, BodyTube t, Surface which) {
|
private void renderTube(final GL2 gl, final Surface which, final double oR, final double iR, final double len) {
|
||||||
|
gl.glPushMatrix();
|
||||||
//outside
|
//outside
|
||||||
gl.glRotated(90, 0, 1.0, 0);
|
gl.glRotated(90, 0, 1.0, 0);
|
||||||
if (which == Surface.OUTSIDE)
|
if (which == Surface.OUTSIDE)
|
||||||
glu.gluCylinder(q, t.getOuterRadius(), t.getOuterRadius(),
|
glu.gluCylinder(q, oR, oR, len, LOD, 1);
|
||||||
t.getLength(), LOD, 1);
|
|
||||||
|
|
||||||
//edges
|
//edges
|
||||||
gl.glRotated(180, 0, 1.0, 0);
|
gl.glRotated(180, 0, 1.0, 0);
|
||||||
if (which == Surface.EDGES)
|
if (which == Surface.EDGES)
|
||||||
glu.gluDisk(q, t.getInnerRadius(), t.getOuterRadius(), LOD, 2);
|
glu.gluDisk(q, iR, oR, LOD, 2);
|
||||||
|
|
||||||
gl.glRotated(180, 0, 1.0, 0);
|
gl.glRotated(180, 0, 1.0, 0);
|
||||||
gl.glTranslated(0, 0, t.getLength());
|
gl.glTranslated(0, 0, len);
|
||||||
if (which == Surface.EDGES)
|
if (which == Surface.EDGES)
|
||||||
glu.gluDisk(q, t.getInnerRadius(), t.getOuterRadius(), LOD, 2);
|
glu.gluDisk(q, iR, oR, LOD, 2);
|
||||||
|
|
||||||
|
|
||||||
//inside
|
//inside
|
||||||
if (which == Surface.INSIDE) {
|
if (which == Surface.INSIDE) {
|
||||||
glu.gluQuadricOrientation(q, GLU.GLU_INSIDE);
|
glu.gluQuadricOrientation(q, GLU.GLU_INSIDE);
|
||||||
glu.gluCylinder(q, t.getInnerRadius(), t.getInnerRadius(),
|
glu.gluCylinder(q, iR, iR, -len, LOD, 1);
|
||||||
-t.getLength(), LOD, 1);
|
|
||||||
glu.gluQuadricOrientation(q, GLU.GLU_OUTSIDE);
|
glu.gluQuadricOrientation(q, GLU.GLU_OUTSIDE);
|
||||||
}
|
}
|
||||||
|
gl.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderTube(GL2 gl, BodyTube t, Surface which) {
|
||||||
|
renderTube(gl, which, t.getOuterRadius(), t.getInnerRadius(), t.getLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderRing(GL2 gl, RingComponent r) {
|
private void renderRing(GL2 gl, RingComponent r) {
|
||||||
@ -229,29 +242,7 @@ public class ComponentRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void renderLug(GL2 gl, LaunchLug t, Surface which) {
|
private void renderLug(GL2 gl, LaunchLug t, Surface which) {
|
||||||
//outside
|
renderTube(gl, which, t.getOuterRadius(), t.getInnerRadius(), t.getLength());
|
||||||
gl.glRotated(90, 0, 1.0, 0);
|
|
||||||
if (which == Surface.OUTSIDE)
|
|
||||||
glu.gluCylinder(q, t.getOuterRadius(), t.getOuterRadius(),
|
|
||||||
t.getLength(), LOD, 1);
|
|
||||||
|
|
||||||
//edges
|
|
||||||
gl.glRotated(180, 0, 1.0, 0);
|
|
||||||
if (which == Surface.EDGES)
|
|
||||||
glu.gluDisk(q, t.getInnerRadius(), t.getOuterRadius(), LOD, 2);
|
|
||||||
|
|
||||||
gl.glRotated(180, 0, 1.0, 0);
|
|
||||||
gl.glTranslated(0, 0, t.getLength());
|
|
||||||
if (which == Surface.EDGES)
|
|
||||||
glu.gluDisk(q, t.getInnerRadius(), t.getOuterRadius(), LOD, 2);
|
|
||||||
|
|
||||||
//inside
|
|
||||||
if (which == Surface.INSIDE) {
|
|
||||||
glu.gluQuadricOrientation(q, GLU.GLU_INSIDE);
|
|
||||||
glu.gluCylinder(q, t.getInnerRadius(), t.getInnerRadius(),
|
|
||||||
-t.getLength(), LOD, 1);
|
|
||||||
glu.gluQuadricOrientation(q, GLU.GLU_OUTSIDE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderMassObject(GL2 gl, MassObject o) {
|
private void renderMassObject(GL2 gl, MassObject o) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user