Examples of PolygonAttributes


Examples of javax.media.j3d.PolygonAttributes

      }
    } else if (node instanceof Link) {
      setBackFaceShown(((Link)node).getSharedGroup(), backFaceShown);
    } else if (node instanceof Shape3D) {
      Appearance appearance = ((Shape3D)node).getAppearance();
      PolygonAttributes polygonAttributes = appearance.getPolygonAttributes();
      // Change cull face
      polygonAttributes.setCullFace(backFaceShown
          ? PolygonAttributes.CULL_FRONT
          : PolygonAttributes.CULL_BACK);
      // Change back face normal flip
      polygonAttributes.setBackFaceNormalFlip(backFaceShown);
    }
  }
View Full Code Here

Examples of javax.media.j3d.PolygonAttributes

      Appearance appearance = ((Shape3D)node).getAppearance();
      if (appearance == null) {
        appearance = createAppearanceWithChangeCapabilities();
        ((Shape3D)node).setAppearance(appearance);
      }
      PolygonAttributes polygonAttributes = appearance.getPolygonAttributes();
      if (polygonAttributes == null) {
        polygonAttributes = createPolygonAttributesWithChangeCapabilities();
        appearance.setPolygonAttributes(polygonAttributes);
      }
     
      // Change cull face
      if (polygonAttributes.getCullFace() != PolygonAttributes.CULL_NONE) {
        polygonAttributes.setCullFace(cullFace);
      }
    }
  }
View Full Code Here

Examples of javax.media.j3d.PolygonAttributes

      Appearance appearance = ((Shape3D)node).getAppearance();
      if (appearance == null) {
        appearance = createAppearanceWithChangeCapabilities();
        ((Shape3D)node).setAppearance(appearance);
      }
      PolygonAttributes polygonAttributes = appearance.getPolygonAttributes();
      if (polygonAttributes == null) {
        polygonAttributes = createPolygonAttributesWithChangeCapabilities();
        appearance.setPolygonAttributes(polygonAttributes);
      }
     
      // Change back face normal flip
      polygonAttributes.setBackFaceNormalFlip(backFaceNormalFlip);
    }
  }
View Full Code Here

Examples of javax.media.j3d.PolygonAttributes

      polygonAttributes.setBackFaceNormalFlip(backFaceNormalFlip);
    }
  }

  private PolygonAttributes createPolygonAttributesWithChangeCapabilities() {
    PolygonAttributes polygonAttributes = new PolygonAttributes();
    polygonAttributes.setCapability(PolygonAttributes.ALLOW_CULL_FACE_READ);
    polygonAttributes.setCapability(PolygonAttributes.ALLOW_CULL_FACE_WRITE);
    polygonAttributes.setCapability(PolygonAttributes.ALLOW_NORMAL_FLIP_WRITE);
    return polygonAttributes;
  }
View Full Code Here

Examples of javax.media.j3d.PolygonAttributes

    appearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
    appearance.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_READ);
    appearance.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_WRITE);
    appearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ);
    appearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE);
    PolygonAttributes polygonAttributes = appearance.getPolygonAttributes();
    if (polygonAttributes != null) {
      polygonAttributes.setCapability(PolygonAttributes.ALLOW_CULL_FACE_READ);
      polygonAttributes.setCapability(PolygonAttributes.ALLOW_CULL_FACE_WRITE);
      polygonAttributes.setCapability(PolygonAttributes.ALLOW_NORMAL_FLIP_WRITE);
    }
  }
View Full Code Here

Examples of javax.media.j3d.PolygonAttributes

        setTransform(new Transform3D(C.nullRot, new Vector3d(0,0,0.1), 1.0));

        if (bg != null) {
            app = new Appearance();
            app.setColoringAttributes(new ColoringAttributes(bg, ColoringAttributes.SHADE_FLAT));
            app.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_BACK, 10.0f));
            addChild(makeQuad(lower.x-0.5, lower.y-0.1, upper.x-lower.x+1, upper.y-lower.y+.6, -.1, app));
        }
    }
View Full Code Here

Examples of javax.media.j3d.PolygonAttributes

    Appearance greenApp = new Appearance();
    setToMyDefaultAppearance(greenApp,new Color3f(0.0f,0.7f,0.0f));

    //The following lines enforce that objects with the
    //Appearance greenApp wil be displayed as wire frame models.
    PolygonAttributes polygAttr = new PolygonAttributes();
    polygAttr.setPolygonMode(PolygonAttributes.POLYGON_LINE);
    greenApp.setPolygonAttributes(polygAttr);



    //Radius of the cockpit.
View Full Code Here

Examples of javax.media.j3d.PolygonAttributes

    }
 
  private static Appearance createMaterialAppearance(boolean bleu){

        Appearance materialAppear = new Appearance();
        PolygonAttributes polyAttrib = new PolygonAttributes();
        polyAttrib.setCullFace(PolygonAttributes.CULL_NONE);
        materialAppear.setPolygonAttributes(polyAttrib);

        if(bleu){
          Material material = new Material();
            material.setDiffuseColor(new Color3f(1.0f, 0.0f, 0.0f));
View Full Code Here

Examples of javax.media.j3d.PolygonAttributes

    }
 
  public static Appearance createMaterialAppearance(){

        Appearance materialAppear = new Appearance();
        PolygonAttributes polyAttrib = new PolygonAttributes();
        polyAttrib.setCullFace(PolygonAttributes.CULL_NONE);
        materialAppear.setPolygonAttributes(polyAttrib);

        Material material = new Material();
        material.setDiffuseColor(new Color3f(0.2f, 0.2f, 0.2f));
        materialAppear.setMaterial(material);
View Full Code Here

Examples of javax.media.j3d.PolygonAttributes

    }
 
  public static Appearance createWireFrameAppearance(){

        Appearance materialAppear = new Appearance();
        PolygonAttributes polyAttrib = new PolygonAttributes();
        polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_LINE);
        materialAppear.setPolygonAttributes(polyAttrib);
        ColoringAttributes redColoring = new ColoringAttributes();
        redColoring.setColor(1.0f, 0.0f, 0.0f);
        materialAppear.setColoringAttributes(redColoring);
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.