|
@@ -11132,7 +11132,12 @@ var BABYLON;
|
|
|
effect.setFloat4(positionUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0);
|
|
|
return;
|
|
|
}
|
|
|
- effect.setFloat4(positionUniformName, this.position.x, this.position.y, this.position.z, 0);
|
|
|
+ if (this.getScene().useRightHandedSystem) {
|
|
|
+ effect.setFloat4(positionUniformName, -this.position.x, -this.position.y, -this.position.z, 0);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ effect.setFloat4(positionUniformName, this.position.x, this.position.y, this.position.z, 0);
|
|
|
+ }
|
|
|
};
|
|
|
PointLight.prototype.needCube = function () {
|
|
|
return true;
|
|
@@ -11240,14 +11245,29 @@ var BABYLON;
|
|
|
}
|
|
|
this.computeTransformedPosition();
|
|
|
BABYLON.Vector3.TransformNormalToRef(this.direction, this.parent.getWorldMatrix(), this._transformedDirection);
|
|
|
- effect.setFloat4(positionUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, this.exponent);
|
|
|
+ if (this.getScene().useRightHandedSystem) {
|
|
|
+ effect.setFloat4(positionUniformName, -this.transformedPosition.x, -this.transformedPosition.y, -this.transformedPosition.z, this.exponent);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ effect.setFloat4(positionUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, this.exponent);
|
|
|
+ }
|
|
|
normalizeDirection = BABYLON.Vector3.Normalize(this._transformedDirection);
|
|
|
}
|
|
|
else {
|
|
|
- effect.setFloat4(positionUniformName, this.position.x, this.position.y, this.position.z, this.exponent);
|
|
|
+ if (this.getScene().useRightHandedSystem) {
|
|
|
+ effect.setFloat4(positionUniformName, -this.position.x, -this.position.y, -this.position.z, this.exponent);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ effect.setFloat4(positionUniformName, this.position.x, this.position.y, this.position.z, this.exponent);
|
|
|
+ }
|
|
|
normalizeDirection = BABYLON.Vector3.Normalize(this.direction);
|
|
|
}
|
|
|
- effect.setFloat4(directionUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, Math.cos(this.angle * 0.5));
|
|
|
+ if (this.getScene().useRightHandedSystem) {
|
|
|
+ effect.setFloat4(directionUniformName, -normalizeDirection.x, -normalizeDirection.y, -normalizeDirection.z, Math.cos(this.angle * 0.5));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ effect.setFloat4(directionUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, Math.cos(this.angle * 0.5));
|
|
|
+ }
|
|
|
};
|
|
|
SpotLight.prototype._getWorldMatrix = function () {
|
|
|
if (!this._worldMatrix) {
|
|
@@ -11300,7 +11320,12 @@ var BABYLON;
|
|
|
};
|
|
|
HemisphericLight.prototype.transferToEffect = function (effect, directionUniformName, groundColorUniformName) {
|
|
|
var normalizeDirection = BABYLON.Vector3.Normalize(this.direction);
|
|
|
- effect.setFloat4(directionUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, 0);
|
|
|
+ if (this.getScene().useRightHandedSystem) {
|
|
|
+ effect.setFloat4(directionUniformName, -normalizeDirection.x, -normalizeDirection.y, -normalizeDirection.z, 0);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ effect.setFloat4(directionUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, 0);
|
|
|
+ }
|
|
|
effect.setColor3(groundColorUniformName, this.groundColor.scale(this.intensity));
|
|
|
};
|
|
|
HemisphericLight.prototype._getWorldMatrix = function () {
|
|
@@ -11419,7 +11444,12 @@ var BABYLON;
|
|
|
effect.setFloat4(directionUniformName, this._transformedDirection.x, this._transformedDirection.y, this._transformedDirection.z, 1);
|
|
|
return;
|
|
|
}
|
|
|
- effect.setFloat4(directionUniformName, this.direction.x, this.direction.y, this.direction.z, 1);
|
|
|
+ if (this.getScene().useRightHandedSystem) {
|
|
|
+ effect.setFloat4(directionUniformName, this.direction.x, this.direction.y, this.direction.z, -1);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ effect.setFloat4(directionUniformName, this.direction.x, this.direction.y, this.direction.z, 1);
|
|
|
+ }
|
|
|
};
|
|
|
DirectionalLight.prototype._getWorldMatrix = function () {
|
|
|
if (!this._worldMatrix) {
|
|
@@ -13304,7 +13334,12 @@ var BABYLON;
|
|
|
offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;
|
|
|
offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;
|
|
|
}
|
|
|
- camera.cameraRotation.y += offsetX / _this.angularSensibility;
|
|
|
+ if (_this.camera.getScene().useRightHandedSystem) {
|
|
|
+ camera.cameraRotation.y -= offsetX / _this.angularSensibility;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ camera.cameraRotation.y += offsetX / _this.angularSensibility;
|
|
|
+ }
|
|
|
camera.cameraRotation.x += offsetY / _this.angularSensibility;
|
|
|
_this.previousPosition = {
|
|
|
x: evt.clientX,
|
|
@@ -13421,6 +13456,9 @@ var BABYLON;
|
|
|
else if (this.keysDown.indexOf(keyCode) !== -1) {
|
|
|
camera._localDirection.copyFromFloats(0, 0, -speed);
|
|
|
}
|
|
|
+ if (camera.getScene().useRightHandedSystem) {
|
|
|
+ camera._localDirection.z *= -1;
|
|
|
+ }
|
|
|
camera.getViewMatrix().invertToRef(camera._cameraTransformMatrix);
|
|
|
BABYLON.Vector3.TransformNormalToRef(camera._localDirection, camera._cameraTransformMatrix, camera._transformedDirection);
|
|
|
camera.cameraDirection.addInPlace(camera._transformedDirection);
|
|
@@ -15135,8 +15173,13 @@ var BABYLON;
|
|
|
this.inputs.checkInputs();
|
|
|
// Inertia
|
|
|
if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) {
|
|
|
- this.alpha += this.beta <= 0 ? -this.inertialAlphaOffset : this.inertialAlphaOffset;
|
|
|
this.beta += this.inertialBetaOffset;
|
|
|
+ if (this.getScene().useRightHandedSystem) {
|
|
|
+ this.alpha -= this.beta <= 0 ? -this.inertialAlphaOffset : this.inertialAlphaOffset;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.alpha += this.beta <= 0 ? -this.inertialAlphaOffset : this.inertialAlphaOffset;
|
|
|
+ }
|
|
|
this.radius -= this.inertialRadiusOffset;
|
|
|
this.inertialAlphaOffset *= this.inertia;
|
|
|
this.inertialBetaOffset *= this.inertia;
|
|
@@ -21346,6 +21389,30 @@ var BABYLON;
|
|
|
var MeshBuilder = (function () {
|
|
|
function MeshBuilder() {
|
|
|
}
|
|
|
+ MeshBuilder.updateSideOrientationForRightHandedSystem = function (orientation, scene) {
|
|
|
+ if (!scene.useRightHandedSystem) {
|
|
|
+ if (orientation === undefined || orientation === null) {
|
|
|
+ return BABYLON.Mesh.FRONTSIDE;
|
|
|
+ }
|
|
|
+ switch (orientation) {
|
|
|
+ case BABYLON.Mesh.FRONTSIDE:
|
|
|
+ case BABYLON.Mesh.DEFAULTSIDE:
|
|
|
+ return BABYLON.Mesh.FRONTSIDE;
|
|
|
+ default:
|
|
|
+ return BABYLON.Mesh.BACKSIDE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (orientation === undefined || orientation === null) {
|
|
|
+ return BABYLON.Mesh.BACKSIDE;
|
|
|
+ }
|
|
|
+ switch (orientation) {
|
|
|
+ case BABYLON.Mesh.FRONTSIDE:
|
|
|
+ case BABYLON.Mesh.DEFAULTSIDE:
|
|
|
+ return BABYLON.Mesh.BACKSIDE;
|
|
|
+ default:
|
|
|
+ return BABYLON.Mesh.FRONTSIDE;
|
|
|
+ }
|
|
|
+ };
|
|
|
/**
|
|
|
* Creates a box mesh.
|
|
|
* tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#box
|
|
@@ -21359,6 +21426,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreateBox = function (name, options, scene) {
|
|
|
var box = new BABYLON.Mesh(name, scene);
|
|
|
+ options.sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var vertexData = BABYLON.VertexData.CreateBox(options);
|
|
|
vertexData.applyToMesh(box, options.updatable);
|
|
|
return box;
|
|
@@ -21377,6 +21445,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreateSphere = function (name, options, scene) {
|
|
|
var sphere = new BABYLON.Mesh(name, scene);
|
|
|
+ options.sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var vertexData = BABYLON.VertexData.CreateSphere(options);
|
|
|
vertexData.applyToMesh(sphere, options.updatable);
|
|
|
return sphere;
|
|
@@ -21393,6 +21462,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreateDisc = function (name, options, scene) {
|
|
|
var disc = new BABYLON.Mesh(name, scene);
|
|
|
+ options.sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var vertexData = BABYLON.VertexData.CreateDisc(options);
|
|
|
vertexData.applyToMesh(disc, options.updatable);
|
|
|
return disc;
|
|
@@ -21410,6 +21480,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreateIcoSphere = function (name, options, scene) {
|
|
|
var sphere = new BABYLON.Mesh(name, scene);
|
|
|
+ options.sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var vertexData = BABYLON.VertexData.CreateIcoSphere(options);
|
|
|
vertexData.applyToMesh(sphere, options.updatable);
|
|
|
return sphere;
|
|
@@ -21436,7 +21507,7 @@ var BABYLON;
|
|
|
var closeArray = options.closeArray;
|
|
|
var closePath = options.closePath;
|
|
|
var offset = options.offset;
|
|
|
- var sideOrientation = options.sideOrientation;
|
|
|
+ var sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var instance = options.instance;
|
|
|
var updatable = options.updatable;
|
|
|
if (instance) {
|
|
@@ -21558,6 +21629,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreateCylinder = function (name, options, scene) {
|
|
|
var cylinder = new BABYLON.Mesh(name, scene);
|
|
|
+ options.sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var vertexData = BABYLON.VertexData.CreateCylinder(options);
|
|
|
vertexData.applyToMesh(cylinder, options.updatable);
|
|
|
return cylinder;
|
|
@@ -21574,6 +21646,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreateTorus = function (name, options, scene) {
|
|
|
var torus = new BABYLON.Mesh(name, scene);
|
|
|
+ options.sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var vertexData = BABYLON.VertexData.CreateTorus(options);
|
|
|
vertexData.applyToMesh(torus, options.updatable);
|
|
|
return torus;
|
|
@@ -21591,6 +21664,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreateTorusKnot = function (name, options, scene) {
|
|
|
var torusKnot = new BABYLON.Mesh(name, scene);
|
|
|
+ options.sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var vertexData = BABYLON.VertexData.CreateTorusKnot(options);
|
|
|
vertexData.applyToMesh(torusKnot, options.updatable);
|
|
|
return torusKnot;
|
|
@@ -21744,7 +21818,7 @@ var BABYLON;
|
|
|
var rotation = options.rotation || 0;
|
|
|
var cap = (options.cap === 0) ? 0 : options.cap || BABYLON.Mesh.NO_CAP;
|
|
|
var updatable = options.updatable;
|
|
|
- var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || BABYLON.Mesh.DEFAULTSIDE;
|
|
|
+ var sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var instance = options.instance;
|
|
|
var invertUV = options.invertUV || false;
|
|
|
return MeshBuilder._ExtrudeShapeGeneric(name, shape, path, scale, rotation, null, null, false, false, cap, false, scene, updatable, sideOrientation, instance, invertUV);
|
|
@@ -21793,7 +21867,7 @@ var BABYLON;
|
|
|
var ribbonClosePath = options.ribbonClosePath || false;
|
|
|
var cap = (options.cap === 0) ? 0 : options.cap || BABYLON.Mesh.NO_CAP;
|
|
|
var updatable = options.updatable;
|
|
|
- var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || BABYLON.Mesh.DEFAULTSIDE;
|
|
|
+ var sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var instance = options.instance;
|
|
|
var invertUV = options.invertUV || false;
|
|
|
return MeshBuilder._ExtrudeShapeGeneric(name, shape, path, null, null, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, true, scene, updatable, sideOrientation, instance, invertUV);
|
|
@@ -21822,7 +21896,7 @@ var BABYLON;
|
|
|
var radius = options.radius || 1;
|
|
|
var tessellation = options.tessellation || 64;
|
|
|
var updatable = options.updatable;
|
|
|
- var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || BABYLON.Mesh.DEFAULTSIDE;
|
|
|
+ var sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var cap = options.cap || BABYLON.Mesh.NO_CAP;
|
|
|
var pi2 = Math.PI * 2;
|
|
|
var paths = new Array();
|
|
@@ -21865,6 +21939,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreatePlane = function (name, options, scene) {
|
|
|
var plane = new BABYLON.Mesh(name, scene);
|
|
|
+ options.sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var vertexData = BABYLON.VertexData.CreatePlane(options);
|
|
|
vertexData.applyToMesh(plane, options.updatable);
|
|
|
if (options.sourcePlane) {
|
|
@@ -22010,7 +22085,7 @@ var BABYLON;
|
|
|
var cap = options.cap || BABYLON.Mesh.NO_CAP;
|
|
|
var invertUV = options.invertUV || false;
|
|
|
var updatable = options.updatable;
|
|
|
- var sideOrientation = options.sideOrientation || BABYLON.Mesh.DEFAULTSIDE;
|
|
|
+ var sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var instance = options.instance;
|
|
|
options.arc = (options.arc <= 0.0 || options.arc > 1.0) ? 1.0 : options.arc || 1.0;
|
|
|
// tube geometry
|
|
@@ -22116,6 +22191,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreatePolyhedron = function (name, options, scene) {
|
|
|
var polyhedron = new BABYLON.Mesh(name, scene);
|
|
|
+ options.sideOrientation = this.updateSideOrientationForRightHandedSystem(options.sideOrientation, scene);
|
|
|
var vertexData = BABYLON.VertexData.CreatePolyhedron(options);
|
|
|
vertexData.applyToMesh(polyhedron, options.updatable);
|
|
|
return polyhedron;
|