Package org.jdesktop.wonderland.modules.sharedstate.client

Examples of org.jdesktop.wonderland.modules.sharedstate.client.SharedMapCli


    }
   
    class SharedListener implements SharedMapListenerCli {

        public void propertyChanged(SharedMapEventCli event) {
            SharedMapCli map = event.getMap();
            if(map.getName().equals("state")) {
                //handle change in state here.
//                logger.warning("ACTIVE SKYBOX CHANGED TO: "+event.getNewValue().toString());
            } else if(map.getName().equals("lights")) {
                String key = event.getPropertyName();
                SharedDirectionLight light = (SharedDirectionLight)event.getNewValue();
               
               
               
                //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));
                    }
                }
               
//                getRenderer().addLight(key, buildLightFromState(light));
            } else if(map.getName().equals("skyboxes")) {
                LOGGER.fine("Skybox sync request!");
                handleSkyboxes(stateMap.getString("active"),map);
            }
          
        }
View Full Code Here


//                addLightToRenderer(value);
//            }
           
            if(cell.getSharedLightMap() != null) {
                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();
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.sharedstate.client.SharedMapCli

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.