if (appearance != null) { NodeComponentRetained nc; nc = ((AppearanceRetained)appearance.retained).material; if (nc != null) { nc.setInImmCtx(true); enableLighting = ((MaterialRetained) nc).lightingEnable; dRed = ((MaterialRetained) nc).diffuseColor.x; dGreen = ((MaterialRetained) nc).diffuseColor.y; dBlue = ((MaterialRetained) nc).diffuseColor.z; } else { enableLighting = false; }
assert(appearance != null);  NodeComponentRetained nc; nc = ((AppearanceRetained)appearance.retained).material; if (nc != null) { nc.setInImmCtx(true); enableLighting = ((MaterialRetained) nc).lightingEnable; dRed = ((MaterialRetained) nc).diffuseColor.x; dGreen = ((MaterialRetained) nc).diffuseColor.y; dBlue = ((MaterialRetained) nc).diffuseColor.z; } else { enableLighting = false; }  if(appearance instanceof ShaderAppearance){  ShaderProgramRetained spR = ((ShaderAppearanceRetained)appearance.retained).shaderProgram; if(spR != null) { spR.setInImmCtx(true); Shader[] sArray = spR.getShaders(); if(sArray != null) { for (int i = 0 ; i < sArray.length; i++) { if (sArray[i] != null) { ((ShaderRetained)sArray[i].retained).setInImmCtx(true); } } } }
    void doSetAppearance(Appearance appearance) {		if (appearance != null) {   	    NodeComponentRetained nc;	    nc = ((AppearanceRetained)appearance.retained).material;	    if (nc != null) {		nc.setInImmCtx(true);		enableLighting = ((MaterialRetained) nc).lightingEnable;		dRed = ((MaterialRetained) nc).diffuseColor.x;		dGreen = ((MaterialRetained) nc).diffuseColor.y;		dBlue = ((MaterialRetained) nc).diffuseColor.z;	    }	    else {		enableLighting = false;	    }            if (appearance instanceof ShaderAppearance) {                // TODO : handle ShaderProgram and ShaderAttributeSet                System.err.println("ShaderProgram not implemented for immediate mode rendering");            }            if (((AppearanceRetained)appearance.retained).texUnitState != null) {		TextureUnitStateRetained[] texUnitState = 		    ((AppearanceRetained)appearance.retained).texUnitState;		for (int i = 0 ; i < texUnitState.length; i++) {		    if (texUnitState[i] != null) {			texUnitState[i].setInImmCtx(true);	    		    }		}	    }	    nc = ((AppearanceRetained)appearance.retained).texture;	    if (nc != null) {		nc.setInImmCtx(true);	    }	    nc = ((AppearanceRetained)appearance.retained).texCoordGeneration;	    if (nc != null) {		nc.setInImmCtx(true);	    }	    nc = ((AppearanceRetained)appearance.retained).textureAttributes;	    if (nc != null) {		nc.setInImmCtx(true);	    }	    nc = ((AppearanceRetained)appearance.retained).coloringAttributes;	    if (nc != null) {		nc.setInImmCtx(true);		red = ((ColoringAttributesRetained)nc).color.x;		green = ((ColoringAttributesRetained)nc).color.y;		blue = ((ColoringAttributesRetained)nc).color.z;	    }	    else {		red = 1.0f;		green = 1.0f;		blue = 1.0f;	    }	    nc = ((AppearanceRetained)appearance.retained).transparencyAttributes;	    if (nc != null) {		nc.setInImmCtx(true);		alpha = 1.0f - ((TransparencyAttributesRetained) nc).transparency;	    } else {		alpha = 1.0f;	    }	    nc = ((AppearanceRetained)appearance.retained).renderingAttributes;	    if (nc != null) {		nc.setInImmCtx(true);		visible = ((RenderingAttributesRetained)nc).visible;	    }	    else		visible = true;	    nc = ((AppearanceRetained)appearance.retained).polygonAttributes;	    if (nc != null) {		nc.setInImmCtx(true);		polygonMode = ((PolygonAttributesRetained)nc).polygonMode;	    }	    else {		polygonMode = PolygonAttributes.POLYGON_FILL;	    }	    nc = ((AppearanceRetained)appearance.retained).lineAttributes;	    if (nc != null) {		nc.setInImmCtx(true);		lineAA = ((LineAttributesRetained)nc).lineAntialiasing;	    }	    else {		lineAA = false;	    }	    nc = ((AppearanceRetained)appearance.retained).pointAttributes;	    if (nc != null) {		if (nc.source.isLive())		    nc.setInImmCtx(true);		pointAA = ((PointAttributesRetained)nc).pointAntialiasing;	    }	    else {		pointAA = false;	    }	    	    if (this.appearance != null) {		AppearanceRetained app = (AppearanceRetained)this.appearance.retained;		app.setInImmCtx(false);		if (app.material != null) {		    app.material.setInImmCtx(false);		}		if (app.texUnitState != null) {		    for (int i = 0; i < app.texUnitState.length; i++) {			if (app.texUnitState[0] != null)			    app.texUnitState[0].setInImmCtx(false);		    }		}		if (app.texture != null) {		    app.texture.setInImmCtx(false);		}		if (app.texCoordGeneration != null) {		    app.texCoordGeneration.setInImmCtx(false);		}		if (app.textureAttributes != null) {		    app.textureAttributes.setInImmCtx(false);		}		if (app.coloringAttributes != null) {		    app.coloringAttributes.setInImmCtx(false);		}		if (app.transparencyAttributes != null) {		    app.transparencyAttributes.setInImmCtx(false);		}		if (app.renderingAttributes != null) {		    app.renderingAttributes.setInImmCtx(false);		}		if (app.polygonAttributes != null) {		    app.polygonAttributes.setInImmCtx(false);		}		if (app.lineAttributes != null) {		    app.lineAttributes.setInImmCtx(false);		}		if (app.pointAttributes != null) {		    app.pointAttributes.setInImmCtx(false);		}	    }	    ((AppearanceRetained)appearance.retained).setInImmCtx(true);		}	this.appearance = appearance;    }