Package com.jme3.light

Examples of com.jme3.light.SpotLight


    });
  }
 
  public void setAmbientLight(final boolean on) {
    if (al == null) {
      al = new AmbientLight();
      al.setColor(new ColorRGBA(1.0f, 0.92f, 0.75f, 1f));
    }
    this.enqueue(new Callable<Integer>(){
      public Integer call() throws Exception {
        if (on) {
View Full Code Here


    //addEntity(ship);
   
   
   
    //addEntity(new RoidField("Roids", "Models/RoidField/Roid.mesh.xml"));
    AmbientLight al = new AmbientLight();
    al.setColor(ColorRGBA.White.mult(0.5f));
    mapNode.addLight(al);
   
   
    /*
    DirectionalLight sun = new DirectionalLight();
View Full Code Here

  }
 
  public void setDirectionalLight(final boolean on) {
    if (dl == null) {
      Vector3f lightDir = new Vector3f(-0.8719428f, -0.46824604f, 0.14304268f);
      dl = new DirectionalLight();
      dl.setColor(new ColorRGBA(1.0f, 0.92f, 0.75f, 1f));
      dl.setDirection(lightDir);

      Vector3f lightDir2 = new Vector3f(0.70518064f, 0.5902297f, -0.39287305f);
      dl2 = new DirectionalLight();
      dl2.setColor(new ColorRGBA(0.7f, 0.85f, 1.0f, 1f));
      dl2.setDirection(lightDir2);
    }
    this.enqueue(new Callable<Integer>(){
      public Integer call() throws Exception {
View Full Code Here

      }
    });
  }
 
  private PointLight getPointLight() {
    PointLight ll = new PointLight();
    ll.setColor(new ColorRGBA(1.0f, 0.92f, 0.75f, 1f));
    ll.setRadius(20f);
    return ll;
  }
View Full Code Here

        lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
        lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
        lightMdl.getMesh().setStatic();
        rootNode.attachChild(lightMdl);

        pl = new PointLight();
        pl.setColor(ColorRGBA.White);
        //pl.setRadius(3f);
        rootNode.addLight(pl);
    }
View Full Code Here

                        glLightf(glLightIndex, GL_QUADRATIC_ATTENUATION, 0);
                    }

                    break;
                case Spot:
                    SpotLight sLight = (SpotLight) 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 = sLight.getPosition();
                    fb16.clear();
                    fb16.put(pos.x).put(pos.y).put(pos.z).put(1.0f).flip();
                    glLight(glLightIndex, GL_POSITION, fb16);

                    Vector3f dir = sLight.getDirection();
                    fb16.clear();
                    fb16.put(dir.x).put(dir.y).put(dir.z).put(1.0f).flip();
                    glLight(glLightIndex, GL_SPOT_DIRECTION, fb16);

                    float outerAngleRad = sLight.getSpotOuterAngle();
                    float innerAngleRad = sLight.getSpotInnerAngle();
                    float spotCut = outerAngleRad * FastMath.RAD_TO_DEG;
                    float spotExpo = 0.0f;
                    if (outerAngleRad > 0) {
                        spotExpo = (1.0f - (innerAngleRad / outerAngleRad)) * 128.0f;
                    }

                    glLightf(glLightIndex, GL_SPOT_CUTOFF, spotCut);
                    glLightf(glLightIndex, GL_SPOT_EXPONENT, spotExpo);

                    if (sLight.getSpotRange() > 0) {
                        glLightf(glLightIndex, GL_LINEAR_ATTENUATION, sLight.getInvSpotRange());
                    }else{
                        glLightf(glLightIndex, GL_LINEAR_ATTENUATION, 0);
                    }

                    break;
View Full Code Here

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

        if (!(light instanceof SpotLight)) {
            throw new SAXException("dotScene parse error: spotLightRange "
                    + "can only appear under 'spot' light elements");
        }

        SpotLight sl = (SpotLight) light;
        sl.setSpotInnerAngle(inner * 0.5f);
        sl.setSpotOuterAngle(outer * 0.5f);
    }
View Full Code Here

        } 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")) {
            light = new SpotLight();
        } else if (lightType.equals("omni")) {
            // XXX: It doesn't seem any exporters actually emit this type?
            light = new AmbientLight();
        } else {
            logger.log(Level.WARNING, "No matching jME3 LightType found for OGRE LightType: {0}", lightType);
View Full Code Here

                } 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);

                    Quaternion q = node.getWorldRotation();
                    Vector3f dir = sl.getDirection();
                    q.multLocal(dir);
                    sl.setDirection(dir);
                }
            }
            light = null;
        }
        checkTopNode(qName);
View Full Code Here

TOP

Related Classes of com.jme3.light.SpotLight

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.