Package com.sun.j3d.utils.geometry

Examples of com.sun.j3d.utils.geometry.GeometryInfo


    static final GeometryArray polygon = makeHex();
    static final GeometryArray border = makeHexOutline();
    static final GeometryArray shaft = makeHexShaft();

    private static final GeometryArray makeHex() {
        GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
        float[] texCoords = {
            0.25f, 1.0f,
            0.00f, 0.5f,
            0.25f, 0.0f,
            0.75f, 0.0f,
            1.00f, 0.5f,
            0.75f, 1.0f,
            0.25f, 1.0f,
        };
        float[] normals = {
            0, 0, 1,
            0, 0, 1,
            0, 0, 1,
            0, 0, 1,
            0, 0, 1,
            0, 0, 1,
            0, 0, 1,
        };
       
        gi.setCoordinates(hexVertices);
        gi.setStripCounts(new int[] { hexVertices.length/3 });
        gi.setContourCounts(new int[] { 1 });
        gi.setNormals(normals);

        gi.setTextureCoordinateParams(1, 2);
        gi.setTextureCoordinates(0, texCoords);
       
        Stripifier st = new Stripifier();
        st.stripify(gi);
       
        return gi.getGeometryArray();
    }
View Full Code Here


       
        return gi.getGeometryArray();
    }

    private static final GeometryArray makeHexShaft() {
        GeometryInfo gi = new GeometryInfo(GeometryInfo.TRIANGLE_STRIP_ARRAY);
       
        double[] coords = new double[hexVertices.length*2];
       
        int s = 0;
        for (int d = 0; d < coords.length; d += 6, s += 3) {
            coords[d] = hexVertices[s];
            coords[d+1] = hexVertices[s+1];
            coords[d+2] = -0.001;
            coords[d+3] = hexVertices[s];
            coords[d+4] = hexVertices[s+1];
            coords[d+5] = -20*BoardModel.HEX_HEIGHT;
        }
       
        gi.setCoordinates(coords);
        gi.setStripCounts(new int[] { coords.length/3 });
       
        NormalGenerator ng = new NormalGenerator(0);
        ng.generateNormals(gi);

        Stripifier st = new Stripifier();
        st.stripify(gi);
       
        return gi.getGeometryArray();
    }
View Full Code Here

      };




    GeometryInfo gi = new GeometryInfo(GeometryInfo.TRIANGLE_ARRAY);
    gi.setCoordinates(tetrahedronCoordinates);
    gi.setCoordinateIndices(coordIndices);
    NormalGenerator ng = new NormalGenerator();

//The parameter specifying up to which angle normal vectors should be
//interpolated, is se here.
    ng.setCreaseAngle(Math.PI);

    ng.generateNormals(gi);
    GeometryArray te = gi.getGeometryArray();

    //Generate the tetrahedron as a Shape.
    Shape3D tetrahedron = new Shape3D(te,yellowApp);

    //The transformation group of the tetrahedron.
View Full Code Here

      coords[i++]= (float)p.z;
      coords[i++]= (float)p.x;
   
        int[] stripCount = {frontiere.size()+1}// ******
       
        GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
        gi.setCoordinates(coords);
        gi.setStripCounts(stripCount);
        gi.recomputeIndices();
       

        NormalGenerator ng = new NormalGenerator();
        ng.generateNormals(gi);
        gi.recomputeIndices();

        Stripifier st = new Stripifier();
        st.stripify(gi);
        gi.recomputeIndices();

        surface.setAppearance(CreateurVoiture.createMaterialAppearance());
        surface.setGeometry(gi.getGeometryArray());
   
    bg.addChild(surface);
    simpleU.addBranchGraph(bg);
    //System.out.println(frontiere.size() +" pts traces");
  }
