public final class R2InstanceBatchedDynamic extends Object implements R2InstanceBatchedDynamicType
The default implementation of the R2InstanceBatchedDynamicType
interface.
This implementation manages a fixed size batch of N
instances. It
stores per-instance matrices in a vertex buffer object, and uses an
"orphaning" strategy where the entire buffer storage is reallocated and
populated on each call to update(JCGLInterfaceGL33Type)
.
Modifier and Type | Method and Description |
---|---|
com.io7m.jcanephora.core.JCGLArrayObjectType |
arrayObject() |
static R2InstanceBatchedDynamic |
create(R2IDPoolType pool,
com.io7m.jcanephora.core.api.JCGLArrayBuffersType g_ab,
com.io7m.jcanephora.core.api.JCGLArrayObjectsType g_ao,
com.io7m.jcanephora.core.JCGLArrayObjectUsableType o,
int count)
Construct a new batch of instances.
|
void |
delete(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g)
Delete the current object.
|
void |
disableAll()
Disable rendering of all instances
|
void |
disableInstance(int id)
Disable rendering of the given instance.
|
int |
enabledCount() |
int |
enableInstance(R2TransformOrthogonalReadableType t)
Enable rendering of an instance with transform
t |
long |
instanceID() |
boolean |
isDeleted() |
int |
maximumSize() |
int |
renderCount() |
void |
update(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g)
Update any data required for rendering on the GPU.
|
boolean |
updateRequired() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
wrap
public static R2InstanceBatchedDynamic create(R2IDPoolType pool, com.io7m.jcanephora.core.api.JCGLArrayBuffersType g_ab, com.io7m.jcanephora.core.api.JCGLArrayObjectsType g_ao, com.io7m.jcanephora.core.JCGLArrayObjectUsableType o, int count)
pool
- The ID poolg_ab
- An array buffer interfaceg_ao
- An array object interfaceo
- An existing array objectcount
- The maximum number of instances in the batchpublic int maximumSize()
maximumSize
in interface R2InstanceBatchedDynamicType
public int enabledCount()
enabledCount
in interface R2InstanceBatchedDynamicType
public int renderCount()
renderCount
in interface R2InstanceBatchedType
public void disableAll()
R2InstanceBatchedDynamicType
disableAll
in interface R2InstanceBatchedDynamicType
public int enableInstance(R2TransformOrthogonalReadableType t)
R2InstanceBatchedDynamicType
t
enableInstance
in interface R2InstanceBatchedDynamicType
t
- The transform for the instancepublic void disableInstance(int id)
R2InstanceBatchedDynamicType
disableInstance
in interface R2InstanceBatchedDynamicType
id
- The index of the instancepublic void update(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g)
R2InstanceBatchedType
update
in interface R2InstanceBatchedType
g
- An OpenGL interfacepublic boolean updateRequired()
updateRequired
in interface R2InstanceBatchedType
true
if the instance data has changed since the last call
to {R2InstanceBatchedType.update(JCGLInterfaceGL33Type)
}public com.io7m.jcanephora.core.JCGLArrayObjectType arrayObject()
arrayObject
in interface R2InstanceBatchedType
public long instanceID()
instanceID
in interface R2InstanceType
public void delete(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g) throws R2Exception
R2DeletableType
delete
in interface R2DeletableType
g
- An OpenGL interfaceR2Exception
- On errorspublic boolean isDeleted()
isDeleted
in interface com.io7m.jcanephora.core.JCGLResourceUsableType
Copyright © 2017 <code@io7m.com> http://io7m.com