UNPKG

@awayjs/graphics

Version:
122 lines (121 loc) 5.03 kB
import { __extends } from "tslib"; import { AnimationNodeBase } from '@awayjs/renderer'; /** * Provides an abstract base class for particle animation nodes. */ var ParticleNodeBase = /** @class */ (function (_super) { __extends(ParticleNodeBase, _super); /** * Creates a new <code>ParticleNodeBase</code> object. * * @param name Defines the generic name of the particle animation node. * @param mode Defines whether the mode of operation acts on local properties of a particle or global properties of the node. * @param dataLength Defines the length of the data used by the node when in <code>LOCAL_STATIC</code> mode. * @param [optional] priority the priority of the particle animation node, used to order the agal generated in a particle animation set. Defaults to 1. */ function ParticleNodeBase(name, mode, dataLength, priority) { if (priority === void 0) { priority = 1; } var _this = _super.call(this) || this; _this._pDataLength = 3; name = name + ParticleNodeBase.MODES[mode]; _this.name = name; _this._pMode = mode; _this._priority = priority; _this._pDataLength = dataLength; _this._pOneData = new Array(_this._pDataLength); return _this; } Object.defineProperty(ParticleNodeBase.prototype, "mode", { /** * Returns the property mode of the particle animation node. Typically set in the node constructor * * @see away.animators.ParticlePropertiesMode */ get: function () { return this._pMode; }, enumerable: false, configurable: true }); Object.defineProperty(ParticleNodeBase.prototype, "priority", { /** * Returns the priority of the particle animation node, used to order the agal generated in a particle animation set. Set automatically on instantiation. * * @see away.animators.ParticleAnimationSet * @see #getAGALVertexCode */ get: function () { return this._priority; }, enumerable: false, configurable: true }); Object.defineProperty(ParticleNodeBase.prototype, "dataLength", { /** * Returns the length of the data used by the node when in <code>LOCAL_STATIC</code> mode. Used to generate the local static data of the particle animation set. * * @see away.animators.ParticleAnimationSet * @see #getAGALVertexCode */ get: function () { return this._pDataLength; }, enumerable: false, configurable: true }); Object.defineProperty(ParticleNodeBase.prototype, "oneData", { /** * Returns the generated data vector of the node after one particle pass during the generation of all local static data of the particle animation set. * * @see away.animators.ParticleAnimationSet * @see #generatePropertyOfOneParticle */ get: function () { return this._pOneData; }, enumerable: false, configurable: true }); /** * Returns the AGAL code of the particle animation node for use in the vertex shader. */ ParticleNodeBase.prototype.getAGALVertexCode = function (shader, animationSet, registerCache, animationRegisterData) { return ''; }; /** * Returns the AGAL code of the particle animation node for use in the fragment shader. */ ParticleNodeBase.prototype.getAGALFragmentCode = function (shader, animationSet, registerCache, animationRegisterData) { return ''; }; /** * Returns the AGAL code of the particle animation node for use in the fragment shader when UV coordinates are required. */ ParticleNodeBase.prototype.getAGALUVCode = function (shader, animationSet, registerCache, animationRegisterData) { return ''; }; /** * Called internally by the particle animation set when assigning the set of static properties originally defined by the initParticleFunc of the set. * * @see away.animators.ParticleAnimationSet#initParticleFunc */ ParticleNodeBase.prototype._iGeneratePropertyOfOneParticle = function (param) { }; /** * Called internally by the particle animation set when determining the requirements of the particle animation node AGAL. */ ParticleNodeBase.prototype._iProcessAnimationSetting = function (particleAnimationSet) { }; //modes alias ParticleNodeBase.GLOBAL = 'Global'; ParticleNodeBase.LOCAL_STATIC = 'LocalStatic'; ParticleNodeBase.LOCAL_DYNAMIC = 'LocalDynamic'; //modes list ParticleNodeBase.MODES = { 0: ParticleNodeBase.GLOBAL, 1: ParticleNodeBase.LOCAL_STATIC, 2: ParticleNodeBase.LOCAL_DYNAMIC }; return ParticleNodeBase; }(AnimationNodeBase)); export { ParticleNodeBase };