r3-legacy/src/r3-plane.js

51 lines
890 B
JavaScript

/**
* R3.Plane
* @param apiComponent
* @constructor
*/
R3.Plane = function(
apiComponent
) {
__RUNTIME_COMPONENT__;
__UPGRADE_TO_RUNTIME__;
};
R3.Plane.prototype = Object.create(R3.Component.prototype);
R3.Plane.prototype.constructor = R3.Plane;
R3.Plane.prototype.createInstance = function() {
this.instance = this.graphics.Plane(
this.normal,
this.constant
);
__CREATE_INSTANCE__;
};
/**
* Updates the instance with the current state
*/
R3.Plane.prototype.updateInstance = function(property) {
if (property === 'normal') {
this.normal.normalize();
this.instance.normal.x = this.normal.x;
this.instance.normal.y = this.normal.y;
this.instance.normal.z = this.normal.z;
}
if (property === 'constant') {
this.instance.constant = this.constant;
}
__UPDATE_INSTANCE__;
};