Package javax.media.j3d

Examples of javax.media.j3d.Geometry


    // 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);
   
    final Background background = new Background(backgroundBranch);
View Full Code Here


    geometryInfo.setCoordinates(coords);
    geometryInfo.setTextureCoordinateParams(1, 2);
    geometryInfo.setTextureCoordinates(0, textureCoords);
    geometryInfo.indexify();
    geometryInfo.compact();
    Geometry halfSphereGeometry = geometryInfo.getIndexedGeometryArray();
    return halfSphereGeometry;
  }
View Full Code Here

      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()
            && geometry instanceof GeometryArray) {
          geometry.setCapability(GeometryArray.ALLOW_FORMAT_READ);
          geometry.setCapability(GeometryArray.ALLOW_COUNT_READ);
          geometry.setCapability(GeometryArray.ALLOW_COORDINATE_READ);
          geometry.setCapability(GeometryArray.ALLOW_NORMAL_READ);
          geometry.setCapability(GeometryArray.ALLOW_TEXCOORD_READ);
          geometry.setCapability(GeometryArray.ALLOW_REF_DATA_READ);
        }
      }
    }
  }
View Full Code Here

      RenderingAttributes renderingAttributes = appearance != null
          ? appearance.getRenderingAttributes() : null;
      if (renderingAttributes == null
          || renderingAttributes.getVisible()) {
        for (int i = 0, n = shape.numGeometries(); i < n; i++) {
          Geometry geometry = shape.getGeometry(i);
          if (geometry instanceof GeometryArray) {
            count += ((GeometryArray)geometry).getVertexCount();
          }
        }
      }
View Full Code Here

            || renderingAttributes.getVisible())
          && (transparencyAttributes == null
              || transparencyAttributes.getTransparency() < 1)) {
        // Compute shape geometries area
        for (int i = 0, n = shape.numGeometries(); i < n; i++) {
          Geometry geometry = shape.getGeometry(i);
          if (geometry instanceof GeometryArray) {
            GeometryArray geometryArray = (GeometryArray)geometry;     

            int vertexCount = geometryArray.getVertexCount();
            Point3f vertex = new Point3f();
View Full Code Here

        Structure3DHelper.assertExactlyOneShape3D(transformGroup);
        Shape3D leafShape3D = (Shape3D) transformGroup.getChild(0);
        assertNotNull(leafShape3D);

        // test position and geometry
        Geometry leafGeometry = leafShape3D.getGeometry();
        assertTrue(leafGeometry instanceof TriangleArray);
        TriangleArray leafTriangle = (TriangleArray) leafGeometry;
        assertEquals(3, leafTriangle.getVertexCount());

        Point3d actualStartPoint = new Point3d();
View Full Code Here

/*      */     }
/*  505 */     else if ((this.pickedNode instanceof Shape3D)) {
/*  506 */       Shape3D shape = (Shape3D)this.pickedNode;
/*  507 */       ArrayList geoArrays = new ArrayList();
/*  508 */       for (int k = 0; k < shape.numGeometries(); k++) {
/*  509 */         Geometry geometry = shape.getGeometry(k);
/*  510 */         if ((geometry instanceof CompressedGeometry)) {
/*  511 */           Shape3D[] sa = ((CompressedGeometry)geometry).decompress();
/*      */
/*  514 */           if (sa != null) {
/*  515 */             for (int j = 0; j < sa.length; j++) {
View Full Code Here

/*      */       case 4099:
/*      */       default:
/*  265 */         throw new IllegalArgumentException("Improper level");
/*      */       }
/*  267 */       for (int i = 0; i < shape.numGeometries(); i++) {
/*  268 */         Geometry geo = shape.getGeometry(i);
/*  269 */         if ((geo instanceof GeometryArray))
/*  270 */           setCapabilities((GeometryArray)geo, level);
/*  271 */         else if ((geo instanceof CompressedGeometry))
/*  272 */           setCapabilities((CompressedGeometry)geo, level);
/*      */       }
View Full Code Here

/* 2063 */     if (shapes[0] == null) {
/* 2064 */       throw new IllegalArgumentException("Shape3D at index 0 is null");
/*      */     }
/* 2066 */     long startTime = 0L;
/*      */
/* 2069 */     Geometry g = shapes[0].getGeometry();
/* 2070 */     if (!(g instanceof GeometryArray)) {
/* 2071 */       throw new IllegalArgumentException("Shape3D at index 0 is not a GeometryArray");
/*      */     }
/*      */
/* 2074 */     GeometryArray ga = (GeometryArray)g;
View Full Code Here

        CompilerHelper.compile(branchGroup);
        Structure3DHelper.assertExactlyOneShape3D(branchGroup);
        Shape3D leafShape3D = (Shape3D) branchGroup.getChild(0);

        // test position and geometry
        Geometry leafGeometry = leafShape3D.getGeometry();
        assertTrue(leafGeometry instanceof TriangleArray);
        TriangleArray leafTriangle = (TriangleArray) leafGeometry;
        assertEquals(3, leafTriangle.getVertexCount());

        Point3d actualStartPoint = new Point3d();
View Full Code Here

TOP

Related Classes of javax.media.j3d.Geometry

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.