Added rotation methods and setters

This commit is contained in:
Richard Davey 2023-01-25 23:30:58 +00:00
parent 57c41cba72
commit de2e7847df

View file

@ -5,9 +5,11 @@
*/
var Class = require('../../utils/Class');
var DegToRad = require('../../math/DegToRad');
var GenerateGridVerts = require('../../geom/mesh/GenerateGridVerts');
var IntegerToRGB = require('../../display/color/IntegerToRGB');
var Mesh = require('../mesh/Mesh');
var RadToDeg = require('../../math/RadToDeg');
var UUID = require('../../utils/string/UUID');
/**
@ -185,6 +187,69 @@ var Plane = new Class({
}
},
addRotateX: function (value)
{
this.rotateX += value;
return this;
},
addRotateY: function (value)
{
this.rotateY += value;
return this;
},
addRotateZ: function (value)
{
this.rotateZ += value;
return this;
},
rotateX: {
get: function ()
{
return RadToDeg(this.modelRotation.x);
},
set: function (value)
{
this.modelRotation.x = DegToRad(value);
}
},
rotateY: {
get: function ()
{
return RadToDeg(this.modelRotation.y);
},
set: function (value)
{
this.modelRotation.y = DegToRad(value);
}
},
rotateZ: {
get: function ()
{
return RadToDeg(this.modelRotation.z);
},
set: function (value)
{
this.modelRotation.z = DegToRad(value);
}
},
/**
* Handles the pre-destroy step for the Plane, which removes the vertices and debug callbacks.
*