summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/classes/share/com/sun/j3d/internal/ByteBufferWrapper.java10
-rwxr-xr-xsrc/classes/share/com/sun/j3d/internal/ByteOrderWrapper.java94
-rw-r--r--src/classes/share/com/sun/j3d/utils/geometry/GeometryInfo.java14
-rw-r--r--src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/GeometryArrayState.java16
4 files changed, 19 insertions, 115 deletions
diff --git a/src/classes/share/com/sun/j3d/internal/ByteBufferWrapper.java b/src/classes/share/com/sun/j3d/internal/ByteBufferWrapper.java
index 70789d0..a45de9f 100755
--- a/src/classes/share/com/sun/j3d/internal/ByteBufferWrapper.java
+++ b/src/classes/share/com/sun/j3d/internal/ByteBufferWrapper.java
@@ -143,18 +143,16 @@ public class ByteBufferWrapper extends BufferWrapper {
/**
* Returns the byte order of this buffer.
*/
- public ByteOrderWrapper order() {
- if ( buffer.order()==ByteOrder.BIG_ENDIAN ) return ByteOrderWrapper.BIG_ENDIAN;
- else return ByteOrderWrapper.LITTLE_ENDIAN;
+ public ByteOrder order() {
+ return buffer.order();
}
/**
* Modifies this buffer's byte order.
*/
- public ByteBufferWrapper order(ByteOrderWrapper bo)
+ public ByteBufferWrapper order(ByteOrder bo)
{
- if ( bo == ByteOrderWrapper.BIG_ENDIAN ) buffer.order( ByteOrder.BIG_ENDIAN );
- else buffer.order( ByteOrder.LITTLE_ENDIAN );
+ buffer.order( bo );
return this;
}
diff --git a/src/classes/share/com/sun/j3d/internal/ByteOrderWrapper.java b/src/classes/share/com/sun/j3d/internal/ByteOrderWrapper.java
deleted file mode 100755
index 5b423a8..0000000
--- a/src/classes/share/com/sun/j3d/internal/ByteOrderWrapper.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any
- * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
- * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
- * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL
- * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF
- * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
- * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR
- * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,
- * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND
- * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR
- * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed, licensed or
- * intended for use in the design, construction, operation or
- * maintenance of any nuclear facility.
- *
- */
-
-package com.sun.j3d.internal;
-
-import java.nio.ByteOrder;
-
-/**
- * NIO Buffers are new in Java 1.4 but we need to run on 1.3
- * as well, so this class was created to hide the NIO classes
- * from non-1.4 Java 3D users.
- *
- * <p>
- * Typesafe enum for byte orders.
- *
- * <p>
- * NOTE: We no longer need to support JDK 1.3 as of the Java 3D 1.3.2
- * community source release on java.net. We should be able to get rid
- * of this class.
- */
-
-public final class ByteOrderWrapper {
-
- private final String enum_name;
-
- /**
- * Private constructor is only called from static initializers
- * in this class.
- */
- private ByteOrderWrapper(String name) {
- enum_name = name;
- }
-
- /**
- * Static initializer creates object of this type.
- */
- public static final ByteOrderWrapper BIG_ENDIAN =
- new ByteOrderWrapper("BIG_ENDIAN");
-
- /**
- * Static initializer creates object of this type.
- */
- public static final ByteOrderWrapper LITTLE_ENDIAN =
- new ByteOrderWrapper("LITTLE_ENDIAN");
-
- public String toString() {
- return enum_name;
- }
-
- /**
- * Returns the native byte order of the host system.
- */
- public static ByteOrderWrapper nativeOrder() {
- if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
- return ByteOrderWrapper.BIG_ENDIAN;
- } else return ByteOrderWrapper.LITTLE_ENDIAN;
- }
-}
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 dae3333..bfe0a69 100644
--- a/src/classes/share/com/sun/j3d/utils/geometry/GeometryInfo.java
+++ b/src/classes/share/com/sun/j3d/utils/geometry/GeometryInfo.java
@@ -39,6 +39,7 @@
package com.sun.j3d.utils.geometry;
+import java.nio.ByteOrder;
import java.util.HashMap;
import javax.media.j3d.GeometryArray;
@@ -67,7 +68,6 @@ import javax.vecmath.Tuple4f;
import javax.vecmath.Vector3f;
import com.sun.j3d.internal.ByteBufferWrapper;
-import com.sun.j3d.internal.ByteOrderWrapper;
import com.sun.j3d.internal.FloatBufferWrapper;
import com.sun.j3d.internal.J3dUtilsI18N;
@@ -2313,7 +2313,7 @@ public class GeometryInfo {
if (nio) {
ByteBufferWrapper b = ByteBufferWrapper.allocateDirect(d.length * 4);
FloatBufferWrapper f =
- b.order( ByteOrderWrapper.nativeOrder() ).asFloatBuffer();
+ b.order( ByteOrder.nativeOrder() ).asFloatBuffer();
f.put(d);
ga.setInterleavedVertexBuffer(f.getJ3DBuffer());
} else ga.setInterleavedVertices(d);
@@ -2322,25 +2322,25 @@ public class GeometryInfo {
ByteBufferWrapper b =
ByteBufferWrapper.allocateDirect(coordinates.length * 4 * 3);
FloatBufferWrapper f =
- b.order( ByteOrderWrapper.nativeOrder() ).asFloatBuffer();
+ b.order( ByteOrder.nativeOrder() ).asFloatBuffer();
f.put(vecmathToFloat(coordinates));
ga.setCoordRefBuffer(f.getJ3DBuffer());
if (colors3 != null) {
b = ByteBufferWrapper.allocateDirect(colors3.length * 4 * 3);
- f = b.order( ByteOrderWrapper.nativeOrder() ).asFloatBuffer();
+ f = b.order( ByteOrder.nativeOrder() ).asFloatBuffer();
f.put(vecmathToFloat(colors3));
ga.setColorRefBuffer(f.getJ3DBuffer());
} else if (colors4 != null) {
b = ByteBufferWrapper.allocateDirect(colors4.length * 4 * 4);
- f = b.order( ByteOrderWrapper.nativeOrder() ).asFloatBuffer();
+ f = b.order( ByteOrder.nativeOrder() ).asFloatBuffer();
f.put(vecmathToFloat(colors4));
ga.setColorRefBuffer(f.getJ3DBuffer());
}
if (normals != null) {
b = ByteBufferWrapper.allocateDirect(normals.length * 4 * 3);
- f = b.order( ByteOrderWrapper.nativeOrder() ).asFloatBuffer();
+ f = b.order( ByteOrder.nativeOrder() ).asFloatBuffer();
f.put(vecmathToFloat(normals));
ga.setNormalRefBuffer(f.getJ3DBuffer());
}
@@ -2348,7 +2348,7 @@ public class GeometryInfo {
for (int i = 0 ; i < texCoordSetCount ; i++) {
b = ByteBufferWrapper.allocateDirect(
texCoordSets[i].length * 4 * texCoordDim);
- f = b.order( ByteOrderWrapper.nativeOrder() ).asFloatBuffer();
+ f = b.order( ByteOrder.nativeOrder() ).asFloatBuffer();
f.put(vecmathToFloat(texCoordSets[i]));
ga.setTexCoordRefBuffer(i, f.getJ3DBuffer());
}
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 6320a6d..ad8d235 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
@@ -46,6 +46,7 @@ import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
+import java.nio.ByteOrder;
import javax.media.j3d.GeometryArray;
import javax.media.j3d.GeometryStripArray;
@@ -63,7 +64,6 @@ import javax.vecmath.Vector3f;
import com.sun.j3d.internal.BufferWrapper;
import com.sun.j3d.internal.ByteBufferWrapper;
-import com.sun.j3d.internal.ByteOrderWrapper;
import com.sun.j3d.internal.DoubleBufferWrapper;
import com.sun.j3d.internal.FloatBufferWrapper;
import com.sun.j3d.utils.scenegraph.io.retained.Controller;
@@ -503,7 +503,7 @@ public abstract class GeometryArrayState extends GeometryState {
ByteBufferWrapper b =
ByteBufferWrapper.allocateDirect( floats.length*4 );
FloatBufferWrapper f =
- b.order( ByteOrderWrapper.nativeOrder() ).asFloatBuffer();
+ b.order( ByteOrder.nativeOrder() ).asFloatBuffer();
f.put( floats );
((GeometryArray)node).setInterleavedVertexBuffer( f.getJ3DBuffer() );
} else ((GeometryArray)node).setInterleavedVertices( readFloatArray( in ) );
@@ -542,7 +542,7 @@ public abstract class GeometryArrayState extends GeometryState {
ByteBufferWrapper b =
ByteBufferWrapper.allocateDirect( floats.length*4 );
FloatBufferWrapper f =
- b.order( ByteOrderWrapper.nativeOrder() ).asFloatBuffer();
+ b.order( ByteOrder.nativeOrder() ).asFloatBuffer();
f.put( floats );
((GeometryArray)node).setColorRefBuffer( f.getJ3DBuffer() );
}
@@ -614,7 +614,7 @@ public abstract class GeometryArrayState extends GeometryState {
ByteBufferWrapper b =
ByteBufferWrapper.allocateDirect( floats.length*4 );
FloatBufferWrapper f =
- b.order( ByteOrderWrapper.nativeOrder() ).asFloatBuffer();
+ b.order( ByteOrder.nativeOrder() ).asFloatBuffer();
f.put( floats );
((GeometryArray)node).setColorRefBuffer( f.getJ3DBuffer() );
}
@@ -677,7 +677,7 @@ public abstract class GeometryArrayState extends GeometryState {
ByteBufferWrapper b =
ByteBufferWrapper.allocateDirect( floats.length*4 );
FloatBufferWrapper f =
- b.order( ByteOrderWrapper.nativeOrder() ).asFloatBuffer();
+ b.order( ByteOrder.nativeOrder() ).asFloatBuffer();
f.put( floats );
((GeometryArray)node).setCoordRefBuffer( f.getJ3DBuffer() );
}
@@ -687,7 +687,7 @@ public abstract class GeometryArrayState extends GeometryState {
ByteBufferWrapper b =
ByteBufferWrapper.allocateDirect( doubles.length*4 );
DoubleBufferWrapper f =
- b.order( ByteOrderWrapper.nativeOrder() ).asDoubleBuffer();
+ b.order( ByteOrder.nativeOrder() ).asDoubleBuffer();
f.put( doubles );
((GeometryArray)node).setCoordRefBuffer( f.getJ3DBuffer() );
}
@@ -744,7 +744,7 @@ public abstract class GeometryArrayState extends GeometryState {
ByteBufferWrapper b =
ByteBufferWrapper.allocateDirect( floats.length*4 );
FloatBufferWrapper f =
- b.order( ByteOrderWrapper.nativeOrder() ).asFloatBuffer();
+ b.order( ByteOrder.nativeOrder() ).asFloatBuffer();
f.put( floats );
((GeometryArray)node).setNormalRefBuffer( f.getJ3DBuffer() );
}
@@ -788,7 +788,7 @@ public abstract class GeometryArrayState extends GeometryState {
ByteBufferWrapper b =
ByteBufferWrapper.allocateDirect( floats.length*4 );
FloatBufferWrapper f = b.order(
- ByteOrderWrapper.nativeOrder() ).asFloatBuffer();
+ ByteOrder.nativeOrder() ).asFloatBuffer();
f.put( floats );
((GeometryArray)node).setTexCoordRefBuffer( set,
f.getJ3DBuffer() );