< Zurück | Inhalt | Weiter >

OldGeomBuffer gbuf = new OldGeomBuffer(4); gbuf.begin(OldGeomBuffer.QUAD_STRIP);


for (int j = 0; j < 2; j++)

{

gbuf.normal3d( (double) normals[i].x*sign, (double) normals[i].y*sign,

(double) normals[i].z*sign);


gbuf.texCoord2d(tcoords[i*8 + j*2], tcoords[i*8 + j*2 + 1]); gbuf.vertex3d( (double) verts[i*12 + j*3]*xdim,

(double) verts[i*12+ j*3 + 1]*ydim, (double) verts[i*12+ j*3 + 2]*zdim );

}


for (int j = 3; j > 1; j−−)

{

gbuf.normal3d( (double) normals[i].x*sign, (double) normals[i].y*sign,

(double) normals[i].z*sign);

gbuf.texCoord2d(tcoords[i*8 + j*2], tcoords[i*8 + j*2 + 1]); gbuf.vertex3d( (double) verts[i*12 + j*3]*xdim,

(double) verts[i*12+ j*3 + 1]*ydim, (double) verts[i*12+ j*3 + 2]*zdim );

}


gbuf.end();

shape[i] = new Shape3D(gbuf.getGeom(flags)); numVerts = gbuf.getNumVerts();

numTris = gbuf.getNumTris();


if ((flags ENABLE_APPEARANCE_MODIFY) != 0)

{

(shape[i]).setCapability(Shape3D.ALLOW_APPEARANCE_READ); (shape[i]).setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);

}

objTrans.addChild(shape[i]);

}

if (ap == null)

{

setAppearance();

}

else setAppearance(ap);

}


image


GeometryBuffer must also be simply modified (in fact, the original 1.1 version can be used), to create a

QuadArray inside processQuadStrips—newer versions create a TriangleStripArray. Copy the

GeomBuffer file (defined in the com.sun.j3d.utils.geometry package, for which there is source code). Save the file as OldGeomBuffer and replace the processQuadStrips method from GeomBuffer with the method which follows.


 

From CuboidTest\OldGeomBuffer.java