- TangentBinormalGenerator : not joining the similar vertices for computing tangents when not splitting mirrored vertices seems to yeild worse artifacts than before.
I reintroduced the joining. That produces wrong lighting anyway, but at least it's consistent with what we had before. after 3.0, I'll default the split mirrored vertice behaviour. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10700 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
e373d160d9
commit
cb90159e81
@ -179,7 +179,7 @@ public class TangentBinormalGenerator {
|
||||
mesh.getMode() + " is not supported.");
|
||||
}
|
||||
|
||||
processTriangleData(mesh, vertices, approxTangents);
|
||||
processTriangleData(mesh, vertices, approxTangents,splitMirrored);
|
||||
|
||||
//if the mesh has a bind pose, we need to generate the bind pose for the tangent buffer
|
||||
if (mesh.getBuffer(Type.BindPosePosition) != null) {
|
||||
@ -597,7 +597,7 @@ public class TangentBinormalGenerator {
|
||||
(FastMath.abs(u.y - v.y) < tolerance);
|
||||
}
|
||||
|
||||
private static ArrayList<VertexInfo> linkVertices(Mesh mesh) {
|
||||
private static ArrayList<VertexInfo> linkVertices(Mesh mesh, boolean splitMirrored) {
|
||||
ArrayList<VertexInfo> vertexMap = new ArrayList<VertexInfo>();
|
||||
|
||||
FloatBuffer vertexBuffer = mesh.getFloatBuffer(Type.Position);
|
||||
@ -619,18 +619,19 @@ public class TangentBinormalGenerator {
|
||||
//Nehon 07/07/2013
|
||||
//Removed this part, joining splitted vertice to compute tangent space makes no sense to me
|
||||
//separate vertice should have separate tangent space
|
||||
// for (int j = 0; j < vertexMap.size(); j++) {
|
||||
// VertexInfo vertexInfo = vertexMap.get(j);
|
||||
// if (approxEqual(vertexInfo.position, position) &&
|
||||
// approxEqual(vertexInfo.normal, normal) &&
|
||||
// approxEqual(vertexInfo.texCoord, texCoord))
|
||||
// {
|
||||
// vertexInfo.indices.add(i);
|
||||
// found = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(!splitMirrored){
|
||||
for (int j = 0; j < vertexMap.size(); j++) {
|
||||
VertexInfo vertexInfo = vertexMap.get(j);
|
||||
if (approxEqual(vertexInfo.position, position) &&
|
||||
approxEqual(vertexInfo.normal, normal) &&
|
||||
approxEqual(vertexInfo.texCoord, texCoord))
|
||||
{
|
||||
vertexInfo.indices.add(i);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
VertexInfo vertexInfo = new VertexInfo(position.clone(), normal.clone(), texCoord.clone());
|
||||
vertexInfo.indices.add(i);
|
||||
@ -642,8 +643,8 @@ public class TangentBinormalGenerator {
|
||||
}
|
||||
|
||||
private static void processTriangleData(Mesh mesh, List<VertexData> vertices,
|
||||
boolean approxTangent) {
|
||||
ArrayList<VertexInfo> vertexMap = linkVertices(mesh);
|
||||
boolean approxTangent, boolean splitMirrored) {
|
||||
ArrayList<VertexInfo> vertexMap = linkVertices(mesh,splitMirrored);
|
||||
|
||||
FloatBuffer tangents = BufferUtils.createFloatBuffer(vertices.size() * 4);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user