Package javax.media.j3d

Examples of javax.media.j3d.LineArray


        }
    }

    private void addBranchShape() {
        Shape3D branchShape = new Shape3D();
        LineArray branchLine = createBranchLine();
        Appearance branchAppearance = new Appearance();
        AppearanceFactory.setColorWithColoringAttributes(branchAppearance, ColorConstants.brown);
        branchShape.setGeometry(branchLine);
        branchShape.setAppearance(branchAppearance);
        group.addChild(branchShape);
View Full Code Here


        branchShape.setAppearance(branchAppearance);
        group.addChild(branchShape);
    }

    private LineArray createBranchLine() {
        LineArray branchLine = new LineArray(2, GeometryArray.COORDINATES);
        branchLine.setCoordinate(0, new Point3d(0, 0, 0));
        branchLine.setCoordinate(1, endPoint);
        return branchLine;
    }
View Full Code Here

    this.edgeAppearanceTransformer = new ConstantTransformer(lightGrayLook);
    this.edgeShapeTransformer = new Transformer<Context<Graph<V,E>,E>,Node>() {

      public Node transform(Context<Graph<V,E>,E> ec) {
        LineArray lineArray = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
        lineArray.setCoordinates(0, new Point3f[]{new Point3f(0,-.5f,0),new Point3f(0,.5f,0)});
        lineArray.setColor(0, new Color3f(1,1,1));
        lineArray.setColor(1, new Color3f(1,1,1));
        Shape3D shape = new Shape3D();
        shape.setGeometry(lineArray);
        return shape;
//        return new Cylinder(1, 1,
//            Cylinder.GENERATE_NORMALS |
View Full Code Here

/* 163 */         appearance.setPointAttributes(pointStyle);
/*     */       }
/* 165 */       else if (shape.facetSizes[0] == 2)
/*     */       {
/* 168 */         debugOutputLn(8, "Creating IndexedLineArray");
/* 169 */         GeometryArray object = new LineArray(vertexCount, vertexFormat);
/*     */
/* 171 */         object.setCoordinates(0, shape.coordsArray);
/* 172 */         ColoringAttributes colorAtt = new ColoringAttributes(surf.getColor(), 0);
/*     */
/* 175 */         appearance.setColoringAttributes(colorAtt);
/*     */       }
/*     */       else
/*     */       {
/* 179 */         debugOutputLn(8, "Creating IndexedTriFanArray");
/*     */
/* 181 */         vertexFormat |= 2;
/*     */
/* 183 */         debugOutputLn(8, "about to process vertices/indices, facetIndices = " + shape.facetIndices);
/*     */
/* 185 */         if (shape.facetIndices != null) {
/* 186 */           float[] textureCoords = null;
/* 187 */           int[] textureIndices = null;
/*     */
/* 189 */           debugOutputLn(8, "setting vertexCount, normind = " + shape.normalIndices);
/*     */
/* 191 */           debugOutputLn(8, "vtxcount, format, indcount = " + vertexCount + ", " + vertexFormat + ", " + indexCount);
/*     */
/* 194 */           if (texture != null)
/*     */           {
/* 197 */             vertexFormat |= 32;
/* 198 */             textureCoords = new float[vertexCount * 2];
/* 199 */             textureIndices = new int[shape.facetIndices.length];
/* 200 */             calculateTextureCoords(texture, shape.coordsArray, shape.facetIndices, textureCoords, textureIndices);
/*     */
/* 203 */             debugOutputLn(8, "textureCoords:");
/* 204 */             debugOutputLn(8, "texture Coords, Indices.length = " + textureCoords.length + ", " + textureIndices.length);
/*     */           }
/* 206 */           debugOutputLn(8, "about to create GeometryInfo");
/*     */
/* 209 */           GeometryInfo gi = new GeometryInfo(3);
/*     */
/* 211 */           gi.setCoordinates(shape.coordsArray);
/* 212 */           gi.setCoordinateIndices(shape.facetIndices);
/* 213 */           gi.setStripCounts(shape.facetSizes);
/* 214 */           if (texture != null) {
/* 215 */             gi.setTextureCoordinateParams(1, 2);
/* 216 */             gi.setTextureCoordinates(0, textureCoords);
/* 217 */             gi.setTextureCoordinateIndices(0, textureIndices);
/*     */           }
/* 219 */           gi.recomputeIndices();
/* 220 */           NormalGenerator ng = new NormalGenerator(surf.getCreaseAngle());
/*     */
/* 222 */           ng.generateNormals(gi);
/* 223 */           Stripifier st = new Stripifier();
/* 224 */           st.stripify(gi);
/* 225 */           GeometryArray object = gi.getGeometryArray(true, true, false);
/* 226 */           debugOutputLn(8, "done.");
/*     */         }
/*     */         else
/*     */         {
/* 232 */           debugOutputLn(8, "about to create trifanarray with vertexCount, facetSizes.len = " + vertexCount + ", " + shape.facetSizes.length);
/*     */
/* 237 */           object = new TriangleFanArray(vertexCount, vertexFormat, shape.facetSizes);
/*     */
/* 241 */           object.setCoordinates(0, shape.coordsArray);
/* 242 */           object.setNormals(0, shape.normalCoords);
/* 243 */           debugOutputLn(2, "passed in normalCoords, length = " + shape.normalCoords.length);
/*     */         }
/*     */
/* 246 */         debugOutputLn(8, "created fan array");
/*     */
View Full Code Here

/* 54 */     return createNode(j3dClass, new Class[] { Integer.TYPE, Integer.TYPE, Integer.TYPE, this.texCoordSetMap.getClass() }, new Object[] { new Integer(this.vertexCount), new Integer(this.vertexFormat), new Integer(this.texCoordSetCount), this.texCoordSetMap });
/*    */   }
/*    */
/*    */   protected SceneGraphObject createNode()
/*    */   {
/* 68 */     return new LineArray(this.vertexCount, this.vertexFormat, this.texCoordSetCount, this.texCoordSetMap);
/*    */   }
View Full Code Here

     * @param expectedStartPoint the expected start point
     * @param expectedEndPoint the expected end point
     */
    public static void testGeometry(Geometry branchGeometry, Point3d expectedStartPoint, Point3d expectedEndPoint) {
        assertTrue(branchGeometry instanceof LineArray);
        LineArray branchLine = (LineArray) branchGeometry;
        Point3d actualStartPoint = new Point3d();
        Point3d actualEndPoint = new Point3d();
        branchLine.getCoordinate(0, actualStartPoint);
        branchLine.getCoordinate(1, actualEndPoint);
        PointTestHelper.assertPointEquals(expectedStartPoint, actualStartPoint);
        PointTestHelper.assertPointEquals(expectedEndPoint, actualEndPoint);
        assertEquals("Ony 2 vertices for a branch line", 2, branchLine.getVertexCount());
    }
View Full Code Here

     * @param expectedStartPoint the expected start point
     * @param expectedEndPoint the expected end point
     */
    public static void testGeometry(Geometry branchGeometry, Point3d expectedStartPoint, Point3d expectedEndPoint) {
        assertTrue(branchGeometry instanceof LineArray);
        LineArray branchLine = (LineArray) branchGeometry;
        Point3d actualStartPoint = new Point3d();
        Point3d actualEndPoint = new Point3d();
        branchLine.getCoordinate(0, actualStartPoint);
        branchLine.getCoordinate(1, actualEndPoint);
        PointTestHelper.assertPointEquals(expectedStartPoint, actualStartPoint);
        PointTestHelper.assertPointEquals(expectedEndPoint, actualEndPoint);
        assertEquals("Ony 2 vertices for a branch line", 2, branchLine.getVertexCount());
    }
View Full Code Here

        this.endPoint = new Point3d(axisType == Axis.X ? 5 : 0, axisType == Axis.Y ? 5 : 0, axisType == Axis.Z ? 5 : 0);
        createBranchShape();
    }

    private LineArray createBranchLine() {
        LineArray branchLine = new LineArray(2, GeometryArray.COORDINATES);
        branchLine.setCoordinate(0, startPoint);
        branchLine.setCoordinate(1, endPoint);
        return branchLine;
    }
View Full Code Here

        branchLine.setCoordinate(1, endPoint);
        return branchLine;
    }

    private void createBranchShape() {
        LineArray branchLine = createBranchLine();
        Appearance branchAppearance = new Appearance();
        setGeometry(branchLine);
        setAppearance(branchAppearance);
    }
View Full Code Here

        }
    }

    private void addBranchShape() {
        Shape3D branchShape = new Shape3D();
        LineArray branchLine = createBranchLine();
        Appearance branchAppearance = new Appearance();
        AppearanceFactory.setColorWithColoringAttributes(branchAppearance, ColorConstants.brown);
        branchShape.setGeometry(branchLine);
        branchShape.setAppearance(branchAppearance);
        group.addChild(branchShape);
View Full Code Here

TOP

Related Classes of javax.media.j3d.LineArray

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.