Examples of LightNode


Examples of ca.eandb.jmist.framework.path.LightNode

  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.Light#emit(ca.eandb.jmist.framework.color.WavelengthPacket, ca.eandb.jmist.framework.Random)
   */
  public final ScatteredRay emit(WavelengthPacket lambda, Random rnd) {
    PathInfo path = new PathInfo(lambda);
    LightNode node = sample(path, rnd.next(), rnd.next(), rnd.next());
    return node.sample(rnd.next(), rnd.next(), rnd.next());
  }
View Full Code Here

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

Examples of com.jme.light.LightNode

               
               
               
                //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

Examples of com.jme.light.LightNode

          
        }
       
        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

Examples of com.jme.light.LightNode

        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

Examples of com.jme.light.LightNode

                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

Examples of com.jme.light.LightNode

        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

Examples of com.jme.light.LightNode

   
    /**
     * 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

Examples of com.jme.light.LightNode

       

    }

    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

Examples of com.jme3.scene.LightNode

    public LightHelper(String blenderVersion, BlenderContext blenderContext) {
        super(blenderVersion, blenderContext);
    }

    public LightNode toLight(Structure structure, BlenderContext blenderContext) throws BlenderFileException {
        LightNode result = (LightNode) blenderContext.getLoadedFeature(structure.getOldMemoryAddress(), LoadedFeatureDataType.LOADED_FEATURE);
        if (result != null) {
            return result;
        }
        Light light = null;
        int type = ((Number) structure.getFieldValue("type")).intValue();
        switch (type) {
            case 0:// Lamp
                light = new PointLight();
                float distance = ((Number) structure.getFieldValue("dist")).floatValue();
                ((PointLight) light).setRadius(distance);
                break;
            case 1:// Sun
                LOGGER.log(Level.WARNING, "'Sun' lamp is not supported in jMonkeyEngine.");
                break;
            case 2:// Spot
                light = new SpotLight();
                // range
                ((SpotLight) light).setSpotRange(((Number) structure.getFieldValue("dist")).floatValue());
                // outer angle
                float outerAngle = ((Number) structure.getFieldValue("spotsize")).floatValue() * FastMath.DEG_TO_RAD * 0.5f;
                ((SpotLight) light).setSpotOuterAngle(outerAngle);

                // inner angle
                float spotblend = ((Number) structure.getFieldValue("spotblend")).floatValue();
                spotblend = FastMath.clamp(spotblend, 0, 1);
                float innerAngle = outerAngle * (1 - spotblend);
                ((SpotLight) light).setSpotInnerAngle(innerAngle);
                break;
            case 3:// Hemi
                LOGGER.log(Level.WARNING, "'Hemi' lamp is not supported in jMonkeyEngine.");
                break;
            case 4:// Area
                light = new DirectionalLight();
                break;
            default:
                throw new BlenderFileException("Unknown light source type: " + type);
        }
        if (light != null) {
            float r = ((Number) structure.getFieldValue("r")).floatValue();
            float g = ((Number) structure.getFieldValue("g")).floatValue();
            float b = ((Number) structure.getFieldValue("b")).floatValue();
            light.setColor(new ColorRGBA(r, g, b, 1.0f));
            result = new LightNode(null, light);
        }
        return result;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.