public final class R2InstanceBillboardedDynamic extends Object implements R2InstanceBillboardedDynamicType
The default implementation of the R2InstanceBatchedDynamicType
interface.
This implementation manages a fixed size set of at most N
instances. It stores per-instance positions/scales/orientations 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 |
---|---|
int |
addInstance(com.io7m.jtensors.core.parameterized.vectors.PVector3D<R2SpaceWorldType> position,
double scale,
double rotation)
Enable rendering of an instance with transform
t |
com.io7m.jcanephora.core.JCGLArrayObjectType |
arrayObject() |
void |
clear()
Clear all instances.
|
static R2InstanceBillboardedDynamic |
create(R2IDPoolType pool,
com.io7m.jcanephora.core.api.JCGLArrayBuffersType g_ab,
com.io7m.jcanephora.core.api.JCGLArrayObjectsType g_ao,
int count)
Construct a new batch of instances.
|
void |
delete(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g)
Delete the current object.
|
int |
enabledCount() |
long |
instanceID() |
boolean |
isDeleted() |
int |
maximumSize() |
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 R2InstanceBillboardedDynamic create(R2IDPoolType pool, com.io7m.jcanephora.core.api.JCGLArrayBuffersType g_ab, com.io7m.jcanephora.core.api.JCGLArrayObjectsType g_ao, int count)
pool
- The ID poolg_ab
- An array buffer interfaceg_ao
- An array object interfacecount
- The maximum number of instances in the batchpublic int maximumSize()
maximumSize
in interface R2InstanceBillboardedDynamicType
public void clear()
R2InstanceBillboardedDynamicType
clear
in interface R2InstanceBillboardedDynamicType
public int addInstance(com.io7m.jtensors.core.parameterized.vectors.PVector3D<R2SpaceWorldType> position, double scale, double rotation) throws R2ExceptionBatchIsFull
R2InstanceBillboardedDynamicType
t
addInstance
in interface R2InstanceBillboardedDynamicType
position
- The world-space positionscale
- The scalerotation
- The rotationR2ExceptionBatchIsFull
- If the batch cannot accept any more
instancespublic 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
public long instanceID()
instanceID
in interface R2InstanceType
public com.io7m.jcanephora.core.JCGLArrayObjectType arrayObject()
arrayObject
in interface R2InstanceBillboardedType
public void update(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g)
R2InstanceBillboardedType
update
in interface R2InstanceBillboardedType
g
- An OpenGL interfacepublic boolean updateRequired()
updateRequired
in interface R2InstanceBillboardedType
true
if the instance data has changed since the last call
to {R2InstanceBillboardedType.update(JCGLInterfaceGL33Type)
}public int enabledCount()
enabledCount
in interface R2InstanceBillboardedType
Copyright © 2017 <code@io7m.com> http://io7m.com