gi.setContourCounts( countourCountArray ); gi.setStripCounts( stripCountArray ); Triangulator triangulator
java.util.StringTokenizer tokenizer = new java.util.StringTokenizer( szBufferData.toString() ); //read the name of the texture image texInfo.m_szImage = tokenizer.nextToken(); //read the size of the generated geometry in the X dimension sizeGeometryX = Float.parseFloat( tokenizer.nextToken() ); //read the Y scale factor factorY = Float.parseFloat( tokenizer.nextToken() ); //read the number of texture coordinates nNumPoints = Integer.parseInt( tokenizer.nextToken() ); //read each texture coordinate texInfo.m_TexCoordArray = new Point2f[nNumPoints]; Point2f texPoint2f = null; for( int n = 0; n < nNumPoints; n++ ) { texPoint2f = new Point2f( Float.parseFloat( tokenizer.nextToken() ), Float.parseFloat( tokenizer.nextToken() ) ); texInfo.m_TexCoordArray[n] = texPoint2f; //keep an eye on the extents of the texture coordinates // so we can automatically center the geometry if( n == 0 || texPoint2f.x > boundsPoint.x ) boundsPoint.x = texPoint2f.x; if( n == 0 || texPoint2f.y > boundsPoint.y ) boundsPoint.y = texPoint2f.y; } } catch( Exception e ) { System.err.println( e.toString() ); return null; } //build the array of coordinates texInfo.m_CoordArray = new Point3f[nNumPoints]; for( int n = 0; n < nNumPoints; n++ ) { //scale and center the geometry based on the texture coordinates texInfo.m_CoordArray[n] = new Point3f( sizeGeometryX * texInfo.m_TexCoordArray[n].x - boundsPoint.x/2), factorY * sizeGeometryX * (texInfo.m_TexCoordArray[n].y - boundsPoint.y/2), 0 ); } return texInfo; } As the TextureTestexample illustrates, using a static mapping from vertex coordinates is relatively straightforward. Texture coordinates are assigned to each vertex, much like vertex coordinates or per-vertex colors. The renderer will take care of all the messy details of interpolating the texture image between projected vertex coordinates using projection and sampling algorithms. 237
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services