|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.scene.Spatial
com.jme.scene.Geometry
com.jme.scene.Line
public class Line
Line
subclasses geometry and defines a collection of lines.
For every two points, a line is created. If mode is set to CONNECTED, these
lines as connected as one big line. If it is set to LOOP, it is also rendered
connected but the last point is connected to the first point.
Nested Class Summary | |
---|---|
static class |
Line.Mode
|
Nested classes/interfaces inherited from class com.jme.scene.Spatial |
---|
Spatial.CullHint, Spatial.LightCombineMode, Spatial.NormalsMode, Spatial.TextureCombineMode |
Field Summary | |
---|---|
protected java.nio.IntBuffer |
indexBuffer
|
Fields inherited from class com.jme.scene.Geometry |
---|
binormalBuf, bound, castsShadows, colorBuf, compVect, defaultColor, displayListID, enabled, fogBuf, hasDirtyVertices, normBuf, states, tangentBuf, texBuf, vboInfo, vertBuf, vertQuantity |
Fields inherited from class com.jme.scene.Spatial |
---|
cullHint, frustrumIntersects, geometricalControllers, isCollidable, lightCombineMode, localRotation, localScale, localTranslation, LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, lockedMode, name, normalsMode, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder |
Constructor Summary | |
---|---|
Line()
|
|
Line(java.lang.String name)
Constructs a new line with the given name. |
|
Line(java.lang.String name,
java.nio.FloatBuffer vertex,
java.nio.FloatBuffer normal,
java.nio.FloatBuffer color,
TexCoords coords)
Constructor instantiates a new Line object with a given
set of data. |
|
Line(java.lang.String name,
Vector3f[] vertex,
Vector3f[] normal,
ColorRGBA[] color,
Vector2f[] texture)
Constructor instantiates a new Line object with a given
set of data. |
Method Summary | |
---|---|
void |
appendCircle(float radius,
float x,
float y,
int segments,
boolean insideOut)
Puts a circle into vertex and normal buffer at the current buffer position. |
void |
draw(Renderer r)
draw prepares the geometry for rendering to the display. |
void |
findCollisions(Spatial scene,
CollisionResults results)
checks this spatial against a second spatial, any collisions are stored in the results object. |
void |
generateIndices()
|
java.nio.IntBuffer |
getIndexBuffer()
getIndexBuffer retrieves the indices array as an
IntBuffer . |
float |
getLineWidth()
|
Line.Mode |
getMode()
|
int |
getStippleFactor()
|
short |
getStipplePattern()
|
boolean |
hasCollision(Spatial scene,
boolean checkTriangles)
Always return false for lines. |
boolean |
isAntialiased()
|
void |
read(JMEImporter e)
|
void |
reconstruct(java.nio.FloatBuffer vertices,
java.nio.FloatBuffer normals,
java.nio.FloatBuffer colors,
TexCoords coords)
reconstruct reinitializes the geometry with new data. |
void |
setAntialiased(boolean antialiased)
Sets whether the point should be antialiased. |
void |
setIndexBuffer(java.nio.IntBuffer indices)
setIndexBuffer sets the index array for this
Line . |
void |
setLineWidth(float lineWidth)
Sets the width of the line when drawn. |
void |
setMode(Line.Mode mode)
|
void |
setStippleFactor(int stippleFactor)
|
void |
setStipplePattern(short stipplePattern)
The stipple or pattern to use when drawing this line. |
void |
write(JMEExporter e)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.jme.util.export.Savable |
---|
getClassTag |
Field Detail |
---|
protected transient java.nio.IntBuffer indexBuffer
Constructor Detail |
---|
public Line()
public Line(java.lang.String name)
name
- The name of the line.public Line(java.lang.String name, java.nio.FloatBuffer vertex, java.nio.FloatBuffer normal, java.nio.FloatBuffer color, TexCoords coords)
Line
object with a given
set of data. Any data can be null except for the vertex list. If vertices
are null an exception will be thrown.
name
- the name of the scene element. This is required for
identification and comparision purposes.vertex
- the vertices that make up the lines.normal
- the normals of the lines.color
- the color of each point of the lines.coords
- the texture coordinates of the lines.public Line(java.lang.String name, Vector3f[] vertex, Vector3f[] normal, ColorRGBA[] color, Vector2f[] texture)
Line
object with a given
set of data. Any data can be null except for the vertex list. If vertices
are null an exception will be thrown.
name
- the name of the scene element. This is required for
identification and comparision purposes.vertex
- the vertices that make up the lines.normal
- the normals of the lines.color
- the color of each point of the lines.texture
- the texture coordinates of the lines.Method Detail |
---|
public void reconstruct(java.nio.FloatBuffer vertices, java.nio.FloatBuffer normals, java.nio.FloatBuffer colors, TexCoords coords)
Geometry
reconstruct
reinitializes the geometry with new data. This
will reuse the geometry object.
reconstruct
in class Geometry
vertices
- the new vertices to use.normals
- the new normals to use.colors
- the new colors to use.coords
- the new texture coordinates to use (position 0).public void generateIndices()
public java.nio.IntBuffer getIndexBuffer()
getIndexBuffer
retrieves the indices array as an
IntBuffer
.
IntBuffer
.public void setIndexBuffer(java.nio.IntBuffer indices)
setIndexBuffer
sets the index array for this
Line
.
indices
- the index array as an IntBuffer.public void findCollisions(Spatial scene, CollisionResults results)
Spatial
findCollisions
in class Spatial
scene
- the scene to test against.results
- the results of the collisions.public boolean hasCollision(Spatial scene, boolean checkTriangles)
hasCollision
in class Spatial
scene
- the scene to test against.checkTriangles
- check for collisions on triangle accuracy level
public void appendCircle(float radius, float x, float y, int segments, boolean insideOut)
radius
- radius of the circlex
- x coordinate of circle centery
- y coordinate of circle centersegments
- number of line segments the circle is built frominsideOut
- false for normal winding (ccw), true for clockwise windingpublic boolean isAntialiased()
public void setAntialiased(boolean antialiased)
antialiased
- true if the line should be antialiased.public Line.Mode getMode()
public void setMode(Line.Mode mode)
mode
- either SEGMENTS, CONNECTED or LOOP. See class description.public float getLineWidth()
public void setLineWidth(float lineWidth)
lineWidth
- The lineWidth to set.public short getStipplePattern()
public void setStipplePattern(short stipplePattern)
stipplePattern
- a 16bit short whose bits describe the pattern to use when
drawing this linepublic int getStippleFactor()
public void setStippleFactor(int stippleFactor)
stippleFactor
- magnification factor to apply to the stipple pattern.public void write(JMEExporter e) throws java.io.IOException
write
in interface Savable
write
in class Geometry
java.io.IOException
public void read(JMEImporter e) throws java.io.IOException
read
in interface Savable
read
in class Geometry
java.io.IOException
public void draw(Renderer r)
Geometry
draw
prepares the geometry for rendering to the display.
The renderstate is set and the subclass is responsible for rendering the
actual data.
draw
in class Geometry
r
- the renderer that displays to the context.Spatial.draw(com.jme.renderer.Renderer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |