Package javax.media.j3d

Examples of javax.media.j3d.Shape3D


                nbLeavesFound++;
            } else {
                if (child instanceof Shape3D) {
                    nbTimesNoLeafShapeIsFound++;
                    assertEquals("We should have only one shape (the branch part)", 1, nbTimesNoLeafShapeIsFound);
                    Shape3D branchScape = (Shape3D) child;
                    BasicTreeBranchPart3DTestHelper.testGeometry(branchScape.getGeometry(), new Point3d(0, 0, 0),
                            part3DState.getEndPoint().toPointValue());
                    BasicTreeBranchPart3DTestHelper.testAppearance(branchScape.getAppearance());
                } else {
                    fail("There should be no other children. child is instance of " + child.getClass());
                }
            }
        }
View Full Code Here


/*      */
/* 1218 */         if ((this.flags & 0x200) != 0) {
/* 1219 */           strippy.stripify(gi);
/*      */         }
/*      */
/* 1228 */         Shape3D shape = new Shape3D();
/*      */
/* 1230 */         shape.setGeometry(gi.getGeometryArray(true, true, false));
/*      */
/* 1232 */         String matName = (String)this.groupMaterials.get(curname);
/* 1233 */         this.materials.assignMaterial(matName, shape);
/*      */
/* 1235 */         group.addChild(shape);
View Full Code Here

