List of usage examples for javax.media.j3d GeometryArray COORDINATES
int COORDINATES
To view the source code for javax.media.j3d GeometryArray COORDINATES.
Click Source Link
From source file:PickTest.java
TetrahedronILA() { super(4, GeometryArray.COORDINATES | GeometryArray.COLOR_3, 12); Point3f verts[] = new Point3f[4]; Color3f colors[] = new Color3f[4]; verts[0] = new Point3f(1.0f, 1.0f, 1.0f); verts[1] = new Point3f(1.0f, -1.0f, -1.0f); verts[2] = new Point3f(-1.0f, -1.0f, 1.0f); verts[3] = new Point3f(-1.0f, 1.0f, -1.0f); colors[0] = new Color3f(1.0f, 0.0f, 0.0f); colors[1] = new Color3f(0.0f, 1.0f, 0.0f); colors[2] = new Color3f(0.0f, 0.0f, 1.0f); colors[3] = new Color3f(1.0f, 1.0f, 0.0f); int[] pntsIndex = new int[12]; int[] clrsIndex = new int[12]; pntsIndex[0] = 0;//w w w . j ava 2s .c o m clrsIndex[0] = 0; pntsIndex[1] = 1; clrsIndex[1] = 1; pntsIndex[2] = 1; clrsIndex[2] = 1; pntsIndex[3] = 2; clrsIndex[3] = 2; pntsIndex[4] = 2; clrsIndex[4] = 2; pntsIndex[5] = 0; clrsIndex[5] = 0; pntsIndex[6] = 1; clrsIndex[6] = 1; pntsIndex[7] = 3; clrsIndex[7] = 3; pntsIndex[8] = 2; clrsIndex[8] = 2; pntsIndex[9] = 3; clrsIndex[9] = 3; pntsIndex[10] = 0; clrsIndex[10] = 0; pntsIndex[11] = 3; clrsIndex[11] = 3; setCoordinates(0, verts); setCoordinateIndices(0, pntsIndex); setColors(0, colors); setColorIndices(0, clrsIndex); }
From source file:ExTexture.java
public QuadArray buildGeometry() { QuadArray cube = new QuadArray(24, GeometryArray.COORDINATES | GeometryArray.NORMALS | GeometryArray.TEXTURE_COORDINATE_2); cube.setCapability(GeometryArray.ALLOW_COORDINATE_WRITE); cube.setCapability(GeometryArray.ALLOW_TEXCOORD_WRITE); VertexList vl = new VertexList(cube); float MAX = 1.0f; float MIN = 0.0f; // Coordinate Normal Texture // X Y Z I J K S T // Front//from w w w . j a v a2s . c om vl.xyzijkst(-1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, MIN, MIN); vl.xyzijkst(1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, MAX, MIN); vl.xyzijkst(1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, MAX, MAX); vl.xyzijkst(-1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, MIN, MAX); // Back vl.xyzijkst(1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, MAX, MIN); vl.xyzijkst(-1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, MIN, MIN); vl.xyzijkst(-1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, MIN, MAX); vl.xyzijkst(1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, MAX, MAX); // Right vl.xyzijkst(1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, MIN, MAX); vl.xyzijkst(1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, MIN, MIN); vl.xyzijkst(1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, MAX, MIN); vl.xyzijkst(1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, MAX, MAX); // Left vl.xyzijkst(-1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, MIN, MIN); vl.xyzijkst(-1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, MIN, MAX); vl.xyzijkst(-1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, MAX, MAX); vl.xyzijkst(-1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, MAX, MIN); // Top vl.xyzijkst(-1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, MIN, MAX); vl.xyzijkst(1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, MAX, MAX); vl.xyzijkst(1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, MAX, MIN); vl.xyzijkst(-1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, MIN, MIN); // Bottom vl.xyzijkst(-1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, MIN, MIN); vl.xyzijkst(1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, MAX, MIN); vl.xyzijkst(1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, MAX, MAX); vl.xyzijkst(-1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, MIN, MAX); return cube; }
From source file:AppearanceExplorer.java
Shape3D createPointArray() { Point3f pnt[] = new Point3f[3]; pnt[0] = new Point3f(-1.0f, -1.0f, 0.0f); pnt[1] = new Point3f(1.0f, -1.0f, 0.0f); pnt[2] = new Point3f(1.0f, 1.0f, 0.0f); PointArray pa = new PointArray(3, GeometryArray.COORDINATES); pa.setCoordinates(0, pnt);//from w ww .j a v a2 s . com return new Shape3D(pa, appearance); }
From source file:PickTest.java
TetrahedronTA() { super(12, GeometryArray.COORDINATES | GeometryArray.COLOR_3); Point3f verts[] = new Point3f[4]; Color3f colors[] = new Color3f[4]; verts[0] = new Point3f(1.0f, 1.0f, 1.0f); verts[1] = new Point3f(1.0f, -1.0f, -1.0f); verts[2] = new Point3f(-1.0f, -1.0f, 1.0f); verts[3] = new Point3f(-1.0f, 1.0f, -1.0f); colors[0] = new Color3f(1.0f, 0.0f, 0.0f); colors[1] = new Color3f(0.0f, 1.0f, 0.0f); colors[2] = new Color3f(0.0f, 0.0f, 1.0f); colors[3] = new Color3f(1.0f, 1.0f, 0.0f); Point3f pnts[] = new Point3f[12]; Color3f clrs[] = new Color3f[12]; pnts[0] = verts[2];// w w w.jav a 2 s .co m clrs[0] = colors[0]; pnts[1] = verts[1]; clrs[1] = colors[0]; pnts[2] = verts[0]; clrs[2] = colors[0]; pnts[3] = verts[3]; clrs[3] = colors[1]; pnts[4] = verts[2]; clrs[4] = colors[1]; pnts[5] = verts[0]; clrs[5] = colors[1]; pnts[6] = verts[1]; clrs[6] = colors[2]; pnts[7] = verts[2]; clrs[7] = colors[2]; pnts[8] = verts[3]; clrs[8] = colors[2]; pnts[9] = verts[1]; clrs[9] = colors[3]; pnts[10] = verts[3]; clrs[10] = colors[3]; pnts[11] = verts[0]; clrs[11] = colors[3]; setCoordinates(0, pnts); setColors(0, clrs); }
From source file:AppearanceExplorer.java
Shape3D createLineArray() { Point3f pnt[] = new Point3f[4]; pnt[0] = new Point3f(-1.0f, -1.0f, 0.0f); pnt[1] = new Point3f(1.0f, -1.0f, 0.0f); pnt[2] = new Point3f(1.0f, 1.0f, 0.0f); pnt[3] = new Point3f(-1.0f, 1.0f, 0.0f); Color3f colrs[] = new Color3f[4]; colrs[0] = black;/*from ww w . j a va 2 s . co m*/ colrs[1] = white; colrs[2] = red; colrs[3] = green; LineArray la = new LineArray(4, GeometryArray.COORDINATES | GeometryArray.COLOR_3); la.setCoordinates(0, pnt); la.setColors(0, colrs); return new Shape3D(la, appearance); }
From source file:AppearanceExplorer.java
Shape3D createTriangleArray() { Point3f pnt[] = new Point3f[3]; pnt[0] = new Point3f(-1.0f, -1.0f, 0.0f); pnt[1] = new Point3f(1.0f, -1.0f, 0.0f); pnt[2] = new Point3f(1.0f, 1.0f, 0.0f); Color3f colrs[] = new Color3f[3]; colrs[0] = red;//from ww w.ja v a 2 s . c o m colrs[1] = green; colrs[2] = blue; Vector3f norms[] = new Vector3f[3]; Vector3f triNormal = new Vector3f(0.0f, 0.0f, 1.0f); norms[0] = triNormal; norms[1] = triNormal; norms[2] = triNormal; TriangleArray ta = new TriangleArray(3, GeometryArray.COORDINATES | GeometryArray.COLOR_3 | GeometryArray.NORMALS); ta.setCoordinates(0, pnt); ta.setColors(0, colrs); ta.setNormals(0, norms); return new Shape3D(ta, appearance); }
From source file:PickTest.java
TetrahedronPA() { super(4, GeometryArray.COORDINATES | GeometryArray.COLOR_3); Point3f verts[] = new Point3f[4]; Color3f colors[] = new Color3f[4]; verts[0] = new Point3f(1.0f, 1.0f, 1.0f); verts[1] = new Point3f(1.0f, -1.0f, -1.0f); verts[2] = new Point3f(-1.0f, -1.0f, 1.0f); verts[3] = new Point3f(-1.0f, 1.0f, -1.0f); colors[0] = new Color3f(1.0f, 0.0f, 0.0f); colors[1] = new Color3f(0.0f, 1.0f, 0.0f); colors[2] = new Color3f(0.0f, 0.0f, 1.0f); colors[3] = new Color3f(1.0f, 1.0f, 0.0f); setCoordinates(0, verts);// w w w .jav a 2 s . c o m setColors(0, colors); }
From source file:AppearanceExplorer.java
Shape3D createLineStripArray() { int[] stripLengths = new int[2]; stripLengths[0] = 3;//from w w w. j ava2 s . c om stripLengths[1] = 2; Point3f pnt[] = new Point3f[5]; // first line pnt[0] = new Point3f(-1.0f, -1.0f, 0.0f); pnt[1] = new Point3f(1.0f, -1.0f, 0.0f); pnt[2] = new Point3f(1.0f, 1.0f, 0.0f); // second line pnt[3] = new Point3f(0.5f, 0.5f, 0.0f); pnt[4] = new Point3f(-0.5f, -0.5f, 0.0f); LineStripArray lsa = new LineStripArray(5, GeometryArray.COORDINATES, stripLengths); lsa.setCoordinates(0, pnt); return new Shape3D(lsa, appearance); }
From source file:PickTest.java
TetrahedronLSA() { super(8, GeometryArray.COORDINATES | GeometryArray.COLOR_3, lineLengths); Point3f verts[] = new Point3f[4]; Color3f colors[] = new Color3f[4]; verts[0] = new Point3f(1.0f, 1.0f, 1.0f); verts[1] = new Point3f(1.0f, -1.0f, -1.0f); verts[2] = new Point3f(-1.0f, -1.0f, 1.0f); verts[3] = new Point3f(-1.0f, 1.0f, -1.0f); colors[0] = new Color3f(1.0f, 0.0f, 0.0f); colors[1] = new Color3f(0.0f, 1.0f, 0.0f); colors[2] = new Color3f(0.0f, 0.0f, 1.0f); colors[3] = new Color3f(1.0f, 1.0f, 0.0f); Point3f pnts[] = new Point3f[8]; Color3f clrs[] = new Color3f[8]; pnts[0] = verts[0];/*w w w.ja va 2 s . c om*/ clrs[0] = colors[0]; pnts[1] = verts[1]; clrs[1] = colors[1]; pnts[2] = verts[3]; clrs[2] = colors[3]; pnts[3] = verts[2]; clrs[3] = colors[2]; pnts[4] = verts[1]; clrs[4] = colors[1]; pnts[5] = verts[2]; clrs[5] = colors[2]; pnts[6] = verts[0]; clrs[6] = colors[0]; pnts[7] = verts[3]; clrs[7] = colors[3]; setCoordinates(0, pnts); setColors(0, clrs); }
From source file:AppearanceExplorer.java
Shape3D createTriangleStripArray() { int[] stripLengths = new int[1]; stripLengths[0] = 5;/*from ww w.j a v a 2 s . co m*/ Point3f pnt[] = new Point3f[5]; pnt[0] = new Point3f(-1.0f, -1.0f, 0.0f); pnt[1] = new Point3f(1.0f, -1.0f, 0.0f); pnt[2] = new Point3f(-1.0f, 0.0f, 0.0f); pnt[3] = new Point3f(1.0f, 0.0f, 0.0f); pnt[4] = new Point3f(1.0f, 1.0f, 0.0f); TriangleStripArray tsa = new TriangleStripArray(5, GeometryArray.COORDINATES, stripLengths); tsa.setCoordinates(0, pnt); return new Shape3D(tsa, appearance); }