|
@@ -326,6 +326,7 @@
|
|
|
* @returns the VertexData
|
|
|
*/
|
|
|
public transform(matrix: Matrix): VertexData {
|
|
|
+ var flip = matrix.m[0] * matrix.m[5] * matrix.m[10] < 0;
|
|
|
var transformed = Vector3.Zero();
|
|
|
var index: number;
|
|
|
if (this.positions) {
|
|
@@ -369,6 +370,14 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (flip && this.indices) {
|
|
|
+ for (index = 0; index < this.indices!.length; index += 3) {
|
|
|
+ let tmp = this.indices[index + 1];
|
|
|
+ this.indices[index + 1] = this.indices[index + 2];
|
|
|
+ this.indices[index + 2] = tmp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return this;
|
|
|
}
|
|
|
|