Package com.jme3.texture

Examples of com.jme3.texture.Image


    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

        eyesRV.add("Models/Eyes/Eye1R.j3o");
    }
    private void setupColors(){
  // setup skin colors
  skinColorV = new Vector<ColorRGBA>();
  skinColorV.add(new ColorRGBA(0.941f,0.859f,0.808f,1.0f));
  skinColorV.add(new ColorRGBA(0.965f,0.788f,0.580f,1.0f));
  skinColorV.add(new ColorRGBA(0.871f,0.627f,0.384f,1.0f));
  skinColorV.add(new ColorRGBA(0.957f,0.741f,0.616f,1.0f));
  skinColorV.add(new ColorRGBA(0.647f,0.380f,0.220f,1.0f));
  skinColorV.add(new ColorRGBA(0.376f,0.243f,0.145f,1.0f));
  // pants
  pantsColor = new ColorRGBA(0.05f,0.05f,0.05f,1f);
  // favorite colors
  favoriteColorV = new Vector<ColorRGBA>();
  favoriteColorV.add(new ColorRGBA(0.820f,0.282f,0.153f,1.0f));
  favoriteColorV.add(new ColorRGBA(0.953f,0.600f,0.282f,1.0f));
  favoriteColorV.add(new ColorRGBA(0.941f,0.812f,0.251f,1.0f));
  favoriteColorV.add(new ColorRGBA(0.643f,0.745f,0.216f,1.0f));
  favoriteColorV.add(new ColorRGBA(0.157f,0.447f,0.235f,1.0f));
  favoriteColorV.add(new ColorRGBA(0.133f,0.275f,0.651f,1.0f));
  favoriteColorV.add(new ColorRGBA(0.424f,0.651f,0.831f,1.0f));
  favoriteColorV.add(new ColorRGBA(0.961f,0.537f,0.537f,1.0f));
  favoriteColorV.add(new ColorRGBA(0.451f,0.224f,0.671f,1.0f));
  favoriteColorV.add(new ColorRGBA(0.463f,0.353f,0.231f,1.0f));
  favoriteColorV.add(new ColorRGBA(0.824f,0.824f,0.824f,1.0f));
  favoriteColorV.add(new ColorRGBA(0.263f,0.263f,0.263f,1.0f));

  //ColorV.add(new ColorRGBA(0.f,0.f,0.f,1.0f));
  //You can also use new ColorRGBA(0.0,1.0,0.0,1.0).
    }
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 {
        if (on) {
View Full Code Here

  }
 
  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) {
          rootNode.addLight(al);
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

TOP

Related Classes of com.jme3.texture.Image

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.