diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util')
3 files changed, 89 insertions, 0 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java index f480c4bde..e281b14fd 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java @@ -444,6 +444,28 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData protected GLArrayDataClient() { } + /** + * Copy Constructor + * <p> + * Buffer is {@link Buffers#slice(Buffer) sliced}, i.e. sharing content but using own state. + * </p> + * <p> + * All other values are simply copied. + * </p> + */ + public GLArrayDataClient(GLArrayDataClient src) { + super(src); + this.isValidated = src.isValidated; + this.sealed = src.sealed; + this.bufferEnabled = src.bufferEnabled; + this.bufferWritten = src.bufferWritten; + this.enableBufferAlways = src.enableBufferAlways; + this.initialElementCount = src.initialElementCount; + this.glArrayHandler = src.glArrayHandler; + this.usesGLSL = src.usesGLSL; + this.shaderState = src.shaderState; + } + protected boolean sealed; protected boolean bufferEnabled; protected boolean bufferWritten; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java index 96643ae72..4a12ff1ae 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java @@ -29,6 +29,7 @@ package com.jogamp.opengl.util; import java.nio.Buffer; +import java.nio.FloatBuffer; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; @@ -36,6 +37,8 @@ import javax.media.opengl.GLArrayData; import javax.media.opengl.GLException; import javax.media.opengl.fixedfunc.GLPointerFuncUtil; +import com.jogamp.common.nio.Buffers; + import jogamp.opengl.util.GLArrayHandler; import jogamp.opengl.util.GLArrayHandlerInterleaved; import jogamp.opengl.util.GLDataArrayHandler; @@ -364,6 +367,14 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE return ad; } + public final void setInterleavedOffset(int interleavedOffset) { + this.interleavedOffset = interleavedOffset; + } + + public final int getInterleavedOffset() { + return interleavedOffset; + } + // // Data matters GLArrayData // @@ -458,6 +469,22 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE } } + protected GLArrayDataServer() { } + + /** + * Copy Constructor + * <p> + * Buffer is {@link Buffers#slice(Buffer) sliced}, i.e. sharing content but using own state. + * </p> + * <p> + * All other values are simply copied. + * </p> + */ + public GLArrayDataServer(GLArrayDataServer src) { + super(src); + this.interleavedOffset = src.interleavedOffset; + } + private int interleavedOffset = 0; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java index 290f47a6d..068ab5203 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java @@ -42,6 +42,8 @@ import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; import javax.media.opengl.fixedfunc.GLPointerFuncUtil; +import com.jogamp.common.nio.Buffers; + import jogamp.opengl.Debug; public class GLArrayDataWrapper implements GLArrayData { @@ -373,6 +375,44 @@ public class GLArrayDataWrapper implements GLArrayData { protected GLArrayDataWrapper() { } + /** + * Copy Constructor + * <p> + * Buffer is {@link Buffers#slice(Buffer) sliced}, i.e. sharing content but using own state. + * </p> + * <p> + * All other values are simply copied. + * </p> + */ + public GLArrayDataWrapper(GLArrayDataWrapper src) { + this.alive = src.alive; + this.index = src.index; + this.location = src.location; + this.name = src.name; + this.components = src.components; + this.componentType = src.componentType; + this.componentClazz = src.componentClazz; + this.componentByteSize = src.componentByteSize; + this.normalized = src.normalized; + this.strideB = src.strideB; + this.strideL = src.strideL; + if( null != src.buffer ) { + if( src.buffer.position() == 0 ) { + this.buffer = Buffers.slice(src.buffer); + } else { + this.buffer = Buffers.slice(src.buffer, 0, src.buffer.limit()); + } + } else { + this.buffer = null; + } + this.isVertexAttribute = src.isVertexAttribute; + this.vboOffset = src.vboOffset; + this.vboName = src.vboName; + this.vboEnabled = src.vboEnabled; + this.vboUsage = src.vboUsage; + this.vboTarget = src.vboTarget; + } + protected boolean alive; protected int index; protected int location; |