/*     */
/* 212 */     GeomBuffer cache = getCachedGeometry(4, radius, 0.0F, height, xdivision, ydivision, primflags);
/*     */
/* 215 */     if (cache != null)
/*     */     {
/* 217 */       shape[0] = new Shape3D(cache.getComputedGeometry());
/* 218 */       this.numVerts += cache.getNumVerts();
/* 219 */       this.numTris += cache.getNumTris();
/*     */     }
/*     */     else
/*     */     {
/* 224 */       gbuf = q.coneTop(height / 2.0D - height / this.ydivisions, radius / this.ydivisions, height / this.ydivisions, this.xdivisions, 1.0D - 1.0D / this.ydivisions, outside);
/*     */
/* 228 */       shape[0] = new Shape3D(gbuf.getGeom(this.flags));
/* 229 */       this.numVerts += gbuf.getNumVerts();
/* 230 */       this.numTris += gbuf.getNumTris();
/* 231 */       if ((primflags & 0x10) == 0) {
/* 232 */         cacheGeometry(4, radius, 0.0F, height, xdivision, ydivision, primflags, gbuf);
/*     */       }
/*     */
/*     */     }
/*     */
/* 239 */     if (this.ydivisions > 1) {
/* 240 */       cache = getCachedGeometry(64, radius, 0.0F, height, xdivision, ydivision, primflags);
/*     */
/* 242 */       if (cache != null)
/*     */       {
/* 244 */         shape[0].addGeometry(cache.getComputedGeometry());
/* 245 */         this.numVerts += cache.getNumVerts();
/* 246 */         this.numTris += cache.getNumTris();
/*     */       }
/*     */       else {
/* 249 */         gbuf = q.coneBody(-(height / 2.0D), height / 2.0D - height / this.ydivisions, radius, radius / this.ydivisions, this.xdivisions, this.ydivisions - 1, 1.0D / this.ydivisions, outside);
/*     */
/* 254 */         shape[0].addGeometry(gbuf.getGeom(this.flags));
/* 255 */         this.numVerts += gbuf.getNumVerts();
/* 256 */         this.numTris += gbuf.getNumTris();
/* 257 */         if ((primflags & 0x10) == 0) {
/* 258 */           cacheGeometry(64, radius, 0.0F, height, xdivision, ydivision, primflags, gbuf);
/*     */         }
/*     */       }
/*     */
/*     */     }
/*     */
/* 264 */     if ((this.flags & 0x40) != 0) {
/* 265 */       shape[0].setCapability(14);
/* 266 */       shape[0].setCapability(15);
/*     */     }
/*     */
/* 269 */     if ((this.flags & 0x20) != 0) {
/* 270 */       shape[0].setCapability(12);
/*     */     }
/*     */
/* 273 */     addChild(shape[0]);
/*     */
/* 276 */     cache = getCachedGeometry(32, radius, radius, -height / 2.0F, xdivision, xdivision, primflags);
/*     */
/* 279 */     if (cache != null)
/*     */     {
/* 281 */       shape[1] = new Shape3D(cache.getComputedGeometry());
/* 282 */       this.numVerts += cache.getNumVerts();
/* 283 */       this.numTris += cache.getNumTris();
/*     */     }
/*     */     else {
/* 286 */       gbuf = q.disk(radius, xdivision, -height / 2.0D, !outside);
/*     */
/* 288 */       shape[1] = new Shape3D(gbuf.getGeom(this.flags));
/* 289 */       this.numVerts += gbuf.getNumVerts();
/* 290 */       this.numTris += gbuf.getNumTris();
/* 291 */       if ((primflags & 0x10) == 0) {
/* 292 */         cacheGeometry(32, radius, radius, -height / 2.0F, xdivision, xdivision, primflags, gbuf);
/*     */       }
View Full Code Here

/*  501 */     if ((this.pickedNode instanceof Morph)) {
/*  502 */       this.geometryArrays = new GeometryArray[1];
/*  503 */       this.geometryArrays[0] = ((Morph)this.pickedNode).getGeometryArray(0);
/*      */     }
/*  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++) {
/*  516 */               for (int i = 0; i < sa[j].numGeometries(); i++) {
/*  517 */                 geoArrays.add(sa[j].getGeometry(i));
/*      */               }
/*      */             }
/*      */           }
/*  521 */           if (this.compressGeomShape3Ds == null)
/*      */           {
/*  523 */             this.compressGeomShape3Ds = sa;
/*      */           }
/*      */           else {
/*  526 */             Shape3D[] save = this.compressGeomShape3Ds;
/*  527 */             int newLength = save.length + sa.length;
/*  528 */             this.compressGeomShape3Ds = new Shape3D[newLength];
/*  529 */             System.arraycopy(save, 0, this.compressGeomShape3Ds, 0, save.length);
/*      */
/*  531 */             System.arraycopy(sa, 0, this.compressGeomShape3Ds, save.length, sa.length);
/*      */           }
/*      */         }
/*  534 */         else if ((geometry instanceof GeometryArray)) {
/*  535 */           geoArrays.add(geometry);
/*      */         }
/*      */       }
/*  538 */       this.geometryArrays = new GeometryArray[geoArrays.size()];
/*  539 */       for (int i = 0; i < geoArrays.size(); i++) {
/*  540 */         this.geometryArrays[i] = ((GeometryArray)geoArrays.get(i));
/*      */       }
/*      */     }
/*  543 */     if (this.geometryArrays == null)
/*      */     {
/*      */       Shape3D shape;
/*  544 */       if ((this.pickedNode instanceof Shape3D)) {
/*  545 */         shape = (Shape3D)this.pickedNode;
/*      */       }
/*  547 */       throw new RuntimeException("Type of the picked node is not supported");
/*      */     }
View Full Code Here

/*     */       }
/* 222 */       nstep = n / 4;
/*     */     }
/*     */
/* 226 */     GeomBuffer cache = getCachedGeometry(1, radius, 0.0F, 0.0F, divisions, 0, primflags);
/*     */     Shape3D shape;
/* 232 */     if (cache != null) {
/* 233 */       Shape3D shape = new Shape3D(cache.getComputedGeometry());
/* 234 */       this.numVerts += cache.getNumVerts();
/* 235 */       this.numTris += cache.getNumTris();
/*     */     }
/*     */     else
/*     */     {
/* 239 */       GeomBuffer gbuf = new GeomBuffer(8 * nstep * (nstep + 2));
/*     */
/* 241 */       for (int i = 0; i < 4; i++) {
/* 242 */         buildQuadrant(gbuf, i * 3.141592653589793D / 2.0D, (i + 1) * 3.141592653589793D / 2.0D, sign, nstep, n, true);
/* 243 */         buildQuadrant(gbuf, i * 3.141592653589793D / 2.0D, (i + 1) * 3.141592653589793D / 2.0D, sign, nstep, n, false);
/*     */       }
/*     */
/* 246 */       shape = new Shape3D(gbuf.getGeom(this.flags));
/* 247 */       this.numVerts = gbuf.getNumVerts();
/* 248 */       this.numTris = gbuf.getNumTris();
/* 249 */       if ((primflags & 0x10) == 0) {
/* 250 */         cacheGeometry(1, radius, 0.0F, 0.0F, divisions, 0, primflags, gbuf);
/*     */       }
/*     */
/*     */     }
/*     */
/* 256 */     if ((this.flags & 0x40) != 0) {
/* 257 */       shape.setCapability(14);
/* 258 */       shape.setCapability(15);
/*     */     }
/*     */
/* 261 */     if ((this.flags & 0x20) != 0) {
/* 262 */       shape.setCapability(12);
/*     */     }
/*     */
/* 265 */     addChild(shape);
/*     */
/* 267 */     if (ap == null)
View Full Code Here

