-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support horizon and vertical billboard in shader
- Loading branch information
1 parent
25d5cb1
commit e53fcb0
Showing
11 changed files
with
162 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import { | ||
BatchedParticleRenderer, | ||
ConstantColor, | ||
PointEmitter, | ||
IntervalValue, | ||
ConstantValue, | ||
ParticleSystem, | ||
SizeOverLife, | ||
PiecewiseBezier, | ||
Bezier, | ||
RenderMode, | ||
RandomQuatGenerator, | ||
AxisAngleGenerator, | ||
Rotation3DOverLife, | ||
RotationOverLife, | ||
SpeedOverLife, | ||
EulerGenerator, | ||
} from './js/three.quarks.esm.js'; | ||
import { | ||
MeshBasicMaterial, | ||
NormalBlending, | ||
AdditiveBlending, | ||
TextureLoader, | ||
Vector4, | ||
Vector3, | ||
PlaneGeometry, | ||
DoubleSide, | ||
} from './js/three.module.js'; | ||
import {Demo} from './demo.js'; | ||
|
||
export class BillboardDemo extends Demo { | ||
name = 'Horizon & Vertical BillboardDemo'; | ||
|
||
initScene() { | ||
super.initScene(); | ||
|
||
this.batchRenderer = new BatchedParticleRenderer(); | ||
this.scene.add(this.batchRenderer); | ||
|
||
const texture = new TextureLoader().load('textures/logo_texture.png'); | ||
const config = { | ||
duration: 5, | ||
looping: true, | ||
//instancingGeometry: new PlaneGeometry(1, 1),//.rotateX((-90 / 180) * Math.PI), | ||
startLife: new IntervalValue(4, 5), | ||
startSpeed: new ConstantValue(2), | ||
startSize: new IntervalValue(0.4, 0.5), | ||
//startRotation: new EulerGenerator(new ConstantValue(0), new ConstantValue(0), new ConstantValue(0)), | ||
startColor: new ConstantColor(new Vector4(1, 1, 1, 1)), | ||
worldSpace: false, | ||
|
||
maxParticle: 100, | ||
emissionOverTime: new ConstantValue(0), | ||
emissionBursts: [ | ||
{ | ||
time: 0, | ||
count: 100, | ||
cycle: 1, | ||
interval: 0.01, | ||
probability: 1, | ||
}, | ||
], | ||
|
||
shape: new PointEmitter(), | ||
material: new MeshBasicMaterial({ | ||
blending: NormalBlending, | ||
transparent: true, | ||
map: texture, | ||
//side: DoubleSide, | ||
}), | ||
startTileIndex: new ConstantValue(0), | ||
uTileCount: 1, | ||
vTileCount: 1, | ||
renderOrder: 2, | ||
renderMode: RenderMode.VerticalBillBoard, | ||
}; | ||
|
||
// Create particle system based on your configuration | ||
let billboard1 = new ParticleSystem(config); | ||
billboard1.addBehavior(new SpeedOverLife(new PiecewiseBezier([[new Bezier(1, 0.75, 0.5, 0), 0]]))); | ||
billboard1.emitter.name = 'billboard'; | ||
billboard1.emitter.position.x = 5; | ||
|
||
config.renderMode = RenderMode.HorizontalBillBoard; | ||
let billboard2 = new ParticleSystem(config); | ||
billboard2.addBehavior(new SpeedOverLife(new PiecewiseBezier([[new Bezier(1, 0.75, 0.5, 0), 0]]))); | ||
billboard2.emitter.name = 'billboard'; | ||
billboard2.emitter.position.x = -5; | ||
|
||
this.batchRenderer.addSystem(billboard1); | ||
this.batchRenderer.addSystem(billboard2); | ||
|
||
this.scene.add(billboard1.emitter); | ||
this.scene.add(billboard2.emitter); | ||
this.scene.add(this.batchRenderer); | ||
|
||
return this.scene; | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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