List of usage examples for javax.media.j3d QuadArray setCoordinates
public void setCoordinates(int index, float coordinates[], int start, int length)
start
for length
vertices. From source file:AvatarTest.java
protected Group createGeometryGroup(Appearance app, Vector3d position, Vector3d scale, String szTextureFile, String szSoundFile) {/* w ww .j ava 2 s . c o m*/ QuadArray quadArray = new QuadArray(4, GeometryArray.COORDINATES | GeometryArray.TEXTURE_COORDINATE_2); float[] coordArray = { -LAND_WIDTH, LAND_HEIGHT, 0, LAND_WIDTH, LAND_HEIGHT, 0, LAND_WIDTH, LAND_HEIGHT, LAND_LENGTH, -LAND_WIDTH, LAND_HEIGHT, LAND_LENGTH }; float[] texArray = { 0, 0, 1, 0, 1, 1, 0, 1 }; quadArray.setCoordinates(0, coordArray, 0, 4); if ((m_nFlags & TEXTURE) == TEXTURE) { quadArray.setTextureCoordinates(0, 0, texArray, 0, 4); setTexture(app, szTextureFile); } Shape3D sh = new Shape3D(quadArray, app); BranchGroup bg = new BranchGroup(); bg.addChild(sh); return bg; }
From source file:AvatarTest.java
protected Group createGeometryGroup(Appearance app, Vector3d position, Vector3d scale, String szTextureFile, String szSoundFile) {// ww w. j a v a 2 s. co m // creates a segment of road 200 x 2 QuadArray quadArray = new QuadArray(4, GeometryArray.COORDINATES | GeometryArray.TEXTURE_COORDINATE_2); float[] coordArray = { -ROAD_WIDTH, ROAD_HEIGHT, 0, ROAD_WIDTH, ROAD_HEIGHT, 0, ROAD_WIDTH, ROAD_HEIGHT, ROAD_LENGTH, -ROAD_WIDTH, ROAD_HEIGHT, ROAD_LENGTH }; float[] texArray = { 0, 0, 1, 0, 1, 1, 0, 1 }; quadArray.setCoordinates(0, coordArray, 0, 4); if ((m_nFlags & TEXTURE) == TEXTURE) { quadArray.setTextureCoordinates(0, 0, texArray, 0, 4); setTexture(app, szTextureFile); } Shape3D sh = new Shape3D(quadArray, app); BranchGroup bg = new BranchGroup(); bg.addChild(sh); return bg; }
From source file:KeyNavigateTest.java
protected Group createGeometryGroup(Appearance app, Vector3d position, Vector3d scale, String szTextureFile, String szSoundFile) {/*from w w w. ja v a2 s. c om*/ int nFlags = GeometryArray.COORDINATES | GeometryArray.NORMALS; if ((m_nFlags & TEXTURE) == TEXTURE) nFlags |= GeometryArray.TEXTURE_COORDINATE_2; QuadArray quadArray = new QuadArray(24, nFlags); quadArray.setCoordinates(0, verts, 0, 24); for (int n = 0; n < 24; n++) quadArray.setNormal(n, normals[n / 4]); if ((m_nFlags & TEXTURE) == TEXTURE) { quadArray.setTextureCoordinates(0, 0, tcoords, 0, 24); setTexture(app, szTextureFile); } Shape3D shape = new Shape3D(quadArray, app); BranchGroup bg = new BranchGroup(); bg.addChild(shape); return bg; }
From source file:KeyNavigateTest.java
protected Group createGeometryGroup(Appearance app, Vector3d position, Vector3d scale, String szTextureFile, String szSoundFile) {/*from ww w . j a v a 2s . com*/ int nFlags = GeometryArray.COORDINATES | GeometryArray.NORMALS; if ((m_nFlags & TEXTURE) == TEXTURE) nFlags |= GeometryArray.TEXTURE_COORDINATE_2; QuadArray quadArray = new QuadArray(4, nFlags); float[] coordArray = { -WIDTH, HEIGHT, LENGTH, WIDTH, HEIGHT, LENGTH, WIDTH, HEIGHT, -LENGTH, -WIDTH, HEIGHT, -LENGTH }; quadArray.setCoordinates(0, coordArray, 0, coordArray.length / 3); for (int n = 0; n < coordArray.length / 3; n++) quadArray.setNormal(n, new Vector3f(0, 1, 0)); if ((m_nFlags & TEXTURE) == TEXTURE) { float[] texArray = { 0, 0, 1, 0, 1, 1, 0, 1 }; quadArray.setTextureCoordinates(0, 0, texArray, 0, coordArray.length / 3); setTexture(app, szTextureFile); } BranchGroup bg = new BranchGroup(); Shape3D shape = new Shape3D(quadArray, app); bg.addChild(shape); return bg; }