public abstract class Primitive extends Object implements IDisposable
Modifier | Constructor and Description |
---|---|
protected |
Primitive() |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting
unmanaged resources.
|
protected void |
dispose(boolean disposing) |
boolean |
getAutomaticallyComputeBoundingSphere()
Gets if the primitive's
BoundingSphere is automatically computed. |
BoundingSphere |
getBoundingSphere()
Gets the bounding sphere that encompasses the primitive.
|
Color |
getColor()
Gets the primitive's color.
|
boolean |
getDisplay()
Gets if the primitive should be
rendered.
|
DisplayCondition |
getDisplayCondition()
Gets the display condition that determines if the primitive should be
rendered.
|
ReferenceFrame |
getReferenceFrame()
Gets the reference frame this primitive is defined and rendered in.
|
Object |
getTag()
Gets custom data associated with this primitive.
|
float |
getTranslucency()
Gets the primitive's translucency.
|
void |
setAutomaticallyComputeBoundingSphere(boolean value)
Sets if the primitive's
BoundingSphere is automatically computed. |
void |
setBoundingSphere(BoundingSphere value)
Sets the bounding sphere that encompasses the primitive.
|
void |
setColor(Color value)
Sets the primitive's color.
|
void |
setDisplay(boolean value)
Sets if the primitive should be
rendered.
|
void |
setDisplayCondition(DisplayCondition value)
Sets the display condition that determines if the primitive should be
rendered.
|
void |
setReferenceFrame(ReferenceFrame value)
Sets the reference frame this primitive is defined and rendered in.
|
void |
setTag(Object value)
Sets custom data associated with this primitive.
|
void |
setTranslucency(float value)
Sets the primitive's translucency.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
public final void dispose()
IDisposable
dispose
in interface IDisposable
protected void dispose(boolean disposing)
public ReferenceFrame getReferenceFrame()
ArgumentNullException
- ReferenceFrame
is null
.IllegalStateException
- Cannot modify ReferenceFrame
once the primitive is added to the
primitive manager or a composite primitive. Remove the primitive from
the manager or composite before modifying ReferenceFrame
.public void setReferenceFrame(ReferenceFrame value)
ArgumentNullException
- ReferenceFrame
is null
.IllegalStateException
- Cannot modify ReferenceFrame
once the primitive is added to the
primitive manager or a composite primitive. Remove the primitive from
the manager or composite before modifying ReferenceFrame
.public BoundingSphere getBoundingSphere()
ReferenceFrame
.IllegalStateException
- Cannot manually set BoundingSphere
when AutomaticallyComputeBoundingSphere
is true
. Set AutomaticallyComputeBoundingSphere
to
false
first.public void setBoundingSphere(BoundingSphere value)
ReferenceFrame
.IllegalStateException
- Cannot manually set BoundingSphere
when AutomaticallyComputeBoundingSphere
is true
. Set AutomaticallyComputeBoundingSphere
to
false
first.public boolean getAutomaticallyComputeBoundingSphere()
BoundingSphere
is automatically computed.
A primitive's BoundingSphere
is used for visibility tests to
improve rendering performance. When AutomaticallyComputeBoundingSphere
is true
, the sphere is automatically computed when a primitive's geometry
or position is modified due to a Set
or SetPartial
call. Otherwise,
it is the caller's responsibility to set the primitive's BoundingSphere
.
A user may set this property to false
in cases when they can determine a
BoundingSphere
that encompasses everywhere a dynamic
primitive may move to. This can improve performance by eliminating
the overhead associated with re-computing the bounding sphere and updating
the primitive manager's spatial data structures.
public void setAutomaticallyComputeBoundingSphere(boolean value)
BoundingSphere
is automatically computed.
A primitive's BoundingSphere
is used for visibility tests to
improve rendering performance. When AutomaticallyComputeBoundingSphere
is true
, the sphere is automatically computed when a primitive's geometry
or position is modified due to a Set
or SetPartial
call. Otherwise,
it is the caller's responsibility to set the primitive's BoundingSphere
.
A user may set this property to false
in cases when they can determine a
BoundingSphere
that encompasses everywhere a dynamic
primitive may move to. This can improve performance by eliminating
the overhead associated with re-computing the bounding sphere and updating
the primitive manager's spatial data structures.
public DisplayCondition getDisplayCondition()
Display
must evaluate to true
for
the primitive to be rendered.
When DisplayCondition
is null
, no display condition is
evaluated before the primitive is rendered.
DisplayCondition
,
Display
public void setDisplayCondition(DisplayCondition value)
Display
must evaluate to true
for
the primitive to be rendered.
When DisplayCondition
is null
, no display condition is
evaluated before the primitive is rendered.
DisplayCondition
,
Display
public boolean getDisplay()
DisplayCondition
must evaluate to true
for
the primitive to be rendered.
A primitive must be added to the
PrimitiveManager
before it is rendered. Once in the manager, setting this
property to false
is more efficient than removing the primitive
from the manager. Although, it is recommended to remove the primitive
from the manager if the primitive will be hidden for a long period of time.
For more control over when a primitive is rendered, see DisplayCondition
.
PrimitiveManager
,
DisplayCondition
public void setDisplay(boolean value)
DisplayCondition
must evaluate to true
for
the primitive to be rendered.
A primitive must be added to the
PrimitiveManager
before it is rendered. Once in the manager, setting this
property to false
is more efficient than removing the primitive
from the manager. Although, it is recommended to remove the primitive
from the manager if the primitive will be hidden for a long period of time.
For more control over when a primitive is rendered, see DisplayCondition
.
PrimitiveManager
,
DisplayCondition
public Color getColor()
public void setColor(Color value)
public float getTranslucency()
Translucency
is between 0
and 1
,
where 0
is opaque and 1
is transparent.ArgumentOutOfRangeException
- Translucency
must be between 0
and 1
.public void setTranslucency(float value)
Translucency
is between 0
and 1
,
where 0
is opaque and 1
is transparent.ArgumentOutOfRangeException
- Translucency
must be between 0
and 1
.public Object getTag()
This property is commonly used in conjunction with picking. Custom data that needs to be retrieved or modified when this primitive is picked is assigned to this property. When the primitive is picked, this property is used to access the custom data.
public void setTag(Object value)
This property is commonly used in conjunction with picking. Custom data that needs to be retrieved or modified when this primitive is picked is assigned to this property. When the primitive is picked, this property is used to access the custom data.