r3-legacy/src/r3-plane.js

51 lines
890 B
JavaScript
Raw Normal View History

2018-04-09 09:35:04 +02:00
/**
2019-10-06 21:11:18 +02:00
* R3.Plane
* @param apiComponent
2018-04-09 09:35:04 +02:00
* @constructor
*/
R3.Plane = function(
2019-10-06 21:11:18 +02:00
apiComponent
2018-04-09 09:35:04 +02:00
) {
2019-10-06 21:11:18 +02:00
__RUNTIME_COMPONENT__;
2018-04-09 09:35:04 +02:00
2019-10-06 21:11:18 +02:00
__UPGRADE_TO_RUNTIME__;
2018-04-09 09:35:04 +02:00
};
R3.Plane.prototype = Object.create(R3.Component.prototype);
R3.Plane.prototype.constructor = R3.Plane;
R3.Plane.prototype.createInstance = function() {
2019-10-06 21:11:18 +02:00
this.instance = this.graphics.Plane(
this.normal,
2018-04-09 09:35:04 +02:00
this.constant
);
2019-10-06 21:11:18 +02:00
__CREATE_INSTANCE__;
2018-04-09 09:35:04 +02:00
};
/**
* 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;
}
2019-10-06 21:11:18 +02:00
__UPDATE_INSTANCE__;
2018-04-09 09:35:04 +02:00
};