JSFiddle - React, Tailwind, and code Playground
by MaxenceBrasselet
HTML
<script src="https://rawgithub.com/BabylonJS/Babylon.js/v1.8.5/babylon.1.8.5.js"></script>
<div id="rootDiv">
<canvas id="renderCanvas"></canvas>
</div>
CSS
html, body, div, canvas {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
overflow: hidden;
}
JavaScript
BABYLON.Mesh.prototype.computeWorldMatrix = function (force) {
if (this._currentRenderId == this._scene.getRenderId() || !force && this.isSynchronized()) {
this._childrenFlag = false;
return this._worldMatrix;
}
this._childrenFlag = true;
this._cache.infiniteDistance = this.infiniteDistance;
this._cache.position.copyFrom(this.position);
this._cache.scaling.copyFrom(this.scaling);
this._cache.pivotMatrixUpdated = false;
this._currentRenderId = this._scene.getRenderId();
// Scaling
BABYLON.Matrix.ScalingToRef(this.scaling.x, this.scaling.y, this.scaling.z, this._localScaling);
// Rotation
if (this.rotationQuaternion) {
this.rotationQuaternion.toRotationMatrix(this._localRotation);
this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion);
} else {
BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._localRotation);
this._cache.rotation.copyFrom(this.rotation);
}
// Translation
if (this.infiniteDistance) {
var camera = this._scene.activeCamera;
BABYLON.Matrix.TranslationToRef(this.position.x + camera.position.x, this.position.y + camera.position.y, this.position.z + camera.position.z, this._localTranslation);
} else {
BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._localTranslation);
}
// Composing transformations
this._pivotMatrix.multiplyToRef(this._localScaling, this._localPivotScaling);
this._localPivotScaling.multiplyToRef(this._localRotation, this._localPivotScalingRotation);
// Billboarding
if (this.billboardMode !== BABYLON.Mesh.BILLBOARDMODE_NONE) {
var localPosition = this.position.clone();
var zero = this._scene.activeCamera.position.clone();
...