From f35dd13fddef3f686a7dd5fb9f7458afc2e44b4e Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Tue, 18 Sep 2012 23:08:23 -0700 Subject: j3dutil: remove many wrapper around nio buffers, the tests for J3DBuffer's type make this safe Signed-off-by: Harvey Harrison --- .../j3d/utils/compression/CompressionStream.java | 30 +++++++-------- .../com/sun/j3d/utils/geometry/GeometryInfo.java | 45 ++++++++++------------ .../j3d/utils/geometry/GeometryInfoGenerator.java | 29 +++++++------- .../geometry/compression/CompressionStream.java | 30 +++++++-------- .../state/javax/media/j3d/GeometryArrayState.java | 36 ++++++++--------- 5 files changed, 81 insertions(+), 89 deletions(-) (limited to 'src') diff --git a/src/classes/share/com/sun/j3d/utils/compression/CompressionStream.java b/src/classes/share/com/sun/j3d/utils/compression/CompressionStream.java index 6299fcd..3a6b8af 100644 --- a/src/classes/share/com/sun/j3d/utils/compression/CompressionStream.java +++ b/src/classes/share/com/sun/j3d/utils/compression/CompressionStream.java @@ -39,6 +39,9 @@ package com.sun.j3d.utils.compression; +import java.nio.ByteBuffer; +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; @@ -73,9 +76,6 @@ import javax.vecmath.Point3i; import javax.vecmath.Vector3f; import com.sun.j3d.internal.BufferWrapper; -import com.sun.j3d.internal.ByteBufferWrapper; -import com.sun.j3d.internal.DoubleBufferWrapper; -import com.sun.j3d.internal.FloatBufferWrapper; import com.sun.j3d.utils.geometry.GeometryInfo; /** @@ -1478,14 +1478,14 @@ public class CompressionStream { * interleaved NIO geometry arrays. */ private class InterleavedGeometryNIO extends InterleavedGeometry { - FloatBufferWrapper fbw = null ; + FloatBuffer fbw = null ; InterleavedGeometryNIO(GeometryArray ga) { super(ga) ; J3DBuffer buffer = ga.getInterleavedVertexBuffer() ; if (BufferWrapper.getBufferType(buffer) == BufferWrapper.TYPE_FLOAT) { - fbw = new FloatBufferWrapper(buffer) ; + fbw = (FloatBuffer)buffer.getBuffer(); } else { throw new IllegalArgumentException @@ -1695,11 +1695,11 @@ public class CompressionStream { private class ByRefGeometryNIO implements GeometryAccessor { VertexCopy vc = new VertexCopy() ; - ByteBufferWrapper colorsB = null ; - FloatBufferWrapper colorsF = null ; - FloatBufferWrapper normals = null ; - FloatBufferWrapper positionsF = null ; - DoubleBufferWrapper positionsD = null ; + ByteBuffer colorsB = null ; + FloatBuffer colorsF = null ; + FloatBuffer normals = null ; + FloatBuffer positionsF = null ; + DoubleBuffer positionsD = null ; int initialPositionIndex = 0 ; int initialNormalIndex = 0 ; @@ -1712,11 +1712,11 @@ public class CompressionStream { switch (BufferWrapper.getBufferType(buffer)) { case BufferWrapper.TYPE_FLOAT: - positionsF = new FloatBufferWrapper(buffer) ; + positionsF = (FloatBuffer)buffer.getBuffer(); if (debug) System.out.println("float positions buffer") ; break ; case BufferWrapper.TYPE_DOUBLE: - positionsD = new DoubleBufferWrapper(buffer) ; + positionsD = (DoubleBuffer)buffer.getBuffer(); if (debug) System.out.println("double positions buffer") ; break ; default: @@ -1730,11 +1730,11 @@ public class CompressionStream { switch (BufferWrapper.getBufferType(buffer)) { case BufferWrapper.TYPE_BYTE: - colorsB = new ByteBufferWrapper(buffer) ; + colorsB = (ByteBuffer)buffer.getBuffer(); if (debug) System.out.println("byte colors buffer") ; break ; case BufferWrapper.TYPE_FLOAT: - colorsF = new FloatBufferWrapper(buffer) ; + colorsF = (FloatBuffer)buffer.getBuffer(); if (debug) System.out.println("float colors buffer") ; break ; default: @@ -1749,7 +1749,7 @@ public class CompressionStream { switch (BufferWrapper.getBufferType(buffer)) { case BufferWrapper.TYPE_FLOAT: - normals = new FloatBufferWrapper(buffer) ; + normals = (FloatBuffer)buffer.getBuffer(); if (debug) System.out.println("float normals buffer") ; break ; default: diff --git a/src/classes/share/com/sun/j3d/utils/geometry/GeometryInfo.java b/src/classes/share/com/sun/j3d/utils/geometry/GeometryInfo.java index bfe0a69..f70c5c7 100644 --- a/src/classes/share/com/sun/j3d/utils/geometry/GeometryInfo.java +++ b/src/classes/share/com/sun/j3d/utils/geometry/GeometryInfo.java @@ -39,7 +39,9 @@ package com.sun.j3d.utils.geometry; +import java.nio.ByteBuffer; import java.nio.ByteOrder; +import java.nio.FloatBuffer; import java.util.HashMap; import javax.media.j3d.GeometryArray; @@ -48,6 +50,7 @@ import javax.media.j3d.IndexedQuadArray; import javax.media.j3d.IndexedTriangleArray; import javax.media.j3d.IndexedTriangleFanArray; import javax.media.j3d.IndexedTriangleStripArray; +import javax.media.j3d.J3DBuffer; import javax.media.j3d.QuadArray; import javax.media.j3d.TriangleArray; import javax.media.j3d.TriangleFanArray; @@ -67,8 +70,6 @@ import javax.vecmath.Tuple3f; import javax.vecmath.Tuple4f; import javax.vecmath.Vector3f; -import com.sun.j3d.internal.ByteBufferWrapper; -import com.sun.j3d.internal.FloatBufferWrapper; import com.sun.j3d.internal.J3dUtilsI18N; /** @@ -2311,46 +2312,42 @@ public class GeometryInfo { } // Register reference to array of interleaved data if (nio) { - ByteBufferWrapper b = ByteBufferWrapper.allocateDirect(d.length * 4); - FloatBufferWrapper f = - b.order( ByteOrder.nativeOrder() ).asFloatBuffer(); + ByteBuffer b = ByteBuffer.allocateDirect(d.length * 4); + FloatBuffer f = b.order(ByteOrder.nativeOrder()).asFloatBuffer(); f.put(d); - ga.setInterleavedVertexBuffer(f.getJ3DBuffer()); + ga.setInterleavedVertexBuffer(new J3DBuffer(f)); } else ga.setInterleavedVertices(d); } else if (nio) { - ByteBufferWrapper b = - ByteBufferWrapper.allocateDirect(coordinates.length * 4 * 3); - FloatBufferWrapper f = - b.order( ByteOrder.nativeOrder() ).asFloatBuffer(); + ByteBuffer b = ByteBuffer.allocateDirect(coordinates.length * 4 * 3); + FloatBuffer f = b.order(ByteOrder.nativeOrder()).asFloatBuffer(); f.put(vecmathToFloat(coordinates)); - ga.setCoordRefBuffer(f.getJ3DBuffer()); + ga.setCoordRefBuffer(new J3DBuffer(f)); if (colors3 != null) { - b = ByteBufferWrapper.allocateDirect(colors3.length * 4 * 3); - f = b.order( ByteOrder.nativeOrder() ).asFloatBuffer(); + b = ByteBuffer.allocateDirect(colors3.length * 4 * 3); + f = b.order(ByteOrder.nativeOrder()).asFloatBuffer(); f.put(vecmathToFloat(colors3)); - ga.setColorRefBuffer(f.getJ3DBuffer()); + ga.setColorRefBuffer(new J3DBuffer(f)); } else if (colors4 != null) { - b = ByteBufferWrapper.allocateDirect(colors4.length * 4 * 4); - f = b.order( ByteOrder.nativeOrder() ).asFloatBuffer(); + b = ByteBuffer.allocateDirect(colors4.length * 4 * 4); + f = b.order(ByteOrder.nativeOrder()).asFloatBuffer(); f.put(vecmathToFloat(colors4)); - ga.setColorRefBuffer(f.getJ3DBuffer()); + ga.setColorRefBuffer(new J3DBuffer(f)); } if (normals != null) { - b = ByteBufferWrapper.allocateDirect(normals.length * 4 * 3); - f = b.order( ByteOrder.nativeOrder() ).asFloatBuffer(); + b = ByteBuffer.allocateDirect(normals.length * 4 * 3); + f = b.order(ByteOrder.nativeOrder()).asFloatBuffer(); f.put(vecmathToFloat(normals)); - ga.setNormalRefBuffer(f.getJ3DBuffer()); + ga.setNormalRefBuffer(new J3DBuffer(f)); } for (int i = 0 ; i < texCoordSetCount ; i++) { - b = ByteBufferWrapper.allocateDirect( - texCoordSets[i].length * 4 * texCoordDim); - f = b.order( ByteOrder.nativeOrder() ).asFloatBuffer(); + b = ByteBuffer.allocateDirect(texCoordSets[i].length * 4 * texCoordDim); + f = b.order(ByteOrder.nativeOrder()).asFloatBuffer(); f.put(vecmathToFloat(texCoordSets[i])); - ga.setTexCoordRefBuffer(i, f.getJ3DBuffer()); + ga.setTexCoordRefBuffer(i, new J3DBuffer(f)); } } else if (byRef) { // Need to copy the data into float arrays - GeometryArray diff --git a/src/classes/share/com/sun/j3d/utils/geometry/GeometryInfoGenerator.java b/src/classes/share/com/sun/j3d/utils/geometry/GeometryInfoGenerator.java index b8b8661..e0178b7 100644 --- a/src/classes/share/com/sun/j3d/utils/geometry/GeometryInfoGenerator.java +++ b/src/classes/share/com/sun/j3d/utils/geometry/GeometryInfoGenerator.java @@ -39,6 +39,10 @@ package com.sun.j3d.utils.geometry; +import java.nio.ByteBuffer; +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; + import javax.media.j3d.GeometryArray; import javax.media.j3d.GeometryStripArray; import javax.media.j3d.IndexedGeometryArray; @@ -64,9 +68,6 @@ import javax.vecmath.TexCoord4f; import javax.vecmath.Vector3f; import com.sun.j3d.internal.BufferWrapper; -import com.sun.j3d.internal.ByteBufferWrapper; -import com.sun.j3d.internal.DoubleBufferWrapper; -import com.sun.j3d.internal.FloatBufferWrapper; import com.sun.j3d.internal.J3dUtilsI18N; @@ -177,7 +178,7 @@ class GeometryInfoGenerator extends Object { float[] d; if ((vertexFormat & GeometryArray.USE_NIO_BUFFER) != 0) { J3DBuffer b = geomArray.getInterleavedVertexBuffer(); - FloatBufferWrapper w = new FloatBufferWrapper(b); + FloatBuffer w = (FloatBuffer)b.getBuffer(); d = new float[w.limit()]; w.position( 0 ); w.get(d); @@ -289,7 +290,7 @@ class GeometryInfoGenerator extends Object { switch (BufferWrapper.getBufferType(buf)) { case BufferWrapper.TYPE_FLOAT: { - FloatBufferWrapper bb = new FloatBufferWrapper(buf); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] c = new float[valid * 3]; bb.position(initial * 3); bb.get(c, 0, valid * 3); @@ -303,7 +304,7 @@ class GeometryInfoGenerator extends Object { break; case BufferWrapper.TYPE_DOUBLE: { - DoubleBufferWrapper bb = new DoubleBufferWrapper( buf ); + DoubleBuffer bb = (DoubleBuffer)buf.getBuffer(); double[] c = new double[valid * 3]; bb.position(initial * 3); bb.get(c, 0, valid * 3); @@ -373,7 +374,7 @@ class GeometryInfoGenerator extends Object { J3DBuffer buf = geomArray.getNormalRefBuffer(); if (BufferWrapper.getBufferType(buf) == BufferWrapper.TYPE_FLOAT) { - FloatBufferWrapper bb = new FloatBufferWrapper(buf); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] c = new float[valid * 3]; bb.position(initial * 3); bb.get(c, 0, valid * 3); @@ -431,7 +432,7 @@ class GeometryInfoGenerator extends Object { switch (BufferWrapper.getBufferType(buf)) { case BufferWrapper.TYPE_FLOAT: { - FloatBufferWrapper bb = new FloatBufferWrapper(buf); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] c = new float[valid * 4]; bb.position(initial * 4); bb.get(c, 0, valid * 4); @@ -446,7 +447,7 @@ class GeometryInfoGenerator extends Object { break; case BufferWrapper.TYPE_BYTE: { - ByteBufferWrapper bb = new ByteBufferWrapper(buf); + ByteBuffer bb = (ByteBuffer)buf.getBuffer(); byte[] c = new byte[valid * 4]; bb.position(initial * 4); bb.get(c, 0, valid * 4); @@ -523,7 +524,7 @@ class GeometryInfoGenerator extends Object { switch (BufferWrapper.getBufferType(buf)) { case BufferWrapper.TYPE_FLOAT: { - FloatBufferWrapper bb = new FloatBufferWrapper(buf); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] c = new float[valid * 3]; bb.position(initial * 3); bb.get(c, 0, valid * 3); @@ -537,7 +538,7 @@ class GeometryInfoGenerator extends Object { break; case BufferWrapper.TYPE_BYTE: { - ByteBufferWrapper bb = new ByteBufferWrapper(buf); + ByteBuffer bb = (ByteBuffer)buf.getBuffer(); byte[] c = new byte[valid * 3]; bb.position(initial * 3); bb.get(c, 0, valid * 3); @@ -612,7 +613,7 @@ class GeometryInfoGenerator extends Object { J3DBuffer buf = geomArray.getTexCoordRefBuffer(i); if (BufferWrapper.getBufferType(buf) == BufferWrapper.TYPE_FLOAT) { - FloatBufferWrapper bb = new FloatBufferWrapper(buf); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] c = new float[valid * 4]; bb.position(initial * 4); bb.get(c, 0, valid * 4); @@ -666,7 +667,7 @@ class GeometryInfoGenerator extends Object { J3DBuffer buf = geomArray.getTexCoordRefBuffer(i); if (BufferWrapper.getBufferType(buf) == BufferWrapper.TYPE_FLOAT) { - FloatBufferWrapper bb = new FloatBufferWrapper(buf); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] c = new float[valid * 3]; bb.position(initial * 3); bb.get(c, 0, valid * 3); @@ -726,7 +727,7 @@ class GeometryInfoGenerator extends Object { J3DBuffer buf = geomArray.getTexCoordRefBuffer(i); if (BufferWrapper.getBufferType(buf) == BufferWrapper.TYPE_FLOAT) { - FloatBufferWrapper bb = new FloatBufferWrapper(buf); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] c = new float[valid * 2]; bb.position(initial * 2); bb.get(c, 0, valid * 2); diff --git a/src/classes/share/com/sun/j3d/utils/geometry/compression/CompressionStream.java b/src/classes/share/com/sun/j3d/utils/geometry/compression/CompressionStream.java index f3fc884..a444b81 100644 --- a/src/classes/share/com/sun/j3d/utils/geometry/compression/CompressionStream.java +++ b/src/classes/share/com/sun/j3d/utils/geometry/compression/CompressionStream.java @@ -39,6 +39,9 @@ package com.sun.j3d.utils.geometry.compression; +import java.nio.ByteBuffer; +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; @@ -72,9 +75,6 @@ import javax.vecmath.Point3i; import javax.vecmath.Vector3f; import com.sun.j3d.internal.BufferWrapper; -import com.sun.j3d.internal.ByteBufferWrapper; -import com.sun.j3d.internal.DoubleBufferWrapper; -import com.sun.j3d.internal.FloatBufferWrapper; import com.sun.j3d.utils.geometry.GeometryInfo; /** @@ -1474,14 +1474,14 @@ public class CompressionStream { * interleaved NIO geometry arrays. */ private class InterleavedGeometryNIO extends InterleavedGeometry { - FloatBufferWrapper fbw = null ; + FloatBuffer fbw = null ; InterleavedGeometryNIO(GeometryArray ga) { super(ga) ; J3DBuffer buffer = ga.getInterleavedVertexBuffer() ; if (BufferWrapper.getBufferType(buffer) == BufferWrapper.TYPE_FLOAT) { - fbw = new FloatBufferWrapper(buffer) ; + fbw = (FloatBuffer)buffer.getBuffer(); } else { throw new IllegalArgumentException @@ -1691,11 +1691,11 @@ public class CompressionStream { private class ByRefGeometryNIO implements GeometryAccessor { VertexCopy vc = new VertexCopy() ; - ByteBufferWrapper colorsB = null ; - FloatBufferWrapper colorsF = null ; - FloatBufferWrapper normals = null ; - FloatBufferWrapper positionsF = null ; - DoubleBufferWrapper positionsD = null ; + ByteBuffer colorsB = null ; + FloatBuffer colorsF = null ; + FloatBuffer normals = null ; + FloatBuffer positionsF = null ; + DoubleBuffer positionsD = null ; int initialPositionIndex = 0 ; int initialNormalIndex = 0 ; @@ -1708,11 +1708,11 @@ public class CompressionStream { switch (BufferWrapper.getBufferType(buffer)) { case BufferWrapper.TYPE_FLOAT: - positionsF = new FloatBufferWrapper(buffer) ; + positionsF = (FloatBuffer)buffer.getBuffer(); if (debug) System.out.println("float positions buffer") ; break ; case BufferWrapper.TYPE_DOUBLE: - positionsD = new DoubleBufferWrapper(buffer) ; + positionsD = (DoubleBuffer)buffer.getBuffer(); if (debug) System.out.println("double positions buffer") ; break ; default: @@ -1726,11 +1726,11 @@ public class CompressionStream { switch (BufferWrapper.getBufferType(buffer)) { case BufferWrapper.TYPE_BYTE: - colorsB = new ByteBufferWrapper(buffer) ; + colorsB = (ByteBuffer)buffer.getBuffer(); if (debug) System.out.println("byte colors buffer") ; break ; case BufferWrapper.TYPE_FLOAT: - colorsF = new FloatBufferWrapper(buffer) ; + colorsF = (FloatBuffer)buffer.getBuffer(); if (debug) System.out.println("float colors buffer") ; break ; default: @@ -1745,7 +1745,7 @@ public class CompressionStream { switch (BufferWrapper.getBufferType(buffer)) { case BufferWrapper.TYPE_FLOAT: - normals = new FloatBufferWrapper(buffer) ; + normals = (FloatBuffer)buffer.getBuffer(); if (debug) System.out.println("float normals buffer") ; break ; default: diff --git a/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/GeometryArrayState.java b/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/GeometryArrayState.java index e625f22..2adf3c5 100644 --- a/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/GeometryArrayState.java +++ b/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/GeometryArrayState.java @@ -66,9 +66,6 @@ import javax.vecmath.TexCoord3f; import javax.vecmath.Vector3f; import com.sun.j3d.internal.BufferWrapper; -import com.sun.j3d.internal.ByteBufferWrapper; -import com.sun.j3d.internal.DoubleBufferWrapper; -import com.sun.j3d.internal.FloatBufferWrapper; import com.sun.j3d.utils.scenegraph.io.retained.Controller; import com.sun.j3d.utils.scenegraph.io.retained.SymbolTableData; @@ -109,8 +106,7 @@ public abstract class GeometryArrayState extends GeometryState { } if ( nio ) { - FloatBufferWrapper x = new FloatBufferWrapper( - ((GeometryArray)node).getInterleavedVertexBuffer()); + FloatBuffer x = (FloatBuffer)((GeometryArray)node).getInterleavedVertexBuffer().getBuffer(); float[] f = new float[x.limit()]; x.position( 0 ); x.get( f ); @@ -138,7 +134,7 @@ public abstract class GeometryArrayState extends GeometryState { switch( BufferWrapper.getBufferType( buf ) ) { case BufferWrapper.TYPE_BYTE: { out.writeInt( FORMAT_BYTE ); - ByteBufferWrapper bb = new ByteBufferWrapper( buf ); + ByteBuffer bb = (ByteBuffer)buf.getBuffer(); byte[] bytes = new byte[ bb.limit() ]; bb.position( 0 ); bb.get( bytes ); @@ -148,7 +144,7 @@ public abstract class GeometryArrayState extends GeometryState { break; case BufferWrapper.TYPE_FLOAT: { out.writeInt( FORMAT_FLOAT ); - FloatBufferWrapper bb = new FloatBufferWrapper( buf ); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] floats = new float[ bb.limit() ]; bb.position( 0 ); bb.get( floats ); @@ -209,7 +205,7 @@ public abstract class GeometryArrayState extends GeometryState { switch( BufferWrapper.getBufferType( buf ) ) { case BufferWrapper.TYPE_BYTE: { out.writeInt( FORMAT_BYTE ); - ByteBufferWrapper bb = new ByteBufferWrapper( buf ); + ByteBuffer bb = (ByteBuffer)buf.getBuffer(); byte[] bytes = new byte[ bb.limit() ]; bb.position( 0 ); bb.get( bytes ); @@ -219,7 +215,7 @@ public abstract class GeometryArrayState extends GeometryState { break; case BufferWrapper.TYPE_FLOAT: { out.writeInt( FORMAT_FLOAT ); - FloatBufferWrapper bb = new FloatBufferWrapper( buf ); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] floats = new float[ bb.limit() ]; bb.position( 0 ); bb.get( floats ); @@ -281,7 +277,7 @@ public abstract class GeometryArrayState extends GeometryState { switch( BufferWrapper.getBufferType( buf ) ) { case BufferWrapper.TYPE_FLOAT: { out.writeInt( FORMAT_FLOAT ); - FloatBufferWrapper bb = new FloatBufferWrapper( buf ); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] floats = new float[ bb.limit() ]; bb.position( 0 ); bb.get( floats ); @@ -290,7 +286,7 @@ public abstract class GeometryArrayState extends GeometryState { break; case BufferWrapper.TYPE_DOUBLE: { out.writeInt( FORMAT_DOUBLE ); - DoubleBufferWrapper bb = new DoubleBufferWrapper( buf ); + DoubleBuffer bb = (DoubleBuffer)buf.getBuffer(); double[] doubles = new double[ bb.limit() ]; bb.position( 0 ); bb.get( doubles ); @@ -349,7 +345,7 @@ public abstract class GeometryArrayState extends GeometryState { out.writeInt( FORMAT_NULL ); else { out.writeInt( FORMAT_FLOAT ); - FloatBufferWrapper bb = new FloatBufferWrapper( buf ); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] floats = new float[ bb.limit() ]; bb.position( 0 ); bb.get( floats ); @@ -390,7 +386,7 @@ public abstract class GeometryArrayState extends GeometryState { out.writeInt( FORMAT_NULL ); else { out.writeInt( FORMAT_FLOAT ); - FloatBufferWrapper bb = new FloatBufferWrapper( buf ); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] floats = new float[ bb.limit() ]; bb.position( 0 ); bb.get( floats ); @@ -429,7 +425,7 @@ public abstract class GeometryArrayState extends GeometryState { out.writeInt( FORMAT_NULL ); else { out.writeInt( FORMAT_FLOAT ); - FloatBufferWrapper bb = new FloatBufferWrapper( buf ); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] floats = new float[ bb.limit() ]; bb.position( 0 ); bb.get( floats ); @@ -469,7 +465,7 @@ public abstract class GeometryArrayState extends GeometryState { out.writeInt( FORMAT_NULL ); else { out.writeInt( FORMAT_FLOAT ); - FloatBufferWrapper bb = new FloatBufferWrapper( buf ); + FloatBuffer bb = (FloatBuffer)buf.getBuffer(); float[] floats = new float[ bb.limit() ]; bb.position( 0 ); bb.get( floats ); @@ -503,12 +499,10 @@ public abstract class GeometryArrayState extends GeometryState { } if ( nio ) { float[] floats = readFloatArray( in ); - ByteBufferWrapper b = - ByteBufferWrapper.allocateDirect( floats.length*4 ); - FloatBufferWrapper f = - b.order( ByteOrder.nativeOrder() ).asFloatBuffer(); - f.put( floats ); - ((GeometryArray)node).setInterleavedVertexBuffer( f.getJ3DBuffer() ); + ByteBuffer b = ByteBuffer.allocateDirect(floats.length * 4); + FloatBuffer f = b.order(ByteOrder.nativeOrder()).asFloatBuffer(); + f.put(floats); + ((GeometryArray)node).setInterleavedVertexBuffer(new J3DBuffer(f)); } else ((GeometryArray)node).setInterleavedVertices( readFloatArray( in ) ); } else { boolean byRef = (vertexFormat & GeometryArray.BY_REFERENCE) != 0; -- cgit v1.2.3