From 0dd6ef1cf40744abfa5fc7eb18ccd26a6cdddb12 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Sat, 16 Mar 2013 21:49:45 -0700 Subject: j3dcore: explicitly store the readonlyBuffer copy in preparation to remove BufferWrapper Signed-off-by: Harvey Harrison --- src/classes/share/javax/media/j3d/J3DBuffer.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/classes/share/javax/media/j3d/J3DBuffer.java b/src/classes/share/javax/media/j3d/J3DBuffer.java index 17fcd61..8abaeae 100644 --- a/src/classes/share/javax/media/j3d/J3DBuffer.java +++ b/src/classes/share/javax/media/j3d/J3DBuffer.java @@ -74,6 +74,7 @@ enum Type { } private Buffer originalBuffer = null; + private Buffer readonlyBuffer = null; private BufferWrapper bufferImpl = null; Type bufferType = Type.NULL; @@ -188,19 +189,23 @@ enum Type { case BYTE: ByteBuffer byteBuffer = ((ByteBuffer)buffer).asReadOnlyBuffer(); byteBuffer.rewind(); + readonlyBuffer = byteBuffer; bufferImpl = new ByteBufferWrapper(byteBuffer); break; case FLOAT: FloatBuffer floatBuffer = ((FloatBuffer)buffer).asReadOnlyBuffer(); floatBuffer.rewind(); + readonlyBuffer = floatBuffer; bufferImpl = new FloatBufferWrapper(floatBuffer); break; case DOUBLE: DoubleBuffer doubleBuffer = ((DoubleBuffer)buffer).asReadOnlyBuffer(); doubleBuffer.rewind(); + readonlyBuffer = doubleBuffer; bufferImpl = new DoubleBufferWrapper(doubleBuffer); break; default: + readonlyBuffer = null; bufferImpl = null; } } @@ -215,6 +220,14 @@ enum Type { return originalBuffer; } +/** + * Gets the readonly view of the nio buffer we wrapped with J3DBuffer + * @return + */ +Buffer getROBuffer() { + return readonlyBuffer; +} + BufferWrapper getBufferImpl() { return bufferImpl; } -- cgit v1.2.3