forked from Alchemist0823/three.quarks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca32e87
commit 32f1f97
Showing
23 changed files
with
308 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,19 @@ | |
<!--script type="module" src="//cdnjs.cloudflare.com/ajax/libs/three.js/r110/three.module.js" integrity="sha512-8Q+LHYWnd5k/kWiIDvLd+FKKCQUjxhnnWa29z9xnQZcEmrI/sM/ONo2NJtN4UIHY91/jEZArn+AFI3oySADsug==" crossorigin="anonymous"></script> | ||
<script type="module" src="//cdnjs.cloudflare.com/ajax/libs/stats.js/r17/Stats.min.js" integrity="sha512-mfOs9z5Hk96xJH71l0ptzjgGvflNJRnHA7brsEwqDZf7mJa8QDfUtcHICKMXq4Ys80g5HKQMD9rsY3R44ZlEug==" crossorigin="anonymous"></script> | ||
<script type="module" src="//threejs.org/examples/jsm/controls/OrbitControls.js"></script--> | ||
<!--script type="module" src="./js/three.module.js"></script> | ||
<!--script type="module" src="three"></script> | ||
<script type="module" src="./js/OrbitControls.js"></script> | ||
<script type="module" src="./three.quarks.esm.js"></script--> | ||
<script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script> | ||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"three": "./js/three.module.js", | ||
"three.quarks": "./js/three.quarks.esm.js" | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
body { | ||
margin: 0; | ||
|
@@ -66,7 +76,7 @@ | |
Clock, | ||
PerspectiveCamera, | ||
WebGLRenderer, | ||
} from "./js/three.module.js"; | ||
} from "three"; | ||
import {OrbitControls} from "./js/OrbitControls.js"; | ||
import Stats from "./js/Stats.min.js"; | ||
import { | ||
|
@@ -80,6 +90,7 @@ | |
import {MeshMaterialDemo} from "./meshMaterialDemo.js"; | ||
import {AlphaTestDemo} from "./alphaTestDemo.js"; | ||
import {BillboardDemo} from "./billboardDemo.js"; | ||
import {NodeBasedVFXDemo} from "./nodeBasedVFXDemo.js"; | ||
|
||
const WEBGL = { | ||
isWebGLAvailable: function () { | ||
|
@@ -143,7 +154,7 @@ | |
let scene; | ||
let demo; | ||
|
||
let demos = [MuzzleFlashDemo, TornadoDemo, TrailDemo, SequencerDemo, MeshMaterialDemo, TurbulenceDemo, AlphaTestDemo, CustomPluginDemo, BillboardDemo]; | ||
let demos = [MuzzleFlashDemo, TornadoDemo, TrailDemo, SequencerDemo, MeshMaterialDemo, TurbulenceDemo, AlphaTestDemo, CustomPluginDemo, BillboardDemo, NodeBasedVFXDemo]; | ||
let demoIndex = 0; | ||
|
||
function init() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import {BatchedParticleRenderer, Node, NodeGraph, NodeTypes, NodeVFX, RenderMode, Wire} from 'three.quarks'; | ||
import {Demo} from './demo.js'; | ||
import {AdditiveBlending, MeshBasicMaterial, NormalBlending, TextureLoader, Vector3, Vector4} from 'three'; | ||
|
||
export class NodeBasedVFXDemo extends Demo { | ||
name = 'Node Based VFX'; | ||
initScene() { | ||
super.initScene(); | ||
|
||
this.batchRenderer = new BatchedParticleRenderer(); | ||
this.scene.add(this.batchRenderer); | ||
|
||
const emissionGraph = new NodeGraph('emission'); | ||
const start = new Node(NodeTypes['startEvent'], 0); | ||
|
||
const repeater = new Node(NodeTypes['repeater'], 0); | ||
repeater.inputs[1] = {getValue: () => 1}; | ||
|
||
const emit = new Node(NodeTypes['emit'], 0); | ||
|
||
emissionGraph.addNode(start); | ||
emissionGraph.addNode(repeater); | ||
emissionGraph.addNode(emit); | ||
emissionGraph.addWire(new Wire(start, 0, repeater, 0)); | ||
emissionGraph.addWire(new Wire(repeater, 0, emit, 0)); | ||
|
||
const updateGraph = new NodeGraph('test'); | ||
const age = new Node(NodeTypes['particleProperty'], 0, {property: 'age'}); | ||
const time = new Node(NodeTypes['time']); | ||
const add = new Node(NodeTypes['add'], 0); | ||
add.inputs[1] = {getValue: () => 1}; | ||
const pos = new Node(NodeTypes['vec3'], 0); | ||
pos.inputs[0] = {getValue: () => 1}; | ||
pos.inputs[1] = {getValue: () => 1}; | ||
pos.inputs[2] = {getValue: () => 1}; | ||
const pos2 = new Node(NodeTypes['vec3'], 0); | ||
pos2.inputs[0] = {getValue: () => 1}; | ||
pos2.inputs[1] = {getValue: () => 1}; | ||
pos2.inputs[2] = {getValue: () => 1}; | ||
|
||
const life = new Node(NodeTypes['particleProperty'], 0, {property: 'life'}); | ||
life.inputs[0] = {getValue: () => 5}; | ||
const ppos = new Node(NodeTypes['particleProperty'], 0, {property: 'position'}); | ||
const pvel = new Node(NodeTypes['particleProperty'], 0, {property: 'velocity'}); | ||
|
||
updateGraph.addNode(age); | ||
updateGraph.addNode(time); | ||
updateGraph.addNode(add); | ||
updateGraph.addNode(pos); | ||
updateGraph.addNode(pos2); | ||
updateGraph.addNode(ppos); | ||
updateGraph.addNode(pvel); | ||
updateGraph.addNode(life); | ||
updateGraph.addWire(new Wire(age, 0, add, 0)); | ||
updateGraph.addWire(new Wire(add, 0, pos, 1)); | ||
updateGraph.addWire(new Wire(pos, 0, ppos, 0)); | ||
updateGraph.addWire(new Wire(pos2, 0, pvel, 1)); | ||
|
||
const texture = new TextureLoader().load('textures/particle_default.png'); | ||
const config = { | ||
duration: 5, | ||
looping: true, | ||
//instancingGeometry: new PlaneGeometry(1, 1),//.rotateX((-90 / 180) * Math.PI), | ||
worldSpace: false, | ||
maxParticle: 100, | ||
emissionGraph: emissionGraph, | ||
updateGraph: updateGraph, | ||
|
||
material: new MeshBasicMaterial({ | ||
blending: AdditiveBlending, | ||
transparent: true, | ||
map: texture, | ||
//side: DoubleSide, | ||
}), | ||
uTileCount: 1, | ||
vTileCount: 1, | ||
renderOrder: 2, | ||
renderMode: RenderMode.BillBoard, | ||
}; | ||
|
||
// Create particle system based on your configuration | ||
this.billboard1 = new NodeVFX(config); | ||
this.billboard1.emitter.name = 'billboard'; | ||
this.billboard1.emitter.position.x = 0; | ||
|
||
this.batchRenderer.addSystem(this.billboard1); | ||
|
||
this.scene.add(this.billboard1.emitter); | ||
this.scene.add(this.batchRenderer); | ||
|
||
return this.scene; | ||
} | ||
|
||
render(delta) { | ||
super.render(delta); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.