View Full Code Here

  public static Shape3D creerForme(boolean bleu){
    float[] coordinateData = null;
        coordinateData = creerCoordonnees();
        int[] stripCount = {17,17,5,5,5,5,5,5,5}// ******
       
        GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
        gi.setCoordinates(coordinateData);
        gi.setStripCounts(stripCount);
        gi.recomputeIndices();

        NormalGenerator ng = new NormalGenerator();
        ng.generateNormals(gi);
        gi.recomputeIndices();

        Stripifier st = new Stripifier();
        st.stripify(gi);
        gi.recomputeIndices();

        Shape3D part = new Shape3D();
        /*if(wireFrame==true)
                part.setAppearance(createWireFrameAppearance());
        else
                part.setAppearance(createMaterialAppearance());*/
        part.setAppearance(createMaterialAppearance(bleu));
        part.setGeometry(gi.getGeometryArray());
       
        return part;
  }
View Full Code Here

  public static Shape3D creerForme(){
    float[] coordinateData = null;
        coordinateData = createCoordinateData();
        int[] stripCount = {17,17,5,5,5,5,5,5,5}// ******
       
        GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
        gi.setCoordinates(coordinateData);
        gi.setStripCounts(stripCount);
        gi.recomputeIndices();

        NormalGenerator ng = new NormalGenerator();
        ng.generateNormals(gi);
        gi.recomputeIndices();

        Stripifier st = new Stripifier();
        st.stripify(gi);
        gi.recomputeIndices();

        Shape3D part = new Shape3D();
        /*if(wireFrame==true)
                part.setAppearance(createWireFrameAppearance());
        else
                part.setAppearance(createMaterialAppearance());*/
        part.setAppearance(createMaterialAppearance());
        part.setGeometry(gi.getGeometryArray());
       
        return part;
  }
View Full Code Here

      };




    GeometryInfo gi = new GeometryInfo(GeometryInfo.TRIANGLE_ARRAY);
    gi.setCoordinates(tetrahedronCoordinates);
    gi.setCoordinateIndices(coordIndices);
    NormalGenerator ng = new NormalGenerator();
    ng.generateNormals(gi);
    GeometryArray te = gi.getGeometryArray();

    //Generate the tetrahedron as a Shape.
    Shape3D tetrahedron = new Shape3D(te,yellowApp);

    //The transformation group of the tetrahedron.
View Full Code Here

            }

            m = m + 2;
        }

        GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
        gi.setCoordinates(polydata);
        gi.setStripCounts(stripCount);

        Triangulator tr = new Triangulator();
        tr.triangulate(gi);
        gi.recomputeIndices();

        NormalGenerator ng = new NormalGenerator();
        ng.generateNormals(gi);
        gi.recomputeIndices();

        Stripifier st = new Stripifier();
        st.stripify(gi);
        gi.recomputeIndices();

        _containedNode = new Shape3D();
        _containedNode.setAppearance(_appearance);
        _containedNode.setGeometry(gi.getGeometryArray());
    }
View Full Code Here

            }

            m = m + 2;
        }

        GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
        gi.setCoordinates(polydata);
        gi.setStripCounts(stripCount);

        Triangulator tr = new Triangulator();
        tr.triangulate(gi);
        gi.recomputeIndices();

        NormalGenerator ng = new NormalGenerator();
        ng.generateNormals(gi);
        gi.recomputeIndices();

        Stripifier st = new Stripifier();
        st.stripify(gi);
        gi.recomputeIndices();

        _containedNode = new Shape3D();
        _containedNode.setAppearance(_appearance);
        _containedNode.setGeometry(gi.getGeometryArray());
    }
View Full Code Here

            data[k + 10] = data[j + 1];
            data[k + 11] = data[j + 2];
            k = k + 12;
        }

        GeometryInfo geometryInfo = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
        geometryInfo.setCoordinates(data);
        geometryInfo.setStripCounts(stripCount);

        Triangulator triangulator = new Triangulator();
        triangulator.triangulate(geometryInfo);
        geometryInfo.recomputeIndices();

        NormalGenerator normalGenerator = new NormalGenerator();
        normalGenerator.generateNormals(geometryInfo);
        geometryInfo.recomputeIndices();

        Stripifier st = new Stripifier();
        st.stripify(geometryInfo);
        geometryInfo.recomputeIndices();
        return geometryInfo.getGeometryArray();
    }
View Full Code Here

TOP

Related Classes of com.sun.j3d.utils.geometry.GeometryInfo

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.