r3-legacy/src/game-lib-d3-graphics.js

37 lines
872 B
JavaScript
Raw Normal View History

2016-10-25 17:57:32 +02:00
/**
* Graphics Superset
* @param graphicsType
* @param instance {THREE}
* @constructor
*/
2016-11-21 16:08:39 +01:00
GameLib.D3.Graphics = function Graphics(
2016-10-25 17:57:32 +02:00
graphicsType,
instance
) {
this.graphicsType = graphicsType;
this.instance = instance;
};
/**
* True if THREE physics
* @returns {boolean}
*/
GameLib.D3.Graphics.prototype.isThree = function() {
return (this.graphicsType == GameLib.D3.Graphics.GRAPHICS_TYPE_THREE)
};
/**
* Logs a warning and throws an error if not cannon
*/
GameLib.D3.Graphics.prototype.isNotThreeThrow = function() {
if (this.graphicsType != GameLib.D3.Graphics.GRAPHICS_TYPE_THREE) {
console.warn('Only THREE supported for this function');
throw new Error('Only THREE supported for this function');
}
};
/**
* Physics GameLib.D3.Graphics Types
* @type {number}
*/
GameLib.D3.Graphics.GRAPHICS_TYPE_THREE = 0x1;