Examples of ColoringAttributes


Examples of javax.media.j3d.ColoringAttributes

            float[] axis = makeAxis(0);
            LineArray la = new LineArray(axis.length/3, LineArray.COORDINATES);
            la.setCoordinates(0,axis);
            Appearance a = new Appearance();
            a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
            ColoringAttributes ca = new ColoringAttributes();
            ca.setColor(0.0f,0.0f,1.0f);
            a.setColoringAttributes(ca);
            Shape3D saxis = new Shape3D(la, a);
            saxis.setName("X");
            g.addChild(saxis);
           
            // Y axis in green
            axis = makeAxis(1);
            la = new LineArray(axis.length/3, LineArray.COORDINATES);
            la.setCoordinates(0,axis);
            a = new Appearance();
            a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
            ca = new ColoringAttributes();
            ca.setColor(0.0f,1.0f,0.0f);
            a.setColoringAttributes(ca);
            saxis = new Shape3D(la, a);
            saxis.setName("Y");
            g.addChild(saxis);
           
            // Z axis in purple
            axis = makeAxis(2);
            la = new LineArray(axis.length/3, LineArray.COORDINATES);
            la.setCoordinates(0,axis);
            a = new Appearance();
            a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
            ca = new ColoringAttributes();
            ca.setColor(1.0f,0.0f,1.0f);
            a.setColoringAttributes(ca);
            saxis = new Shape3D(la, a);
            saxis.setName("Z");
            g.addChild(saxis);
           
View Full Code Here

Examples of javax.media.j3d.ColoringAttributes

                Color3f aColor  = new Color3f(0.1f, 0.1f, 0.1f);
                Color3f eColor  = new Color3f(0.0f, 0.0f, 0.0f);
                Color3f sColor  = new Color3f(1.0f, 1.0f, 1.0f);

                Appearance cya=new Appearance();
                cya.setColoringAttributes(new ColoringAttributes(new Color3f(Color.WHITE),ColoringAttributes.SHADE_GOURAUD));
                cya.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0));
                Material cym = new Material(aColor, eColor, new Color3f(Color.WHITE), sColor, 100.0f);
                cym.setLightingEnable(true);
                cya.setMaterial(cym);
                sd.setAppearance(cya);
View Full Code Here

Examples of javax.media.j3d.ColoringAttributes

       
                LineArray la = new LineArray(2, LineArray.COORDINATES);
                la.setCoordinates(0,v);
                Appearance a = new Appearance();
                a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
                ColoringAttributes ca = new ColoringAttributes();
                ca.setColor(1.0f,1.0f,1.0f);
                a.setColoringAttributes(ca);
                Shape3D sd = new Shape3D(la, a);

                gn.addChild(sd);
       
View Full Code Here

Examples of javax.media.j3d.ColoringAttributes

            Color3f aColor  = new Color3f(0.1f, 0.1f, 0.1f);
            Color3f eColor  = new Color3f(0.0f, 0.0f, 0.0f);
            Color3f sColor  = new Color3f(1.0f, 1.0f, 1.0f);

            Appearance cya=new Appearance();
            cya.setColoringAttributes(new ColoringAttributes(new Color3f(Color.WHITE),ColoringAttributes.SHADE_GOURAUD));
            cya.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0));
            Material cym = new Material(aColor, eColor, new Color3f(Color.WHITE), sColor, 100.0f);
            cym.setLightingEnable(true);
            cya.setMaterial(cym);
            sd.setAppearance(cya);
View Full Code Here

