public class MikkTSpaceImpl extends java.lang.Object implements MikkTSpaceContext
Constructor and Description |
---|
MikkTSpaceImpl(Mesh mesh) |
Modifier and Type | Method and Description |
---|---|
void |
getNormal(float[] normOut,
int face,
int vert) |
int |
getNumFaces()
Returns the number of faces (triangles/quads) on the mesh to be
processed.
|
int |
getNumVerticesOfFace(int face)
Returns the number of vertices on face number iFace iFace is a number in
the range {0, 1, ..., getNumFaces()-1}
|
void |
getPosition(float[] posOut,
int face,
int vert)
returns the position/normal/texcoord of the referenced face of vertex
number iVert.
|
void |
getTexCoord(float[] texOut,
int face,
int vert) |
void |
setTSpace(float[] tangent,
float[] biTangent,
float magS,
float magT,
boolean isOrientationPreserving,
int face,
int vert)
This function is used to return tangent space results to the application.
|
void |
setTSpaceBasic(float[] tangent,
float sign,
int face,
int vert)
The callback setTSpaceBasic() is sufficient for basic normal mapping.
|
public MikkTSpaceImpl(Mesh mesh)
public int getNumFaces()
MikkTSpaceContext
getNumFaces
in interface MikkTSpaceContext
public int getNumVerticesOfFace(int face)
MikkTSpaceContext
getNumVerticesOfFace
in interface MikkTSpaceContext
face
- which face (≥0, <numFaces)public void getPosition(float[] posOut, int face, int vert)
MikkTSpaceContext
getPosition
in interface MikkTSpaceContext
posOut
- storage for the results (modified)face
- which face (≥0, <numFaces)vert
- which vertex in the face (≥0, <numVertices)public void getNormal(float[] normOut, int face, int vert)
getNormal
in interface MikkTSpaceContext
public void getTexCoord(float[] texOut, int face, int vert)
getTexCoord
in interface MikkTSpaceContext
public void setTSpaceBasic(float[] tangent, float sign, int face, int vert)
MikkTSpaceContext
setTSpaceBasic
in interface MikkTSpaceContext
tangent
- the desired tangent vector (unaffected)sign
- the desired signface
- which face (≥0, <numFaces)vert
- which vertex in the face (≥0, <numVertices)public void setTSpace(float[] tangent, float[] biTangent, float magS, float magT, boolean isOrientationPreserving, int face, int vert)
MikkTSpaceContext
fSign = bIsOrientationPreserving ? 1.0f : (-1.0f); bitangent = fSign * cross(vN, tangent);Note that the results are returned unindexed. It is possible to generate a new index list. But averaging/overwriting tangent spaces by using an already existing index list WILL produce INCORRECT results. DO NOT! use an already existing index list.
setTSpace
in interface MikkTSpaceContext
tangent
- the desired tangent vector (unaffected)biTangent
- the desired bitangent vector (unaffected)magS
- true magnitude of SmagT
- true magnitude of TisOrientationPreserving
- true→preserves, false→doesn't
preserveface
- which face (≥0, <numFaces)vert
- which vertex in the face (≥0, <numVertices)