public final class SurfaceMeshPrimitive extends Primitive implements IDisposable
Constructor and Description |
---|
SurfaceMeshPrimitive()
Initializes a default surface mesh primitive.
|
SurfaceMeshPrimitive(SetHint setHint)
Initializes a surface mesh primitive with the specified
setHint . |
SurfaceMeshPrimitive(SetHint setHint,
SurfaceMeshRenderingMethod renderingMethod)
Initializes a surface mesh primitive with the specified
setHint
and renderingMethod . |
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.
|
Color |
getBlendingColor()
Gets the blending color.
|
BlendingEquation |
getBlendingEquation()
Gets or set the blending equation used when compositing a transparent surface mesh.
|
BlendingFunction |
getDestinationBlendingFunction()
Gets or set the blending function that is used to modify the destination color before the final
blending operation occurs.
|
SurfaceMeshRenderingMethod |
getRenderingMethod()
Gets the rendering method used to render the mesh.
|
SetHint |
getSetHint()
Gets the primitive's
SetHint . |
BlendingFunction |
getSourceBlendingFunction()
Gets or set the blending function that is used to modify the source color before the final
blending operation occurs.
|
Texture2D |
getTexture()
Gets the texture applied to this primitive when rendering.
|
TextureFilter2D |
getTextureFilter()
Gets the filter used when a
Texture is applied to this primitive. |
TextureMatrix |
getTextureMatrix()
Gets the matrix used to transform texture coordinates when a
Texture
is applied to this primitive. |
boolean |
getTransparentTextureBorder()
Gets or set the boolean that defines if the color obtained from texture coordinates beyond
the texture border should be considered transparent or not.
|
WindingOrder |
getTriangleWindingOrder()
Gets the orientation of front-facing triangles in the mesh.
|
boolean |
getUseCustomBlendingParameters()
Gets or set the boolean that defines if custom blending parameters will be used or if it will
use the blending parameters set by the particular rendering pass.
|
boolean |
getWireframe()
Gets or sets whether the primitive is rendered in wireframe.
|
void |
set(SurfaceTriangulatorResult surfaceTriangulator)
Defines the surface mesh using the specified
surfaceTriangulator . |
void |
setBlendingColor(Color value)
Sets the blending color.
|
void |
setBlendingEquation(BlendingEquation blendingEquation)
Gets or set the blending equation used when compositing a transparent surface mesh.
|
void |
setDestinationBlendingFunction(BlendingFunction blendingFunction)
Gets or set the blending function that is used to modify the destination color before the final
blending operation occurs.
|
void |
setSourceBlendingFunction(BlendingFunction blendingFunction)
Gets or set the blending function that is used to modify the source color before the final
blending operation occurs.
|
void |
setTexture(Texture2D value)
Sets the texture applied to this primitive when rendering.
|
void |
setTextureFilter(TextureFilter2D filter)
Sets the filter used when a
Texture is applied to this primitive. |
void |
setTextureMatrix(TextureMatrix matrix)
Sets the matrix used to transform texture coordinates when a
Texture
is applied to this primitive. |
void |
setTransparentTextureBorder(boolean transparentTextureBorder)
Gets or set the boolean that defines if the color obtained from texture coordinates beyond
the texture border should be considered transparent or not.
|
void |
setUseCustomBlendingParameters(boolean useCustomBlendingParameters)
Gets or set the boolean that defines if custom blending parameters will be used or if it will
use the blending parameters set by the particular rendering pass.
|
void |
setWireframe(boolean value)
Gets or sets whether the primitive is rendered in wireframe.
|
void |
setWithoutTexturing(SurfaceTriangulatorResult surfaceTriangulator)
Defines the surface mesh using the specified
surfaceTriangulator . |
static boolean |
supported()
Determines whether or not the video card supports the surface mesh primitive.
|
static boolean |
supported(SurfaceMeshRenderingMethod renderingMethod)
Determines whether or not the video card supports the surface mesh primitive
with the given
renderingMethod . |
dispose, getAutomaticallyComputeBoundingSphere, getBoundingSphere, getColor, getDisplay, getDisplayCondition, getReferenceFrame, getTag, getTranslucency, setAutomaticallyComputeBoundingSphere, setBoundingSphere, setColor, setDisplay, setDisplayCondition, setReferenceFrame, setTag, setTranslucency
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, dispose
public SurfaceMeshPrimitive()
SetHint
of Frequent
and a
SurfaceMeshRenderingMethod
of Automatic
.
See SurfaceMeshPrimitive.SurfaceMeshPrimitive(agi.foundation.graphics.SetHint,agi.foundation.graphics.advanced.SurfaceMeshRenderingMethod)
for a full discussion.
public SurfaceMeshPrimitive(SetHint setHint)
setHint
.
This is equivalent to constructing a surface mesh with the specified
setHint
and a
SurfaceMeshRenderingMethod
of Automatic
.
See SurfaceMeshPrimitive.SurfaceMeshPrimitive(agi.foundation.graphics.SetHint,agi.foundation.graphics.advanced.SurfaceMeshRenderingMethod)
for a full discussion.
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.SurfaceMeshPrimitive.SurfaceMeshPrimitive(agi.foundation.graphics.SetHint,agi.foundation.graphics.advanced.SurfaceMeshRenderingMethod)
public SurfaceMeshPrimitive(SetHint setHint, SurfaceMeshRenderingMethod renderingMethod)
setHint
and renderingMethod
.
After constructing the primitive, call Set
to provide it with a mesh for rendering.
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
: White
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
agi.foundation.graphics.primitive.Translucency
: 0.5f
RenderingMethod
: renderingMethod
SetHint
: setHint
Texture
: null
TextureFilter
: LinearClampToEdge
(get
)TextureMatrix
: Identity
TriangleWindingOrder
: CounterClockwise
Wireframe
: false
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.renderingMethod
- The method used to render the primitive.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.UnsupportedCaseException
- renderingMethod
must be a valid value in SurfaceMeshRenderingMethod
.InsufficientVideoCardException
- The surface mesh is not supported by this video card. Check
SurfaceMeshPrimitive.supported()
to determine if the surface mesh is supported.Set
,
SurfaceMeshPrimitive.supported()
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 Texture2D getTexture()
When a Texture
is defined, it is modulated with the primitive's
agi.foundation.graphics.primitive.Color
. In order
to show just the texture color, make sure
agi.foundation.graphics.primitive.Color
is White
.
By default, the texture is aligned north and encompasses the bounding
extent of the surface mesh. Use TextureMatrix
to
scale, translate, and/or rotate the texture.
The texture will not show up correctly if SetWithoutTexturing
is used to define the surface mesh. When a texturing is desired, always
use Set
instead of SetWithoutTexturing
.
If rendering performance is poor when a texture is applied to the surface mesh, it is likely that the texturing is occurring in software instead of hardware. If you experience this, try updating your video card drivers.
IllegalStateException
- When TextureFilter
is set to a mipmapping filter the new
Texture
must be mipmap capable.TextureMatrix
,
TextureFilter
,
Set
,
SetWithoutTexturing
,
Texture2DFactory
,
TextureFilter2D
public final void setTexture(Texture2D value)
When a Texture
is defined, it is modulated with the primitive's
agi.foundation.graphics.primitive.Color
. In order
to show just the texture color, make sure
agi.foundation.graphics.primitive.Color
is White
.
By default, the texture is aligned north and encompasses the bounding
extent of the surface mesh. Use TextureMatrix
to
scale, translate, and/or rotate the texture.
The texture will not show up correctly if SetWithoutTexturing
is used to define the surface mesh. When a texturing is desired, always
use Set
instead of SetWithoutTexturing
.
If rendering performance is poor when a texture is applied to the surface mesh, it is likely that the texturing is occurring in software instead of hardware. If you experience this, try updating your video card drivers.
IllegalStateException
- When TextureFilter
is set to a mipmapping filter the new
Texture
must be mipmap capable.TextureMatrix
,
TextureFilter
,
Set
,
SetWithoutTexturing
,
Texture2DFactory
,
TextureFilter2D
public final boolean getWireframe()
public final void setWireframe(boolean value)
public final WindingOrder getTriangleWindingOrder()
public final SetHint getSetHint()
SetHint
.
See the Set Hint topic for more information on
selecting an appropriate value to construct the primitive with.public final SurfaceMeshRenderingMethod getRenderingMethod()
public final TextureFilter2D getTextureFilter()
Texture
is applied to this primitive.IllegalStateException
- Cannot set the TextureFilter
to a mipmapping filter if the currently
set Texture
is not mipmap capable.Texture
,
Texture2DFactory
public final void setTextureFilter(TextureFilter2D filter)
Texture
is applied to this primitive.IllegalStateException
- Cannot set the TextureFilter
to a mipmapping filter if the currently
set Texture
is not mipmap capable.Texture
,
Texture2DFactory
public final TextureMatrix getTextureMatrix()
Texture
is applied to this primitive.
Performing transformations with the TextureMatrix
over time can create
effects such as water movement. See the
Surface Mesh Primitive topic, Texture Matrix section
for more information on using the TextureMatrix
.
Texture
public final void setTextureMatrix(TextureMatrix matrix)
Texture
is applied to this primitive.
Performing transformations with the TextureMatrix
over time can create
effects such as water movement. See the
Surface Mesh Primitive topic, Texture Matrix section
for more information on using the TextureMatrix
.
Texture
public final boolean getTransparentTextureBorder()
TextureMatrix
.public final void setTransparentTextureBorder(boolean transparentTextureBorder)
TextureMatrix
.public final boolean getUseCustomBlendingParameters()
public final void setUseCustomBlendingParameters(boolean useCustomBlendingParameters)
public final BlendingEquation getBlendingEquation()
public final void setBlendingEquation(BlendingEquation blendingEquation)
public final BlendingFunction getSourceBlendingFunction()
public final void setSourceBlendingFunction(BlendingFunction blendingFunction)
public final BlendingFunction getDestinationBlendingFunction()
public final void setDestinationBlendingFunction(BlendingFunction blendingFunction)
public final Color getBlendingColor()
public final void setBlendingColor(Color value)
public final void set(SurfaceTriangulatorResult surfaceTriangulator)
surfaceTriangulator
.
The mesh 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.
surfaceTriangulator
- The surface triangulator used to define the surface mesh.ArgumentNullException
- surfaceTriangulator
is null
.CouldNotCreateVideoCardResourceException
- Could not allocate video memory for the mesh.CouldNotCreateVideoCardResourceException
- Could not compile or link the required shaders. This may indicate that the video driver needs to be updated.SetWithoutTexturing
public final void setWithoutTexturing(SurfaceTriangulatorResult surfaceTriangulator)
surfaceTriangulator
.
The mesh is rendered in the primitive's agi.foundation.graphics.primitive.ReferenceFrame
.
Calling this method is more efficient than calling Set
but the surface
mesh will not render textures when this is used instead of Set
. Therefore,
only use SetWithoutTexturing
when the surface mesh's Texture
will
only ever be null
.
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.
surfaceTriangulator
- The surface triangulator used to define the surface mesh.ArgumentNullException
- surfaceTriangulator
is null
.CouldNotCreateVideoCardResourceException
- Could not allocate video memory for the mesh.CouldNotCreateVideoCardResourceException
- Could not compile or link the required shaders. This may indicate that the video driver needs to be updated.Set
,
Texture
public static final boolean supported(SurfaceMeshRenderingMethod renderingMethod)
renderingMethod
.renderingMethod
- The rendering method to check support for.true
if the video card supports the surface mesh primitive using
the given renderingMethod
; otherwise, false
.UnsupportedCaseException
- renderingMethod
must be a valid value in SurfaceMeshRenderingMethod
.public static final boolean supported()
SurfaceMeshPrimitive.supported(agi.foundation.graphics.advanced.SurfaceMeshRenderingMethod)
with Automatic
.true
if the video card supports the surface mesh primitive; otherwise, false
.SurfaceMeshPrimitive.supported(agi.foundation.graphics.advanced.SurfaceMeshRenderingMethod)