forTesting = DisplaySystem.getDisplaySystem().getRenderer() .createZBufferState(); forTesting.setWritable(false); forTesting.setFunction(ZBufferState.CF_LEQUAL); forTesting.setEnabled(true);
zbufferWriteLE = r.createZBufferState(); zbufferWriteLE.setWritable(true); zbufferWriteLE.setFunction(ZBufferState.CF_LEQUAL); zbufferWriteLE.setEnabled(true);
    protected void init() {        if (initialised)            return;                initialised = true;                highlightMaterial = DisplaySystem.getDisplaySystem().getRenderer()                .createMaterialState();        highlightMaterial.setEmissive(new ColorRGBA(0.3f, 0.6f, 0.7f, 1f));        highlightMaterial.setAmbient(new ColorRGBA(0.3f, 0.6f, 0.7f, 1f));        highlightMaterial.setEnabled(true);        zbufferWriteLE = DisplaySystem.getDisplaySystem().getRenderer()                .createZBufferState();        zbufferWriteLE.setWritable(true);        zbufferWriteLE.setFunction(ZBufferState.CF_LEQUAL);        zbufferWriteLE.setEnabled(true);        zbufferAlways = DisplaySystem.getDisplaySystem().getRenderer()                .createZBufferState();        zbufferAlways.setWritable(false);        zbufferAlways.setFunction(ZBufferState.CF_ALWAYS);        zbufferAlways.setEnabled(true);        forTesting = DisplaySystem.getDisplaySystem().getRenderer()                .createZBufferState();        forTesting.setWritable(false);        forTesting.setFunction(ZBufferState.CF_LEQUAL);        forTesting.setEnabled(true);        noStencil = DisplaySystem.getDisplaySystem().getRenderer()                .createStencilState();        noStencil.setEnabled(false);        stencilFrontFaces = DisplaySystem.getDisplaySystem().getRenderer()                .createStencilState();        stencilFrontFaces.setEnabled(true);        stencilFrontFaces.setStencilMask(0);        stencilFrontFaces.setStencilFunc(StencilState.SF_ALWAYS);        stencilFrontFaces.setStencilOpFail(StencilState.SO_KEEP);        stencilFrontFaces.setStencilOpZFail(StencilState.SO_KEEP);        stencilFrontFaces.setStencilOpZPass(StencilState.SO_INCR);        stencilBackFaces = DisplaySystem.getDisplaySystem().getRenderer()                .createStencilState();        stencilBackFaces.setEnabled(true);        stencilBackFaces.setStencilMask(0);        stencilBackFaces.setStencilFunc(StencilState.SF_ALWAYS);        stencilBackFaces.setStencilOpFail(StencilState.SO_KEEP);        stencilBackFaces.setStencilOpZFail(StencilState.SO_KEEP);        stencilBackFaces.setStencilOpZPass(StencilState.SO_DECR);        stencilDrawOnlyWhenSet = DisplaySystem.getDisplaySystem().getRenderer()                .createStencilState();        stencilDrawOnlyWhenSet.setEnabled(true);        stencilDrawOnlyWhenSet.setStencilMask(-1);        stencilDrawOnlyWhenSet.setStencilFunc(StencilState.SF_NOTEQUAL);        stencilDrawOnlyWhenSet.setStencilOpFail(StencilState.SO_KEEP);        stencilDrawOnlyWhenSet.setStencilOpZFail(StencilState.SO_KEEP);        stencilDrawOnlyWhenSet.setStencilOpZPass(StencilState.SO_KEEP);        stencilDrawOnlyWhenSet.setStencilRef(0);        stencilDrawWhenNotSet = DisplaySystem.getDisplaySystem().getRenderer()                .createStencilState();        stencilDrawWhenNotSet.setEnabled(true);        stencilDrawWhenNotSet.setStencilMask(-1);        stencilDrawWhenNotSet.setStencilFunc(StencilState.SF_EQUAL);        stencilDrawWhenNotSet.setStencilOpFail(StencilState.SO_KEEP);        stencilDrawWhenNotSet.setStencilOpZFail(StencilState.SO_KEEP);        stencilDrawWhenNotSet.setStencilOpZPass(StencilState.SO_KEEP);        stencilDrawWhenNotSet.setStencilRef(0);        cullFrontFace = DisplaySystem.getDisplaySystem().getRenderer()                .createCullState();        cullFrontFace.setEnabled(true);        cullFrontFace.setCullMode(CullState.CS_FRONT);        noCull = DisplaySystem.getDisplaySystem().getRenderer()                .createCullState();        noCull.setEnabled(false);        cullBackFace = DisplaySystem.getDisplaySystem().getRenderer()                .createCullState();        cullBackFace.setEnabled(true);        cullBackFace.setCullMode(CullState.CS_BACK);        blended = DisplaySystem.getDisplaySystem().getRenderer()                .createAlphaState();        blended.setEnabled(true);        blended.setBlendEnabled(true);        colorEnabled = DisplaySystem.getDisplaySystem().getRenderer()                .createColorMaskState();        colorEnabled.setAll(true);        colorDisabled = DisplaySystem.getDisplaySystem().getRenderer()                .createColorMaskState();        colorDisabled.setAll(false);        volumeNode.setRenderQueueMode(Renderer.QUEUE_SKIP);        volumeNode.updateRenderState();        shadowQuad = new Quad("RenderForeground", DisplaySystem                .getDisplaySystem().getRenderer().getWidth(), DisplaySystem                .getDisplaySystem().getRenderer().getHeight());        shadowQuad.setLocalTranslation(new Vector3f(DisplaySystem                .getDisplaySystem().getRenderer().getWidth() / 2, DisplaySystem                .getDisplaySystem().getRenderer().getHeight() / 2, 0));        shadowQuad.setRenderQueueMode(Renderer.QUEUE_SKIP);        shadowQuad.updateGeometricState(0, true);        shadowQuad.updateRenderState();    }