Package nu3a.material.color

Examples of nu3a.material.color.N3ColorRGBA


    N3JDKImageLoader loader = new N3JDKImageLoader(is);
    N3Texture2D texture = new N3Texture2D(scene, "textura1");
    texture.genTexture(loader, render);
    material.addTexture(texture);
    material.setAmbientColor(new N3ColorRGBA(1, 1, 1));
    material.setDiffuseColor(new N3ColorRGBA(1, 1, 1));
    material.setSpecularColor(new N3ColorRGBA(0.2f, 0.2f, 0.2f), 0.5f);
    material.applyMaterial(true);
  }
View Full Code Here


     * grpScene | | ----------------------- camera1trans light01Trans | | |
     * | | sueloRot cubeTrans sphereTrans camera1 light01 | | |
     * (*)sueloTrans | | | | | (*) suelo cube sphere
     */
    N3GroupNode root = scene.getHierarchyRoot();
    scene.setAmbientalLight(new N3ColorRGBA(0f, 0f, 0f));

    grpScene = new N3GroupNode(scene, "grpScene");

    N3TransformationNode sueloRot = new N3TransformationNode(scene, "sueloRot");
    N3TransformationNode sueloTrans;
    sueloRot.rotate(-90.0f, new N3Vector3D(1.0f, 0, 0));
    sueloRot.update();
    N3GeometryData g = N3GeometryData.createPlane(0.4f, 0.4f, new N3ColorRGBA(1, 0, 0), false);
    N3Material sm = new N3Material(scene, "rojo");
    sm.setAmbientColor(new N3ColorRGBA(1, 0, 0));
    sm.setSpecularColor(new N3ColorRGBA(0, 0, 0), 0.1f);
    sm.setDiffuseColor(new N3ColorRGBA(1, 0, 0));
    sm.applyMaterial(true);
    for (int i = -5; i < 4; i++)
      for (int j = -5; j < 4; j++) {
        sueloTrans = new N3TransformationNode(scene, "sueloTrans" + i + "-" + j);
        sueloTrans.translate(new N3Vector3D(i * 0.4f, j * 0.4f, 0));
        sueloTrans.update();
        suelo = new N3VisualMesh(scene, g, "suelo" + i + "-" + j);
        suelo.setMaterial(sm);
        sueloTrans.addChild(suelo);
        sueloRot.addChild(sueloTrans);
      }

    cubeTrans = new N3TransformationNode(scene, "cubeTrans");
    cubeTrans.translate(new N3Vector3D(0, 0.2f, 1.0f));
    cubeTrans.update();

    // El otro cubo
    N3TransformationNode cubeTrans2 = new N3TransformationNode(scene, "cubeTrans2");
    cubeTrans2.translate(new N3Vector3D(-0.5f, 0.2f, -0.5f));
    cubeTrans2.update();

    cube = new N3VisualMesh(scene, N3GeometryData.createCube(0.4f, 0.4f, 0.4f, new N3ColorRGBA(1, 1, 1), true), "cube");
    cube.setMaterial(material);

    // El otro cubo
    cube2 = new N3VisualMesh(scene, N3GeometryData.createCube(0.4f, 0.4f, 0.4f, new N3ColorRGBA(1, 1, 1), true), "cube2");
    cube2.setMaterial(material);

    sphereTrans = new N3TransformationNode(scene, "sphereTrans");
    sphereTrans.translate(new N3Vector3D(0.5f, 0.5f, 0.0f));
    sphereTrans.update();

    sphere = new N3VisualMesh(scene, N3GeometryData.createSphere(20, 20, 0.15f, new N3ColorRGBA(0, 0, 1)), "sphere");
    sphere.setMaterial(new N3Material(scene, "Azul"));
    sphere.getMaterial().setAmbientColor(new N3ColorRGBA(0, 0, 1));
    sphere.getMaterial().setSpecularColor(new N3ColorRGBA(0, 0, 0), 0.1f);
    sphere.getMaterial().setDiffuseColor(new N3ColorRGBA(0, 0, 1));
    sphere.getMaterial().applyMaterial(true);

    camera1Trans = new N3TransformationNode(scene, "camera1Trans");
    camera1Trans.translate(new N3Vector3D(0.0f, 2.0f, 3.0f));
    camera1Trans.update();

    N3Camera camera1 = new N3Camera(new Rectangle(0, 0, c.getWidth(), c.getHeight()), 60.0f, c.getWidth() / c.getHeight(), 0.1f, 100.0f, scene, "camera1");

    light01Trans = new N3TransformationNode(scene, "light01Trans");
    light01Trans.translate(new N3Vector3D(0, 5.0f, 0.0f));
    light01Trans.update();

    light01 = new N3Light(N3LightData.createSpotLightData(new N3ColorRGBA(0, 0, 0), new N3ColorRGBA(1, 1, 1), new N3ColorRGBA(1, 1, 1), new N3Vector3D(0, -1.0f, 0), spotAngle), scene, "light01");

    root.addChild(grpScene);
    root.addChild(camera1Trans);
    root.addChild(light01Trans);
    grpScene.addChild(sueloRot);
