public class RenderInstances extends java.lang.Object implements Versioned, DisposeObservable, Disposable
RenderObject
s, with
varying transforms:
Modifier and Type | Class and Description |
---|---|
static class |
RenderInstances.InstanceTransformType |
static interface |
RenderInstances.RenderInstanceConsumer
Interface to allow simplified iterations through all instance transforms
|
static class |
RenderInstances.RenderInstancesIdentifier |
static class |
RenderInstances.RenderInstancesState
Stores exposable state of the object, tracking the
current primitive group indices.
|
static class |
RenderInstances.RenderInstancesVersion
Keeps track of versions for detecting changes.
|
Constructor and Description |
---|
RenderInstances() |
Modifier and Type | Method and Description |
---|---|
int |
addAffine(AffineTransform3d affine)
Adds a new affine transform that can be referenced to create
an instance.
|
int |
addAffineInstance(int aidx)
Adds an instance based on affine index
|
int |
addColor(byte[] rgba)
Adds an indexable color by reference.
|
int |
addColor(byte r,
byte g,
byte b,
byte a)
Adds an indexable color
|
int |
addColor(java.awt.Color color)
Adds an indexable color
|
int |
addColor(float[] rgba)
Adds an indexable color.
|
int |
addColor(float r,
float g,
float b,
float a)
Adds an indexable color
|
int |
addColor(int r,
int g,
int b,
int a)
Adds an indexable color
|
int |
addFrame(RigidTransform3d frame)
Adds a new frame that can be referenced to create
an instance.
|
int |
addFrameInstance(int fidx)
Adds an instance based on frame index
|
int |
addInstance(AffineTransform3d affine)
Adds an instance by affine
|
int |
addInstance(float[] xyz)
Adds an instance by point
|
int |
addInstance(float px,
float py,
float pz)
Adds an instance by point
|
int |
addInstance(RenderInstances.InstanceTransformType type,
int tidx)
Adds an instance with supplied transform index, scale index and current
color and scale
|
int |
addInstance(RenderInstances.InstanceTransformType type,
int tidx,
int sidx,
int cidx)
Adds an instance with supplied transform index, scale index and color index
|
int |
addInstance(RigidTransform3d frame)
Adds an instance by frame
|
int |
addInstance(Vector3d pos)
Adds an instance by point
|
int |
addPoint(double x,
double y,
double z)
Adds a new point that can be referenced to create
an instance.
|
int |
addPoint(float[] pos)
Adds a new point that can be referenced to create
an instance.
|
int |
addPoint(Vector3d pos)
Adds a new point that can be referenced to create
an instance.
|
int |
addPointInstance(int pidx)
Adds an instance based on point index
|
int |
addScale(java.lang.Double s)
Adds a new indexable scale.
|
void |
clearAll()
Clears everything in the RenderInstances, allowing it to be
recreated.
|
RenderInstances |
copy() |
void |
dispose()
Signal a destruction of the object.
|
void |
ensureAffineCapacity(int cap)
Hint for ensuring sufficient storage
|
void |
ensureColorCapacity(int cap)
Hint for ensuring sufficient storage
|
void |
ensureFrameCapacity(int cap)
Hint for ensuring sufficient storage
|
void |
ensureInstanceCapacity(int cap)
Hint for ensuring sufficient storage
|
void |
ensurePointCapacity(int cap)
Hint for ensuring sufficient storage
|
void |
ensureScaleCapacity(int cap)
Hint for ensuring sufficient storage
|
void |
forEachInstance(RenderInstances.RenderInstanceConsumer consumer)
Apply a function to each instance, separating
points, frames, and affines.
|
AffineTransform3d |
getAffine(int pidx)
Retrieves the affine stored with supplied index
|
java.util.List<AffineTransform3d> |
getAffines()
Retrieves the full list of Affines.
|
int |
getAffinesVersion()
Returns the latest affines version number,
for use in detecting if changes are present.
|
byte[] |
getColor(int cidx)
Retrieves the color at the supplied index.
|
java.util.List<byte[]> |
getColors()
Retrieves the full list of Colors.
|
int |
getColorsVersion()
Returns the latest colors version number,
for use in detecting if changes are present.
|
int |
getCurrentColor()
Returns the index associated with the current color, or -1
if there is no current color.
|
int |
getCurrentScale()
Returns the index associated with the current scale, or -1
if there is no current scale.
|
RenderInstances.RenderInstancesIdentifier |
getDisposeObserver()
Return an "observer" object that tracks the dispose status
of this object.
|
RigidTransform3d |
getFrame(int fidx)
Retrieves the frame stored with supplied index
|
java.util.List<RigidTransform3d> |
getFrames()
Retrieves the full list of Frames.
|
int |
getFramesVersion()
Returns the latest frames version number,
for use in detecting if changes are present.
|
RenderInstances.RenderInstancesIdentifier |
getIdentifier()
Returns a special identifier for this
RenderInstances object.
|
int |
getInstanceColorOffset() |
int[] |
getInstances() |
java.lang.Double |
getInstanceScale(int idx) |
int |
getInstanceScaleOffset() |
int |
getInstanceStride() |
int |
getInstancesVersion()
Returns the latest colors version number,
for use in detecting if changes are present.
|
int |
getInstanceTransformOffset() |
RenderInstances.InstanceTransformType |
getInstanceType(int idx) |
int |
getInstanceTypeOffset() |
float[] |
getPoint(int pidx)
Retrieves the point stored with supplied index
|
java.util.List<float[]> |
getPoints()
Retrieves the full list of Points.
|
int |
getPointsVersion()
Returns the latest points version number,
for use in detecting if changes are present.
|
java.lang.Double |
getScale(int sidx)
Retrieves the scale stored with supplied index
|
java.util.List<java.lang.Double> |
getScales()
Retrieves the full list of Scales.
|
int |
getScalesVersion()
Returns the latest scales version number,
for use in detecting if changes are present.
|
RenderInstances.RenderInstancesState |
getStateInfo() |
static RenderInstances.InstanceTransformType[] |
getTransformTypes() |
int |
getVersion()
Retrieves the version of the object, for use in detecting
whether any information has changed since last use.
|
RenderInstances.RenderInstancesVersion |
getVersionInfo()
Returns an immutable copy of all version information in this RenderInstances,
safe for sharing between threads.
|
boolean |
hasAffineInstances() |
boolean |
hasAffines()
Whether or not any affines have been defined.
|
boolean |
hasColors()
Whether or not any colors have been defined.
|
boolean |
hasFrameInstances() |
boolean |
hasFrames()
Whether or not any frames have been defined.
|
boolean |
hasInstances()
Whether or not any instances have been defined.
|
boolean |
hasPointInstances() |
boolean |
hasPoints()
Whether or not any points have been defined.
|
boolean |
hasScales()
Whether or not any scales have been defined.
|
boolean |
isDisposed()
Whether or not the current object is disposed
|
boolean |
isValid()
Returns whether or not this RenderObject is valid.
|
void |
notifyAffinesModified()
Indicate that the positions have been modified.
|
void |
notifyColorsModified() |
void |
notifyFramesModified()
Indicate that the positions have been modified.
|
void |
notifyInstancesModified()
Indicate that the instances have been modified.
|
void |
notifyPointsModified()
Indicate that the positions have been modified.
|
void |
notifyScalesModified()
Indicate that the scales have been modified.
|
int |
numAffineInstances() |
int |
numAffines()
Number of affines defined
|
int |
numColors()
Number of colors defined
|
int |
numFrameInstances() |
int |
numFrames()
Number of frames defined
|
int |
numInstances()
Number of instances defined
|
int |
numPointInstances() |
int |
numPoints()
Number of points defined
|
int |
numScales()
Number of scales defined
|
void |
readLock()
Prevents modifications until object is unlocked
|
void |
readUnlock()
Release a read lock on the object, allowing modifications.
|
void |
setAffine(int aidx,
AffineTransform3d affine)
Sets the affine position by reference
|
void |
setColor(int cidx,
byte[] rgba)
Updates the values of the color, by reference, with index cidx.
|
void |
setColor(int cidx,
byte r,
byte g,
byte b,
byte a)
Updates the values of the color with index cidx.
|
void |
setColor(int cidx,
java.awt.Color color)
Updates the values of the color with index cidx.
|
void |
setColor(int cidx,
float r,
float g,
float b,
float a)
Updates the values of the color with index cidx.
|
void |
setColor(int cidx,
int r,
int g,
int b,
int a)
Updates the values of the color with index cidx.
|
void |
setCurrentColor(int cidx)
Sets the current color to be used in following instances
based on color index.
|
void |
setCurrentScale(int sidx)
Sets the current scale to be used in following instances
based on scale index.
|
void |
setFrame(int fidx,
RigidTransform3d frame)
Sets the frame position by reference
|
void |
setInstance(int idx,
RenderInstances.InstanceTransformType type,
int tidx,
int sidx,
int cidx) |
void |
setPoint(int pidx,
double x,
double y,
double z)
Sets the point position
|
void |
setPoint(int pidx,
float[] pos)
Sets the point position by reference
|
void |
setPoint(int pidx,
Vector3d pos)
Sets the point position
|
void |
setScale(int sidx,
java.lang.Double s)
Sets the scale by reference
|
void |
writeLock()
Prevents reading until object is unlocked
|
void |
writeUnlock()
Release a write lock on the object, allowing reads
|
public void readLock()
public void readUnlock()
public void writeLock()
public void writeUnlock()
public RenderInstances.RenderInstancesIdentifier getIdentifier()
public RenderInstances.RenderInstancesVersion getVersionInfo()
public RenderInstances.RenderInstancesState getStateInfo()
public void ensurePointCapacity(int cap)
cap
- capacitypublic int addPoint(float[] pos)
pos
- position of point added, by referencepublic int addPoint(Vector3d pos)
pos
- position of point addedpublic int addPoint(double x, double y, double z)
x
- x-coordinatey
- y-coordinatez
- z-coordinatepublic void setPoint(int pidx, double x, double y, double z)
pidx
- index of point to modifyx
- x-coordinatey
- y-coordinatez
- z-coordinatepublic void setPoint(int pidx, float[] pos)
public void setPoint(int pidx, Vector3d pos)
public float[] getPoint(int pidx)
pidx
- index of pointpublic void notifyPointsModified()
public boolean hasPoints()
public int numPoints()
public java.util.List<float[]> getPoints()
public int getPointsVersion()
public void ensureFrameCapacity(int cap)
cap
- capacitypublic int addFrame(RigidTransform3d frame)
frame
- frame to be added, by referencepublic void setFrame(int fidx, RigidTransform3d frame)
fidx
- frame indexframe
- frame posepublic RigidTransform3d getFrame(int fidx)
fidx
- index of framepublic void notifyFramesModified()
public boolean hasFrames()
public int numFrames()
public java.util.List<RigidTransform3d> getFrames()
public int getFramesVersion()
public void ensureAffineCapacity(int cap)
cap
- capacitypublic int addAffine(AffineTransform3d affine)
affine
- affine transform to add, by referencepublic void setAffine(int aidx, AffineTransform3d affine)
aidx
- affine indexaffine
- affine transformpublic AffineTransform3d getAffine(int pidx)
pidx
- index of affinepublic void notifyAffinesModified()
public boolean hasAffines()
public int numAffines()
public java.util.List<AffineTransform3d> getAffines()
public int getAffinesVersion()
public void ensureColorCapacity(int cap)
cap
- capacitypublic int addColor(byte r, byte g, byte b, byte a)
r
- redg
- greenb
- bluea
- alphapublic int addColor(int r, int g, int b, int a)
r
- red [0-255]g
- green [0-255]b
- blue [0-255]a
- alpha [0-255]public int addColor(float r, float g, float b, float a)
r
- red [0-1]g
- green [0-1]b
- blue [0-1]a
- alpha [0-1]public int addColor(float[] rgba)
rgba
- 4-float vectorpublic int addColor(java.awt.Color color)
color
- color from which RGBA values are determinespublic int addColor(byte[] rgba)
notifyColorsModified()
must
be called. Otherwise, renderers are free to assume the render object
has not changed.rgba
- {red, green, blue, alpha}public void notifyColorsModified()
public void setCurrentColor(int cidx)
cidx
- index of a previously added colorpublic int getCurrentColor()
public void setColor(int cidx, byte r, byte g, byte b, byte a)
cidx
- color to modifyr
- redg
- greenb
- bluea
- alphapublic void setColor(int cidx, int r, int g, int b, int a)
cidx
- color to modifyr
- redg
- greenb
- bluea
- alphapublic void setColor(int cidx, float r, float g, float b, float a)
cidx
- color to modifyr
- redg
- greenb
- bluea
- alphapublic void setColor(int cidx, java.awt.Color color)
cidx
- color to modifycolor
- new color valuespublic void setColor(int cidx, byte[] rgba)
cidx
- color to modifyrgba
- {red, green, blue, alpha}public byte[] getColor(int cidx)
notifyColorsModified()
must be manually called.cidx
- color indexpublic boolean hasColors()
public int numColors()
public java.util.List<byte[]> getColors()
public int getColorsVersion()
public void ensureScaleCapacity(int cap)
cap
- capacitypublic int addScale(java.lang.Double s)
s
- scale, by referencepublic void setCurrentScale(int sidx)
sidx
- index of a previously added scalepublic int getCurrentScale()
public void setScale(int sidx, java.lang.Double s)
sidx
- index of scale to modifys
- scalepublic java.lang.Double getScale(int sidx)
sidx
- index of scalepublic void notifyScalesModified()
public boolean hasScales()
public int numScales()
public java.util.List<java.lang.Double> getScales()
public int getScalesVersion()
public void ensureInstanceCapacity(int cap)
cap
- capacitypublic int addInstance(RenderInstances.InstanceTransformType type, int tidx, int sidx, int cidx)
type
- type of instancetidx
- transform index (either point, frame, or affine index)sidx
- scale indexcidx
- color indexpublic void setInstance(int idx, RenderInstances.InstanceTransformType type, int tidx, int sidx, int cidx)
public static RenderInstances.InstanceTransformType[] getTransformTypes()
public RenderInstances.InstanceTransformType getInstanceType(int idx)
public java.lang.Double getInstanceScale(int idx)
public int[] getInstances()
public int getInstanceTypeOffset()
public int getInstanceTransformOffset()
public int getInstanceScaleOffset()
public int getInstanceColorOffset()
public int getInstanceStride()
public void forEachInstance(RenderInstances.RenderInstanceConsumer consumer)
consumer
- consumer object for processing instancespublic void notifyInstancesModified()
public int getInstancesVersion()
public boolean hasInstances()
public int numInstances()
public boolean hasPointInstances()
public int numPointInstances()
public boolean hasFrameInstances()
public int numFrameInstances()
public boolean hasAffineInstances()
public int numAffineInstances()
public int addInstance(RenderInstances.InstanceTransformType type, int tidx)
type
- type of instancetidx
- transform index (either point, frame, or affine index)public int addPointInstance(int pidx)
pidx
- point indexpublic int addFrameInstance(int fidx)
fidx
- frame indexpublic int addAffineInstance(int aidx)
aidx
- affine indexpublic int addInstance(float px, float py, float pz)
px
- x-coordinate of instancepy
- y-coordinate of instancepz
- z-coordinate of instancepublic int addInstance(float[] xyz)
xyz
- coordinatespublic int addInstance(Vector3d pos)
pos
- position of instancepublic int addInstance(RigidTransform3d frame)
frame
- frame transform for instancepublic int addInstance(AffineTransform3d affine)
affine
- transform to be added, by referencepublic void clearAll()
public int getVersion()
getVersion
in interface Versioned
public boolean isValid()
true
if this RenderObject is validpublic void dispose()
dispose
in interface Disposable
public RenderInstances copy()
public boolean isDisposed()
DisposeObservable
isDisposed
in interface DisposeObservable
public RenderInstances.RenderInstancesIdentifier getDisposeObserver()
DisposeObservable
getDisposeObserver
in interface DisposeObservable