MinieExamples/src/main/java/jme3utilities/minie/test/TestSoftBody.java
/**
     * Add lighting and shadows to the specified scene.
     *
     * @param rootSpatial which scene (not null)
     * @param shadowFlag if true, add a shadow renderer to the default viewport
     */
Add lighting and shadows to the specified scene.

@param rootSpatial which scene (not null)
@param shadowFlag if true, add a shadow renderer to the default viewport
Add lighting and shadows to the specified scene . @param rootSpatial which scene ( not null ) @param shadowFlag if true add a shadow renderer to the default viewport
private void addLighting(Spatial rootSpatial, boolean shadowFlag) {
        ColorRGBA ambientColor = new ColorRGBA(0.1f, 0.1f, 0.1f, 1f);
        AmbientLight ambient = new AmbientLight(ambientColor);
        rootSpatial.addLight(ambient);
        ambient.setName("ambient");
        ColorRGBA directColor = new ColorRGBA(0.7f, 0.7f, 0.7f, 1f);
        Vector3f direction = new Vector3f(1f, -2f, -2f).normalizeLocal();
        DirectionalLight sun = new DirectionalLight(direction, directColor);
        rootSpatial.addLight(sun);
        sun.setName("sun");
        rootSpatial.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
        if (shadowFlag) {
            int mapSize = 2_048; 
            int numSplits = 3;
            DirectionalLightShadowRenderer dlsr
                    = new DirectionalLightShadowRenderer(assetManager, mapSize,
                            numSplits);
            dlsr.setLight(sun);
            dlsr.setShadowIntensity(0.5f);
            viewPort.addProcessor(dlsr);
        }
    }
private void addLighting ( Spatial rootSpatial , boolean shadowFlag ) { ColorRGBA ambientColor = new ColorRGBA ( 0.1f , 0.1f , 0.1f , 1f ) ; AmbientLight ambient = new AmbientLight ( ambientColor ) ; rootSpatial . addLight ( ambient ) ; ambient . setName ( "ambient" ) ; ColorRGBA directColor = new ColorRGBA ( 0.7f , 0.7f , 0.7f , 1f ) ; Vector3f direction = new Vector3f ( 1f , - 2f , - 2f ) . normalizeLocal ( ) ; DirectionalLight sun = new DirectionalLight ( direction , directColor ) ; rootSpatial . addLight ( sun ) ; sun . setName ( "sun" ) ; rootSpatial . setShadowMode ( RenderQueue . ShadowMode . CastAndReceive ) ; if ( shadowFlag ) { int mapSize = 2_048 ; int numSplits = 3 ; DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer ( assetManager , mapSize , numSplits ) ; dlsr . setLight ( sun ) ; dlsr . setShadowIntensity ( 0.5f ) ; viewPort . addProcessor ( dlsr ) ; } }
Add lighting and shadows to the specified scene.
Add lighting and shadows to the specified scene .
// in pixels
