@ -21,15 +21,12 @@ public class MikkTSpaceImpl implements MikkTSpaceContext {
public MikkTSpaceImpl ( Mesh mesh ) {
public MikkTSpaceImpl ( Mesh mesh ) {
this . mesh = mesh ;
this . mesh = mesh ;
VertexBuffer tangentBuffer = mesh . getBuffer ( VertexBuffer . Type . Tangent ) ;
//replacing any existing tangent buffer, if you came here you want them new.
if ( tangentBuffer = = null ) {
mesh . clearBuffer ( VertexBuffer . Type . Tangent ) ;
FloatBuffer fb = BufferUtils . createFloatBuffer ( mesh . getVertexCount ( ) * 4 ) ;
FloatBuffer fb = BufferUtils . createFloatBuffer ( mesh . getVertexCount ( ) * 4 ) ;
mesh . setBuffer ( VertexBuffer . Type . Tangent , 4 , fb ) ;
mesh . setBuffer ( VertexBuffer . Type . Tangent , 4 , fb ) ;
}
}
//TODO ensure the Tangent buffer exists, else create one.
}
@Override
@Override
public int getNumFaces ( ) {
public int getNumFaces ( ) {
return mesh . getTriangleCount ( ) ;
return mesh . getTriangleCount ( ) ;