mirror of
https://github.com/MapMakersAndProgrammers/Alternativa3D.git
synced 2025-10-26 01:49:07 -07:00
Fix box primitive tangents and binormals, createBinormals()
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user