Package com.jme3.light

Examples of com.jme3.light.DirectionalLight


    tm.update(cam.getLocation());
      rootNode.attachChild(debugNodes);
        rootNode.attachChild(bboxes);
        rootNode.attachChild(navs);

        DirectionalLight light = new DirectionalLight();
        light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize());
        rootNode.addLight(light);

        AmbientLight ambLight = new AmbientLight();
        ambLight.setColor(new ColorRGBA(0.2f, 0.2f, 0.2f, 1f));
        rootNode.addLight(ambLight);
View Full Code Here


   
    if(sky == null)
      sky = SkyFactory.createSky(Singleton.get().getAssetManager().getJmeAssetMan(),"models/textures/sky_povray1.jpg", true);
        Singleton.get().getSceneManager().changeCharNode(sky,Action.ADD);
       
        skyLight = new DirectionalLight();
        skyLight.setColor(new ColorRGBA(0.8f, 0.75f, 0.8f, 1f));
    Singleton.get().getSceneManager().changeRootLight(skyLight, Action.ADD);
   
//    //TODO should be not here
//        DirectionalLightShadowFilter dlsf = new DirectionalLightShadowFilter(assetManager, 2048, 3);
View Full Code Here

 
  public void addSkyDome(Camera cam, int timeOffset){
    if(sky == null)
      sky = new Node("Sky");
   
    skyLight = new DirectionalLight();
    skyLight.setColor(new ColorRGBA(1f, 1f, 1f, 1f));
    Singleton.get().getSceneManager().changeRootLight(skyLight, Action.ADD);
   
    AssetManager assetManager = Singleton.get().getAssetManager().getJmeAssetMan();
    com.l2client.util.SkyDome skyControl = new com.l2client.util.SkyDome(assetManager, cam);
View Full Code Here

        ninja.scale(0.05f, 0.05f, 0.05f);
        ninja.rotate(0.0f, -3.0f, 0.0f);
        ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);
        rootNode.attachChild(ninja);
        /** You must add a light to make the model visible */
        DirectionalLight sun = new DirectionalLight();
        sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
        rootNode.addLight(sun);
       
      AnimControl c = (AnimControl)rootNode.getChild(0).getControl(0);
      c.createChannel();
      final JMESimpleController con = new JMESimpleController(c);
View Full Code Here

            glEnable(glLightIndex);
           
            // OGL spec states default value for light ambient is black
            switch (lightType){
                case Directional:
                    DirectionalLight dLight = (DirectionalLight) light;

                    fb16.clear();
                    fb16.put(col.r).put(col.g).put(col.b).put(col.a).flip();
                    glLight(glLightIndex, GL_DIFFUSE, fb16);
                    glLight(glLightIndex, GL_SPECULAR, fb16);

                    pos = tempVec.set(dLight.getDirection()).negateLocal().normalizeLocal();
                    fb16.clear();
                    fb16.put(pos.x).put(pos.y).put(pos.z).put(0.0f).flip();
                    glLight(glLightIndex, GL_POSITION, fb16);
                    glLightf(glLightIndex, GL_SPOT_CUTOFF, 180);
                    break;
View Full Code Here

            Vector3f vecDiff = vars.vect1.set(pLight.getPosition()).subtractLocal(spatial.getWorldTranslation());
            spatial.setLocalTranslation(vecDiff.addLocal(spatial.getLocalTranslation()));
        }

        if (light instanceof DirectionalLight) {
            DirectionalLight dLight = (DirectionalLight) light;
            vars.vect1.set(dLight.getDirection()).multLocal(-1.0f);
            Vector3f vecDiff = vars.vect1.subtractLocal(spatial.getWorldTranslation());
            spatial.setLocalTranslation(vecDiff.addLocal(spatial.getLocalTranslation()));
        }
        vars.release();
        //TODO add code for Spot light here when it's done
View Full Code Here

    super.initialize(stateManager, app);

    viewPort.setBackgroundColor(backgroundColor);

    // Must add a light to make the lit object visible!
    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(1, -5, -2).normalizeLocal());
    sun.setColor(ColorRGBA.White);
    localRootNode.addLight(sun);

    // create floor
    Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    material.setTexture("ColorMap", assetManager.loadTexture("Textures/concrete_cracked.jpeg"));
View Full Code Here

                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) {
View Full Code Here

    shiny_rock.setLocalTranslation(0, 2, -2); // Move it a bit
    shiny_rock.rotate(1.6f, 0, 0); // Rotate it a bit
    rootNode.attachChild(shiny_rock);

    /** Must add a light to make the lit object visible! */
    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(1, 0, -2).normalizeLocal());
    sun.setColor(ColorRGBA.White);
    rootNode.addLight(sun);
  }
View Full Code Here

    // We add light so we see the scene
    AmbientLight al = new AmbientLight();
    al.setColor(ColorRGBA.White.mult(1.3f));
    rootNode.addLight(al);

    DirectionalLight dl = new DirectionalLight();
    dl.setColor(ColorRGBA.White);
    dl.setDirection(new Vector3f(2.8f, -2.8f, -2.8f).normalizeLocal());
    rootNode.addLight(dl);
  }
View Full Code Here

TOP

Related Classes of com.jme3.light.DirectionalLight

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.