Java Programing

January 31, 2007

gi.setContourCounts( countourCountArray ); gi.setStripCounts( stripCountArray ); Triangulator triangulator

Filed under: Java 3D Programming — webmaster @ 12:26 pm

gi.setContourCounts( countourCountArray ); gi.setStripCounts( stripCountArray ); Triangulator triangulator = new Triangulator(); triangulator.triangulate( gi ); //Generate normal vectors for the triangles, not strictly necessary //as we are not lighting the scene, but generally useful. NormalGenerator normalGenerator = new NormalGenerator(); normalGenerator.generateNormals( gi ); //wrap the GeometryArray in a Shape3D and assign appearance return new Shape3D( gi.getGeometryArray(), app ); } /* * Handle the nitty-gritty details of loading the input file * and reading (in order): * - texture file image name * - size of the geometry in the X direction * - Y direction scale factor * - number of texture coordinates * - each texture coordinate (X Y) * This could all be easily accomplished using a scenegraph loader, * but this simple code is included for reference. */ protected TextureGeometryInfo createTextureCoordinates( String szFile ) { //create a simple wrapper class to package our return values TextureGeometryInfo texInfo = new TextureGeometryInfo(); //allocate a temporary buffer to store the input file StringBuffer szBufferData = new StringBuffer(); float sizeGeometryX = 0; float factorY = 1; int nNumPoints = 0; Point2f boundsPoint = new Point2f(); try { //attach a reader to the input file FileReader fileIn = new FileReader( szFile ); int nChar = 0; //read the entire file into the StringBuffer while( true ) { nChar = fileIn.read(); //if we have not hit the end of file //add the character to the StringBuffer if( nChar != -1 ) szBufferData.append( (char) nChar ); else //hit EOF break; } //create a tokenizer to tokenize the input file at whitespace 236

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.

Powered by Java Web Hosting