generateVolumes();
init();
    public void doRender(Renderer r) {        if (!renderShadows) {            renderScene(r);            return;        }                // init states        init();                // grab the shadowcasting lights        getShadowLights();                // grab the occluders        getOccluderMeshes();                // if no occluders or no shadow casting lights, just render the scene normally and return.        if (occluderMeshes.size() == 0 || shadowLights.size() == 0) {            //render normal            renderScene(r);            cleanup();            return;        } else {            // otherwise render an ambient pass by masking the diffuse and specular of shadowcasting lights.            if (lightingMethod == ADDITIVE) {                maskShadowLights(LightState.MASK_DIFFUSE | LightState.MASK_SPECULAR);                renderScene(r);                unmaskShadowLights();            } else {                renderScene(r);                            }        }        generateVolumes();        for (int l = shadowLights.size(); --l >= 0; ) {            Light light = (Light)shadowLights.get(l);            // Clear out the stencil buffer            r.clearStencilBuffer();                        saveEnforcedStates();            Spatial.enforceState(forTesting);            Spatial.enforceState(colorDisabled);            Spatial.enforceState(stencilFrontFaces);            Spatial.enforceState(cullBackFace);                        volumeNode.detachAllChildren();            addShadowVolumes(volumeNode, light);            volumeNode.updateGeometricState(0, false);            volumeNode.onDraw(r);            Spatial.enforceState(stencilBackFaces);            Spatial.enforceState(cullFrontFace);            volumeNode.onDraw(r);            Spatial.enforceState(colorEnabled);            Spatial.enforceState(blended);            Spatial.enforceState(noCull);            if (lightingMethod == ADDITIVE) {                Spatial.enforceState(stencilDrawWhenNotSet);                Spatial.enforceState(zbufferWriteLE);                r.clearZBuffer();                renderScene(r);            } else {                Spatial.enforceState(stencilDrawOnlyWhenSet);                Spatial.enforceState(zbufferAlways);                Spatial.enforceState(cullBackFace);                shadowColor.a = 1 - light.getAmbient().a;                shadowQuad.setDefaultColor(shadowColor);                r.setOrtho();                shadowQuad.draw(r);                r.unsetOrtho();            }            replaceEnforcedStates();        }                if (renderVolume) {            drawVolumes(r);        }                cleanup();    }