Package jme3utilities
Class Element
java.lang.Object
jme3utilities.Element
Utility methods that operate on individual elements of vertex buffers.
Outside of index buffers, each element represents a single mesh vertex.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopy(com.jme3.scene.VertexBuffer source, int sourceIndex, com.jme3.scene.VertexBuffer target, int targetIndex) Copy all data from one vertex-buffer element to another.static booleanequals(com.jme3.scene.VertexBuffer vertexBuffer, int index1, int index2) Compare all data between 2 elements of a VertexBuffer.static voidlerp(float t, com.jme3.scene.VertexBuffer source, int sourceIndex0, int sourceIndex1, com.jme3.scene.VertexBuffer target, int targetIndex) Linearly interpolate all data between 2 vertex-buffer elements and store the result in a 3rd vertex-buffer element.static voidlerp3(float t1, float t2, com.jme3.scene.VertexBuffer source, int sourceIndex0, int sourceIndex1, int sourceIndex2, com.jme3.scene.VertexBuffer target, int targetIndex) Linearly interpolate all data between 3 vertex-buffer elements and store the result in a 4th vertex-buffer element.static voidswap(com.jme3.scene.VertexBuffer vertexBuffer, int index1, int index2) Swap all data between 2 elements of a VertexBuffer.
-
Method Details
-
copy
public static void copy(com.jme3.scene.VertexBuffer source, int sourceIndex, com.jme3.scene.VertexBuffer target, int targetIndex) Copy all data from one vertex-buffer element to another. The vertex buffers must have the same type, format, and number of components per element.- Parameters:
source- the VertexBuffer containing the source element (not null, unaffected)sourceIndex- the index of the source element (≥0)target- the VertexBuffer containing the target element (not null, modified)targetIndex- the index of the target element (≥0)
-
equals
public static boolean equals(com.jme3.scene.VertexBuffer vertexBuffer, int index1, int index2) Compare all data between 2 elements of a VertexBuffer.- Parameters:
vertexBuffer- (not null, unaffected)index1- the index of the first element (≥0)index2- the index of the 2nd element (≥0)- Returns:
- true if all data are equal, otherwise false
-
lerp
public static void lerp(float t, com.jme3.scene.VertexBuffer source, int sourceIndex0, int sourceIndex1, com.jme3.scene.VertexBuffer target, int targetIndex) Linearly interpolate all data between 2 vertex-buffer elements and store the result in a 3rd vertex-buffer element. The vertex buffers must have the same type and number of components per element.- Parameters:
t- the weight given to thesourceIndex1elementsource- the VertexBuffer containing the source elements (not null, unaffected)sourceIndex0- the index of the source element for t=0 (≥0)sourceIndex1- the index of the source element for t=1 (≥0)target- the VertexBuffer containing the target element (not null, Float format, modified)targetIndex- the index of the target element (≥0)
-
lerp3
public static void lerp3(float t1, float t2, com.jme3.scene.VertexBuffer source, int sourceIndex0, int sourceIndex1, int sourceIndex2, com.jme3.scene.VertexBuffer target, int targetIndex) Linearly interpolate all data between 3 vertex-buffer elements and store the result in a 4th vertex-buffer element. The vertex buffers must have the same type and number of components per element.- Parameters:
t1- the weight given to thesourceIndex1elementt2- the weight given to thesourceIndex2elementsource- the VertexBuffer containing the source elements (not null, unaffected)sourceIndex0- the index of the source element for t1=0, t2=0 (≥0)sourceIndex1- the index of the source element for t1=1, t2=0 (≥0)sourceIndex2- the index of the source element for t1=0, t2=1 (≥0)target- the VertexBuffer containing the target element (not null, Float format, modified)targetIndex- the index of the target element (≥0)
-
swap
public static void swap(com.jme3.scene.VertexBuffer vertexBuffer, int index1, int index2) Swap all data between 2 elements of a VertexBuffer.- Parameters:
vertexBuffer- the VertexBuffer to modify (not null)index1- the index of the first element (≥0)index2- the index of the 2nd element (≥0)
-