Package com.jme3.light

Examples of com.jme3.light.PointLight


        checkTopNode("node");

        String lightType = parseString(attribs.getValue("type"), "point");
        if (lightType.equals("point")) {
            light = new PointLight();
        } else if (lightType.equals("directional") || lightType.equals("sun")) {
            light = new DirectionalLight();
            // Assuming "normal" property is not provided
            ((DirectionalLight) light).setDirection(Vector3f.UNIT_Z);
        } else if (lightType.equals("spotLight") || lightType.equals("spot")) {
View Full Code Here


                    Quaternion q = node.getWorldRotation();
                    Vector3f dir = dl.getDirection();
                    q.multLocal(dir);
                    dl.setDirection(dir);
                } else if (light instanceof PointLight) {
                    PointLight pl = (PointLight) light;
                    Vector3f pos = node.getWorldTranslation();
                    pl.setPosition(pos);
                } else if (light instanceof SpotLight) {
                    SpotLight sl = (SpotLight) light;

                    Vector3f pos = node.getWorldTranslation();
                    sl.setPosition(pos);
View Full Code Here

  }

  @Override
  public void internalLoadSceneObject() {
    sceneObject = GlobalObjectStore.<AssetManager>getObject(AssetManager.class).loadModel("ship/glider/Hull.mesh.xml");
    sceneObject.addLight(new PointLight());
    sceneObject.setName("PlayerShip");

    // TODO: ship: Gr��e laden
    CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1f, 2f);
    rbc = new RigidBodyControl(capsuleShape, 1f);
View Full Code Here

        }
    }

    public Viewer() {
        super();
        this.cameraLight = new PointLight();
        this.cameraLight.setColor(ColorRGBA.White);
        this.cameraLight.setRadius(10f);
        this.sunLight = new DirectionalLight();
        this.sunLight.setColor(ColorRGBA.White);
        this.sunLight.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
View Full Code Here

    public void simpleInitApp() {
        Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", b);
        geom.updateModelBound();

        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
        mat.setColor("m_Color", ColorRGBA.Blue);
        geom.setMaterial(mat);

        rootNode.attachChild(geom);
    }
View Full Code Here

  for(int i = 0; i < node.getQuantity(); i++){
      Spatial spatial = node.getChild(i);
      if(spatial instanceof Geometry){
                //Material material = new Material();
                AssetManager assetManager = JmeSystem.newAssetManager(Thread.currentThread().getContextClassLoader().getResource("com/jme3/asset/Desktop.cfg"));
                Material material = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
                material.setColor("m_Color",color);
                //Material geomMaterial = ((Geometry)spatial).getMaterial();
                spatial.setMaterial(material);
                System.out.println("Spatial: "+spatial.getName());
      }else if(spatial instanceof Node){
    setColor((Node)spatial,color);
View Full Code Here

     * Note, this is a recursive method.
     * @param node the node that contains children
     **/
    private void setColor(Geometry geometry, ColorRGBA color){
        AssetManager assetManager = JmeSystem.newAssetManager(Thread.currentThread().getContextClassLoader().getResource("com/jme3/asset/Desktop.cfg"));
        Material material = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
        material.setColor("m_Color",color);
        geometry.setMaterial(material);
        System.out.println("Spatial: "+geometry.getName());
    }
View Full Code Here

  private Geometry atmo;

  @Override
  public void simpleInitApp() {
    Sphere atmoSphere = new Sphere(48, 48, radius, false, true);
    mat = new Material(assetManager, "MatDefs/SimpleAtmoshere.j3md");
   
    mat.setFloat("radius", radius);
    atmo = new Geometry("atmo_Planet", atmoSphere);
   
    Vector3f pos = new Vector3f(5,0,0);
    atmo.setLocalTranslation(pos);
    mat.setVector3("v3Center", pos);
   
   
    atmo.setMaterial(mat);
      rootNode.attachChild(atmo);
     
      Sphere planetSphere = new Sphere(48, 48, radius * 0.8f);
      Material planteMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
      planteMat.setColor("Color", ColorRGBA.Green);
      Geometry planet = new Geometry("geo_Planet", planetSphere);
      planet.setLocalTranslation(pos);
      planet.setMaterial(planteMat);
      rootNode.attachChild(planet);
     
View Full Code Here

  @Override
  public void simpleUpdate(float tpf) {
    super.simpleUpdate(tpf);
   
    Vector3f camLocation = getCamera().getLocation();
    Material newMat = mat;
   
    Vector3f planetLocation = Vector3f.ZERO;
   
    newMat.setVector3("v3CameraPos", camLocation);
    /*
    float maxCamDistance = radius + planetLocation.subtract(camLocation).length();
    newMat.setFloat("maxCamDistance", maxCamDistance);
    float camToCenter = planetLocation.subtract(camLocation).length();
    newMat.setFloat("minCamDistance", FastMath.sqrt(camToCenter*camToCenter + radius*radius));
 
View Full Code Here

    @Override
    public void simpleInitApp() {
        Spatial teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
      
        teapot.setLocalScale(2f);
        Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
        mat.setFloat("m_Shininess", 32f);
        mat.setBoolean("m_UseMaterialColors", true);

        mat.setColor("m_Ambient",  ColorRGBA.Black);
        mat.setColor("m_Diffuse",  ColorRGBA.Green);
        mat.setColor("m_Specular", ColorRGBA.Red);
       
        teapot.setMaterial(mat);
        rootNode.attachChild(teapot);

        lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
View Full Code Here

TOP

Related Classes of com.jme3.light.PointLight

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.