normals[20].y=1;normals[21].y=1;normals[22].y=1;normals[23].y=1; lsa.setNormals(0, normals); lsa.setCoordinates(0, pts); Shape3D sh=new Shape3D(); PolygonAttributes pa=new PolygonAttributes();
public GeometryArray getQuad(final CubeData cdata, final int index) { calculateQuad(cdata, index); final QuadArray quadArray = new QuadArray(4, GeometryArray.COORDINATES); quadArray.setCoordinates(0, quadCoords); // quadArray.setCapability(QuadArray.ALLOW_INTERSECT); return quadArray; }
/** * Constructs a color cube with unit scale. The corners of the * color cube are [-1,-1,-1] and [1,1,1]. */ public ColorCube() { QuadArray cube = new QuadArray(24, QuadArray.COORDINATES | QuadArray.COLOR_3); cube.setCoordinates(0, verts); cube.setColors(0, colors); this.setGeometry(cube); scale = 1.0; }
/** * Creates a rectangle of the given width and height and sets up * texture coordinates to map the text image onto the whole surface * of the rectangle (the rectangle is the same size as the text image) */ private QuadArray setupGeometry(int width, int height) { float zPosition = 0f; float rectWidth = (float)width * rectangleScaleFactor; float rectHeight = (float)height * rectangleScaleFactor; float[] verts1 = { rectWidth, 0f, zPosition, rectWidth, rectHeight, zPosition, 0f, rectHeight, zPosition, 0f, 0f, zPosition }; float[] texCoords = { 0f, -1f, 0f, 0f, (-1f), 0f, (-1f), -1f }; QuadArray rect = new QuadArray(4, QuadArray.COORDINATES | QuadArray.TEXTURE_COORDINATE_2); rect.setCoordinates(0, verts1); rect.setTextureCoordinates(0, 0, texCoords); return rect; }
/** * Constructs a color cube with the specified scale. The corners of the * color cube are [-scale,-scale,-scale] and [scale,scale,scale]. * @param scale the scale of the cube */ public ColorCube(double scale) { QuadArray cube = new QuadArray(24, QuadArray.COORDINATES | QuadArray.COLOR_3); float scaledVerts[] = new float[verts.length]; for (int i = 0; i < verts.length; i++) scaledVerts[i] = verts[i] * (float)scale; cube.setCoordinates(0, scaledVerts); cube.setColors(0, colors); this.setGeometry(cube); this.scale = scale; }
/** * Returns the QuadArray for the specified axis and slice index. * * @param direction * @param index * @return */ public GeometryArray getQuad(final int direction, final int index) { calculateQuad(direction, index); final QuadArray quadArray = new QuadArray(4, GeometryArray.COORDINATES); quadArray.setCoordinates(0, quadCoords); quadArray.setCapability(Geometry.ALLOW_INTERSECT); quadArray.setCapability(GeometryArray.ALLOW_COORDINATE_WRITE); return quadArray; }
/** * Sets the slice index of the specified plane to the given value. * * @param axis * @param v */ public void setSlice(final int axis, final int v) { if (v >= dimensions[axis] || v < 0) return; slices[axis] = v; final Group g = (Group) axisSwitch.getChild(axisIndex[axis][FRONT]); final int num = g.numChildren(); if (num > 1) System.out.println(num + " children, expected only 1"); final Shape3D shape = (Shape3D) ((Group) g.getChild(num - 1)).getChild(0); final double[] quadCoords = geomCreator.getQuadCoords(axis, v); ((QuadArray) shape.getGeometry()).setCoordinates(0, quadCoords); final Texture2D tex = appCreator.getTexture(axis, v); shape.getAppearance().setTexture(tex); final TexCoordGeneration tg = appCreator.getTg(axis); shape.getAppearance().setTexCoordGeneration(tg); } }
public GeometryArray createGeometry() { QuadArray quadArray = new QuadArray(4, GeometryArray.COORDINATES | GeometryArray.COLOR_3); Point3f[] coords = new Point3f[4]; coords[0] = new Point3f(0, 0, 0); coords[1] = new Point3f(w, 0, 0); coords[2] = new Point3f(w, h, 0); coords[3] = new Point3f(0, h, 0); Color3f[] colors = new Color3f[4]; colors[0] = new Color3f(100, 100, 100); colors[1] = new Color3f(100, 100, 100); colors[2] = new Color3f(100, 100, 100); colors[3] = new Color3f(100, 100, 100); quadArray.setCoordinates(0, coords); quadArray.setColors(0, colors); return quadArray; }
public GeometryArray createGeometry() { QuadArray quadArray = new QuadArray(4, GeometryArray.COORDINATES | GeometryArray.COLOR_3); Point3f[] coords = new Point3f[4]; coords[0] = new Point3f(0, 0, 0); coords[1] = new Point3f(w, 0, 0); coords[2] = new Point3f(w, h, 0); coords[3] = new Point3f(0, h, 0); Color3f[] colors = new Color3f[4]; colors[0] = new Color3f(100, 100, 100); colors[1] = new Color3f(100, 100, 100); colors[2] = new Color3f(100, 100, 100); colors[3] = new Color3f(100, 100, 100); quadArray.setCoordinates(0, coords); quadArray.setColors(0, colors); return quadArray; }
coords[23] = p[7]; qa.setCoordinates(0, coords);