public final class SolidPrimitive extends Primitive implements IDisposable
TriangleMeshPrimitive
or PolylinePrimitive
can be used for reduced overhead.Constructor and Description |
---|
SolidPrimitive()
Initializes a default solid primitive.
|
SolidPrimitive(SetHint setHint)
Initializes a solid primitive with the specified
setHint . |
Modifier and Type | Method and Description |
---|---|
protected void |
dispose(boolean disposing) |
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
boolean |
getAffectedByLighting()
Gets whether the primitive is affected by lighting.
|
Color |
getBackLineColor()
Gets the back line's color.
|
float |
getBackLineTranslucency()
Gets the back line's translucency.
|
float |
getBackLineWidth()
Gets the back line's width, in pixels.
|
boolean |
getDisplayFill()
Gets whether the solid's fill is displayed.
|
boolean |
getDisplayOutline()
Gets whether the solid's outline is displayed.
|
boolean |
getDisplaySilhouette()
Gets whether the solid's silhouette is displayed.
|
static float |
getMaximumSilhouetteWidthSupported()
Gets the maximum silhouette width, in pixels, supported by the video card.
|
static float |
getMinimumSilhouetteWidthSupported()
Gets the minimum silhouette width, in pixels, supported by the video card.
|
OutlineAppearance |
getOutlineAppearance()
Gets the outline's appearance.
|
Color |
getOutlineColor()
Gets the outline's color.
|
float |
getOutlineTranslucency()
Gets the outline's translucency.
|
float |
getOutlineWidth()
Gets the outline's width, in pixels.
|
Cartesian |
getPosition()
Gets the solid's position.
|
UnitQuaternion |
getRotation()
Gets the rotation applied to the solid before rendering.
|
Cartesian |
getScale()
Gets a non-uniform scale that is applied to the solid to increase or
decrease its rendered size.
|
SetHint |
getSetHint()
Gets the primitive's
SetHint . |
Color |
getSilhouetteColor()
Gets the silhouette's color.
|
float |
getSilhouetteTranslucency()
Gets the silhouette's translucency.
|
float |
getSilhouetteWidth()
Gets the silhouette' width, in pixels.
|
void |
set(Iterable<Cartesian> positions,
Iterable<Cartesian> normals,
Iterable<Integer> indices,
Iterable<Integer> outlineIndices,
WindingOrder windingOrder,
BoundingSphere boundingSphere,
boolean closed)
Defines the solid using the specified parameters.
|
void |
set(SolidTriangulatorResult solidTriangulatorResult)
Defines the solid using the specified
solidTriangulatorResult . |
void |
setAffectedByLighting(boolean value)
Sets whether the primitive is affected by lighting.
|
void |
setBackLineColor(Color value)
Sets the back line's color.
|
void |
setBackLineTranslucency(float value)
Sets the back line's translucency.
|
void |
setBackLineWidth(float value)
Sets the back line's width, in pixels.
|
void |
setDisplayFill(boolean value)
Sets whether the solid's fill is displayed.
|
void |
setDisplayOutline(boolean value)
Sets whether the solid's outline is displayed.
|
void |
setDisplaySilhouette(boolean value)
Sets whether the solid's silhouette is displayed.
|
void |
setOutlineAppearance(OutlineAppearance value)
Sets the outline's appearance.
|
void |
setOutlineColor(Color value)
Sets the outline's color.
|
void |
setOutlineTranslucency(float value)
Sets the outline's translucency.
|
void |
setOutlineWidth(float value)
Sets the outline's width, in pixels.
|
void |
setPosition(Cartesian value)
Sets the solid's position.
|
void |
setRotation(UnitQuaternion value)
Sets the rotation applied to the solid before rendering.
|
void |
setScale(Cartesian value)
Sets a non-uniform scale that is applied to the solid to increase or
decrease its rendered size.
|
void |
setSilhouetteColor(Color value)
Sets the silhouette's color.
|
void |
setSilhouetteTranslucency(float value)
Sets the silhouette's translucency.
|
void |
setSilhouetteWidth(float value)
Sets the silhouette' width, in pixels.
|
void |
setTranslucency(float value)
Sets the primitive's translucency.
|
dispose, getAutomaticallyComputeBoundingSphere, getBoundingSphere, getColor, getDisplay, getDisplayCondition, getReferenceFrame, getTag, getTranslucency, setAutomaticallyComputeBoundingSphere, setBoundingSphere, setColor, setDisplay, setDisplayCondition, setReferenceFrame, setTag
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, dispose
public SolidPrimitive()
SetHint
of Frequent
.
See SolidPrimitive.SolidPrimitive(agi.foundation.graphics.SetHint)
for a full discussion.
public SolidPrimitive(SetHint setHint)
setHint
.
After constructing the primitive, call
Set
to provide it with a
SolidTriangulatorResult
.
The primitive's properties are initialized to the following values:
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
: true
agi.foundation.graphics.primitive.BoundingSphere
: BoundingSphere.MaximumRadiusBoundingSphere
(get
)agi.foundation.graphics.primitive.Color
: Purple
agi.foundation.graphics.primitive.Display
: true
agi.foundation.graphics.primitive.DisplayCondition
: null
agi.foundation.graphics.primitive.ReferenceFrame
: The earth's agi.foundation.celestial.earthcentralbody.FixedFrame
Position
: Cartesian.Zero
Rotation
: (1, 0, 0, 0)
Scale
: (1, 1, 1)
Translucency
: 0.7f
AffectedByLighting
: true
DisplayFill
: true
DisplaySilhouette
: false
SilhouetteColor
: White
SilhouetteTranslucency
: 0
SilhouetteWidth
: 2
MaximumSilhouetteWidthSupported
: Video card dependentMinimumSilhouetteWidthSupported
: Video card dependentDisplayOutline
: true
OutlineColor
: Purple
OutlineTranslucency
: 0
OutlineWidth
: 1
OutlineAppearance
: agi.foundation.graphics.OutlineAppearance#FrontAndBackLines
BackLineColor
: Purple
BackLineTranslucency
: 0.5f
BackLineWidth
: 1
SetHint
: setHint
Once the primitive is constructed, it must be added to
Primitives
(get
) before it will be rendered.
setHint
- The expected usage for Set
methods.
See the Set Hint topic for more information on
selecting an appropriate value.UnsupportedCaseException
- setHint
must be
agi.foundation.graphics.SetHint#Infrequent
or
agi.foundation.graphics.SetHint#Frequent
.
agi.foundation.graphics.SetHint#Partial
is not
supported by this primitive.protected void finalize() throws Throwable
java.lang.Object
finalize
method to dispose of
system resources or to perform other cleanup.
The general contract of finalize
is that it is invoked
if and when the Java™ virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The finalize
method may take any action, including
making this object available again to other threads; the usual purpose
of finalize
, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.
The finalize
method of class Object
performs no
special action; it simply returns normally. Subclasses of
Object
may override this definition.
The Java programming language does not guarantee which thread will
invoke the finalize
method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.
After the finalize
method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.
The finalize
method is never invoked more than once by a Java
virtual machine for any given object.
Any exception thrown by the finalize
method causes
the finalization of this object to be halted, but is otherwise
ignored.
finalize
in class Object
Throwable
- the Exception
raised by this methodWeakReference
,
PhantomReference
public final boolean getAffectedByLighting()
If lighting makes one side of the solid too dark, set this to false
for the solid to have uniform color. When this is false
, it is
recommonded that DisplayOutline
be true
, so the shape
of the solid is still decipherable.
public final void setAffectedByLighting(boolean value)
If lighting makes one side of the solid too dark, set this to false
for the solid to have uniform color. When this is false
, it is
recommonded that DisplayOutline
be true
, so the shape
of the solid is still decipherable.
public final boolean getDisplayFill()
public final void setDisplayFill(boolean value)
public final boolean getDisplaySilhouette()
The silhouette is the outline of the solid from the camera's point of view.
It is a useful visual cue to differentiate the solid from the background.
The silhouette is rendered using SilhouetteColor
,
SilhouetteTranslucency
, and SilhouetteWidth
.
SilhouetteColor
,
SilhouetteTranslucency
,
SilhouetteWidth
,
TranslucentPrimitivesSortOrder (get)
,
TranslucentPrimitivesSortOrder (get)
public final void setDisplaySilhouette(boolean value)
The silhouette is the outline of the solid from the camera's point of view.
It is a useful visual cue to differentiate the solid from the background.
The silhouette is rendered using SilhouetteColor
,
SilhouetteTranslucency
, and SilhouetteWidth
.
SilhouetteColor
,
SilhouetteTranslucency
,
SilhouetteWidth
,
TranslucentPrimitivesSortOrder (get)
,
TranslucentPrimitivesSortOrder (get)
public final Color getSilhouetteColor()
DisplaySilhouette
,
SilhouetteTranslucency
,
SilhouetteWidth
public final void setSilhouetteColor(Color value)
DisplaySilhouette
,
SilhouetteTranslucency
,
SilhouetteWidth
public final float getSilhouetteTranslucency()
0
and 1
, where 0
is opaque and 1
is transparent.ArgumentOutOfRangeException
- The translucency must be between 0
and 1
.DisplaySilhouette
,
SilhouetteColor
,
SilhouetteWidth
public final void setSilhouetteTranslucency(float value)
0
and 1
, where 0
is opaque and 1
is transparent.ArgumentOutOfRangeException
- The translucency must be between 0
and 1
.DisplaySilhouette
,
SilhouetteColor
,
SilhouetteWidth
public final float getSilhouetteWidth()
The width is defined in pixels so even if the camera moves very close or very far from the solid, the width of the silhouette on the screen does not change.
ArgumentOutOfRangeException
- Width is less than 0
.InsufficientVideoCardException
- Width is outside of the range supported by the video card. To verify
a width is supported, check MinimumSilhouetteWidthSupported
and MaximumSilhouetteWidthSupported
. Regardless of
MinimumSilhouetteWidthSupported
, a width of 0
is
always allowed and effectively hides the silhouette.DisplaySilhouette
,
SilhouetteColor
,
SilhouetteTranslucency
,
MinimumSilhouetteWidthSupported
,
MaximumSilhouetteWidthSupported
public final void setSilhouetteWidth(float value)
The width is defined in pixels so even if the camera moves very close or very far from the solid, the width of the silhouette on the screen does not change.
ArgumentOutOfRangeException
- Width is less than 0
.InsufficientVideoCardException
- Width is outside of the range supported by the video card. To verify
a width is supported, check MinimumSilhouetteWidthSupported
and MaximumSilhouetteWidthSupported
. Regardless of
MinimumSilhouetteWidthSupported
, a width of 0
is
always allowed and effectively hides the silhouette.DisplaySilhouette
,
SilhouetteColor
,
SilhouetteTranslucency
,
MinimumSilhouetteWidthSupported
,
MaximumSilhouetteWidthSupported
public static final float getMinimumSilhouetteWidthSupported()
SilhouetteWidth
public static final float getMaximumSilhouetteWidthSupported()
SilhouetteWidth
public final boolean getDisplayOutline()
OutlineColor
,
OutlineTranslucency
,
OutlineWidth
,
OutlineAppearance
public final void setDisplayOutline(boolean value)
OutlineColor
,
OutlineTranslucency
,
OutlineWidth
,
OutlineAppearance
public final Color getOutlineColor()
DisplayOutline
,
OutlineTranslucency
,
OutlineWidth
,
OutlineAppearance
public final void setOutlineColor(Color value)
DisplayOutline
,
OutlineTranslucency
,
OutlineWidth
,
OutlineAppearance
public final float getOutlineTranslucency()
0
and 1
, where 0
is opaque and 1
is transparent.ArgumentOutOfRangeException
- The translucency must be between 0
and 1
.DisplayOutline
,
OutlineColor
,
OutlineWidth
,
OutlineAppearance
public final void setOutlineTranslucency(float value)
0
and 1
, where 0
is opaque and 1
is transparent.ArgumentOutOfRangeException
- The translucency must be between 0
and 1
.DisplayOutline
,
OutlineColor
,
OutlineWidth
,
OutlineAppearance
public final float getOutlineWidth()
The width is defined in pixels so even if the camera moves very close or very far from a solid, the width of the outline on the screen does not change.
ArgumentOutOfRangeException
- Width is less than 0
.InsufficientVideoCardException
- Width is outside of the range supported by the video card. To verify
a width is supported, check PolylinePrimitive.MinimumWidthSupported
(get
)
and PolylinePrimitive.MaximumWidthSupported
(get
). Regardless of
PolylinePrimitive.MinimumWidthSupported
(get
), a width of 0
is
always allowed and effectively hides the outline.DisplayOutline
,
OutlineColor
,
OutlineTranslucency
,
OutlineAppearance
,
PolylinePrimitive.MinimumWidthSupported (get)
,
PolylinePrimitive.MaximumWidthSupported (get)
public final void setOutlineWidth(float value)
The width is defined in pixels so even if the camera moves very close or very far from a solid, the width of the outline on the screen does not change.
ArgumentOutOfRangeException
- Width is less than 0
.InsufficientVideoCardException
- Width is outside of the range supported by the video card. To verify
a width is supported, check PolylinePrimitive.MinimumWidthSupported
(get
)
and PolylinePrimitive.MaximumWidthSupported
(get
). Regardless of
PolylinePrimitive.MinimumWidthSupported
(get
), a width of 0
is
always allowed and effectively hides the outline.DisplayOutline
,
OutlineColor
,
OutlineTranslucency
,
OutlineAppearance
,
PolylinePrimitive.MinimumWidthSupported (get)
,
PolylinePrimitive.MaximumWidthSupported (get)
public final OutlineAppearance getOutlineAppearance()
Changing OutlineAppearance can result in this solid primitive hiding translucent
primitives behind it. To avoid this, set the solid's owner's
PrimitivesSortOrder
to
PrimitivesSortOrderBackToFront
.
DisplayOutline
,
OutlineColor
,
OutlineTranslucency
,
OutlineWidth
,
TranslucentPrimitivesSortOrder (get)
,
TranslucentPrimitivesSortOrder (get)
public final void setOutlineAppearance(OutlineAppearance value)
Changing OutlineAppearance can result in this solid primitive hiding translucent
primitives behind it. To avoid this, set the solid's owner's
PrimitivesSortOrder
to
PrimitivesSortOrderBackToFront
.
DisplayOutline
,
OutlineColor
,
OutlineTranslucency
,
OutlineWidth
,
TranslucentPrimitivesSortOrder (get)
,
TranslucentPrimitivesSortOrder (get)
public final Color getBackLineColor()
This is only used when OutlineAppearance
is agi.foundation.graphics.OutlineAppearance#StylizeBackLines
.
OutlineAppearance
,
BackLineTranslucency
,
BackLineWidth
public final void setBackLineColor(Color value)
This is only used when OutlineAppearance
is agi.foundation.graphics.OutlineAppearance#StylizeBackLines
.
OutlineAppearance
,
BackLineTranslucency
,
BackLineWidth
public final float getBackLineTranslucency()
0
and 1
, where 0
is opaque and 1
is transparent.
This is only used when OutlineAppearance
is agi.foundation.graphics.OutlineAppearance#StylizeBackLines
.
ArgumentOutOfRangeException
- The translucency must be between 0
and 1
.OutlineAppearance
,
BackLineColor
,
BackLineWidth
public final void setBackLineTranslucency(float value)
0
and 1
, where 0
is opaque and 1
is transparent.
This is only used when OutlineAppearance
is agi.foundation.graphics.OutlineAppearance#StylizeBackLines
.
ArgumentOutOfRangeException
- The translucency must be between 0
and 1
.OutlineAppearance
,
BackLineColor
,
BackLineWidth
public final Cartesian getPosition()
ReferenceFrame
.
If the solid's
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
property is true
when setting the solid's position, the Center
of the solid's
agi.foundation.graphics.primitive.BoundingSphere
is set to the new position. Otherwise, it is the caller's
responsibility to update the solid's
agi.foundation.graphics.primitive.BoundingSphere
to a sphere that encompasses the solid.
ReferenceFrame
,
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
public final void setPosition(Cartesian value)
ReferenceFrame
.
If the solid's
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
property is true
when setting the solid's position, the Center
of the solid's
agi.foundation.graphics.primitive.BoundingSphere
is set to the new position. Otherwise, it is the caller's
responsibility to update the solid's
agi.foundation.graphics.primitive.BoundingSphere
to a sphere that encompasses the solid.
ReferenceFrame
,
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
public final UnitQuaternion getRotation()
public final void setRotation(UnitQuaternion value)
public final Cartesian getScale()
A Scale
of (1, 1, 1)
renders the solid using its actual size.
Values greater than 1
for a component increase the size of the rendered
solid in the corresponding direction in the primitive's
agi.foundation.graphics.primitive.ReferenceFrame
. Values
less than 1
decrease the size.
If the solid's
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
property is true
when setting Scale
, the Radius
of the solid's
agi.foundation.graphics.primitive.BoundingSphere
is set to fit around the scaled solid. Otherwise, it is the caller's
responsibility to update the solid's
agi.foundation.graphics.primitive.BoundingSphere
to a sphere that encompasses the scaled solid.
public final void setScale(Cartesian value)
A Scale
of (1, 1, 1)
renders the solid using its actual size.
Values greater than 1
for a component increase the size of the rendered
solid in the corresponding direction in the primitive's
agi.foundation.graphics.primitive.ReferenceFrame
. Values
less than 1
decrease the size.
If the solid's
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
property is true
when setting Scale
, the Radius
of the solid's
agi.foundation.graphics.primitive.BoundingSphere
is set to fit around the scaled solid. Otherwise, it is the caller's
responsibility to update the solid's
agi.foundation.graphics.primitive.BoundingSphere
to a sphere that encompasses the scaled solid.
public final float getBackLineWidth()
This is only used when OutlineAppearance
is agi.foundation.graphics.OutlineAppearance#StylizeBackLines
.
The width is defined in pixels so even if the camera moves very close or very far from a solid, the width of the outline on the screen does not change.
ArgumentOutOfRangeException
- Width is less than 0
.InsufficientVideoCardException
- Width is outside of the range supported by the video card. To verify
a width is supported, check PolylinePrimitive.MinimumWidthSupported
(get
)
and PolylinePrimitive.MaximumWidthSupported
(get
). Regardless of
PolylinePrimitive.MinimumWidthSupported
(get
), a width of 0
is
always allowed and effectively hides the back line.OutlineAppearance
,
BackLineColor
,
BackLineTranslucency
,
PolylinePrimitive.MinimumWidthSupported (get)
,
PolylinePrimitive.MaximumWidthSupported (get)
public final void setBackLineWidth(float value)
This is only used when OutlineAppearance
is agi.foundation.graphics.OutlineAppearance#StylizeBackLines
.
The width is defined in pixels so even if the camera moves very close or very far from a solid, the width of the outline on the screen does not change.
ArgumentOutOfRangeException
- Width is less than 0
.InsufficientVideoCardException
- Width is outside of the range supported by the video card. To verify
a width is supported, check PolylinePrimitive.MinimumWidthSupported
(get
)
and PolylinePrimitive.MaximumWidthSupported
(get
). Regardless of
PolylinePrimitive.MinimumWidthSupported
(get
), a width of 0
is
always allowed and effectively hides the back line.OutlineAppearance
,
BackLineColor
,
BackLineTranslucency
,
PolylinePrimitive.MinimumWidthSupported (get)
,
PolylinePrimitive.MaximumWidthSupported (get)
public final SetHint getSetHint()
SetHint
.
See the Set Hint topic for more information on
selecting an appropriate value to construct the primitive with.public void setTranslucency(float value)
Primitive
Translucency
is between 0
and 1
,
where 0
is opaque and 1
is transparent.setTranslucency
in class Primitive
public final void set(SolidTriangulatorResult solidTriangulatorResult)
solidTriangulatorResult
.
The solid is rendered in the primitive's agi.foundation.graphics.primitive.ReferenceFrame
.
If this method is called frequently, it is recommended to construct the primitive with
agi.foundation.graphics.SetHint#Frequent
,
which is the default. If this method will be called only once or infrequently, construct the primitive with
agi.foundation.graphics.SetHint#Infrequent
.
See the Set Hint topic for more information.
If the primitive's
AutomaticallyComputeBoundingSphere
(get
)
property is true
, the primitive's
BoundingSphere
(get
)
is computed based on the input.
Otherwise, it is the caller's responsibility to update the primitive's
BoundingSphere
(get
)
to a sphere that encompasses the input.
solidTriangulatorResult
- The triangulator used to define the solid.ArgumentNullException
- solidTriangulatorResult
is null
.CouldNotCreateVideoCardResourceException
- Could not allocate video memory for the solid.public final void set(Iterable<Cartesian> positions, Iterable<Cartesian> normals, Iterable<Integer> indices, Iterable<Integer> outlineIndices, WindingOrder windingOrder, BoundingSphere boundingSphere, boolean closed)
agi.foundation.graphics.primitive.ReferenceFrame
.
If this method is called frequently, it is recommended to construct the primitive with
agi.foundation.graphics.SetHint#Frequent
,
which is the default. If this method will be called only once or infrequently, construct the primitive with
agi.foundation.graphics.SetHint#Infrequent
.
See the Set Hint topic for more information.
If the primitive's
AutomaticallyComputeBoundingSphere
(get
)
property is true
, the primitive's
BoundingSphere
(get
)
is computed based on the input.
Otherwise, it is the caller's responsibility to update the primitive's
BoundingSphere
(get
)
to a sphere that encompasses the input.
positions
- The positions of the solid.normals
- The normals of the mesh.indices
- The indices into positions and normals.outlineIndices
- The indices into positions that define an outline of the solid.windingOrder
- The orientation of front-facing triangles.boundingSphere
- The bounding sphere that encompasses the solid.closed
- Indicates if the solid is closed. For example, a box with six faces is closed. If one face is removed, the box is open.