Examples of javax.media.j3d.ColoringAttributes

        } else {
          this.sunflow.parameter("color", null, diffuseColor);
          this.sunflow.shader(appearanceName, "constant");
        }
      } else {
        ColoringAttributes coloringAttributes = appearance.getColoringAttributes();
        if (coloringAttributes != null) {
          Color3f color = new Color3f();
          coloringAttributes.getColor(color);
          if (ignoreConstantShader) {
            this.sunflow.parameter("diffuse", null, new float [] {color.x, color.y, color.z});
            this.sunflow.shader(appearanceName, "diffuse");
          } else {
            this.sunflow.parameter("color", null, new float [] {color.x, color.y, color.z});
View Full Code Here

Examples of javax.media.j3d.ColoringAttributes

  /**
   * Returns a new background node. 
   */
  private Node createBackgroundNode(boolean listenToHomeUpdates, final boolean waitForLoading) {
    final Appearance backgroundAppearance = new Appearance();
    ColoringAttributes backgroundColoringAttributes = new ColoringAttributes();
    backgroundAppearance.setColoringAttributes(backgroundColoringAttributes);
    // Allow background color and texture to change
    backgroundAppearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
    backgroundAppearance.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
    backgroundColoringAttributes.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE);
   
    Geometry halfSphereGeometry = createHalfSphereGeometry();  
    final Shape3D halfSphere = new Shape3D(halfSphereGeometry, backgroundAppearance);
    BranchGroup backgroundBranch = new BranchGroup();
    backgroundBranch.addChild(halfSphere);
View Full Code Here

Examples of javax.media.j3d.ColoringAttributes

      }
      geometryInfo.setStripCounts(stripCountsArray);
      Shape3D shadow = new Shape3D(geometryInfo.getIndexedGeometryArray());
      Appearance shadowAppearance = new Appearance();
      shadowAppearance.setColoringAttributes(new ColoringAttributes(new Color3f(), ColoringAttributes.SHADE_FLAT));
      shadowAppearance.setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.NICEST, 0.7f));
      shadow.setAppearance(shadowAppearance);   
      homeRoot.addChild(shadow);
    }
  }
View Full Code Here

Examples of javax.media.j3d.ColoringAttributes

        } else {
          // Set default color if it doesn't exist yet
          Color3f black = new Color3f();
          if (appearance.getMaterial() == null) {
            appearance.setMaterial(new Material(black, black, black, black, 1));
            appearance.setColoringAttributes(new ColoringAttributes(black, ColoringAttributes.SHADE_GOURAUD));
          }
        }
        this.transparentColor = null;
        this.transparency = null;
       
        this.inPhongBlinnOrLambert = false;
        this.inConstant = false;
      } else if (this.inConstant || this.inPhongBlinnOrLambert) {
        // Set appearance attributes
        if ("color".equals(name)) {
          if ("emission".equals(parent)) {
            if (this.inPhongBlinnOrLambert) {
              getAppearanceMaterial(this.effectId).setEmissiveColor(
                  this.floats [0], this.floats [1], this.floats [2]);
            } else { // inConstant
              this.effectAppearances.get(this.effectId).setColoringAttributes(new ColoringAttributes(
                  this.floats [0], this.floats [1], this.floats [2], ColoringAttributes.SHADE_GOURAUD));
            }
          } else if ("ambient".equals(parent)) {
            getAppearanceMaterial(this.effectId).setAmbientColor(
                this.floats [0], this.floats [1], this.floats [2]);
          } else if ("diffuse".equals(parent)) {
            getAppearanceMaterial(this.effectId).setDiffuseColor(
                this.floats [0], this.floats [1], this.floats [2], this.floats [3]);
            // Always set coloring attributes in case geometries don't contain normals
            this.effectAppearances.get(this.effectId).setColoringAttributes(new ColoringAttributes(
                this.floats [0], this.floats [1], this.floats [2], ColoringAttributes.SHADE_GOURAUD));
          } else if ("specular".equals(parent)) {
            getAppearanceMaterial(this.effectId).setSpecularColor(
                this.floats [0], this.floats [1], this.floats [2]);
          } else if ("transparent".equals(parent)) {
View Full Code Here

Examples of javax.media.j3d.ColoringAttributes

          parseNumber(tokenizer), parseNumber(tokenizer));
      if (currentAppearance != null) {
        OBJMaterial material = getMaterial(currentAppearance);
        material.setDiffuseColor(diffuseColor);
        currentAppearance.setColoringAttributes(
            new ColoringAttributes(diffuseColor, ColoringAttributes.SHADE_GOURAUD));
      }
    } else if ("Ks".equals(tokenizer.sval)) {
      // Read specular color Ks r g b
      Color3f specularColor = new Color3f(parseNumber(tokenizer),
          parseNumber(tokenizer), parseNumber(tokenizer));
View Full Code Here

Examples of javax.media.j3d.ColoringAttributes

    this.originY = groundOriginY;
    this.width = groundWidth;
    this.depth = groundDepth;

    // Use coloring attributes for ground to avoid ground lighting
    ColoringAttributes groundColoringAttributes = new ColoringAttributes();
    groundColoringAttributes.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE);
   
    Appearance groundAppearance = new Appearance();
    groundAppearance.setColoringAttributes(groundColoringAttributes);
    groundAppearance.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
    groundAppearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
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.