JSFiddle - React, Tailwind, and code Playground
by Michael Prosser
JavaScript
var mesh = {
id: "MY MESH",
name: "MY MESH NAME",
position: { x: 0, y: 0, z: 0 },
rotation: { x: 0, y: 0, z: 0 },
scaling: { x: 1, y: 1, z: 1 },
dispose: function(){
console.log("REMOVED MESH");
}
}
function DaydreamMesh(mesh){
this.id = mesh.id;
this.name = mesh.name;
this.position = mesh.position;
this.rotation = mesh.rotation;
this.scaling = mesh.scaling;
this.mesh = mesh;
}
DaydreamMesh.prototype.move = function(newPosition){
this.position = newPosition;
}
DaydreamMesh.prototype.rotate = function(newRotation){
this.rotation = newRotation;
}
DaydreamMesh.prototype.scale = function(newScaling){
this.scaling = newScaling;
}
DaydreamMesh.prototype.dispose = function(){
this.mesh.dispose();
}
var item1 = new DaydreamMesh(mesh);
item1.move({ x:3, y: 3, z: -1 });
item1.scale({ x:2, y: 2, z: 2 });
item1.rotate({ x:0.4, y: 1.3, z: -1.8 });
console.log(item1);