1 /** 2 * Create a tQuery.Sprite 3 * 4 * @returns {tQuery.Sprite} the create object 5 */ 6 tQuery.registerStatic('createSprite', function(opts){ 7 opts = tQuery.extend(opts, { 8 useScreenCoordinates : false 9 }); 10 var sprite = new THREE.Sprite(opts); 11 return new tQuery.Sprite(sprite) 12 }) 13 14 ////////////////////////////////////////////////////////////////////////////////// 15 // // 16 ////////////////////////////////////////////////////////////////////////////////// 17 18 /** 19 * Wrapper on top of THREE.Sprite 20 */ 21 tQuery.registerStatic('Sprite', function(elements){ 22 // call parent ctor 23 tQuery.Sprite.parent.constructor.call(this, elements) 24 25 // sanity check - all items MUST be THREE.Material 26 this._lists.forEach(function(item){ console.assert(item instanceof THREE.Sprite); }); 27 }); 28 29 /** 30 * inherit from tQuery.Node 31 */ 32 tQuery.inherit(tQuery.Sprite, tQuery.Object3D); 33 34 35 /** 36 * define all acceptable attributes for this class 37 */ 38 tQuery.mixinAttributes(tQuery.Sprite, { 39 color : tQuery.convert.toThreeColor, 40 map : tQuery.convert.toTexture, 41 useScreenCoordinates : tQuery.convert.toBoolean 42 }); 43