babylon.particleSystem.ts 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. module BABYLON {
  2. var randomNumber = (min: number, max: number): number => {
  3. if (min === max) {
  4. return (min);
  5. }
  6. var random = Math.random();
  7. return ((random * (max - min)) + min);
  8. }
  9. export class ParticleSystem implements IDisposable, IAnimatable {
  10. // Statics
  11. public static BLENDMODE_ONEONE = 0;
  12. public static BLENDMODE_STANDARD = 1;
  13. // Members
  14. public animations: Animation[] = [];
  15. public id: string;
  16. public renderingGroupId = 0;
  17. public emitter = null;
  18. public emitRate = 10;
  19. public manualEmitCount = -1;
  20. public updateSpeed = 0.01;
  21. public targetStopDuration = 0;
  22. public disposeOnStop = false;
  23. public minEmitPower = 1;
  24. public maxEmitPower = 1;
  25. public minLifeTime = 1;
  26. public maxLifeTime = 1;
  27. public minSize = 1;
  28. public maxSize = 1;
  29. public minAngularSpeed = 0;
  30. public maxAngularSpeed = 0;
  31. public particleTexture: Texture;
  32. public layerMask: number = 0x0FFFFFFF;
  33. public customShader: any = null;
  34. public preventAutoStart: boolean = false;
  35. /**
  36. * An event triggered when the system is disposed.
  37. * @type {BABYLON.Observable}
  38. */
  39. public onDisposeObservable = new Observable<ParticleSystem>();
  40. private _onDisposeObserver: Observer<ParticleSystem>;
  41. public set onDispose(callback: () => void) {
  42. if (this._onDisposeObserver) {
  43. this.onDisposeObservable.remove(this._onDisposeObserver);
  44. }
  45. this._onDisposeObserver = this.onDisposeObservable.add(callback);
  46. }
  47. public updateFunction: (particles: Particle[]) => void;
  48. public blendMode = ParticleSystem.BLENDMODE_ONEONE;
  49. public forceDepthWrite = false;
  50. public gravity = Vector3.Zero();
  51. public direction1 = new Vector3(0, 1.0, 0);
  52. public direction2 = new Vector3(0, 1.0, 0);
  53. public minEmitBox = new Vector3(-0.5, -0.5, -0.5);
  54. public maxEmitBox = new Vector3(0.5, 0.5, 0.5);
  55. public color1 = new Color4(1.0, 1.0, 1.0, 1.0);
  56. public color2 = new Color4(1.0, 1.0, 1.0, 1.0);
  57. public colorDead = new Color4(0, 0, 0, 1.0);
  58. public textureMask = new Color4(1.0, 1.0, 1.0, 1.0);
  59. public startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle) => void;
  60. public startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle) => void;
  61. private particles = new Array<Particle>();
  62. private _capacity: number;
  63. private _scene: Scene;
  64. private _stockParticles = new Array<Particle>();
  65. private _newPartsExcess = 0;
  66. private _vertexData: Float32Array;
  67. private _vertexBuffer: Buffer;
  68. private _vertexBuffers: { [key: string]: VertexBuffer } = {};
  69. private _indexBuffer: WebGLBuffer;
  70. private _effect: Effect;
  71. private _customEffect: Effect;
  72. private _cachedDefines: string;
  73. private _scaledColorStep = new Color4(0, 0, 0, 0);
  74. private _colorDiff = new Color4(0, 0, 0, 0);
  75. private _scaledDirection = Vector3.Zero();
  76. private _scaledGravity = Vector3.Zero();
  77. private _currentRenderId = -1;
  78. private _alive: boolean;
  79. private _started = false;
  80. private _stopped = false;
  81. private _actualFrame = 0;
  82. private _scaledUpdateSpeed: number;
  83. constructor(public name: string, capacity: number, scene: Scene, customEffect?: Effect) {
  84. this.id = name;
  85. this._capacity = capacity;
  86. this._scene = scene || Engine.LastCreatedScene;
  87. this._customEffect = customEffect;
  88. scene.particleSystems.push(this);
  89. var indices = [];
  90. var index = 0;
  91. for (var count = 0; count < capacity; count++) {
  92. indices.push(index);
  93. indices.push(index + 1);
  94. indices.push(index + 2);
  95. indices.push(index);
  96. indices.push(index + 2);
  97. indices.push(index + 3);
  98. index += 4;
  99. }
  100. this._indexBuffer = scene.getEngine().createIndexBuffer(indices);
  101. // 11 floats per particle (x, y, z, r, g, b, a, angle, size, offsetX, offsetY) + 1 filler
  102. this._vertexData = new Float32Array(capacity * 11 * 4);
  103. this._vertexBuffer = new Buffer(scene.getEngine(), this._vertexData, true, 11);
  104. var positions = this._vertexBuffer.createVertexBuffer(VertexBuffer.PositionKind, 0, 3);
  105. var colors = this._vertexBuffer.createVertexBuffer(VertexBuffer.ColorKind, 3, 4);
  106. var options = this._vertexBuffer.createVertexBuffer("options", 7, 4);
  107. this._vertexBuffers[VertexBuffer.PositionKind] = positions;
  108. this._vertexBuffers[VertexBuffer.ColorKind] = colors;
  109. this._vertexBuffers["options"] = options;
  110. // Default behaviors
  111. this.startDirectionFunction = (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle): void => {
  112. var randX = randomNumber(this.direction1.x, this.direction2.x);
  113. var randY = randomNumber(this.direction1.y, this.direction2.y);
  114. var randZ = randomNumber(this.direction1.z, this.direction2.z);
  115. Vector3.TransformNormalFromFloatsToRef(randX * emitPower, randY * emitPower, randZ * emitPower, worldMatrix, directionToUpdate);
  116. }
  117. this.startPositionFunction = (worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle): void => {
  118. var randX = randomNumber(this.minEmitBox.x, this.maxEmitBox.x);
  119. var randY = randomNumber(this.minEmitBox.y, this.maxEmitBox.y);
  120. var randZ = randomNumber(this.minEmitBox.z, this.maxEmitBox.z);
  121. Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
  122. }
  123. this.updateFunction = (particles: Particle[]): void => {
  124. for (var index = 0; index < particles.length; index++) {
  125. var particle = particles[index];
  126. particle.age += this._scaledUpdateSpeed;
  127. if (particle.age >= particle.lifeTime) { // Recycle by swapping with last particle
  128. this.recycleParticle(particle);
  129. index--;
  130. continue;
  131. }
  132. else {
  133. particle.colorStep.scaleToRef(this._scaledUpdateSpeed, this._scaledColorStep);
  134. particle.color.addInPlace(this._scaledColorStep);
  135. if (particle.color.a < 0)
  136. particle.color.a = 0;
  137. particle.angle += particle.angularSpeed * this._scaledUpdateSpeed;
  138. particle.direction.scaleToRef(this._scaledUpdateSpeed, this._scaledDirection);
  139. particle.position.addInPlace(this._scaledDirection);
  140. this.gravity.scaleToRef(this._scaledUpdateSpeed, this._scaledGravity);
  141. particle.direction.addInPlace(this._scaledGravity);
  142. }
  143. }
  144. }
  145. }
  146. public recycleParticle(particle: Particle): void {
  147. var lastParticle = this.particles.pop();
  148. if (lastParticle !== particle) {
  149. lastParticle.copyTo(particle);
  150. this._stockParticles.push(lastParticle);
  151. }
  152. }
  153. public getCapacity(): number {
  154. return this._capacity;
  155. }
  156. public isAlive(): boolean {
  157. return this._alive;
  158. }
  159. public isStarted(): boolean {
  160. return this._started;
  161. }
  162. public start(): void {
  163. this._started = true;
  164. this._stopped = false;
  165. this._actualFrame = 0;
  166. }
  167. public stop(): void {
  168. this._stopped = true;
  169. }
  170. public _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void {
  171. var offset = index * 11;
  172. this._vertexData[offset] = particle.position.x;
  173. this._vertexData[offset + 1] = particle.position.y;
  174. this._vertexData[offset + 2] = particle.position.z;
  175. this._vertexData[offset + 3] = particle.color.r;
  176. this._vertexData[offset + 4] = particle.color.g;
  177. this._vertexData[offset + 5] = particle.color.b;
  178. this._vertexData[offset + 6] = particle.color.a;
  179. this._vertexData[offset + 7] = particle.angle;
  180. this._vertexData[offset + 8] = particle.size;
  181. this._vertexData[offset + 9] = offsetX;
  182. this._vertexData[offset + 10] = offsetY;
  183. }
  184. private _update(newParticles: number): void {
  185. // Update current
  186. this._alive = this.particles.length > 0;
  187. this.updateFunction(this.particles);
  188. // Add new ones
  189. var worldMatrix;
  190. if (this.emitter.position) {
  191. worldMatrix = this.emitter.getWorldMatrix();
  192. } else {
  193. worldMatrix = Matrix.Translation(this.emitter.x, this.emitter.y, this.emitter.z);
  194. }
  195. var particle: Particle;
  196. for (var index = 0; index < newParticles; index++) {
  197. if (this.particles.length === this._capacity) {
  198. break;
  199. }
  200. if (this._stockParticles.length !== 0) {
  201. particle = this._stockParticles.pop();
  202. particle.age = 0;
  203. } else {
  204. particle = new Particle();
  205. }
  206. this.particles.push(particle);
  207. var emitPower = randomNumber(this.minEmitPower, this.maxEmitPower);
  208. this.startDirectionFunction(emitPower, worldMatrix, particle.direction, particle);
  209. particle.lifeTime = randomNumber(this.minLifeTime, this.maxLifeTime);
  210. particle.size = randomNumber(this.minSize, this.maxSize);
  211. particle.angularSpeed = randomNumber(this.minAngularSpeed, this.maxAngularSpeed);
  212. this.startPositionFunction(worldMatrix, particle.position, particle);
  213. var step = randomNumber(0, 1.0);
  214. Color4.LerpToRef(this.color1, this.color2, step, particle.color);
  215. this.colorDead.subtractToRef(particle.color, this._colorDiff);
  216. this._colorDiff.scaleToRef(1.0 / particle.lifeTime, particle.colorStep);
  217. }
  218. }
  219. private _getEffect(): Effect {
  220. if (this._customEffect) {
  221. return this._customEffect;
  222. };
  223. var defines = [];
  224. if (this._scene.clipPlane) {
  225. defines.push("#define CLIPPLANE");
  226. }
  227. // Effect
  228. var join = defines.join("\n");
  229. if (this._cachedDefines !== join) {
  230. this._cachedDefines = join;
  231. this._effect = this._scene.getEngine().createEffect(
  232. "particles",
  233. [VertexBuffer.PositionKind, VertexBuffer.ColorKind, "options"],
  234. ["invView", "view", "projection", "vClipPlane", "textureMask"],
  235. ["diffuseSampler"], join);
  236. }
  237. return this._effect;
  238. }
  239. public animate(): void {
  240. if (!this._started)
  241. return;
  242. var effect = this._getEffect();
  243. // Check
  244. if (!this.emitter || !effect.isReady() || !this.particleTexture || !this.particleTexture.isReady())
  245. return;
  246. if (this._currentRenderId === this._scene.getRenderId()) {
  247. return;
  248. }
  249. this._currentRenderId = this._scene.getRenderId();
  250. this._scaledUpdateSpeed = this.updateSpeed * this._scene.getAnimationRatio();
  251. // determine the number of particles we need to create
  252. var newParticles;
  253. if (this.manualEmitCount > -1) {
  254. newParticles = this.manualEmitCount;
  255. this._newPartsExcess = 0;
  256. this.manualEmitCount = 0;
  257. } else {
  258. newParticles = ((this.emitRate * this._scaledUpdateSpeed) >> 0);
  259. this._newPartsExcess += this.emitRate * this._scaledUpdateSpeed - newParticles;
  260. }
  261. if (this._newPartsExcess > 1.0) {
  262. newParticles += this._newPartsExcess >> 0;
  263. this._newPartsExcess -= this._newPartsExcess >> 0;
  264. }
  265. this._alive = false;
  266. if (!this._stopped) {
  267. this._actualFrame += this._scaledUpdateSpeed;
  268. if (this.targetStopDuration && this._actualFrame >= this.targetStopDuration)
  269. this.stop();
  270. } else {
  271. newParticles = 0;
  272. }
  273. this._update(newParticles);
  274. // Stopped?
  275. if (this._stopped) {
  276. if (!this._alive) {
  277. this._started = false;
  278. if (this.disposeOnStop) {
  279. this._scene._toBeDisposed.push(this);
  280. }
  281. }
  282. }
  283. // Update VBO
  284. var offset = 0;
  285. for (var index = 0; index < this.particles.length; index++) {
  286. var particle = this.particles[index];
  287. this._appendParticleVertex(offset++, particle, 0, 0);
  288. this._appendParticleVertex(offset++, particle, 1, 0);
  289. this._appendParticleVertex(offset++, particle, 1, 1);
  290. this._appendParticleVertex(offset++, particle, 0, 1);
  291. }
  292. this._vertexBuffer.update(this._vertexData);
  293. }
  294. public render(): number {
  295. var effect = this._getEffect();
  296. // Check
  297. if (!this.emitter || !effect.isReady() || !this.particleTexture || !this.particleTexture.isReady() || !this.particles.length)
  298. return 0;
  299. var engine = this._scene.getEngine();
  300. // Render
  301. engine.enableEffect(effect);
  302. engine.setState(false);
  303. var viewMatrix = this._scene.getViewMatrix();
  304. effect.setTexture("diffuseSampler", this.particleTexture);
  305. effect.setMatrix("view", viewMatrix);
  306. effect.setMatrix("projection", this._scene.getProjectionMatrix());
  307. effect.setFloat4("textureMask", this.textureMask.r, this.textureMask.g, this.textureMask.b, this.textureMask.a);
  308. if (this._scene.clipPlane) {
  309. var clipPlane = this._scene.clipPlane;
  310. var invView = viewMatrix.clone();
  311. invView.invert();
  312. effect.setMatrix("invView", invView);
  313. effect.setFloat4("vClipPlane", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);
  314. }
  315. // VBOs
  316. engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);
  317. // Draw order
  318. if (this.blendMode === ParticleSystem.BLENDMODE_ONEONE) {
  319. engine.setAlphaMode(Engine.ALPHA_ONEONE);
  320. } else {
  321. engine.setAlphaMode(Engine.ALPHA_COMBINE);
  322. }
  323. if (this.forceDepthWrite) {
  324. engine.setDepthWrite(true);
  325. }
  326. engine.draw(true, 0, this.particles.length * 6);
  327. engine.setAlphaMode(Engine.ALPHA_DISABLE);
  328. return this.particles.length;
  329. }
  330. public dispose(): void {
  331. if (this._vertexBuffer) {
  332. this._vertexBuffer.dispose();
  333. this._vertexBuffer = null;
  334. }
  335. if (this._indexBuffer) {
  336. this._scene.getEngine()._releaseBuffer(this._indexBuffer);
  337. this._indexBuffer = null;
  338. }
  339. if (this.particleTexture) {
  340. this.particleTexture.dispose();
  341. this.particleTexture = null;
  342. }
  343. // Remove from scene
  344. var index = this._scene.particleSystems.indexOf(this);
  345. this._scene.particleSystems.splice(index, 1);
  346. // Callback
  347. this.onDisposeObservable.notifyObservers(this);
  348. this.onDisposeObservable.clear();
  349. }
  350. // Clone
  351. public clone(name: string, newEmitter: any): ParticleSystem {
  352. var custom: Effect = null;
  353. var program: any = null;
  354. if (this.customShader != null) {
  355. program = this.customShader;
  356. var defines: string = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join("\n") : "";
  357. custom = this._scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);
  358. }
  359. var result = new ParticleSystem(name, this._capacity, this._scene, custom);
  360. result.customShader = program;
  361. Tools.DeepCopy(this, result, ["particles", "customShader"]);
  362. if (newEmitter === undefined) {
  363. newEmitter = this.emitter;
  364. }
  365. result.emitter = newEmitter;
  366. if (this.particleTexture) {
  367. result.particleTexture = new Texture(this.particleTexture.url, this._scene);
  368. }
  369. if (!this.preventAutoStart) {
  370. result.start();
  371. }
  372. return result;
  373. }
  374. public serialize(): any {
  375. var serializationObject: any = {};
  376. serializationObject.name = this.name;
  377. serializationObject.id = this.id;
  378. // Emitter
  379. if (this.emitter.position) {
  380. serializationObject.emitterId = this.emitter.id;
  381. } else {
  382. serializationObject.emitter = this.emitter.asArray();
  383. }
  384. serializationObject.capacity = this.getCapacity();
  385. if (this.particleTexture) {
  386. serializationObject.textureName = this.particleTexture.name;
  387. }
  388. // Animations
  389. Animation.AppendSerializedAnimations(this, serializationObject);
  390. // Particle system
  391. serializationObject.minAngularSpeed = this.minAngularSpeed;
  392. serializationObject.maxAngularSpeed = this.maxAngularSpeed;
  393. serializationObject.minSize = this.minSize;
  394. serializationObject.maxSize = this.maxSize;
  395. serializationObject.minEmitPower = this.minEmitPower;
  396. serializationObject.maxEmitPower = this.maxEmitPower;
  397. serializationObject.minLifeTime = this.minLifeTime;
  398. serializationObject.maxLifeTime = this.maxLifeTime;
  399. serializationObject.emitRate = this.emitRate;
  400. serializationObject.minEmitBox = this.minEmitBox.asArray();
  401. serializationObject.maxEmitBox = this.maxEmitBox.asArray();
  402. serializationObject.gravity = this.gravity.asArray();
  403. serializationObject.direction1 = this.direction1.asArray();
  404. serializationObject.direction2 = this.direction2.asArray();
  405. serializationObject.color1 = this.color1.asArray();
  406. serializationObject.color2 = this.color2.asArray();
  407. serializationObject.colorDead = this.colorDead.asArray();
  408. serializationObject.updateSpeed = this.updateSpeed;
  409. serializationObject.targetStopDuration = this.targetStopDuration;
  410. serializationObject.textureMask = this.textureMask.asArray();
  411. serializationObject.blendMode = this.blendMode;
  412. serializationObject.customShader = this.customShader;
  413. serializationObject.preventAutoStart = this.preventAutoStart;
  414. return serializationObject;
  415. }
  416. public static Parse(parsedParticleSystem: any, scene: Scene, rootUrl: string): ParticleSystem {
  417. var name = parsedParticleSystem.name;
  418. var custom: Effect = null;
  419. var program: any = null;
  420. if (parsedParticleSystem.customShader) {
  421. program = parsedParticleSystem.customShader;
  422. var defines: string = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join("\n") : "";
  423. custom = scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);
  424. }
  425. var particleSystem = new ParticleSystem(name, parsedParticleSystem.capacity, scene, custom);
  426. particleSystem.customShader = program;
  427. if (parsedParticleSystem.id) {
  428. particleSystem.id = parsedParticleSystem.id;
  429. }
  430. // Auto start
  431. if (parsedParticleSystem.preventAutoStart) {
  432. particleSystem.preventAutoStart = parsedParticleSystem.preventAutoStart;
  433. }
  434. // Texture
  435. if (parsedParticleSystem.textureName) {
  436. particleSystem.particleTexture = new Texture(rootUrl + parsedParticleSystem.textureName, scene);
  437. particleSystem.particleTexture.name = parsedParticleSystem.textureName;
  438. }
  439. // Emitter
  440. if (parsedParticleSystem.emitterId) {
  441. particleSystem.emitter = scene.getLastMeshByID(parsedParticleSystem.emitterId);
  442. } else {
  443. particleSystem.emitter = Vector3.FromArray(parsedParticleSystem.emitter);
  444. }
  445. // Animations
  446. if (parsedParticleSystem.animations) {
  447. for (var animationIndex = 0; animationIndex < parsedParticleSystem.animations.length; animationIndex++) {
  448. var parsedAnimation = parsedParticleSystem.animations[animationIndex];
  449. particleSystem.animations.push(Animation.Parse(parsedAnimation));
  450. }
  451. }
  452. if (parsedParticleSystem.autoAnimate) {
  453. scene.beginAnimation(particleSystem, parsedParticleSystem.autoAnimateFrom, parsedParticleSystem.autoAnimateTo, parsedParticleSystem.autoAnimateLoop, parsedParticleSystem.autoAnimateSpeed || 1.0);
  454. }
  455. // Particle system
  456. particleSystem.minAngularSpeed = parsedParticleSystem.minAngularSpeed;
  457. particleSystem.maxAngularSpeed = parsedParticleSystem.maxAngularSpeed;
  458. particleSystem.minSize = parsedParticleSystem.minSize;
  459. particleSystem.maxSize = parsedParticleSystem.maxSize;
  460. particleSystem.minLifeTime = parsedParticleSystem.minLifeTime;
  461. particleSystem.maxLifeTime = parsedParticleSystem.maxLifeTime;
  462. particleSystem.minEmitPower = parsedParticleSystem.minEmitPower;
  463. particleSystem.maxEmitPower = parsedParticleSystem.maxEmitPower;
  464. particleSystem.emitRate = parsedParticleSystem.emitRate;
  465. particleSystem.minEmitBox = Vector3.FromArray(parsedParticleSystem.minEmitBox);
  466. particleSystem.maxEmitBox = Vector3.FromArray(parsedParticleSystem.maxEmitBox);
  467. particleSystem.gravity = Vector3.FromArray(parsedParticleSystem.gravity);
  468. particleSystem.direction1 = Vector3.FromArray(parsedParticleSystem.direction1);
  469. particleSystem.direction2 = Vector3.FromArray(parsedParticleSystem.direction2);
  470. particleSystem.color1 = Color4.FromArray(parsedParticleSystem.color1);
  471. particleSystem.color2 = Color4.FromArray(parsedParticleSystem.color2);
  472. particleSystem.colorDead = Color4.FromArray(parsedParticleSystem.colorDead);
  473. particleSystem.updateSpeed = parsedParticleSystem.updateSpeed;
  474. particleSystem.targetStopDuration = parsedParticleSystem.targetStopDuration;
  475. particleSystem.textureMask = Color4.FromArray(parsedParticleSystem.textureMask);
  476. particleSystem.blendMode = parsedParticleSystem.blendMode;
  477. if (!particleSystem.preventAutoStart) {
  478. particleSystem.start();
  479. }
  480. return particleSystem;
  481. }
  482. }
  483. }