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, R2TransformContextType).
| Modifier and Type | Method and Description |
|---|---|
int |
addInstance(com.io7m.jtensors.parameterized.PVectorI3F<R2SpaceWorldType> position,
float scale,
float rotation)
Enable rendering of an instance with transform
t |
com.io7m.jcanephora.core.JCGLArrayObjectType |
arrayObject() |
void |
clear()
Clear all instances.
|
void |
delete(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g)
Delete the current object.
|
int |
enabledCount() |
long |
instanceID() |
boolean |
isDeleted() |
int |
maximumSize() |
static R2InstanceBillboardedDynamicType |
newBillboarded(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 |
update(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g,
R2TransformContextType context)
Update any data required for rendering on the GPU.
|
public static R2InstanceBillboardedDynamicType newBillboarded(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 R2InstanceBillboardedDynamicTypepublic void clear()
R2InstanceBillboardedDynamicTypeclear in interface R2InstanceBillboardedDynamicTypepublic int addInstance(com.io7m.jtensors.parameterized.PVectorI3F<R2SpaceWorldType> position, float scale, float rotation) throws R2ExceptionBatchIsFull
R2InstanceBillboardedDynamicTypetaddInstance in interface R2InstanceBillboardedDynamicTypeposition - 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
R2DeletableTypedelete in interface R2DeletableTypeg - An OpenGL interfaceR2Exception - On errorspublic boolean isDeleted()
isDeleted in interface com.io7m.jcanephora.core.JCGLResourceUsableTypepublic long instanceID()
instanceID in interface R2InstanceTypepublic com.io7m.jcanephora.core.JCGLArrayObjectType arrayObject()
arrayObject in interface R2InstanceBillboardedTypepublic void update(com.io7m.jcanephora.core.api.JCGLInterfaceGL33Type g,
R2TransformContextType context)
R2InstanceBillboardedTypeupdate in interface R2InstanceBillboardedTypeg - An OpenGL interfacecontext - The transform contextpublic int enabledCount()
enabledCount in interface R2InstanceBillboardedTypeCopyright © 2017 <code@io7m.com> http://io7m.com