Package nu3a.material.color

Examples of nu3a.material.color.N3ColorRGBA


      N3Point2D p2 = null;
      N3Point2D p3 = null;
      N3Vector2D n1 = null;
      N3Vector2D n2 = null;
      N3Vector2D n3 = null;
      N3ColorRGBA c1 = null;
      N3ColorRGBA c2 = null;
      N3ColorRGBA c3 = null;
      N3TexCoord2D uv1 = null;
      N3TexCoord2D uv2 = null;
      N3TexCoord2D uv3 = null;
      vertexData.clear();
      normalData.clear();
View Full Code Here


    texture_mode = N3_MODULATE;
    multitexture = false;
    isDirty = false;
    active_texture = null;
    apply_material = false;
    ambient_color = new N3ColorRGBA(1f, 1f, 1f);
    diffuse_color = new N3ColorRGBA(1f, 1f, 1f);
    specular_color = new N3ColorRGBA(1f, 1f, 1f);
    emission_color = new N3ColorRGBA(0f, 0f, 0f);
    face = N3_FRONT;
  }
View Full Code Here

      render.setColorMaterialDiffuse(face, diffuse_color);
      render.setColorMaterialSpecular(face, specular_color);
      render.setColorMaterialEmission(face, emission_color);
    } else {
      render.setColorMaterial(true);
      render.setColorMaterialAmbient(face, new N3ColorRGBA(1f, 1f, 1f));
      render.setColorMaterialDiffuse(face, new N3ColorRGBA(1f, 1f, 1f));
      render.setColorMaterialSpecular(face, new N3ColorRGBA(1f, 1f, 1f));
      render.setColorMaterialEmission(face, new N3ColorRGBA(0f, 0f, 0f));
    }

    if (texture_mode != N3_NO_TEXTURE && !textures.isEmpty()) {
      switch (texture_mode) {
      case N3_REPLACE:
View Full Code Here

      throws Exception {
    Element texData;
    NodeList texts;
    N3Texture tex;
    int index;
    N3ColorRGBA a, s, d, e;
    float shininess;
    Element data = (Element) infoNode.getElementsByTagName("name").item(0);

    N3Material result = new N3Material(scene, data.getAttribute("value"));
View Full Code Here

    N3Polygon p;

    int index;
    N3Point3D v;
    N3Vector3D n;
    N3ColorRGBA c;
    N3TexCoord2D uv;

    N3GeometryData result = new N3GeometryData();

    for (int i = 0; i < polys.getLength(); i++) {
View Full Code Here

   *            Render en el que realizar el dibujado de la caja.
   */
  public void draw(N3Render render) {
    N3VertexData v = new N3VertexData();
    N3ColorData c = new N3ColorData();
    c.addColor(new N3ColorRGBA(1.0f, 1.0f, 1.0f));

    v1.x = minX;
    v1.y = maxY;
    v1.z = maxZ;

View Full Code Here

    if (dirtyGeometry) {
      N3Point2D p1 = null;
      N3Point2D p2 = null;
      N3Vector2D n1 = null;
      N3Vector2D n2 = null;
      N3ColorRGBA c1 = null;
      N3ColorRGBA c2 = null;
      vertexData.clear();
      normalData.clear();
      colorData.clear();
      for (int i = 0; i < geometry.polygonCount(); i++) {
        N3Polygon p = geometry.getPolygon(i);
View Full Code Here

  protected void processGeometry() {
    if (dirtyGeometry) {
      N3Point2D p1 = null;
      N3Vector2D n1 = null;
      N3ColorRGBA c1 = null;
      vertexData.clear();
      normalData.clear();
      colorData.clear();
      for (int i = 0; i < geometry.polygonCount(); i++) {
        N3Polygon p = geometry.getPolygon(i);
View Full Code Here

public class BasicTest extends Thread {
  N3SoftwareRenderContext c;

  public BasicTest(N3SoftwareRenderContext context) {
    c = context;
    N3ColorRGBA color = new N3ColorRGBA(0, 0, 0);
    c.setDepthTest(true);
    c.cleanZBuffer();
    c.clearToColor(color);
    c.paint();
  }
View Full Code Here

    N3Point3D vertexL1 = new N3Point3D(0, 0, 0);
    N3Point3D vertexL2 = new N3Point3D(0, 0, 0);
    N3Point3D vertexT1 = new N3Point3D(0, 0, 0);
    N3Point3D vertexT2 = new N3Point3D(0, 0, 0);
    N3Point3D vertexT3 = new N3Point3D(0, 0, 0);
    N3ColorRGBA color = new N3ColorRGBA(0, 0, 0);
    N3ColorRGBA colorG1 = new N3ColorRGBA(0, 0, 0);
    N3ColorRGBA colorG2 = new N3ColorRGBA(0, 0, 0);
    N3ColorRGBA colorG3 = new N3ColorRGBA(0, 0, 0);
    double t = System.currentTimeMillis();
    int i = 0;
    boolean flatVertex = true;
    boolean flatHLine = true;
    boolean flatVLine = true;
    boolean flatLine = true;
    boolean goraudHLine = true;
    boolean goraudVLine = true;
    boolean goraudLine = true;
    boolean flatTriangle = true;
    boolean goraudTriangle = true;
    while (true) {
      c.beginDrawingMode(N3SoftwareRenderContext.N3_POINTS);
      /* Dibujamos un punto */
      if (flatVertex) {
        color.setR((float) Math.random());
        color.setG((float) Math.random());
        color.setB((float) Math.random());
        c.setColor(color);
        vertexP.setX((float) (Math.random() * c.getWidth()));
        vertexP.setY((float) (Math.random() * c.getHeight()));
        vertexP.setZ((float) Math.random());
        c.setVertex(vertexP);
      }
      c.endDrawingMode();

      /* Vamos a dibjuar líneas... */
      c.beginDrawingMode(N3SoftwareRenderContext.N3_LINES);
      /* Dibujamos una línea horizontal flat */
      if (flatHLine) {
        color.setR((float) Math.random());
        color.setG((float) Math.random());
        color.setB((float) Math.random());
        c.setColor(color);
        vertexL1.setX((float) (Math.random() * c.getWidth()));
        vertexL1.setY((float) (Math.random() * c.getHeight()));
        vertexL1.setZ((float) Math.random());
        c.setVertex(vertexL1);
        vertexL2.setX((float) (Math.random() * c.getWidth()));
        vertexL2.setY(vertexL1.getY());
        vertexL2.setZ((float) Math.random());
        c.setVertex(vertexL2);
      }

      /* Dibujamos una línea vertical flat */
      if (flatVLine) {
        color.setR((float) Math.random());
        color.setG((float) Math.random());
        color.setB((float) Math.random());
        c.setColor(color);
        vertexL1.setX((float) (Math.random() * c.getWidth()));
        vertexL1.setY((float) (Math.random() * c.getHeight()));
        vertexL1.setZ((float) Math.random());
        c.setVertex(vertexL1);
        vertexL2.setX(vertexL1.getX());
        vertexL2.setY((float) (Math.random() * c.getHeight()));
        vertexL2.setZ((float) Math.random());
        c.setVertex(vertexL2);
      }

      /* Dibujamos una línea cualquiera flat */
      if (flatLine) {
        color.setR((float) Math.random());
        color.setG((float) Math.random());
        color.setB((float) Math.random());
        c.setColor(color);
        vertexL1.setX((float) (Math.random() * c.getWidth()));
        vertexL1.setY((float) (Math.random() * c.getHeight()));
        vertexL1.setZ((float) Math.random());
        c.setVertex(vertexL1);
        vertexL2.setX((float) (Math.random() * c.getWidth()));
        vertexL2.setY((float) (Math.random() * c.getHeight()));
        vertexL2.setZ((float) Math.random());
        c.setVertex(vertexL2);
      }

      /* Dibujamos una línea horizontal goraud */
      if (goraudHLine) {
        colorG1.setR((float) Math.random());
        colorG1.setG((float) Math.random());
        colorG1.setB((float) Math.random());
        c.setColor(colorG1);
        vertexL1.setX((float) (Math.random() * c.getWidth()));
        vertexL1.setY((float) (Math.random() * c.getHeight()));
        vertexL1.setZ((float) Math.random());
        c.setVertex(vertexL1);
        colorG2.setR((float) Math.random());
        colorG2.setG((float) Math.random());
        colorG2.setB((float) Math.random());
        c.setColor(colorG2);
        vertexL2.setX((float) (Math.random() * c.getWidth()));
        vertexL2.setY(vertexL1.getY());
        vertexL2.setZ((float) Math.random());
        c.setVertex(vertexL2);
      }

      /* Dibujamos una línea vertical goraud */
      if (goraudVLine) {
        colorG1.setR((float) Math.random());
        colorG1.setG((float) Math.random());
        colorG1.setB((float) Math.random());
        c.setColor(colorG1);
        vertexL1.setX((float) (Math.random() * c.getWidth()));
        vertexL1.setY((float) (Math.random() * c.getHeight()));
        vertexL1.setZ((float) Math.random());
        c.setVertex(vertexL1);
        colorG2.setR((float) Math.random());
        colorG2.setG((float) Math.random());
        colorG2.setB((float) Math.random());
        c.setColor(colorG2);
        vertexL2.setX(vertexL1.getX());
        vertexL2.setY((float) (Math.random() * c.getHeight()));
        vertexL2.setZ((float) Math.random());
        c.setVertex(vertexL2);
      }

      /* Dibujamos una línea goraud */
      if (goraudLine) {
        colorG1.setR((float) Math.random());
        colorG1.setG((float) Math.random());
        colorG1.setB((float) Math.random());
        c.setColor(colorG1);
        vertexL1.setX((float) (Math.random() * c.getWidth()));
        vertexL1.setY((float) (Math.random() * c.getHeight()));
        vertexL1.setZ((float) Math.random());
        c.setVertex(vertexL1);
        colorG2.setR((float) Math.random());
        colorG2.setG((float) Math.random());
        colorG2.setB((float) Math.random());
        c.setColor(colorG2);
        vertexL2.setX((float) (Math.random() * c.getWidth()));
        vertexL2.setY((float) (Math.random() * c.getHeight()));
        vertexL2.setZ((float) Math.random());
        c.setVertex(vertexL2);
      }

      c.endDrawingMode();

      c.beginDrawingMode(N3SoftwareRenderContext.N3_TRIANGLES);
      /* Dibujamos un triángulo plano */
      if (flatTriangle) {
        color.setR((float) Math.random());
        color.setG((float) Math.random());
        color.setB((float) Math.random());
        c.setColor(color);
        vertexT1.setX((float) (Math.random() * c.getWidth() + 10));
        vertexT1.setY((float) (Math.random() * c.getHeight() - 10));
        vertexT1.setZ((float) Math.random());
        c.setVertex(vertexT1);
        vertexT2.setX((float) (Math.random() * c.getWidth() - 10));
        vertexT2.setY((float) (Math.random() * c.getHeight() + 10));
        vertexT2.setZ((float) Math.random());
        c.setVertex(vertexT2);
        vertexT3.setX((float) (Math.random() * c.getWidth() + 10));
        vertexT3.setY((float) (Math.random() * c.getHeight() - 10));
        vertexT3.setZ((float) Math.random());
        c.setVertex(vertexT3);
      }

      /* Dibujamos un triángulo goraud */
      if (goraudTriangle) {
        colorG1.setR((float) Math.random());
        colorG1.setG((float) Math.random());
        colorG1.setB((float) Math.random());
        c.setColor(colorG1);
        vertexT1.setX((float) (Math.random() * c.getWidth()));
        vertexT1.setY((float) (Math.random() * c.getHeight()));
        vertexT1.setZ((float) Math.random());
        c.setVertex(vertexT1);
        colorG2.setR((float) Math.random());
        colorG2.setG((float) Math.random());
        colorG2.setB((float) Math.random());
        c.setColor(colorG2);
        vertexT2.setX((float) (Math.random() * c.getWidth()));
        vertexT2.setY((float) (Math.random() * c.getHeight()));
        vertexT2.setZ((float) Math.random());
        c.setVertex(vertexT2);
        colorG3.setR((float) Math.random());
        colorG3.setG((float) Math.random());
        colorG3.setB((float) Math.random());
        c.setColor(colorG3);
        vertexT3.setX((float) (Math.random() * c.getWidth()));
        vertexT3.setY((float) (Math.random() * c.getHeight()));
        vertexT3.setZ((float) Math.random());
        c.setVertex(vertexT3);
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.