|
@@ -326,6 +326,9 @@
|
|
|
* @returns the VertexData
|
|
|
*/
|
|
|
public transform(matrix: Matrix): VertexData {
|
|
|
+ var scaling = Vector3.One();
|
|
|
+ matrix.decompose(scaling, BABYLON.Tmp.Quaternion[0], BABYLON.Tmp.Vector3[0]);
|
|
|
+ var flip = scaling.x * scaling.y * scaling.z < 0;
|
|
|
var transformed = Vector3.Zero();
|
|
|
var index: number;
|
|
|
if (this.positions) {
|
|
@@ -369,6 +372,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;
|
|
|
}
|
|
|
|