/*  250 */       for (int i = 0; i < weights.length; i++) {
/*  251 */         GeometryArray ga = morph.getGeometryArray(i);
/*  252 */         setCapabilities(ga, level);
/*      */       }
/*  254 */     } else if ((node instanceof Shape3D)) {
/*  255 */       Shape3D shape = (Shape3D)node;
/*  256 */       switch (level)
/*      */       {
/*      */       case 4098:
/*      */       case 4100:
/*  260 */         shape.setCapability(12);
/*      */       case 4097:
/*  263 */         break;
/*      */       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

/* 503 */         debugOutputLn(8, "Cloning shapes");
/* 504 */         Vector cloneShapeList = cloneObject.getShapeList();
/* 505 */         Enumeration e = cloneShapeList.elements();
/* 506 */         while (e.hasMoreElements()) {
/* 507 */           debugOutputLn(8, "   shape clone");
/* 508 */           Shape3D shape = (Shape3D)e.nextElement();
/* 509 */           Shape3D cloneShape = (Shape3D)shape.cloneTree();
/* 510 */           this.objectTransform.addChild(cloneShape);
/*     */         }
/*     */       }
/*     */
/*     */     }
View Full Code Here

/*     */     {
/* 181 */       cache = getCachedGeometry(8, xdim, ydim, zdim, i, i, primflags);
/*     */
/* 183 */       if (cache != null)
/*     */       {
/* 185 */         shape[i] = new Shape3D(cache.getComputedGeometry());
/* 186 */         this.numVerts += cache.getNumVerts();
/* 187 */         this.numTris += cache.getNumTris();
/*     */       }
/*     */       else
/*     */       {
/* 191 */         GeomBuffer gbuf = new GeomBuffer(4, numTexUnit);
/*     */
/* 193 */         gbuf.begin(1);
/* 194 */         for (int j = 0; j < 2; j++) {
/* 195 */           gbuf.normal3d(normals[i].x * sign, normals[i].y * sign, normals[i].z * sign);
/*     */
/* 198 */           gbuf.texCoord2d(tcoords[(i * 8 + j * 2)], tcoords[(i * 8 + j * 2 + 1)]);
/* 199 */           gbuf.vertex3d(verts[(i * 12 + j * 3)] * xdim, verts[(i * 12 + j * 3 + 1)] * ydim, verts[(i * 12 + j * 3 + 2)] * zdim);
/*     */         }
/*     */
/* 203 */         for (int j = 3; j > 1; j--) {
/* 204 */           gbuf.normal3d(normals[i].x * sign, normals[i].y * sign, normals[i].z * sign);
/*     */
/* 207 */           gbuf.texCoord2d(tcoords[(i * 8 + j * 2)], tcoords[(i * 8 + j * 2 + 1)]);
/* 208 */           gbuf.vertex3d(verts[(i * 12 + j * 3)] * xdim, verts[(i * 12 + j * 3 + 1)] * ydim, verts[(i * 12 + j * 3 + 2)] * zdim);
/*     */         }
/*     */
/* 212 */         gbuf.end();
/* 213 */         shape[i] = new Shape3D(gbuf.getGeom(this.flags));
/* 214 */         this.numVerts = gbuf.getNumVerts();
/* 215 */         this.numTris = gbuf.getNumTris();
/*     */
/* 217 */         if ((primflags & 0x10) == 0) {
/* 218 */           cacheGeometry(8, xdim, ydim, zdim, i, i, primflags, gbuf);
View Full Code Here

/*     */
/* 215 */     GeomBuffer cache = getCachedGeometry(2, 0.0F, radius, height, xdivision, ydivision, primflags);
/*     */
/* 218 */     if (cache != null)
/*     */     {
/* 220 */       shape[0] = new Shape3D(cache.getComputedGeometry());
/* 221 */       this.numVerts += cache.getNumVerts();
/* 222 */       this.numTris += cache.getNumTris();
/*     */     }
/*     */     else {
/* 225 */       gbuf = q.cylinder(height, radius, xdivision, ydivision, outside);
/*     */
/* 227 */       shape[0] = new Shape3D(gbuf.getGeom(this.flags));
/* 228 */       this.numVerts += gbuf.getNumVerts();
/* 229 */       this.numTris += gbuf.getNumTris();
/* 230 */       if ((primflags & 0x10) == 0) {
/* 231 */         cacheGeometry(2, 0.0F, radius, height, xdivision, ydivision, primflags, gbuf);
/*     */       }
/*     */
/*     */     }
/*     */
/* 236 */     if ((this.flags & 0x40) != 0) {
/* 237 */       shape[0].setCapability(14);
/* 238 */       shape[0].setCapability(15);
/*     */     }
/*     */
/* 241 */     if ((this.flags & 0x20) != 0) {
/* 242 */       shape[0].setCapability(12);
/*     */     }
/*     */
/* 245 */     addChild(shape[0]);
/*     */
/* 248 */     cache = getCachedGeometry(16, radius, radius, height / 2.0F, xdivision, xdivision, primflags);
/*     */
/* 250 */     if (cache != null)
/*     */     {
/* 252 */       shape[1] = new Shape3D(cache.getComputedGeometry());
/* 253 */       this.numVerts += cache.getNumVerts();
/* 254 */       this.numTris += cache.getNumTris();
/*     */     }
/*     */     else {
/* 257 */       gbuf = q.disk(radius, xdivision, height / 2.0D, outside);
/*     */
/* 259 */       shape[1] = new Shape3D(gbuf.getGeom(this.flags));
/* 260 */       this.numVerts += gbuf.getNumVerts();
/* 261 */       this.numTris += gbuf.getNumTris();
/* 262 */       if ((primflags & 0x10) == 0) {
/* 263 */         cacheGeometry(16, radius, radius, height / 2.0F, xdivision, xdivision, primflags, gbuf);
/*     */       }
/*     */
/*     */     }
/*     */
/* 269 */     if ((this.flags & 0x40) != 0) {
/* 270 */       shape[1].setCapability(14);
/* 271 */       shape[1].setCapability(15);
/*     */     }
/*     */
/* 274 */     if ((this.flags & 0x20) != 0) {
/* 275 */       shape[1].setCapability(12);
/*     */     }
/*     */
/* 278 */     addChild(shape[1]);
/*     */
/* 281 */     cache = getCachedGeometry(32, radius, radius, -height / 2.0F, xdivision, xdivision, primflags);
/*     */
/* 284 */     if (cache != null)
/*     */     {
/* 286 */       shape[2] = new Shape3D(cache.getComputedGeometry());
/* 287 */       this.numVerts += cache.getNumVerts();
/* 288 */       this.numTris += cache.getNumTris();
/*     */     }
/*     */     else {
/* 291 */       gbuf = q.disk(radius, xdivision, -height / 2.0D, !outside);
/* 292 */       shape[2] = new Shape3D(gbuf.getGeom(this.flags));
/* 293 */       this.numVerts += gbuf.getNumVerts();
/* 294 */       this.numTris += gbuf.getNumTris();
/* 295 */       if ((primflags & 0x10) == 0) {
/* 296 */         cacheGeometry(32, radius, radius, -height / 2.0F, xdivision, xdivision, primflags, gbuf);
/*     */       }
View Full Code Here

/*    */   {
/* 79 */     return false;
/*    */   }
/*    */
/*    */   public SceneGraphObject createNode(Class j3dClass) {
/* 83 */     Shape3D shape = (Shape3D)createNode(j3dClass, new Class[] { Double.TYPE }, new Object[] { new Double(this.scale) });
/*    */
/* 85 */     return shape;
/*    */   }
View Full Code Here

TOP

Related Classes of javax.media.j3d.Shape3D

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.