Examples of GLMaterial


Examples of org.mt4j.util.opengl.GLMaterial

    MTLight.enableLightningAndAmbient(mtApplication, 150, 150, 150, 255);
    //Create a light source //I think GL_LIGHT0 is used by processing!
    MTLight light = new MTLight(mtApplication, GL.GL_LIGHT3, new Vector3D(0,-300,0));
   
    //Set up a material to react to the light
    GLMaterial material = new GLMaterial(Tools3D.getGL(mtApplication));
    material.setAmbient(new float[]{ .5f, .5f, .5f, 1f });
    material.setDiffuse(new float[]{ .8f, .8f, .8f, 1f } );
    material.setEmission(new float[]{ .0f, .0f, .0f, 1f });
    material.setSpecular(new float[]{ 0.9f, 0.9f, 0.9f, 1f })// almost white: very reflective
    material.setShininess(110);// 0=no shine,  127=max shine
   
    //Group used to move to the screen center and to put the mesh group in
    MTComponent group1 = new MTComponent(mtApplication);
   
    //Create a group and set the light for the whole mesh group ->better for performance than setting light to more comps
View Full Code Here

Examples of org.mt4j.util.opengl.GLMaterial

    //Create a light source //I think GL_LIGHT0 is used by processing!
//    MTLight light = new MTLight(pa, GL.GL_LIGHT3, new Vector3D(0,0,0));
    MTLight light = new MTLight(pa, GL.GL_LIGHT3, new Vector3D(pa.width/5f,-pa.height/10f,0));
   
    //Set up a material to react to the light
    GLMaterial material = new GLMaterial(Tools3D.getGL(pa));
    material.setAmbient(new float[]{ .1f, .1f, .1f, 1f });
    material.setDiffuse(new float[]{ 1.0f, 1.0f, 1.0f, 1f } );
    material.setEmission(new float[]{ .0f, .0f, .0f, 1f });
    material.setSpecular(new float[]{ 1.0f, 1.0f, 1.0f, 1f })// almost white: very reflective
    material.setShininess(127);// 0=no shine,  127=max shine
   
    //Create the earth
    earth = new MTSphere(pa, "earth", 40, 40, 80, TextureMode.Projected); //TextureMode.Polar);
    earth.setLight(light);
    earth.setMaterial(material);
View Full Code Here

Examples of org.mt4j.util.opengl.GLMaterial

  }
 
 
  public static GLMaterial createDefaultGLMaterial(PApplet app){
    //Set up a material
    GLMaterial material = new GLMaterial(Tools3D.getGL(app));
    material.setAmbient(new float[]{ .2f, .2f, .2f, 1f });
    material.setDiffuse(new float[]{ .8f, .8f, .8f, 1f } );
    material.setEmission(new float[]{ .0f, .0f, .0f, 1f });
    material.setSpecular(new float[]{ 1.0f, 1.0f, 1.0f, 1f })// almost white: very reflective
    material.setShininess(110);// 0=no shine,  127=max shine
    return material;
  }
View Full Code Here

Examples of org.mt4j.util.opengl.GLMaterial

      ObjectFileMaterial p = null;

      if ((DEBUG & 1) != 0)
        System.out.println("Color " + matName);
     
      GLMaterial m = new GLMaterial(gl);
      p = (ObjectFileMaterial)materials.get(matName);
//      Appearance a = new Appearance();

      if (p != null) {
       
        // Set ambient & diffuse color
        if (p.Ka != null)
//          m.setAmbient(p.Ka);
          m.setAmbient(new float[]{p.Ka[0],p.Ka[1],p.Ka[2], 1.0f}); //we have to add the last value, else material will not be opaque
       
        if (p.Kd != null)
//          m.setDiffuse(p.Kd);
          m.setDiffuse(new float[]{p.Kd[0],p.Kd[1],p.Kd[2], 1.0f});

        // Set specular color
        if ((p.Ks != null) && (p.illum != 1))
//          m.setSpecular(p.Ks);
          m.setSpecular(new float[]{p.Ks[0],p.Ks[1],p.Ks[2], 1.0f});
        else if (p.illum == 1)
          m.setSpecular(new float[]{0.0f, 0.0f, 0.0f, 1.0f});

//      if (p.illum >= 1) m.setLightingEnable(true);
//      else if (p.illum == 0) m.setLightingEnable(false);

        if (p.Ns != -1.0f)
          m.setShininess(p.Ns);
       

        if (p.t != null) {
          PImage tex = p.t;
         
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.