Package jme3utilities
Class MyMesh
java.lang.Object
jme3utilities.MyMesh
Utility methods for meshes and mesh vertices.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic com.jme3.scene.MeshaddIndices(com.jme3.scene.Mesh input) Compress a Mesh by introducing an index buffer.static voidaddSphereNormals(com.jme3.scene.Mesh mesh) Add normals to a Mesh for an outward-facing sphere.static booleanareIdentical(com.jme3.scene.Mesh mesh, int vi1, int vi2) Test whether specified vertices in the specified Mesh are identical.static com.jme3.material.MaterialboneWeightMaterial(com.jme3.scene.Mesh mesh, com.jme3.math.ColorRGBA[] boneIndexToColor, com.jme3.asset.AssetManager assetManager) Generate a material to visualize the bone weights in the specified Mesh.static voidcenterBuffer(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType) Translate the specified VertexBuffer so that the center of its axis-aligned bounding box is at (0, 0, 0).static intcountBones(com.jme3.scene.Mesh mesh) Estimate the number of bones in the specified Mesh by reading its bone-index buffers.static com.jme3.scene.Meshexpand(com.jme3.scene.Mesh in) Expand a Mesh to ensure that no vertex data are re-used.static com.jme3.scene.Mesh.ModeexpandedMode(com.jme3.scene.Mesh inputMesh) Determine the type of primitives contained in the specified Mesh.static voidgenerateFacetNormals(com.jme3.scene.Mesh mesh) Generate normals on a triangle-by-triangle basis for a Triangles-mode Mesh without an index buffer.static voidgenerateFacetNormals(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type normalBufferType, com.jme3.scene.VertexBuffer.Type positionBufferType) Generate facet normals for a Triangles-mode Mesh without an index buffer.static voidgenerateNormals(com.jme3.scene.Mesh mesh) Deprecated.static voidgenerateSphereNormals(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type normalBufferType, com.jme3.scene.VertexBuffer.Type positionBufferType) Generate sphere normals for a Mesh.static com.jme3.scene.CollisionDatagetCollisionTree(com.jme3.scene.Mesh mesh) Access the collision tree of the specified Meshstatic booleanhasAnyNormals(com.jme3.scene.Mesh mesh) Test whether the specified Mesh has vertex normals, including bind-pose normals.static booleanhasAnyTangents(com.jme3.scene.Mesh mesh) Test whether the specified Mesh has vertex tangents, including bind-pose tangents.static booleanhasIndices(com.jme3.scene.Mesh mesh) Test whether the specified Mesh has an index buffer.static booleanhasNormals(com.jme3.scene.Mesh mesh) Test whether the specified Mesh has vertex normals, not including bind-pose normals.static booleanhasTangents(com.jme3.scene.Mesh mesh) Test whether the specified Mesh has vertex tangents, not including bind-pose tangents.static booleanhasTriangles(com.jme3.scene.Mesh mesh) Test whether the specified Mesh is composed of triangles.static booleanhasUV(com.jme3.scene.Mesh mesh) Test whether the specified Mesh has texture (U-V) coordinates.static booleanisAnimated(com.jme3.scene.Mesh mesh) Test whether the specified Mesh is bone animated.static List<com.jme3.scene.Mesh>listMeshes(com.jme3.scene.Spatial subtree, List<com.jme3.scene.Mesh> storeResult) Enumerate all meshes in the specified subtree of a scene graph.static VectorSetlistVertexLocations(com.jme3.scene.Spatial subtree, VectorSet storeResult) Enumerate the world locations of all vertices in the specified subtree of a scene graph.static com.jme3.scene.Meshmerge(com.jme3.scene.Mesh mesh1, com.jme3.scene.Mesh mesh2) Merge 2 meshes.static intnumInfluenced(com.jme3.scene.Mesh mesh, int boneIndex) Count how many vertices in the specified Mesh are directly influenced by the indexed bone.static voidreverseNormals(com.jme3.scene.Mesh mesh) Reverse the normals of a Mesh.static voidreverseWinding(com.jme3.scene.Mesh mesh) Reverse the winding order of a Triangles-mode Mesh, but don't reverse its normals.static voidrotate(com.jme3.scene.Mesh mesh, com.jme3.math.Quaternion rotation) Apply the specified rotation to the specified Mesh.static voidrotateBuffer(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType, com.jme3.math.Quaternion rotation) Apply the specified rotation to all data in the specified VertexBuffer.static voidrotateTangentBuffer(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType, com.jme3.math.Quaternion rotation) Apply the specified rotation to all data in the specified tangent buffer.static voidscale(com.jme3.scene.Mesh mesh, float factor) Scale all vertex positions uniformly by the specified factor.static voidsetBoneIndexBuffer(com.jme3.scene.Mesh mesh, int wpv, com.jme3.scene.mesh.IndexBuffer indexBuffer) Replace the BoneIndexBuffer of a Mesh.static voidsmoothNormals(com.jme3.scene.Mesh mesh) Smooth the normals of a Mesh by averaging them across all uses of each distinct vertex position.static voidsmoothNormals(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type normalBufferType, com.jme3.scene.VertexBuffer.Type positionBufferType) Smooth the normals of a Mesh by averaging them across all uses of each distinct vertex position.static com.jme3.scene.MeshsubdivideLines(com.jme3.scene.Mesh in, int ratio) Subdivide the specified Lines-mode mesh by the specified ratio.static com.jme3.scene.MeshsubdivideTriangles(com.jme3.scene.Mesh in, int ratio) Uniformly subdivide the specified Triangles-mode mesh by the specified ratio.static voidtransformBuffer(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType, com.jme3.math.Transform transform) Apply the specified coordinate transform to all data in the specified VertexBuffer.static voidtranslate(com.jme3.scene.Mesh mesh, com.jme3.math.Vector3f offset) Translate all vertices in the specified Mesh by the specified offset.static voidtrianglesToLines(com.jme3.scene.Mesh mesh) Convert mesh triangles to lines.static int[]vertexBoneIndices(com.jme3.scene.Mesh mesh, int vertexIndex, int[] storeResult) Copy the bone indices for the indexed vertex.static float[]vertexBoneWeights(com.jme3.scene.Mesh mesh, int vertexIndex, float[] storeResult) Copy the bone weights for the indexed vertex.static com.jme3.math.ColorRGBAvertexColor(com.jme3.scene.Mesh mesh, int vertexIndex, com.jme3.math.ColorRGBA storeResult) Copy the color of the indexed vertex from the color buffer of the specified Mesh.static com.jme3.math.Vector3fvertexLocation(com.jme3.scene.Mesh mesh, int vertexIndex, com.jme3.math.Matrix4f[] skinningMatrices, com.jme3.math.Vector3f storeResult) Determine the location of the indexed vertex in mesh space using the skinning matrices provided.static com.jme3.math.Vector3fvertexNormal(com.jme3.scene.Mesh mesh, int vertexIndex, com.jme3.math.Matrix4f[] skinningMatrices, com.jme3.math.Vector3f storeResult) Determine the normal of the indexed vertex in mesh space using the skinning matrices provided.static floatvertexSize(com.jme3.scene.Mesh mesh, int vertexIndex) Read the size of the indexed vertex from the size buffer.static com.jme3.math.Vector4fvertexTangent(com.jme3.scene.Mesh mesh, int vertexIndex, com.jme3.math.Matrix4f[] skinningMatrices, com.jme3.math.Vector4f storeResult) Determine the tangent of the indexed vertex in mesh space using the skinning matrices provided.static com.jme3.math.Vector2fvertexVector2f(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType, int vertexIndex, com.jme3.math.Vector2f storeResult) Copy texture coordinates of the indexed vertex from the specified vertex buffer.static com.jme3.math.Vector3fvertexVector3f(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType, int vertexIndex, com.jme3.math.Vector3f storeResult) Copy Vector3f data for the indexed vertex from the specified VertexBuffer.static com.jme3.math.Vector4fvertexVector4f(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType, int vertexIndex, com.jme3.math.Vector4f storeResult) Copy Vector4f data for the indexed vertex from the specified vertex buffer.static com.jme3.math.Vector3fvertexWorldLocation(com.jme3.scene.Geometry geometry, int vertexIndex, com.jme3.math.Matrix4f[] skinningMatrices, com.jme3.math.Vector3f storeResult) Determine the location of the indexed vertex in world space using the skinning matrices provided.
-
Field Details
-
vpe
public static final int vpenumber of vertices per edge- See Also:
-
vpt
public static final int vptnumber of vertices per triangle- See Also:
-
-
Method Details
-
addIndices
public static com.jme3.scene.Mesh addIndices(com.jme3.scene.Mesh input) Compress a Mesh by introducing an index buffer.- Parameters:
input- the input Mesh (not null, without an index buffer)- Returns:
- a new Mesh (with an index buffer)
-
addSphereNormals
public static void addSphereNormals(com.jme3.scene.Mesh mesh) Add normals to a Mesh for an outward-facing sphere.- Parameters:
mesh- the Mesh to modify (not null, without normals)
-
areIdentical
public static boolean areIdentical(com.jme3.scene.Mesh mesh, int vi1, int vi2) Test whether specified vertices in the specified Mesh are identical.- Parameters:
mesh- (not null, unaffected)vi1- the index of the first vertex (≥0)vi2- the index of the 2nd vertex (≥0)- Returns:
- true if identical, otherwise false
-
boneWeightMaterial
public static com.jme3.material.Material boneWeightMaterial(com.jme3.scene.Mesh mesh, com.jme3.math.ColorRGBA[] boneIndexToColor, com.jme3.asset.AssetManager assetManager) Generate a material to visualize the bone weights in the specified Mesh.- Parameters:
mesh- the subject mesh (not null, animated, modified)boneIndexToColor- map bone indices to colors (not null, unaffected)assetManager- (not null)- Returns:
- a new wireframe material instance
-
centerBuffer
public static void centerBuffer(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType) Translate the specified VertexBuffer so that the center of its axis-aligned bounding box is at (0, 0, 0).- Parameters:
mesh- the subject mesh (not null)bufferType- which buffer to modify (not null)
-
countBones
public static int countBones(com.jme3.scene.Mesh mesh) Estimate the number of bones in the specified Mesh by reading its bone-index buffers.- Parameters:
mesh- the Mesh to examine (not null)- Returns:
- an estimated number of bones (≥0)
-
expand
public static com.jme3.scene.Mesh expand(com.jme3.scene.Mesh in) Expand a Mesh to ensure that no vertex data are re-used. Any index buffer is eliminated and any loop/strip/fan mode is changed to Triangles or Lines.- Parameters:
in- the input mesh (not null, mode not Hybrid or Patch, unaffected)- Returns:
- a new Mesh (without an index buffer, in one of the list modes)
-
expandedMode
public static com.jme3.scene.Mesh.Mode expandedMode(com.jme3.scene.Mesh inputMesh) Determine the type of primitives contained in the specified Mesh.- Parameters:
inputMesh- the Mesh to analyze (not null, mode not Hybrid or Patch, unaffected)- Returns:
- an enum value (one of the list modes)
- See Also:
-
generateFacetNormals
public static void generateFacetNormals(com.jme3.scene.Mesh mesh) Generate normals on a triangle-by-triangle basis for a Triangles-mode Mesh without an index buffer. Pre-existing normal buffers are discarded.- Parameters:
mesh- the Mesh to modify (not null, mode=Triangles, not indexed)
-
generateFacetNormals
public static void generateFacetNormals(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type normalBufferType, com.jme3.scene.VertexBuffer.Type positionBufferType) Generate facet normals for a Triangles-mode Mesh without an index buffer. Any pre-existing target buffer is discarded.- Parameters:
mesh- the Mesh to modify (not null, mode=Triangles, not indexed)normalBufferType- the target buffer type (Normal or BindPoseNormal)positionBufferType- the source buffer type (Position or BindPosePosition)
-
generateNormals
Deprecated.Generate normals on a triangle-by-triangle basis for a Triangles-mode Mesh without an index buffer. Pre-existing normal buffers are discarded.- Parameters:
mesh- the Mesh to modify (not null, mode=Triangles, not indexed)
-
generateSphereNormals
public static void generateSphereNormals(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type normalBufferType, com.jme3.scene.VertexBuffer.Type positionBufferType) Generate sphere normals for a Mesh. Any pre-existing target buffer is discarded.- Parameters:
mesh- the Mesh to modify (not null)normalBufferType- the target buffer type (Normal or BindPoseNormal)positionBufferType- the source buffer type (Position or BindPosePosition)
-
getCollisionTree
public static com.jme3.scene.CollisionData getCollisionTree(com.jme3.scene.Mesh mesh) Access the collision tree of the specified Mesh- Parameters:
mesh- the Mesh to access (not null, unaffected)- Returns:
- the pre-existing instance, or null if none
-
hasAnyNormals
public static boolean hasAnyNormals(com.jme3.scene.Mesh mesh) Test whether the specified Mesh has vertex normals, including bind-pose normals.- Parameters:
mesh- the Mesh to test (not null, unaffected)- Returns:
- true if the Mesh has vertex normals, otherwise false
-
hasAnyTangents
public static boolean hasAnyTangents(com.jme3.scene.Mesh mesh) Test whether the specified Mesh has vertex tangents, including bind-pose tangents.- Parameters:
mesh- the Mesh to test (not null, unaffected)- Returns:
- true if the Mesh has vertex tangents, otherwise false
-
hasIndices
public static boolean hasIndices(com.jme3.scene.Mesh mesh) Test whether the specified Mesh has an index buffer.- Parameters:
mesh- the Mesh to test (not null, unaffected)- Returns:
- true if the Mesh has indices, otherwise false
-
hasNormals
public static boolean hasNormals(com.jme3.scene.Mesh mesh) Test whether the specified Mesh has vertex normals, not including bind-pose normals.- Parameters:
mesh- the Mesh to test (not null, unaffected)- Returns:
- true if the Mesh has vertex normals, otherwise false
-
hasTangents
public static boolean hasTangents(com.jme3.scene.Mesh mesh) Test whether the specified Mesh has vertex tangents, not including bind-pose tangents.- Parameters:
mesh- the Mesh to test (not null, unaffected)- Returns:
- true if the Mesh has vertex tangents, otherwise false
-
hasTriangles
public static boolean hasTriangles(com.jme3.scene.Mesh mesh) Test whether the specified Mesh is composed of triangles.- Parameters:
mesh- the Mesh to test (not null, unaffected)- Returns:
- true if the Mesh is composed of triangles, otherwise false
-
hasUV
public static boolean hasUV(com.jme3.scene.Mesh mesh) Test whether the specified Mesh has texture (U-V) coordinates.- Parameters:
mesh- the Mesh to test (not null, unaffected)- Returns:
- true if the Mesh has texture coordinates, otherwise false
-
isAnimated
public static boolean isAnimated(com.jme3.scene.Mesh mesh) Test whether the specified Mesh is bone animated. UnlikeMesh.isAnimated(), this method checks for bone weights and ignores hardware buffers.- Parameters:
mesh- which Mesh to test (not null, unaffected)- Returns:
- true if animated, otherwise false
-
listMeshes
public static List<com.jme3.scene.Mesh> listMeshes(com.jme3.scene.Spatial subtree, List<com.jme3.scene.Mesh> storeResult) Enumerate all meshes in the specified subtree of a scene graph. Note: recursive!- Parameters:
subtree- (may be null, aliases created)storeResult- storage for results (added to if not null)- Returns:
- an expanded list (either storeResult or a new instance)
-
listVertexLocations
Enumerate the world locations of all vertices in the specified subtree of a scene graph. Note: recursive!- Parameters:
subtree- (may be null)storeResult- storage for results (added to if not null)- Returns:
- the resulting set (either storeResult or a new instance)
-
merge
public static com.jme3.scene.Mesh merge(com.jme3.scene.Mesh mesh1, com.jme3.scene.Mesh mesh2) Merge 2 meshes. Doesn't handle levels of detail, hybrid meshes, or tessellation meshes. Both meshes must be composed of the same sort of primitives. In other words, if mesh1 is composed of triangles, then so must mesh2, and vice versa. Apart from indices, both meshes must have the same set of vertex buffers. In other words, if mesh1 has normals, UVs, and bone animations, then so must mesh2, and vice versa. Furthermore, corresponding vertex buffers must have the same number of components per element.- Parameters:
mesh1- the first input mesh (not null, unaffected)mesh2- the 2nd input mesh (not null, unaffected)- Returns:
- a new Mesh (without an index buffer, in one of the list modes)
-
numInfluenced
public static int numInfluenced(com.jme3.scene.Mesh mesh, int boneIndex) Count how many vertices in the specified Mesh are directly influenced by the indexed bone.- Parameters:
mesh- the Mesh to analyze (not null, possibly modified)boneIndex- which bone (≥0)- Returns:
- count (≥0)
-
reverseNormals
public static void reverseNormals(com.jme3.scene.Mesh mesh) Reverse the normals of a Mesh. Apply this method (for instance) after reversing the winding order of a triangle mesh.- Parameters:
mesh- the Mesh to modify (not null)
-
reverseWinding
public static void reverseWinding(com.jme3.scene.Mesh mesh) Reverse the winding order of a Triangles-mode Mesh, but don't reverse its normals.- Parameters:
mesh- the Mesh to modify (not null, mode=Triangles)
-
rotate
public static void rotate(com.jme3.scene.Mesh mesh, com.jme3.math.Quaternion rotation) Apply the specified rotation to the specified Mesh. This is not recommended for animated meshes.- Parameters:
mesh- the Mesh to rotate (not null, modified)rotation- the rotation to apply (not null, unaffected)
-
rotateBuffer
public static void rotateBuffer(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType, com.jme3.math.Quaternion rotation) Apply the specified rotation to all data in the specified VertexBuffer.- Parameters:
mesh- the subject mesh (not null)bufferType- which buffer to modify (not null)rotation- the rotation to apply (not null, unaffected)
-
rotateTangentBuffer
public static void rotateTangentBuffer(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType, com.jme3.math.Quaternion rotation) Apply the specified rotation to all data in the specified tangent buffer.- Parameters:
mesh- the subject mesh (not null)bufferType- which buffer to modify (not null)rotation- the rotation to apply (not null, unaffected)
-
scale
public static void scale(com.jme3.scene.Mesh mesh, float factor) Scale all vertex positions uniformly by the specified factor.- Parameters:
mesh- the Mesh to scale (not null, modified)factor- the scale factor to apply
-
setBoneIndexBuffer
public static void setBoneIndexBuffer(com.jme3.scene.Mesh mesh, int wpv, com.jme3.scene.mesh.IndexBuffer indexBuffer) Replace the BoneIndexBuffer of a Mesh.- Parameters:
mesh- the Mesh to modify (not null)wpv- the number of bone weights per vertex (≥1, ≤4)indexBuffer- the desired IndexBuffer (not null, alias created)
-
smoothNormals
public static void smoothNormals(com.jme3.scene.Mesh mesh) Smooth the normals of a Mesh by averaging them across all uses of each distinct vertex position.- Parameters:
mesh- the Mesh to modify (not null, with normals)
-
smoothNormals
public static void smoothNormals(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type normalBufferType, com.jme3.scene.VertexBuffer.Type positionBufferType) Smooth the normals of a Mesh by averaging them across all uses of each distinct vertex position.- Parameters:
mesh- the Mesh to modify (not null, with normals)normalBufferType- the normal-buffer type (Normal or BindPoseNormal)positionBufferType- the position-buffer type (Position or
-
subdivideLines
public static com.jme3.scene.Mesh subdivideLines(com.jme3.scene.Mesh in, int ratio) Subdivide the specified Lines-mode mesh by the specified ratio.- Parameters:
in- the input mesh (not null, mode=Lines, unaffected)ratio- the input edge lengths divided by result edge lengths (>1)- Returns:
- a new Mesh (mode=Lines, not indexed)
-
subdivideTriangles
public static com.jme3.scene.Mesh subdivideTriangles(com.jme3.scene.Mesh in, int ratio) Uniformly subdivide the specified Triangles-mode mesh by the specified ratio.- Parameters:
in- the input mesh (not null, mode=Triangles, unaffected)ratio- the input edge lengths divided by output edge lengths (>1)- Returns:
- a new Mesh (mode=Triangles, not indexed)
-
transformBuffer
public static void transformBuffer(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType, com.jme3.math.Transform transform) Apply the specified coordinate transform to all data in the specified VertexBuffer.- Parameters:
mesh- the subject mesh (not null)bufferType- which buffer to read (not null)transform- the Transform to apply (not null, unaffected)
-
translate
public static void translate(com.jme3.scene.Mesh mesh, com.jme3.math.Vector3f offset) Translate all vertices in the specified Mesh by the specified offset.- Parameters:
mesh- the Mesh to translate (not null, modified)offset- the amount to add to each position (not null, unaffected)
-
trianglesToLines
public static void trianglesToLines(com.jme3.scene.Mesh mesh) Convert mesh triangles to lines.- Parameters:
mesh- the Mesh to modify (not null, mode=Triangles/TriangleFan/TriangleStrip)
-
vertexBoneIndices
public static int[] vertexBoneIndices(com.jme3.scene.Mesh mesh, int vertexIndex, int[] storeResult) Copy the bone indices for the indexed vertex.- Parameters:
mesh- the subject mesh (not null)vertexIndex- index into the mesh's vertices (≥0)storeResult- storage for the result (modified if not null)- Returns:
- the data vector (either storeResult or a new instance)
-
vertexBoneWeights
public static float[] vertexBoneWeights(com.jme3.scene.Mesh mesh, int vertexIndex, float[] storeResult) Copy the bone weights for the indexed vertex.- Parameters:
mesh- the subject mesh (not null, unaffected)vertexIndex- index into the mesh's vertices (≥0)storeResult- storage for the result (modified if not null)- Returns:
- the data vector (either storeResult or a new instance)
-
vertexColor
public static com.jme3.math.ColorRGBA vertexColor(com.jme3.scene.Mesh mesh, int vertexIndex, com.jme3.math.ColorRGBA storeResult) Copy the color of the indexed vertex from the color buffer of the specified Mesh. The buffer must have 3 or 4 components per element.- Parameters:
mesh- the subject mesh (not null, unaffected)vertexIndex- index into the mesh's vertices (≥0)storeResult- storage for the result (modified if not null)- Returns:
- the color (either storeResult or a new instance)
-
vertexLocation
public static com.jme3.math.Vector3f vertexLocation(com.jme3.scene.Mesh mesh, int vertexIndex, com.jme3.math.Matrix4f[] skinningMatrices, com.jme3.math.Vector3f storeResult) Determine the location of the indexed vertex in mesh space using the skinning matrices provided.- Parameters:
mesh- the subject mesh (not null)vertexIndex- index into the mesh's vertices (≥0)skinningMatrices- (not null, unaffected)storeResult- storage for the result (modified if not null)- Returns:
- mesh coordinates (either storeResult or a new instance)
-
vertexNormal
public static com.jme3.math.Vector3f vertexNormal(com.jme3.scene.Mesh mesh, int vertexIndex, com.jme3.math.Matrix4f[] skinningMatrices, com.jme3.math.Vector3f storeResult) Determine the normal of the indexed vertex in mesh space using the skinning matrices provided.- Parameters:
mesh- the subject mesh (not null)vertexIndex- index into the mesh's vertices (≥0)skinningMatrices- (not null, unaffected)storeResult- storage for the result (modified if not null)- Returns:
- a unit vector in mesh space (either storeResult or a new instance)
-
vertexSize
public static float vertexSize(com.jme3.scene.Mesh mesh, int vertexIndex) Read the size of the indexed vertex from the size buffer.- Parameters:
mesh- the subject mesh (not null, unaffected)vertexIndex- index into the mesh's vertices (≥0)- Returns:
- the size (in pixels)
-
vertexTangent
public static com.jme3.math.Vector4f vertexTangent(com.jme3.scene.Mesh mesh, int vertexIndex, com.jme3.math.Matrix4f[] skinningMatrices, com.jme3.math.Vector4f storeResult) Determine the tangent of the indexed vertex in mesh space using the skinning matrices provided.- Parameters:
mesh- the subject mesh (not null)vertexIndex- index into the mesh's vertices (≥0)skinningMatrices- (not null, unaffected)storeResult- storage for the result (modified if not null)- Returns:
- the tangent vector (either storeResult or a new instance)
-
vertexVector2f
public static com.jme3.math.Vector2f vertexVector2f(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType, int vertexIndex, com.jme3.math.Vector2f storeResult) Copy texture coordinates of the indexed vertex from the specified vertex buffer.- Parameters:
mesh- the subject mesh (not null, unaffected)bufferType- which buffer to read (8 legal values)vertexIndex- index into the mesh's vertices (≥0)storeResult- storage for the result (modified if not null)- Returns:
- the texture coordinates (either storeResult or a new instance)
-
vertexVector3f
public static com.jme3.math.Vector3f vertexVector3f(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType, int vertexIndex, com.jme3.math.Vector3f storeResult) Copy Vector3f data for the indexed vertex from the specified VertexBuffer.A software skin update is required BEFORE reading positions/normals from an animated mesh.
- Parameters:
mesh- the subject mesh (not null, unaffected)bufferType- which buffer to read (5 legal values)vertexIndex- index into the mesh's vertices (≥0)storeResult- storage for the result (modified if not null)- Returns:
- the data vector (either storeResult or a new instance)
-
vertexVector4f
public static com.jme3.math.Vector4f vertexVector4f(com.jme3.scene.Mesh mesh, com.jme3.scene.VertexBuffer.Type bufferType, int vertexIndex, com.jme3.math.Vector4f storeResult) Copy Vector4f data for the indexed vertex from the specified vertex buffer.A software skin update is required BEFORE reading tangents from an animated mesh.
- Parameters:
mesh- the subject mesh (not null, unaffected)bufferType- which buffer to read (5 legal values)vertexIndex- index into the mesh's vertices (≥0)storeResult- storage for the result (modified if not null)- Returns:
- the data vector (either storeResult or a new instance)
-
vertexWorldLocation
public static com.jme3.math.Vector3f vertexWorldLocation(com.jme3.scene.Geometry geometry, int vertexIndex, com.jme3.math.Matrix4f[] skinningMatrices, com.jme3.math.Vector3f storeResult) Determine the location of the indexed vertex in world space using the skinning matrices provided.- Parameters:
geometry- Geometry containing the subject mesh (not null)vertexIndex- index into the geometry's vertices (≥0)skinningMatrices- (not null, unaffected)storeResult- storage for the result (modified if not null)- Returns:
- the location in world coordinates (either storeResult or a new instance)
-
generateFacetNormals(com.jme3.scene.Mesh)