37 lines
872 B
JavaScript
37 lines
872 B
JavaScript
|
/**
|
||
|
* Graphics Superset
|
||
|
* @param graphicsType
|
||
|
* @param instance {THREE}
|
||
|
* @constructor
|
||
|
*/
|
||
|
GameLib.D3.Graphics = function Graphics(
|
||
|
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;
|