Update RocketRenderer.java

Fix depth test issues with transparent components
This commit is contained in:
ChrisMickelson 2018-02-02 04:49:32 -06:00 committed by GitHub
parent 818fa911d9
commit 40f18d9125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -197,17 +197,24 @@ public abstract class RocketRenderer {
}
private void renderTree( GL2 gl, final Collection<Geometry> geometryList){
//cycle through opaque components first, then transparent to preserve proper depth testing
for(Geometry geom: geometryList ) {
if( geom.active ) {
if( isDrawnTransparent( (RocketComponent)geom.obj) ){
// Draw T&T front faces blended, without depth test
renderComponent(gl, geom, 0.2f);
}else{
renderComponent(gl, geom, 1.0f);
if( geom.active ) {
//if not transparent
if( !isDrawnTransparent( (RocketComponent)geom.obj) ){
renderComponent(gl, geom, 1.0f);
}
}
}
for(Geometry geom: geometryList ) {
if( geom.active ) {
if( isDrawnTransparent( (RocketComponent)geom.obj) ){
// Draw T&T front faces blended, without depth test
renderComponent(gl, geom, 0.2f);
}
}
}
}
}
private void renderMotors(GL2 gl, FlightConfiguration configuration) {
// FlightConfigurationId motorID = configuration.getFlightConfigurationID();