public abstract class LXFixture extends LXComponent implements LXFixtureContainer, LXComponent.Renamable
Modifier and Type | Class and Description |
---|---|
class |
LXFixture.DynamicIndexBuffer
An internal utility class which dynamically keeps the index values inside
an index buffer up to date and in sync with this fixture.
|
static class |
LXFixture.IndexBufferSegment |
static class |
LXFixture.Protocol
Output protocols
|
class |
LXFixture.Submodel
Helper class to ensure that Submodels are *only* constructed
using the points from the produced LXModel array.
|
LXComponent.Placeholder, LXComponent.Renamable
LXSerializable.Utils
Modifier and Type | Field and Description |
---|---|
BoundedParameter |
brightness |
protected List<LXFixture> |
children |
BooleanParameter |
enabled |
BooleanParameter |
identify |
BooleanParameter |
mute |
protected static LXFixture.Submodel[] |
NO_SUBMODELS |
List<LXOutput> |
outputs
Publicly accessible list of the outputs that should be sent to this fixture
|
BoundedParameter |
pitch |
List<LXPoint> |
points
Publicly accessible immutable view of the points in this fixture.
|
BoundedParameter |
roll |
BooleanParameter |
selected |
BooleanParameter |
solo |
BoundedParameter |
x |
BoundedParameter |
y |
BoundedParameter |
yaw |
BoundedParameter |
z |
controlSurfaceSemaphore, KEY_CLASS, KEY_COMPONENT_ID, KEY_ID, KEY_PARAMETER_PATH, KEY_PATH, label, lx, modulationColor
Modifier | Constructor and Description |
---|---|
protected |
LXFixture(LX lx) |
protected |
LXFixture(LX lx,
String label) |
Modifier and Type | Method and Description |
---|---|
protected void |
addChild(LXFixture child) |
protected LXFixture |
addGeometryParameter(String path,
LXParameter parameter)
Adds a parameter which impacts the position of points in the fixture.
|
protected LXFixture |
addMetricsParameter(String path,
LXParameter parameter)
Adds a parameter which impacts the number of LEDs that are in the fixture.
|
protected void |
addOutput(LXOutput output)
Subclasses call this method to add an output to thix fixture.
|
protected LXFixture |
addOutputParameter(String path,
LXParameter parameter)
Adds a parameter which impacts the outputs of the fixture.
|
protected LXComponent |
addParameter(String path,
LXParameter parameter)
Adds a parameter to the component at a fixed path.
|
protected void |
beforeRegenerate()
Subclasses may override this method to do custom preparation work before
computeGeometryMatrix(LXMatrix) is called. |
protected abstract void |
buildOutputs()
Subclasses must override this method to provide an implementation that
produces the necessary set of outputs for this fixture to be sent.
|
protected void |
computeGeometryMatrix(LXMatrix geometryMatrix)
Subclasses may override this if they perform geometric transformations in a
different order or using totally different parameters.
|
protected abstract void |
computePointGeometry(LXMatrix transform,
List<LXPoint> points)
This method should be implemented by subclasses to generate the geometry of the
fixture any time its geometry parameters have changed.
|
protected LXModel |
constructModel(List<LXPoint> modelPoints,
List<? extends LXModel> childModels,
String[] modelKeys)
Subclasses may override this method to use custom model type
|
protected LXPoint |
constructPoint(int localIndex)
Subclasses may override this method to use custom point types
|
protected LXPoint |
copyPoint(LXPoint copy)
Subclasses may override this method to use custom point types
|
void |
dispose()
Invoked when a component is being removed from the system and will no longer be used at all.
|
void |
fixtureGenerationChanged(LXFixture fixture)
The generation of this fixture has changed, its metrics
or hierarchy are now different.
|
void |
fixtureGeometryChanged(LXFixture fixture)
The geometry of this fixture has changed, its metrics
and hierarchy are consistent but the point locations
may have changed.
|
protected int |
getFirstPointIndex() |
LXMatrix |
getGeometryMatrix()
Returns a copy of the geometry matrix for this fixture
|
LXMatrix |
getGeometryMatrix(LXMatrix m)
Returns the geometry transformation matrix, copied into the given matrix
|
int |
getIndex() |
int |
getIndexBufferOffset()
Returns the offset of this fixture in the index buffer
|
protected Map<String,String> |
getMetaData()
Subclasses may override to provide a map of String key/value pairs that are attached
as metadata onto the resulting LXModel object
|
protected String |
getModelKey()
Subclasses should implement, specifying the type key of this fixture in the model
hierarchy.
|
protected String[] |
getModelKeys()
Subclasses may override to return an array of multiple key types.
|
String |
getPath()
Accessor for the path of this object.
|
void |
load(LX lx,
JsonObject obj)
Loads the LX component.
|
void |
onParameterChanged(LXParameter p)
Subclasses are free to override this if desired.
|
protected void |
regenerate()
Invoked when this fixture has been loaded or added to some container.
|
protected void |
reindexOutputs()
Subclasses may override this method to update their outputs in the
case that the point indexing of this fixture has changed.
|
protected void |
removeChild(LXFixture child) |
protected void |
removeOutput(LXOutput output)
Subclasses call this method to remove a output from the fixture.
|
protected void |
setStructure(LXStructure structure) |
protected abstract int |
size()
Subclasses must implement to specify the number of points in the fixture.
|
protected int[] |
toDynamicIndexBuffer()
Get an index buffer version of this fixture.
|
protected int[] |
toDynamicIndexBuffer(int start,
int num)
Get an index buffer version of this fixture.
|
protected int[] |
toDynamicIndexBuffer(int start,
int num,
int stride)
Get an index buffer version of this fixture.
|
protected int[] |
toDynamicIndexBuffer(LXFixture.IndexBufferSegment... segments)
Get an index buffer version of this fixture.
|
protected LXFixture.Submodel[] |
toSubmodels()
Subclasses may override when they specify submodels
|
int |
totalSize()
Total points in this model and all its submodels
|
addArray, addChild, addInternalParameter, addParameter, contains, copyParameters, getChild, getComponentName, getComponentName, getComponentName, getId, getLabel, getLX, getOscAddress, getOscLabel, getOscPath, getParameter, getParameters, getParent, handleOscMessage, loadParameters, removeParameter, removeParameter, save, saveParameters, setParent, toString, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
get, get, getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, getComponent, getComponent, getParameter, getParameter
public final BooleanParameter selected
public final BooleanParameter identify
public final BoundedParameter x
public final BoundedParameter y
public final BoundedParameter z
public final BoundedParameter yaw
public final BoundedParameter pitch
public final BoundedParameter roll
public final BooleanParameter enabled
public final BoundedParameter brightness
public final BooleanParameter mute
public final BooleanParameter solo
public final List<LXOutput> outputs
public final List<LXPoint> points
protected static final LXFixture.Submodel[] NO_SUBMODELS
protected LXFixture(LX lx)
protected LXComponent addParameter(String path, LXParameter parameter)
LXComponent
addParameter
in class LXComponent
path
- String key path to the parameter, must be uniqueparameter
- Parameter to add to the componentpublic String getPath()
LXComponent
getPath
in interface LXPath
getPath
in class LXComponent
public int getIndex()
protected int getFirstPointIndex()
protected void setStructure(LXStructure structure)
protected void addChild(LXFixture child)
protected void removeChild(LXFixture child)
public final void fixtureGenerationChanged(LXFixture fixture)
LXFixtureContainer
fixtureGenerationChanged
in interface LXFixtureContainer
fixture
- Fixture that has changedpublic final void fixtureGeometryChanged(LXFixture fixture)
LXFixtureContainer
fixtureGeometryChanged
in interface LXFixtureContainer
fixture
- Fixture that has changedprotected LXFixture addMetricsParameter(String path, LXParameter parameter)
path
- Path to parameterparameter
- Parameterprotected LXFixture addGeometryParameter(String path, LXParameter parameter)
path
- Path to parameterparameter
- Parameterprotected LXFixture addOutputParameter(String path, LXParameter parameter)
path
- Path to parameterparameter
- Parameterpublic void onParameterChanged(LXParameter p)
LXComponent
onParameterChanged
in interface LXParameterListener
onParameterChanged
in class LXComponent
p
- Parameter that has a value changeprotected int[] toDynamicIndexBuffer()
protected int[] toDynamicIndexBuffer(int start, int num)
start
- Start index relative to this fixturenum
- Total number of pointsprotected int[] toDynamicIndexBuffer(int start, int num, int stride)
start
- Start index relative to this fixturenum
- Total number of pointsstride
- How many points to stride over for each stepprotected int[] toDynamicIndexBuffer(LXFixture.IndexBufferSegment... segments)
segments
- Segments in the index bufferprotected abstract void buildOutputs()
addOutput(LXOutput)
for each output.protected void reindexOutputs()
LXFixture.DynamicIndexBuffer
class has been used to construct indices for
outputs, then no action should typically be necessary.protected void addOutput(LXOutput output)
output
- Output to addprotected void removeOutput(LXOutput output)
output
- Output to removeprotected final void regenerate()
protected void beforeRegenerate()
computeGeometryMatrix(LXMatrix)
is called.protected void computeGeometryMatrix(LXMatrix geometryMatrix)
geometryMatrix
- The geometry transformation matrix for this objectprotected abstract void computePointGeometry(LXMatrix transform, List<LXPoint> points)
transform
- A transform matrix representing the fixture's positionpoints
- The list of points that need to have their positions setprotected LXModel constructModel(List<LXPoint> modelPoints, List<? extends LXModel> childModels, String[] modelKeys)
modelPoints
- Points in the modelchildModels
- Child modelsmodelKeys
- Model keysprotected LXPoint constructPoint(int localIndex)
localIndex
- Index of the point relative to this fixtureprotected LXPoint copyPoint(LXPoint copy)
copy
- Point to make a copy ofprotected Map<String,String> getMetaData()
protected String getModelKey()
protected String[] getModelKeys()
protected LXFixture.Submodel[] toSubmodels()
protected abstract int size()
public final int getIndexBufferOffset()
public LXMatrix getGeometryMatrix()
public LXMatrix getGeometryMatrix(LXMatrix m)
m
- LXMatrix object to copy intopublic final int totalSize()
public void dispose()
LXComponent
super.dispose()
at the appropriate
time to perform the basic cleanup, which may need to happen either before or after cleaning
up other objects.dispose
in class LXComponent
public void load(LX lx, JsonObject obj)
LXComponent
load
in interface LXSerializable
load
in class LXComponent
lx
- LX instanceobj
- Object to deserializeLX library by Mark C. Slee. © 2012-2020