Fix box primitive tangents and binormals, createBinormals()

This commit is contained in:
artem pecheny
2012-07-12 21:16:14 +06:00
parent 39d8877651
commit 9ab6c475e1
2 changed files with 7 additions and 7 deletions

View File

@@ -376,7 +376,7 @@ package alternativa.engine3d.objects {
binormal.normalize();
resultGeometry.addLine(
vertices[index], vertices[int(index + 1)], vertices[int(index + 2)],
vertices[index] + binormal.z*length, vertices[int(index + 1)] + binormal.z*length, vertices[int(index + 2)] + binormal.z*length);
vertices[index] + binormal.x*length, vertices[int(index + 1)] + binormal.y*length, vertices[int(index + 2)] + binormal.z*length);
}
result.calculateBoundBox();
result._x = mesh._x;

View File

@@ -74,7 +74,7 @@ package alternativa.engine3d.primitives {
for (x = 0; x < wp; x++) {
for (y = 0; y < lp; y++) {
if (x < widthSegments && y < lengthSegments) {
createFace(indices, vertices, (x + 1)*lp + y + 1, (x + 1)*lp + y, x*lp + y, x*lp + y + 1, 0, 0, -1, halfHeight, 0,-1,0,0, reverse);
createFace(indices, vertices, (x + 1)*lp + y + 1, (x + 1)*lp + y, x*lp + y, x*lp + y + 1, 0, 0, -1, halfHeight, -1,0,0,-1, reverse);
}
}
}
@@ -95,7 +95,7 @@ package alternativa.engine3d.primitives {
for (x = 0; x < wp; x++) {
for (y = 0; y < lp; y++) {
if (x < widthSegments && y < lengthSegments) {
createFace(indices, vertices, o + x*lp + y, o + (x + 1)*lp + y, o + (x + 1)*lp + y + 1, o + x*lp + y + 1, 0, 0, 1, halfHeight,0,-1,0,0, reverse);
createFace(indices, vertices, o + x*lp + y, o + (x + 1)*lp + y, o + (x + 1)*lp + y + 1, o + x*lp + y + 1, 0, 0, 1, halfHeight,1,0,0,-1, reverse);
}
}
}
@@ -117,7 +117,7 @@ package alternativa.engine3d.primitives {
for (x = 0; x < wp; x++) {
for (z = 0; z < hp; z++) {
if (x < widthSegments && z < heightSegments) {
createFace(indices, vertices, o + x*hp + z, o + (x + 1)*hp + z, o + (x + 1)*hp + z + 1, o + x*hp + z + 1, 0, -1, 0, halfLength,0,0,-1,0, reverse);
createFace(indices, vertices, o + x*hp + z, o + (x + 1)*hp + z, o + (x + 1)*hp + z + 1, o + x*hp + z + 1, 0, -1, 0, halfLength,1,0,0,-1, reverse);
}
}
}
@@ -138,7 +138,7 @@ package alternativa.engine3d.primitives {
for (x = 0; x < wp; x++) {
for (z = 0; z < hp; z++) {
if (x < widthSegments && z < heightSegments) {
createFace(indices, vertices, o + x*hp + z, o + x*hp + z + 1, o + (x + 1)*hp + z + 1, o + (x + 1)*hp + z, 0, 1, 0, halfLength,0,0,-1,0, reverse);
createFace(indices, vertices, o + x*hp + z, o + x*hp + z + 1, o + (x + 1)*hp + z + 1, o + (x + 1)*hp + z, 0, 1, 0, halfLength,-1,0,0,-1, reverse);
}
}
}
@@ -159,7 +159,7 @@ package alternativa.engine3d.primitives {
for (y = 0; y < lp; y++) {
for (z = 0; z < hp; z++) {
if (y < lengthSegments && z < heightSegments) {
createFace(indices, vertices, o + y*hp + z, o + y*hp + z + 1, o + (y + 1)*hp + z + 1, o + (y + 1)*hp + z, -1, 0, 0, halfWidth, 0,0,-1,0,reverse);
createFace(indices, vertices, o + y*hp + z, o + y*hp + z + 1, o + (y + 1)*hp + z + 1, o + (y + 1)*hp + z, -1, 0, 0, halfWidth, 0,-1,0,-1,reverse);
}
}
}
@@ -179,7 +179,7 @@ package alternativa.engine3d.primitives {
for (y = 0; y < lp; y++) {
for (z = 0; z < hp; z++) {
if (y < lengthSegments && z < heightSegments) {
createFace(indices, vertices, o + y*hp + z, o + (y + 1)*hp + z, o + (y + 1)*hp + z + 1, o + y*hp + z + 1, 1, 0, 0, halfWidth,0,0,-1,0, reverse);
createFace(indices, vertices, o + y*hp + z, o + (y + 1)*hp + z, o + (y + 1)*hp + z + 1, o + y*hp + z + 1, 1, 0, 0, halfWidth,0,1,0,-1, reverse);
}
}
}