|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectcom.jme3.scene.Mesh
public class Mesh
Mesh
is used to store rendering data.
All visible elements in a scene are represented by meshes. Meshes may contain three types of geometric primitives:
setPointSize(float)
.
Points can also be used for point
sprite
mode.setLineWidth(float)
.
入れ子のクラスの概要 | |
---|---|
static class |
Mesh.Mode
The mode of the Mesh specifies both the type of primitive represented by the mesh and how the data should be interpreted. |
コンストラクタの概要 | |
---|---|
Mesh()
Creates a new mesh with no vertex buffers . |
メソッドの概要 | |
---|---|
void |
clearBuffer(VertexBuffer.Type type)
Clears or unsets the VertexBuffer set on this mesh
with the given type. |
Mesh |
clone()
Create a shallow clone of this Mesh. |
Mesh |
cloneForAnim()
Clone the mesh for animation use. |
int |
collideWith(Collidable other,
Matrix4f worldMatrix,
BoundingVolume worldBound,
CollisionResults results)
Handles collision detection, internal use only. |
void |
createCollisionData()
Generates a collision tree for the mesh. |
Mesh |
deepClone()
Creates a deep clone of this mesh. |
void |
generateBindPose(boolean forSoftwareAnim)
Generates the VertexBuffer.Type.BindPosePosition and VertexBuffer.Type.BindPoseNormal
buffers for this mesh by duplicating them based on the position and normal
buffers already set on the mesh. |
BoundingVolume |
getBound()
Returns the BoundingVolume of this Mesh. |
VertexBuffer |
getBuffer(VertexBuffer.Type type)
Get the VertexBuffer stored on this mesh with the given
type. |
java.util.ArrayList<VertexBuffer> |
getBufferList()
|
IntMap<VertexBuffer> |
getBuffers()
Returns a map of all vertex buffers on this Mesh. |
int[] |
getElementLengths()
Get the element lengths for Mesh.Mode.Hybrid mesh mode. |
java.nio.FloatBuffer |
getFloatBuffer(VertexBuffer.Type type)
Get the VertexBuffer data stored on this mesh in float
format. |
int |
getId()
Returns the mesh's VAO ID. |
IndexBuffer |
getIndexBuffer()
Get the index buffer for this mesh. |
IndexBuffer |
getIndicesAsList()
Acquires an index buffer that will read the vertices on the mesh as a list. |
float |
getLineWidth()
Returns the line width for line meshes. |
VertexBuffer |
getLodLevel(int lod)
Returns the lod level at the given index. |
int |
getMaxNumWeights()
Returns the maximum number of weights per vertex on this mesh. |
Mesh.Mode |
getMode()
Returns the mesh mode |
int[] |
getModeStart()
Set the mode start indices for Mesh.Mode.Hybrid mesh mode. |
int |
getNumLodLevels()
|
float |
getPointSize()
Returns the size of points for point meshes |
java.nio.ShortBuffer |
getShortBuffer(VertexBuffer.Type type)
Get the VertexBuffer data stored on this mesh in short
format. |
void |
getTriangle(int index,
int[] indices)
Gets the triangle vertex indices at the given triangle index and stores them into the given int array. |
void |
getTriangle(int index,
Triangle tri)
Gets the triangle vertex positions at the given triangle index and stores them into the Triangle argument. |
void |
getTriangle(int index,
Vector3f v1,
Vector3f v2,
Vector3f v3)
Gets the triangle vertex positions at the given triangle index and stores them into the v1, v2, v3 arguments. |
int |
getTriangleCount()
Returns how many triangles or elements are on this Mesh. |
int |
getTriangleCount(int lod)
Returns the triangle count for the given LOD level. |
int |
getVertexCount()
Returns the number of vertices on this mesh. |
void |
prepareForAnim(boolean forSoftwareAnim)
Prepares the mesh for software skinning by converting the bone index and weight buffers to heap buffers. |
void |
read(JmeImporter im)
|
void |
scaleTextureCoordinates(Vector2f scaleFactor)
Scales the texture coordinate buffer on this mesh by the given scale factor. |
void |
setBound(BoundingVolume modelBound)
Sets the BoundingVolume for this Mesh. |
void |
setBuffer(VertexBuffer.Type type,
int components,
byte[] buf)
|
void |
setBuffer(VertexBuffer.Type type,
int components,
java.nio.ByteBuffer buf)
|
void |
setBuffer(VertexBuffer.Type type,
int components,
float[] buf)
|
void |
setBuffer(VertexBuffer.Type type,
int components,
java.nio.FloatBuffer buf)
Set a floating point VertexBuffer on the mesh. |
void |
setBuffer(VertexBuffer.Type type,
int components,
int[] buf)
|
void |
setBuffer(VertexBuffer.Type type,
int components,
java.nio.IntBuffer buf)
|
void |
setBuffer(VertexBuffer.Type type,
int components,
short[] buf)
|
void |
setBuffer(VertexBuffer.Type type,
int components,
java.nio.ShortBuffer buf)
|
void |
setBuffer(VertexBuffer vb)
|
void |
setDynamic()
Indicates to the GPU that this mesh will be modified occasionally (a hint). |
void |
setElementLengths(int[] elementLengths)
Set the element lengths for Mesh.Mode.Hybrid mesh mode. |
void |
setId(int id)
Sets the mesh's VAO ID. |
void |
setInterleaved()
Interleaves the data in this mesh. |
void |
setLineWidth(float lineWidth)
Specify the line width for meshes of the line modes, such as Mesh.Mode.Lines . |
void |
setLodLevels(VertexBuffer[] lodLevels)
Set the LOD (level of detail) index buffers on this mesh. |
void |
setMaxNumWeights(int maxNumWeights)
Set the maximum number of weights per vertex on this mesh. |
void |
setMode(Mesh.Mode mode)
Change the Mesh's mode. |
void |
setModeStart(int[] modeStart)
Get the mode start indices for Mesh.Mode.Hybrid mesh mode. |
void |
setPointSize(float pointSize)
Set the size of points for meshes of mode Mesh.Mode.Points . |
void |
setStatic()
Indicates to the GPU that this mesh will not be modified (a hint). |
void |
setStreamed()
Indicates to the GPU that this mesh will be modified every frame (a hint). |
void |
updateBound()
Updates the bounding volume of this mesh. |
void |
updateCounts()
Update the vertex and
triangle counts for this mesh
based on the current data. |
void |
write(JmeExporter ex)
|
クラス java.lang.Object から継承されたメソッド |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
コンストラクタの詳細 |
---|
public Mesh()
vertex buffers
.
メソッドの詳細 |
---|
public Mesh clone()
vertex
buffers
are shared between this and the clone mesh, the rest
of the data is cloned.
java.lang.Object
内の clone
public Mesh deepClone()
vertex buffers
and the data inside them
is cloned.
public Mesh cloneForAnim()
vertex buffer
data, however the
VertexBuffer.Type.BindPosePosition
and VertexBuffer.Type.BindPoseNormal
buffers
are deeply cloned.
public void generateBindPose(boolean forSoftwareAnim)
VertexBuffer.Type.BindPosePosition
and VertexBuffer.Type.BindPoseNormal
buffers for this mesh by duplicating them based on the position and normal
buffers already set on the mesh.
This method does nothing if the mesh has no bone weight or index
buffers.
forSoftwareAnim
- Should be true if the bind pose is to be generated.public void prepareForAnim(boolean forSoftwareAnim)
forSoftwareAnim
- Should be true to enable the conversion.public void setLodLevels(VertexBuffer[] lodLevels)
lodLevels
- The LOD levels to setpublic int getNumLodLevels()
public VertexBuffer getLodLevel(int lod)
lod
- The lod level index, this does not include
the main index buffer.
java.lang.IndexOutOfBoundsException
- If the index is outside of the
range [0, getNumLodLevels()
].setLodLevels(com.jme3.scene.VertexBuffer[])
public int[] getElementLengths()
Mesh.Mode.Hybrid
mesh mode.
public void setElementLengths(int[] elementLengths)
Mesh.Mode.Hybrid
mesh mode.
elementLengths
- The element lengths to setpublic int[] getModeStart()
Mesh.Mode.Hybrid
mesh mode.
public void setModeStart(int[] modeStart)
Mesh.Mode.Hybrid
mesh mode.
public Mesh.Mode getMode()
setMode(com.jme3.scene.Mesh.Mode)
public void setMode(Mesh.Mode mode)
Mesh.Mode.Triangles
.
mode
- The new mode to setMesh.Mode
public int getMaxNumWeights()
setMaxNumWeights(int)
public void setMaxNumWeights(int maxNumWeights)
maxNumWeights
- public float getPointSize()
setPointSize(float)
public void setPointSize(float pointSize)
Mesh.Mode.Points
.
The point size is specified as on-screen pixels, the default
value is 1.0. The point size
does nothing if point sprite
render state is enabled, in that case, the vertex shader must specify the
point size by writing to gl_PointSize
.
pointSize
- The size of pointspublic float getLineWidth()
public void setLineWidth(float lineWidth)
Mesh.Mode.Lines
. The line width is specified as on-screen pixels,
the default value is 1.0.
lineWidth
- The line widthpublic void setStatic()
VertexBuffer.Usage.Static
for all vertex buffers
on this Mesh.
public void setDynamic()
VertexBuffer.Usage.Dynamic
for all vertex buffers
on this Mesh.
public void setStreamed()
VertexBuffer.Usage.Stream
for all vertex buffers
on this Mesh.
public void setInterleaved()
public void updateCounts()
vertex
and
triangle
counts for this mesh
based on the current data. This method should be called
after the capacities
of the mesh's
vertex buffers
has been altered.
java.lang.IllegalStateException
- If this mesh is in
interleaved
format.public int getTriangleCount(int lod)
lod
- The lod level to look up
public int getTriangleCount()
updateCounts()
is called.
If the mesh mode is not a triangle mode, then this returns the
number of elements/primitives, e.g. how many lines or how many points,
instead of how many triangles.
public int getVertexCount()
public void getTriangle(int index, Vector3f v1, Vector3f v2, Vector3f v3)
index
- The index of the triangle.
Should be between 0 and getTriangleCount()
.v1
- Vector to contain first vertex positionv2
- Vector to contain second vertex positionv3
- Vector to contain third vertex positionpublic void getTriangle(int index, Triangle tri)
Triangle
argument.
Also sets the triangle index to the index
argument.
index
- The index of the triangle.
Should be between 0 and getTriangleCount()
.tri
- The triangle to store the positions inpublic void getTriangle(int index, int[] indices)
index
- The index of the triangle.
Should be between 0 and getTriangleCount()
.indices
- Indices of the triangle's verticespublic int getId()
public void setId(int id)
public void createCollisionData()
collideWith(com.jme3.collision.Collidable,
com.jme3.math.Matrix4f,
com.jme3.bounding.BoundingVolume,
com.jme3.collision.CollisionResults)
.
public int collideWith(Collidable other, Matrix4f worldMatrix, BoundingVolume worldBound, CollisionResults results)
Spatial
s.
public void setBuffer(VertexBuffer.Type type, int components, java.nio.FloatBuffer buf)
VertexBuffer
on the mesh.
type
- The type of VertexBuffer
,
e.g. VertexBuffer.Type.Position
, VertexBuffer.Type.Normal
, etc.components
- Number of components on the vertex buffer, should
be between 1 and 4.buf
- The floating point data to containpublic void setBuffer(VertexBuffer.Type type, int components, float[] buf)
public void setBuffer(VertexBuffer.Type type, int components, java.nio.IntBuffer buf)
public void setBuffer(VertexBuffer.Type type, int components, int[] buf)
public void setBuffer(VertexBuffer.Type type, int components, java.nio.ShortBuffer buf)
public void setBuffer(VertexBuffer.Type type, int components, byte[] buf)
public void setBuffer(VertexBuffer.Type type, int components, java.nio.ByteBuffer buf)
public void setBuffer(VertexBuffer vb)
public void clearBuffer(VertexBuffer.Type type)
VertexBuffer
set on this mesh
with the given type.
Does nothing if the vertex buffer type is not set initially
type
- The type to removepublic void setBuffer(VertexBuffer.Type type, int components, short[] buf)
public VertexBuffer getBuffer(VertexBuffer.Type type)
VertexBuffer
stored on this mesh with the given
type.
type
- The type of VertexBuffer
public java.nio.FloatBuffer getFloatBuffer(VertexBuffer.Type type)
VertexBuffer
data stored on this mesh in float
format.
type
- The type of VertexBuffer
public java.nio.ShortBuffer getShortBuffer(VertexBuffer.Type type)
VertexBuffer
data stored on this mesh in short
format.
type
- The type of VertexBuffer
public IndexBuffer getIndicesAsList()
mesh
- The mesh to read from
public IndexBuffer getIndexBuffer()
null
if no index buffer is set.
VertexBuffer.Type.Index
public void scaleTextureCoordinates(Vector2f scaleFactor)
Note that values above 1 will cause the texture to tile, while values below 1 will cause the texture to stretch.
scaleFactor
- The scale factor to scale by. Every texture
coordinate is multiplied by this vector to get the result.
java.lang.IllegalStateException
- If there's no texture coordinate
buffer on the mesh
java.lang.UnsupportedOperationException
- If the texture coordinate
buffer is not in 2D float format.public void updateBound()
VertexBuffer.Type.Position
buffer.
It is expected that the position buffer is a float buffer with 3 components.
public BoundingVolume getBound()
BoundingVolume
of this Mesh.
By default the bounding volume is a BoundingBox
.
public void setBound(BoundingVolume modelBound)
BoundingVolume
for this Mesh.
The bounding volume is recomputed by calling updateBound()
.
modelBound
- The model bound to setpublic IntMap<VertexBuffer> getBuffers()
vertex buffers
on this Mesh.
The integer key for the map is the ordinal
of the vertex buffer's VertexBuffer.Type
.
Note that the returned map is a reference to the map used internally,
modifying it will cause undefined results.
public java.util.ArrayList<VertexBuffer> getBufferList()
public void write(JmeExporter ex) throws java.io.IOException
Savable
内の write
java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
Savable
内の read
java.io.IOException
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |