three-base 2.0.87 → 2.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/threeLoader.d.ts +2 -2
- package/threeLoader.js +97 -16
- package/threeUtils.d.ts +1 -0
- package/threeUtils.js +17 -1
- package/ApngTexture.ts +0 -91
- package/ApngTextureManage.ts +0 -130
- package/EventMesh.ts +0 -79
- package/ExtrudeMesh.ts +0 -576
- package/FPScontrol.ts +0 -209
- package/Fire/Fire.ts +0 -99
- package/Fire/FireGromtry.ts +0 -54
- package/Fire/FireMaterial.ts +0 -92
- package/InstancedMeshBase.ts +0 -316
- package/KeyFrameAnimation.ts +0 -122
- package/MeshBase.ts +0 -236
- package/Mirror.ts +0 -254
- package/PlaneModal1/PlaneModal1.ts +0 -151
- package/PlaneModal1/index.ts +0 -1
- package/PlaneText.ts +0 -58
- package/PlaneWithHtml.ts +0 -85
- package/PointLight/PointLight.ts +0 -75
- package/PointLight/index.ts +0 -1
- package/Sky/Sky.ts +0 -36
- package/Sky/index.ts +0 -1
- package/SpriteModal1/SpriteModal1.ts +0 -160
- package/SpriteModal1/index.ts +0 -1
- package/SpriteText.ts +0 -190
- package/SpriteText2.ts +0 -237
- package/SpriteWithHtml.ts +0 -62
- package/Text3D/Text3D.ts +0 -93
- package/Text3D/fontController.ts +0 -284
- package/Text3D/index.ts +0 -1
- package/ThreeBase.ts +0 -758
- package/ThreeMouse.ts +0 -483
- package/Transition.ts +0 -288
- package/index.ts +0 -2
- package/keyContorls.ts +0 -127
- package/pass/FullScreenQuad.ts +0 -33
- package/pass/glow_pass.ts +0 -607
- package/pass/stroke_pass.ts +0 -561
- package/shaders/FXAAShaderMaterial.ts +0 -248
- package/shaders.ts +0 -264
- package/threeLoader.ts +0 -447
- package/threeUtils.ts +0 -351
package/FPScontrol.ts
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: xiaosihan
|
|
3
|
-
* @Date: 2022-05-04 23:01:36
|
|
4
|
-
* @Last Modified by: xiaosihan
|
|
5
|
-
* @Last Modified time: 2022-06-06 13:32:08
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { Camera, Clock, EventDispatcher, Object3D, Vector3 } from "three";
|
|
9
|
-
import { Capsule } from "three/examples/jsm/math/Capsule";
|
|
10
|
-
import { Octree } from "three/examples/jsm/math/Octree";
|
|
11
|
-
import { clamp, degToRad } from "three/src/math/MathUtils";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 第一人称控制器
|
|
16
|
-
*
|
|
17
|
-
* @export
|
|
18
|
-
* @class FPScontrol
|
|
19
|
-
* @extends {EventDispatcher}
|
|
20
|
-
*/
|
|
21
|
-
export default class FPScontrol extends EventDispatcher {
|
|
22
|
-
|
|
23
|
-
canvas!: HTMLCanvasElement
|
|
24
|
-
|
|
25
|
-
constructor(camera: Camera, canvas: HTMLCanvasElement) {
|
|
26
|
-
super();
|
|
27
|
-
|
|
28
|
-
// 相机对象
|
|
29
|
-
this.camera = camera;
|
|
30
|
-
|
|
31
|
-
this.camera.rotation.order = 'YXZ';
|
|
32
|
-
|
|
33
|
-
this.canvas = canvas;
|
|
34
|
-
|
|
35
|
-
this.init(canvas);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// 是否启用
|
|
39
|
-
enable = false;
|
|
40
|
-
|
|
41
|
-
GRAVITY = 30; // 重力
|
|
42
|
-
STEPS_PER_FRAME = 5; // 每帧碰撞计算的次数
|
|
43
|
-
speed = 1; // 速度
|
|
44
|
-
camera!: Camera;
|
|
45
|
-
|
|
46
|
-
// 世界八叉树对象
|
|
47
|
-
worldOctree = new Octree();
|
|
48
|
-
|
|
49
|
-
// 用户自己的碰撞体积
|
|
50
|
-
playerCollider = new Capsule(new Vector3(0, 0.35, 0), new Vector3(0, 1, 0), 0.35);
|
|
51
|
-
|
|
52
|
-
// 时钟对象
|
|
53
|
-
clock = new Clock();
|
|
54
|
-
|
|
55
|
-
playerVelocity = new Vector3();
|
|
56
|
-
playerDirection = new Vector3();
|
|
57
|
-
|
|
58
|
-
playerOnFloor = false;
|
|
59
|
-
mouseTime = 0;
|
|
60
|
-
isMousedown = false;
|
|
61
|
-
keyStates: { [key: string]: boolean } = {};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
init(canvas: HTMLCanvasElement) {
|
|
65
|
-
this.playerCollider.end.set(0, 1, 0);
|
|
66
|
-
document.addEventListener('keydown', this.keydown);
|
|
67
|
-
document.addEventListener('keyup', this.keyup);
|
|
68
|
-
canvas.addEventListener('pointerdown', this.mousedown);
|
|
69
|
-
document.addEventListener('pointerup', this.mouseup);
|
|
70
|
-
document.body.addEventListener('pointermove', this.mousemove);
|
|
71
|
-
this.enable = true;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
keydown = (event: KeyboardEvent) => {
|
|
76
|
-
this.keyStates[event.code] = true;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
keyup = (event: KeyboardEvent) => {
|
|
80
|
-
this.keyStates[event.code] = false;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
mousedown = () => {
|
|
84
|
-
this.isMousedown = true;
|
|
85
|
-
this.mouseTime = performance.now();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
mouseup = () => {
|
|
89
|
-
this.isMousedown = false;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
mousemove = (event: MouseEvent) => {
|
|
93
|
-
if (this.enable && this.isMousedown) {
|
|
94
|
-
this.camera.rotation.y -= event.movementX / 500;
|
|
95
|
-
this.camera.rotation.x -= event.movementY / 500;
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// 设置 八叉树 节点
|
|
101
|
-
fromGraphNode(object3d: Object3D) {
|
|
102
|
-
this.worldOctree.fromGraphNode(object3d);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// 获取前进的向量
|
|
106
|
-
getForwardVector = () => {
|
|
107
|
-
this.camera.getWorldDirection(this.playerDirection);
|
|
108
|
-
this.playerDirection.y = 0;
|
|
109
|
-
this.playerDirection.normalize();
|
|
110
|
-
return this.playerDirection;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// 获取 后退的向量
|
|
114
|
-
getSideVector = () => {
|
|
115
|
-
this.camera.getWorldDirection(this.playerDirection);
|
|
116
|
-
this.playerDirection.y = 0;
|
|
117
|
-
this.playerDirection.normalize();
|
|
118
|
-
this.playerDirection.cross(this.camera.up);
|
|
119
|
-
return this.playerDirection;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// 玩家移动控制器
|
|
123
|
-
controls = (deltaTime: number) => {
|
|
124
|
-
const speedDelta = deltaTime * (this.playerOnFloor ? 25 : 8) * this.speed;
|
|
125
|
-
if (this.keyStates['KeyW']) {
|
|
126
|
-
this.playerVelocity.add(this.getForwardVector().multiplyScalar(speedDelta));
|
|
127
|
-
}
|
|
128
|
-
if (this.keyStates['KeyS']) {
|
|
129
|
-
this.playerVelocity.add(this.getForwardVector().multiplyScalar(-speedDelta));
|
|
130
|
-
}
|
|
131
|
-
if (this.keyStates['KeyA']) {
|
|
132
|
-
this.playerVelocity.add(this.getSideVector().multiplyScalar(-speedDelta));
|
|
133
|
-
}
|
|
134
|
-
if (this.keyStates['KeyD']) {
|
|
135
|
-
this.playerVelocity.add(this.getSideVector().multiplyScalar(speedDelta));
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (this.playerOnFloor) {
|
|
139
|
-
if (this.keyStates['Space']) {
|
|
140
|
-
this.playerVelocity.y = 15;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// 更新玩家的位置
|
|
147
|
-
updatePlayer = (deltaTime: number) => {
|
|
148
|
-
let damping = Math.exp(-4 * deltaTime) - 1;
|
|
149
|
-
if (!this.playerOnFloor) {
|
|
150
|
-
this.playerVelocity.y -= this.GRAVITY * deltaTime;
|
|
151
|
-
damping *= 0.1;
|
|
152
|
-
}
|
|
153
|
-
this.playerVelocity.addScaledVector(this.playerVelocity, damping);
|
|
154
|
-
const deltaPosition = this.playerVelocity.clone().multiplyScalar(deltaTime);
|
|
155
|
-
this.playerCollider.translate(deltaPosition);
|
|
156
|
-
this.playerCollisions();
|
|
157
|
-
this.camera.position.copy(this.playerCollider.end);
|
|
158
|
-
this.camera.position.y += 1;
|
|
159
|
-
this.camera.rotation.x = clamp(this.camera.rotation.x, degToRad(-20), degToRad(20));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// 玩家的碰撞检测
|
|
163
|
-
playerCollisions() {
|
|
164
|
-
const result = this.worldOctree.capsuleIntersect(this.playerCollider);
|
|
165
|
-
this.playerOnFloor = false;
|
|
166
|
-
if (result) {
|
|
167
|
-
this.playerOnFloor = result.normal.y > 0;
|
|
168
|
-
if (!this.playerOnFloor) {
|
|
169
|
-
this.playerVelocity.addScaledVector(result.normal, -result.normal.dot(this.playerVelocity));
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
this.playerCollider.translate(result.normal.multiplyScalar(result.depth));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
// 更新控制器的位置
|
|
176
|
-
teleportPlayerIfOob = () => {
|
|
177
|
-
if (this.camera.position.y <= -10) {
|
|
178
|
-
this.playerCollider.start.set(0, 0.35, 0);
|
|
179
|
-
this.playerCollider.end.set(0, 1, 10);
|
|
180
|
-
this.playerCollider.radius = 0.35;
|
|
181
|
-
this.camera.position.copy(this.playerCollider.end);
|
|
182
|
-
// this.camera.position.set(0, 3, 0);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// 更新
|
|
187
|
-
update() {
|
|
188
|
-
if (this.enable) {
|
|
189
|
-
const deltaTime = Math.min(0.05, this.clock.getDelta()) / this.STEPS_PER_FRAME;
|
|
190
|
-
for (let i = 0; i < this.STEPS_PER_FRAME; i++) {
|
|
191
|
-
this.controls(deltaTime);
|
|
192
|
-
this.updatePlayer(deltaTime);
|
|
193
|
-
this.teleportPlayerIfOob();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// 销毁事件
|
|
199
|
-
disposer() {
|
|
200
|
-
this.enable = false;
|
|
201
|
-
document.removeEventListener('keydown', this.keydown);
|
|
202
|
-
document.removeEventListener('keyup', this.keyup);
|
|
203
|
-
this.canvas.removeEventListener('pointerdown', this.mousedown);
|
|
204
|
-
document.removeEventListener('pointerup', this.mouseup);
|
|
205
|
-
document.body.removeEventListener('pointermove', this.mousemove);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
package/Fire/Fire.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: xiaosihan
|
|
3
|
-
* @Date: 2024-06-17 02:15:58
|
|
4
|
-
* @Last Modified by: xiaosihan
|
|
5
|
-
* @Last Modified time: 2024-06-18 20:34:38
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { BufferGeometry, Camera, Clock, Color, Group, Material, NormalBufferAttributes, Object3DEventMap, PerspectiveCamera, Points, Scene, Vector2, WebGLRenderer } from "three";
|
|
9
|
-
import FireGromtry from "./FireGromtry";
|
|
10
|
-
import FireMaterial from "./FireMaterial";
|
|
11
|
-
import { degToRad } from "three/src/math/MathUtils";
|
|
12
|
-
|
|
13
|
-
// 粒子火焰效果
|
|
14
|
-
export default class Fire extends Points {
|
|
15
|
-
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
geometry = new FireGromtry(0, 0, 0);
|
|
21
|
-
|
|
22
|
-
material = new FireMaterial();
|
|
23
|
-
|
|
24
|
-
// 火焰的颜色
|
|
25
|
-
fireColor = "#ff2200";
|
|
26
|
-
// 火焰的整体缩放值
|
|
27
|
-
fireScale = 1;
|
|
28
|
-
// 火焰的燃烧半径
|
|
29
|
-
fireRadius = 0.5;
|
|
30
|
-
// 火焰的高度
|
|
31
|
-
fireHeight = 3;
|
|
32
|
-
// 火焰的粒子数量
|
|
33
|
-
particleCount = 500;
|
|
34
|
-
// 是否是透视相机
|
|
35
|
-
isPerspectiveCamera = true;
|
|
36
|
-
//渲染器的尺寸
|
|
37
|
-
size = new Vector2();
|
|
38
|
-
|
|
39
|
-
// 缓存的参数
|
|
40
|
-
cacheProps = {
|
|
41
|
-
fireColor: "#ff2200",
|
|
42
|
-
fireScale: 0,
|
|
43
|
-
fireRadius: 0.5,
|
|
44
|
-
fireHeight: 3,
|
|
45
|
-
particleCount: 500,
|
|
46
|
-
width: 0,
|
|
47
|
-
height: 0,
|
|
48
|
-
isPerspectiveCamera: true
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// 当前渲染的帧数
|
|
52
|
-
updataFrame = 0;
|
|
53
|
-
|
|
54
|
-
// 时钟对象
|
|
55
|
-
clock = new Clock();
|
|
56
|
-
|
|
57
|
-
onBeforeRender(renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry<NormalBufferAttributes>, material: Material, group: Group<Object3DEventMap>): void {
|
|
58
|
-
|
|
59
|
-
const delta = this.clock.getDelta();
|
|
60
|
-
renderer.getSize(this.size);
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
this.cacheProps.fireColor !== this.fireColor ||
|
|
64
|
-
this.cacheProps.fireScale !== this.fireScale ||
|
|
65
|
-
this.cacheProps.fireRadius !== this.fireRadius ||
|
|
66
|
-
this.cacheProps.fireHeight !== this.fireHeight ||
|
|
67
|
-
this.cacheProps.particleCount !== this.particleCount ||
|
|
68
|
-
this.cacheProps.isPerspectiveCamera !== this.isPerspectiveCamera ||
|
|
69
|
-
this.cacheProps.width !== this.size.x ||
|
|
70
|
-
this.cacheProps.height !== this.size.y
|
|
71
|
-
) {
|
|
72
|
-
this.cacheProps.fireColor = this.fireColor;
|
|
73
|
-
this.cacheProps.fireScale = this.fireScale;
|
|
74
|
-
this.cacheProps.fireRadius = this.fireRadius;
|
|
75
|
-
this.cacheProps.fireHeight = this.fireHeight;
|
|
76
|
-
this.cacheProps.particleCount = this.particleCount;
|
|
77
|
-
this.cacheProps.isPerspectiveCamera = this.isPerspectiveCamera;
|
|
78
|
-
this.cacheProps.width = this.size.x;
|
|
79
|
-
this.cacheProps.height = this.size.y;
|
|
80
|
-
|
|
81
|
-
this.geometry = new FireGromtry(this.fireRadius * this.fireScale, this.fireHeight * this.fireScale, this.particleCount);
|
|
82
|
-
|
|
83
|
-
this.material.uniforms.color.value = new Color(this.fireColor);
|
|
84
|
-
this.material.uniforms.size.value = this.fireScale * 0.4;
|
|
85
|
-
if ((camera as PerspectiveCamera).isPerspectiveCamera) {
|
|
86
|
-
this.material.uniforms.heightOfNearPlane.value = Math.abs(this.size.y / (2 * Math.tan(degToRad((camera as PerspectiveCamera).fov * 0.5))));
|
|
87
|
-
} else {
|
|
88
|
-
this.material.uniforms.heightOfNearPlane.value = 0;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
this.isPerspectiveCamera = (camera as PerspectiveCamera).isPerspectiveCamera;
|
|
94
|
-
|
|
95
|
-
this.material.uniforms.time.value = (this.material.uniforms.time.value + delta) % 1;
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
}
|
package/Fire/FireGromtry.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: xiaosihan
|
|
3
|
-
* @Date: 2024-06-17 02:15:58
|
|
4
|
-
* @Last Modified by: xiaosihan
|
|
5
|
-
* @Last Modified time: 2024-06-18 18:12:37
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export const SPRITE_ROW_LENGTH = 4; // 粒子图片中图片数量
|
|
9
|
-
export const ONE_SPRITE_ROW_LENGTH = 1 / SPRITE_ROW_LENGTH; // 每一行的宽度
|
|
10
|
-
import { BufferAttribute, BufferGeometry } from "three";
|
|
11
|
-
|
|
12
|
-
// 粒子火焰顶点对象
|
|
13
|
-
export default class FireGromtry extends BufferGeometry {
|
|
14
|
-
|
|
15
|
-
radius = 0.5;
|
|
16
|
-
height = 3;
|
|
17
|
-
particleCount = 200;
|
|
18
|
-
|
|
19
|
-
constructor(radius: number = 0.5, height: number = 3, particleCount: number = 200) {
|
|
20
|
-
super();
|
|
21
|
-
|
|
22
|
-
const halfHeight = height * 0.5;
|
|
23
|
-
const position = new Float32Array(particleCount * 3);
|
|
24
|
-
const random = new Float32Array(particleCount);
|
|
25
|
-
const sprite = new Float32Array(particleCount);
|
|
26
|
-
|
|
27
|
-
for (let i = 0; i < particleCount; i++) {
|
|
28
|
-
|
|
29
|
-
const r = Math.sqrt(Math.random()) * radius;
|
|
30
|
-
const angle = Math.random() * 2 * Math.PI;
|
|
31
|
-
position[i * 3 + 0] = Math.cos(angle) * r;
|
|
32
|
-
position[i * 3 + 1] = (radius - r) / radius * halfHeight + halfHeight;
|
|
33
|
-
position[i * 3 + 2] = Math.sin(angle) * r;
|
|
34
|
-
sprite[i] = ONE_SPRITE_ROW_LENGTH * ((Math.random() * 4) | 0);
|
|
35
|
-
random[i] = Math.random();
|
|
36
|
-
|
|
37
|
-
if (i === 0) {
|
|
38
|
-
|
|
39
|
-
// to avoid going out of Frustum
|
|
40
|
-
position[i * 3 + 0] = 0;
|
|
41
|
-
position[i * 3 + 1] = 0;
|
|
42
|
-
position[i * 3 + 2] = 0;
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
this.setAttribute('position', new BufferAttribute(position, 3));
|
|
49
|
-
this.setAttribute('random', new BufferAttribute(random, 1));
|
|
50
|
-
this.setAttribute('sprite', new BufferAttribute(sprite, 1));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
package/Fire/FireMaterial.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: xiaosihan
|
|
3
|
-
* @Date: 2024-06-17 02:37:46
|
|
4
|
-
* @Last Modified by: xiaosihan
|
|
5
|
-
* @Last Modified time: 2024-06-18 20:23:31
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { AdditiveBlending, Color, ShaderChunk, ShaderMaterial } from "three";
|
|
9
|
-
import threeLoader from "../threeLoader";
|
|
10
|
-
import { ONE_SPRITE_ROW_LENGTH } from "./FireGromtry";
|
|
11
|
-
|
|
12
|
-
// 火焰粒子材质
|
|
13
|
-
export default class FireMaterial extends ShaderMaterial {
|
|
14
|
-
|
|
15
|
-
constructor() {
|
|
16
|
-
super();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// 材质参数
|
|
20
|
-
uniforms = {
|
|
21
|
-
color: { value: new Color() },
|
|
22
|
-
size: { value: 0.0 },
|
|
23
|
-
map: { value: threeLoader.getTexture("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAABACAMAAADCg1mMAAABgFBMVEUAAAABAQEGBgYLCwsODg4QEBACAgIWFhYbGxsdHR0fHx8gICAjIyMoKCgtLS0wMDAyMjI1NTU2NjY3Nzc4ODgvLy8wLzA5OTk9PT0+Pj4/Pz47OztAQEBDQ0NHR0dLS0tOTk5QUFBSUlJXV1cxMTFcXFxgYGBgYWFiYmJmZmZra2tub25wcHBzc3NxcXEuLi5fX19wb3B3eHd9fHyDg4OGhYWGh4eBgYF+f36JiImLi4uQkZGXl5egoKCkpKSrq6ucnJyQkJCNjY2Pj4+SkpKhoaGurq6zs7O3t7dPT08/QECwsLDGxsbLy8vOzs6vr6+8vLzCwsLW1tbf39/h4eHd3d3X19fT09NfYF9/f3/a2trj4+Po5+js7Ozq6urn5+fm5ubR0dC+v77Pz8/AwMDR0dI3ODjf4N+foJ+enp7p6ene3t6jo6PZ2Nju7u6eoKDZ19fz8/Px8fHw7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7qv/r4vmFaPJvuN0kC5nRDwrEE0CxnNiirYjbPW6kdt9H1NQggSGQWCEBRcAkQCBgsGGlmJWJMea0U33A1iHlflRHSXLRfMwgQYVQGeHvhfnIXcTiXoDf9Cxksy0Y5IN34TFA6aKM7vgYBAAkyAHyF/nAjJM3mAgAkd3cJx+IXIYLgCaXoCQzw1a2OQ+M8gv8oA8z75TxDxK47HX7w6NSckw19eXybvwTBJb0xGwqEKFAUvklwziOO7LInsGbMcqOg4vwv7Tyn45+vzy2+olxz4f6YGhCCcPjtq+JE8Ceg0WtnNkXoFKeMDXPa5X46/OCbHur1jPhjXAK+TQJAHAmdWjnzkKBvOBePm46HqKjT9xk/LQpODUXUt5gRDwPEtx+vhPftxm/Eb8TPAwz8rJ6S1NOrAAAAAElFTkSuQmCC") },
|
|
24
|
-
time: { value: 0.0 },
|
|
25
|
-
heightOfNearPlane: { value: 0.0 }
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// 顶点着色器
|
|
29
|
-
vertexShader = `
|
|
30
|
-
${ShaderChunk.common}
|
|
31
|
-
${ShaderChunk.logdepthbuf_pars_vertex}
|
|
32
|
-
attribute float random;
|
|
33
|
-
attribute float sprite;
|
|
34
|
-
uniform float time;
|
|
35
|
-
uniform float size;
|
|
36
|
-
uniform float heightOfNearPlane;
|
|
37
|
-
|
|
38
|
-
varying float vSprite;
|
|
39
|
-
varying float vOpacity;
|
|
40
|
-
|
|
41
|
-
float quadraticIn( float t ) {
|
|
42
|
-
float tt = t * t;
|
|
43
|
-
return tt * tt;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
void main() {
|
|
47
|
-
float progress = fract( time + ( 2.0 * random - 1.0 ) );
|
|
48
|
-
float progressNeg = 1.0 - progress;
|
|
49
|
-
float ease = quadraticIn( progress );
|
|
50
|
-
float influence = sin( PI * ease );
|
|
51
|
-
|
|
52
|
-
vec3 newPosition = position * vec3( 1.0, ease, 1.0 );
|
|
53
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( newPosition, 1.0 );
|
|
54
|
-
gl_PointSize = ( heightOfNearPlane * size ) / gl_Position.w;
|
|
55
|
-
|
|
56
|
-
vOpacity = min( influence * 4.0, 1.0 ) * progressNeg;
|
|
57
|
-
vSprite = sprite;
|
|
58
|
-
${ShaderChunk.logdepthbuf_vertex}
|
|
59
|
-
}
|
|
60
|
-
`;
|
|
61
|
-
|
|
62
|
-
//片元着色器
|
|
63
|
-
fragmentShader = `
|
|
64
|
-
${ShaderChunk.logdepthbuf_pars_fragment}
|
|
65
|
-
uniform vec3 color;
|
|
66
|
-
uniform sampler2D map;
|
|
67
|
-
|
|
68
|
-
varying float vSprite;
|
|
69
|
-
varying float vOpacity;
|
|
70
|
-
|
|
71
|
-
void main() {
|
|
72
|
-
vec2 texCoord = vec2(
|
|
73
|
-
gl_PointCoord.x * ${ONE_SPRITE_ROW_LENGTH} + vSprite,
|
|
74
|
-
gl_PointCoord.y
|
|
75
|
-
);
|
|
76
|
-
// gl_FragColor = vec4( texture2D( map, texCoord ).xyz * color * vOpacity, 1.0 );
|
|
77
|
-
vec4 textureColor = texture2D( map, texCoord );
|
|
78
|
-
float colorMax = max(max(textureColor.x, textureColor.y),textureColor.z);
|
|
79
|
-
vec4 newTextureColor = vec4( textureColor.xyz * (100.0) , colorMax);
|
|
80
|
-
gl_FragColor = newTextureColor * vec4(color,1.0) * vOpacity;
|
|
81
|
-
${ShaderChunk.logdepthbuf_fragment}
|
|
82
|
-
}
|
|
83
|
-
`
|
|
84
|
-
|
|
85
|
-
blending = AdditiveBlending
|
|
86
|
-
depthTest = true
|
|
87
|
-
depthWrite = false;
|
|
88
|
-
transparent = true
|
|
89
|
-
fog = true
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|