View Full Code Here

        doubleBuffer);

    projectionMatrix = new N3Matrix4D();
    modelViewMatrix = new N3Matrix4D();
    cullFace = N3Render.N3_BACK_CULL;
    clearColor = new N3ColorRGBA(0, 0, 0);
    lights = new N3SoftwareLight[MAX_LIGHTS];
    for (int i = 0; i < lights.length; i++)
      lights[i] = new N3SoftwareLight();

    // /Optimizaciones
    vect1 = new N3Vector3D();
    vect2 = new N3Vector3D();
    d = new N3Vector3D();
    v1 = new N3Point3D();
    v2 = new N3Point3D();
    v3 = new N3Point3D();
    c1 = new N3ColorRGBA();
    c2 = new N3ColorRGBA();
    c3 = new N3ColorRGBA();
    cV1 = new N3Point3D();
    cV2 = new N3Point3D();
    cV3 = new N3Point3D();
    normal = new N3Vector3D();
    renderContext.setTextureMode(renderContext.N3_SWR_MODULATE);
View Full Code Here

  /**
   * Crea una instancia de la clase con los valores de color a blanco,
   */
  protected N3LightData() {
    ambiental = new N3ColorRGBA();
    diffuse = new N3ColorRGBA();
    specular = new N3ColorRGBA();
    constantAttenuation = 1.0f;
    linearAttenuation = 0.0f;
    quadraticAttenuation = 0.0f;
  }
View Full Code Here

      N3SceneReader reader, N3Render render, N3Scene scene)
      throws Exception {
    Element data = (Element) infoNode.getElementsByTagName("ambiental")
        .item(0);
    int index = Integer.parseInt(data.getAttribute("index"));
    N3ColorRGBA ambiental = (N3ColorRGBA) reader.getResource(index, nodes);

    data = (Element) infoNode.getElementsByTagName("diffuse").item(0);
    index = Integer.parseInt(data.getAttribute("index"));
    N3ColorRGBA diffuse = (N3ColorRGBA) reader.getResource(index, nodes);

    data = (Element) infoNode.getElementsByTagName("specular").item(0);
    index = Integer.parseInt(data.getAttribute("index"));
    N3ColorRGBA specular = (N3ColorRGBA) reader.getResource(index, nodes);

    data = (Element) infoNode.getElementsByTagName("direction").item(0);
    index = Integer.parseInt(data.getAttribute("index"));
    N3Vector3D direction = (N3Vector3D) reader.getResource(index, nodes);
View Full Code Here

    zBuffer = new float[size];
    image = Toolkit.getDefaultToolkit().createImage(this);
    colormodel = new DirectColorModel(32, 0x000000FF, 0x0000FF00,
        0x00FF0000, 0xFF000000);
    consumer = null;
    lastColor = new N3ColorRGBA(1, 1, 1);
    lastUV = new N3TexCoord2D(0, 0);
    lastVertex = null;
    status = N3_SWR_STATUS_INIT;
    needUpdate = true;
    depthtest = false;
View Full Code Here

   * Construye una luz con las componentes a color blanco, posicion (0,0,0) y
   * direcci�n (0,0,-1)
   */
  protected N3SoftwareLight() {
    if (ambientalLight == null) {
      ambientalLight = new N3ColorRGBA(0.2f, 0.2f, 0.2f);
      matEmission = new N3ColorRGBA(0, 0, 0);
      matAmbient = new N3ColorRGBA(0, 0, 0);
      matDiffuse = new N3ColorRGBA(1, 1, 1);
      matSpecular = new N3ColorRGBA(0, 0, 0);
    }
    ambiental = new N3ColorRGBA(0.2f, 0.2f, 0.2f);
    diffuse = new N3ColorRGBA(0.8f, 0.8f, 0.8f);
    specular = new N3ColorRGBA(0, 0, 0, 0);
    dir = new N3Vector3D();
    pos = new N3Point3D();
    enable = true;
    d = new N3Vector3D();
    ambientTerm = new N3ColorRGBA();
    diffuseTerm = new N3ColorRGBA();
    specularTerm = new N3ColorRGBA();
  }
View Full Code Here

    cameras = new Vector(0, 1);
    objects = new Vector(0, 1);
    activeLights = new Vector(0, 1);
    activeLightCount = 0;
    selectedCamera = null;
    ambientalLight = new N3ColorRGBA(0.2f, 0.2f, 0.2f);
    try {
      root = new N3GroupNode(this, "root");
    } catch (N3NameException e) {
    }
  }
View Full Code Here

        for (; i < render.getMaxLights(); i++) {
          render.disableLight(i);
        }
      }
      N3VisualObject obj;
      render.setClearColor(new N3ColorRGBA(0, 0, 0, 1.0f));
      render.clear();
      for (i = 0; i < objects.size(); i++) {
        obj = (N3VisualObject) objects.elementAt(i);
        if (obj.inScene() && obj.isVisible())
          obj.draw(render);
View Full Code Here

TOP

Related Classes of nu3a.material.color.N3ColorRGBA

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.