From 666d76600b4d4cc8a19c107e8b85eb1b70c72c34 Mon Sep 17 00:00:00 2001
From: Forrest Sun <the.forrest.sun@gmail.com>
Date: Thu, 25 Jul 2024 22:20:45 -0700
Subject: [PATCH] update README.md

---
 README.md                                   | 11 +++++++++++
 packages/quarks.core/package.json           |  2 +-
 packages/quarks.core/src/IParticleSystem.ts |  6 ++++++
 packages/quarks.nodes/package.json          |  4 ++--
 packages/three.quarks/package.json          |  4 ++--
 packages/three.quarks/src/ParticleSystem.ts |  2 +-
 packages/three.quarks/src/QuarksUtil.ts     |  7 +++++++
 7 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index 9dfb8f1..7b8a7da 100644
--- a/README.md
+++ b/README.md
@@ -150,6 +150,17 @@ loader.load(jsonURL, (obj) => {
 scene.add(batchSystem);
 ```
 
+#### Play multiple instances of loaded effect
+
+```javascript
+const effect = obj.clone(true);
+scene.add(effect);
+QuarksUtil.setAutoDestroy(effect, true);
+QuarksUtil.addToBatchRenderer(effect, batchSystem);
+QuarksUtil.play(effect);
+
+```
+
 Note: the texture url reference is defined by the texture's name field.
 you may need to modify the texture url in json as needed.
 
diff --git a/packages/quarks.core/package.json b/packages/quarks.core/package.json
index eac6f23..e2975af 100644
--- a/packages/quarks.core/package.json
+++ b/packages/quarks.core/package.json
@@ -1,6 +1,6 @@
 {
   "name": "quarks.core",
-  "version": "0.15.0",
+  "version": "0.15.2",
   "description": "Core library for Quarks VFX / Particle System Library",
   "type": "module",
   "types": "./dist/types/index.d.ts",
diff --git a/packages/quarks.core/src/IParticleSystem.ts b/packages/quarks.core/src/IParticleSystem.ts
index ea98dd8..761cd37 100644
--- a/packages/quarks.core/src/IParticleSystem.ts
+++ b/packages/quarks.core/src/IParticleSystem.ts
@@ -92,6 +92,12 @@ export interface IEmitter {
 
 
 export interface IParticleSystem {
+
+    /**
+     * Whether the ParticleSystem should be automatically disposed when it finishes emitting particles.
+     * @type {string}
+     */
+    autoDestroy: boolean;
     /**
      * Whether the system is in world space.
      * @type {boolean}
diff --git a/packages/quarks.nodes/package.json b/packages/quarks.nodes/package.json
index 2765fc4..e1a73ef 100644
--- a/packages/quarks.nodes/package.json
+++ b/packages/quarks.nodes/package.json
@@ -1,10 +1,10 @@
 {
   "name": "quarks.nodes",
-  "version": "0.15.0",
+  "version": "0.15.2",
   "description": "node based behavior and render system for quarks engine",
   "type": "module",
   "dependencies": {
-    "three.quarks": "^0.15.0"
+    "three.quarks": "^0.15.2"
   },
   "devDependencies": {
     "@types/three": "^0.165.0",
diff --git a/packages/three.quarks/package.json b/packages/three.quarks/package.json
index 34b5360..f9011a8 100644
--- a/packages/three.quarks/package.json
+++ b/packages/three.quarks/package.json
@@ -1,6 +1,6 @@
 {
   "name": "three.quarks",
-  "version": "0.15.1",
+  "version": "0.15.2",
   "description": "A General-Purpose Particle System for three.js",
   "type": "module",
   "types": "./dist/types/index.d.ts",
@@ -60,7 +60,7 @@
     "three": ">=0.165.0"
   },
   "dependencies": {
-    "quarks.core": "^0.15.0"
+    "quarks.core": "^0.15.2"
   },
   "devDependencies": {
     "@types/jest": "^29.5.12",
diff --git a/packages/three.quarks/src/ParticleSystem.ts b/packages/three.quarks/src/ParticleSystem.ts
index 2d4159f..ce3b6c2 100644
--- a/packages/three.quarks/src/ParticleSystem.ts
+++ b/packages/three.quarks/src/ParticleSystem.ts
@@ -279,7 +279,7 @@ const DEFAULT_GEOMETRY = new PlaneGeometry(1, 1, 1, 1);
  */
 export class ParticleSystem implements IParticleSystem {
     /**
-     * Determines whether the ParticleSystem should be automatically disposed when it finishes emitting particles.
+     * whether the ParticleSystem should be automatically disposed when it finishes emitting particles.
      *
      * @type {boolean}
      */
diff --git a/packages/three.quarks/src/QuarksUtil.ts b/packages/three.quarks/src/QuarksUtil.ts
index b85714c..8b53fc3 100644
--- a/packages/three.quarks/src/QuarksUtil.ts
+++ b/packages/three.quarks/src/QuarksUtil.ts
@@ -1,6 +1,7 @@
 import {Object3D} from 'three';
 import {ParticleEmitter} from './ParticleEmitter';
 import {BatchedRenderer} from './BatchedRenderer';
+import {ParticleSystem} from './ParticleSystem';
 
 
 export class QuarksUtil {
@@ -52,6 +53,12 @@ export class QuarksUtil {
         });
     }
 
+    static setAutoDestroy(obj: Object3D, value: boolean) {
+        QuarksUtil.runOnAllParticleEmitters(obj, (ps) => {
+            ps.system.autoDestroy = value;
+        });
+    }
+
     /**
      * Stop emit new particles from all particle systems and
      * keep simulating the existing particles in the object and the object's children.