Package com.jme.light

Examples of com.jme.light.LightNode


        return new SharedDirectionLight(ambient, diffuse, specular, translation, direction, castShadows);
    }
   

    public LightNode toLightNode() {
        LightNode node = new LightNode();
        DirectionalLight light = new DirectionalLight();
        light.setAmbient(ambient);
        light.setDiffuse(diffuse);
        light.setSpecular(specular);
        light.setShadowCaster(castShadows);
        light.setDirection(direction);
       
        node.setLight(light);
        node.setLocalTranslation(translation);
       
        return node;
    }
View Full Code Here


               
               
               
                //CASE 1: edited light already exists in global lights
                if(globalLights.containsKey(key)) {
                    LightNode oldLightNode = globalLights.get(key);
                    LightNode freshLightNode = buildLightFromState(light);
                   
                    getRenderer().updateLight(oldLightNode, freshLightNode);
                    LOGGER.fine("UPDATING LIGHT: "+key);
                //CASE 2: edited light does not exist in global lights
                } else {
                    LOGGER.fine("ADDING LIGHT: "+key);
                    LightNode freshLight = buildLightFromState(light);
                    globalLights.put(key, freshLight);
                    getRenderer().addLight(key, freshLight);
                    //needs to be added anew.
                }
               
                //CASE 3: there are global lights that don't exist in shared map
                //hint #1: is the global lights length greater than the shared map?
                if(globalLights.size()  > sharedLightMap.size()) {
                    String lightToAdd = findALightToAdd();
                    if(lightToAdd != null) {
                       LightNode node = globalLights.get(lightToAdd);
                       LOGGER.fine("SHARING LIGHT: "+key);
                       sharedLightMap.put(lightToAdd,buildStateFromLight(node));
                    }
                }
               
View Full Code Here

          
        }
       
        private LightNode buildLightFromState(SharedDirectionLight state) {
            DirectionalLight light = new DirectionalLight();
            LightNode lightNode = new LightNode();
           
            light.setAmbient(state.getAmbient());
            light.setDiffuse(state.getDiffuse());
            light.setSpecular(state.getSpecular());
            light.setDirection(state.getDirection());
            light.setShadowCaster(state.isCastShadows());
            lightNode.setLight(light);
            lightNode.setLocalTranslation(state.getTranslation());
           
            return lightNode;
        }
View Full Code Here

        return true;
                   
    }
   
    public LightNode reconstructLight() {
        LightNode node = new LightNode();
        DirectionalLight light = new DirectionalLight();
       
        light.setAmbient(ambient);
        light.setDiffuse(diffuse);
        light.setSpecular(specular);
        light.setShadowCaster(castShadows);
        light.setDirection(direction);
       
        node.setLight(light);
        node.setLocalTranslation(position);
       
        return node;
    }
View Full Code Here

                LOGGER.fine("POPULATING LIGHTS WITH SHARED VALUES!");
                SharedMapCli smc = cell.getSharedLightMap();
                for(Map.Entry<String, SharedData> data:smc.entrySet()) {
                    LOGGER.fine("POPULATING LIGHT: "+data.getKey());
                    if (initialLights.containsKey(data.getKey())) {
                        LightNode node = initialLights.get(data.getKey());
                        SharedDirectionLight light = (SharedDirectionLight) data.getValue();

                        updateLight(node, buildLightFromState(light));
                    } else {
                        //there's a light in the shared map that isn't in the
View Full Code Here

        return status;
    }

    private LightNode buildLightFromState(SharedDirectionLight state) {
            DirectionalLight light = new DirectionalLight();
            LightNode lightNode = new LightNode();
           
            light.setAmbient(state.getAmbient());
            light.setDiffuse(state.getDiffuse());
            light.setSpecular(state.getSpecular());
            light.setDirection(state.getDirection());
            light.setShadowCaster(state.isCastShadows());
            lightNode.setLight(light);
            lightNode.setLocalTranslation(state.getTranslation());
           
            return lightNode;
        }
View Full Code Here

   
    /**
     * Add global lights
     */
    protected void addGlobalLights() {
        LightNode globalLight1;
        LightNode globalLight2;
        LightNode globalLight3;

        float radius = 75.0f;
        float lheight = 30.0f;
        float x = (float)(radius*Math.cos(Math.PI/6));
        float z = (float)(radius*Math.sin(Math.PI/6));
 
View Full Code Here

       

    }

    private LightNode createLight(float x, float y, float z) {
        LightNode lightNode = new LightNode();
        DirectionalLight light = new DirectionalLight();
        light.setDiffuse(new ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f));
        light.setAmbient(new ColorRGBA(0.1f, 0.1f, 0.1f, 1.0f));
        light.setSpecular(new ColorRGBA(0.4f, 0.4f, 0.4f, 1.0f));
        light.setEnabled(true);
        lightNode.setLight(light);
        lightNode.setLocalTranslation(x, y, z);
        light.setDirection(new Vector3f(-x, -y, -z));
        return (lightNode);
    }
View Full Code Here

TOP

Related Classes of com.jme.light.LightNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.