Package javax.media.j3d

Examples of javax.media.j3d.PolygonAttributes


                GroupNode gn=(GroupNode)getNode();
       
                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);
View Full Code Here


            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

      } else if ("double_sided".equals(name)
                 && "1".equals(getCharacters())
                 && ("GOOGLEEARTH".equals(this.techniqueProfile)
                     || "MAX3D".equals(this.techniqueProfile)
                     || "MAYA".equals(this.techniqueProfile))) {
        this.effectAppearances.get(this.effectId).setPolygonAttributes(new PolygonAttributes(
            PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0));
      }
    }
View Full Code Here

        }
       
        int cullFace = PolygonAttributes.CULL_BACK;
        boolean backFaceNormalFlip = false;
        if (appearance != null) {
          PolygonAttributes polygonAttributes = appearance.getPolygonAttributes();
          if (polygonAttributes != null) {
            cullFace = polygonAttributes.getCullFace();
            backFaceNormalFlip = polygonAttributes.getBackFaceNormalFlip();
          }
        }
       
        // Write object geometries
        for (int i = 0, n = shape.numGeometries(); i < n; i++) {
View Full Code Here

      appearance.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
      appearance.setCapability(Appearance.ALLOW_MATERIAL_READ);
      appearance.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
      node.setCapability(Shape3D.ALLOW_APPEARANCE_READ);

      PolygonAttributes polygonAttributes = appearance.getPolygonAttributes();
      if (polygonAttributes == null) {
        polygonAttributes = new PolygonAttributes();
        appearance.setPolygonAttributes(polygonAttributes);
      }
      polygonAttributes.setCapability(PolygonAttributes.ALLOW_CULL_FACE_WRITE);
      polygonAttributes.setCapability(PolygonAttributes.ALLOW_NORMAL_FLIP_WRITE);
     
      Enumeration<?> enumeration = shape.getAllGeometries();
      while (enumeration.hasMoreElements()) {
        Geometry geometry = (Geometry) enumeration.nextElement();
        if (!geometry.isLive()
View Full Code Here

      }
    } 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

      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

      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

      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

    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

TOP

Related Classes of javax.media.j3d.PolygonAttributes

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.