@pirireis/webglobeplugins 0.9.6 → 0.9.7
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 +5 -2
- package/Math/angle-calculation.js +0 -14
- package/Math/arc.ts +0 -76
- package/Math/bounds/line-bbox.js +0 -225
- package/Math/constants.ts +0 -11
- package/Math/frustum/camera.ts +0 -32
- package/Math/frustum/from-globeinfo.ts +0 -63
- package/Math/frustum/types.ts +0 -11
- package/Math/globe-util/horizon-plane.ts +0 -137
- package/Math/index.js +0 -0
- package/Math/juction/arc-plane.ts +0 -114
- package/Math/juction/line-sphere.ts +0 -30
- package/Math/juction/plane-plane.ts +0 -66
- package/Math/line.ts +0 -70
- package/Math/matrix4.ts +0 -0
- package/Math/methods.js +0 -237
- package/Math/plane.ts +0 -86
- package/Math/quaternion.ts +0 -120
- package/Math/roadmap.md +0 -10
- package/Math/types.ts +0 -45
- package/Math/utils.js +0 -3
- package/Math/vec3.ts +0 -155
- package/algorithms/search-binary.js +0 -14
- package/altitude-locator/adaptors.js +0 -0
- package/altitude-locator/draw-subset-obj.js +0 -27
- package/altitude-locator/keymethod.js +0 -0
- package/altitude-locator/plugin.js +0 -439
- package/altitude-locator/types.js +0 -26
- package/arrowfield/adaptor.js +0 -11
- package/arrowfield/index.js +0 -3
- package/arrowfield/plugin.js +0 -128
- package/bearing-line/index.js +0 -2
- package/bearing-line/plugin.js +0 -512
- package/circle-line-chain/chain-list-map.js +0 -221
- package/circle-line-chain/init.js +0 -0
- package/circle-line-chain/plugin.js +0 -469
- package/circle-line-chain/readme.md +0 -57
- package/circle-line-chain/util.js +0 -1
- package/compass-rose/compass-rose-padding-flat.js +0 -266
- package/compass-rose/compass-text-writer.js +0 -173
- package/compass-rose/index.js +0 -3
- package/compassrose/compassrose.js +0 -341
- package/compassrose/index.js +0 -2
- package/depth-locator/readme.md +0 -26
- package/globe-types.ts +0 -13
- package/heatwave/index.js +0 -4
- package/heatwave/isobar/objectarraylabels.js +0 -247
- package/heatwave/isobar/plugin.js +0 -340
- package/heatwave/isobar/quadtreecontours.js +0 -336
- package/heatwave/plugins/heatwaveglobeshell.js +0 -258
- package/jest.config.js +0 -6
- package/partialrings/buffer-manager.js +0 -89
- package/partialrings/goals.md +0 -17
- package/partialrings/index.js +0 -3
- package/partialrings/plugin.js +0 -160
- package/partialrings/program.js +0 -324
- package/pin/pin-object-array.js +0 -381
- package/pin/pin-point-totem.js +0 -77
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -78
- package/point-heat-map/index.js +0 -0
- package/point-heat-map/plugin-webworker.js +0 -151
- package/point-heat-map/point-to-heat-map-flow.js +0 -150
- package/point-heat-map/readme.md +0 -15
- package/point-tracks/key-methods.js +0 -3
- package/point-tracks/plugin.js +0 -394
- package/programs/arrowfield/index.js +0 -2
- package/programs/arrowfield/logic.js +0 -286
- package/programs/arrowfield/object.js +0 -89
- package/programs/data2legend/density-to-legend.js +0 -115
- package/programs/data2legend/point-to-density-texture.js +0 -114
- package/programs/float2legendwithratio/index.js +0 -3
- package/programs/float2legendwithratio/logic.js +0 -194
- package/programs/float2legendwithratio/object.js +0 -141
- package/programs/globe-util/is-globe-moved.js +0 -27
- package/programs/globeshell/index.js +0 -2
- package/programs/globeshell/noise/noises.js +0 -0
- package/programs/globeshell/wiggle/index.js +0 -6
- package/programs/globeshell/wiggle/logic.js +0 -371
- package/programs/globeshell/wiggle/object.js +0 -93
- package/programs/helpers/blender/index.js +0 -0
- package/programs/helpers/blender/program.js +0 -91
- package/programs/helpers/fadeaway/index.js +0 -3
- package/programs/helpers/fadeaway/logic.js +0 -76
- package/programs/helpers/fadeaway/object.js +0 -20
- package/programs/helpers/index.js +0 -2
- package/programs/index.js +0 -21
- package/programs/interface.ts +0 -7
- package/programs/line-on-globe/angled-line.js +0 -206
- package/programs/line-on-globe/circle-accurate-3d.js +0 -167
- package/programs/line-on-globe/circle-accurate-flat.js +0 -262
- package/programs/line-on-globe/circle-accurate.js +0 -202
- package/programs/line-on-globe/circle.js +0 -191
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -188
- package/programs/line-on-globe/index.js +0 -0
- package/programs/line-on-globe/lines-color-instanced-flat.js +0 -151
- package/programs/line-on-globe/linestrip.ts +0 -228
- package/programs/line-on-globe/naive-accurate-flexible.js +0 -239
- package/programs/line-on-globe/to-the-surface.js +0 -129
- package/programs/line-on-globe/util.js +0 -8
- package/programs/picking/pickable-renderer.js +0 -216
- package/programs/point-on-globe/element-globe-surface-glow.js +0 -168
- package/programs/point-on-globe/element-point-glow.js +0 -184
- package/programs/point-on-globe/square-pixel-point.js +0 -189
- package/programs/programcache.ts +0 -131
- package/programs/rings/distancering/circleflatprogram.js +0 -136
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -378
- package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -420
- package/programs/rings/distancering/index.js +0 -5
- package/programs/rings/distancering/paddyflatprogram.js +0 -146
- package/programs/rings/distancering/paddyflatprogram2d.js +0 -150
- package/programs/rings/distancering/paddyflatprogram3d.js +0 -146
- package/programs/rings/distancering/shader.js +0 -0
- package/programs/rings/index.js +0 -1
- package/programs/rings/partial-ring/piece-of-pie.js +0 -315
- package/programs/totems/camerauniformblock.d.ts +0 -48
- package/programs/totems/camerauniformblock.js +0 -197
- package/programs/totems/canvas-webglobe-info.js +0 -136
- package/programs/totems/gpu-selection-uniform-block.js +0 -132
- package/programs/totems/index.ts +0 -2
- package/programs/two-d/pixel-circle.js +0 -0
- package/programs/two-d/pixel-padding-for-compass.js +0 -174
- package/programs/util.js +0 -20
- package/programs/vectorfields/index.js +0 -3
- package/programs/vectorfields/logics/drawrectangleparticles.js +0 -125
- package/programs/vectorfields/logics/index.js +0 -5
- package/programs/vectorfields/logics/pixelbased.js +0 -161
- package/programs/vectorfields/logics/ubo.js +0 -64
- package/programs/vectorfields/pingpongbuffermanager.js +0 -80
- package/publish.bat +0 -60
- package/rangerings/enum.js +0 -3
- package/rangerings/index.js +0 -5
- package/rangerings/plugin.js +0 -649
- package/rangerings/rangeringangletext.js +0 -368
- package/rangerings/ring-account.js +0 -129
- package/shaders/fragment-toy/firework.js +0 -55
- package/shaders/fragment-toy/singularity.js +0 -59
- package/shape-on-terrain/arc/naive/plugin.ts +0 -304
- package/shape-on-terrain/goal.md +0 -12
- package/tests/Math/junction/arc-plane.test.ts +0 -133
- package/tests/Math/junction/plane-plane.test.ts +0 -82
- package/tests/Math/plane.test.ts +0 -43
- package/tests/Math/vec3.test.ts +0 -14
- package/timetracks/adaptors-line-strip.js +0 -80
- package/timetracks/adaptors.js +0 -133
- package/timetracks/index.js +0 -6
- package/timetracks/plugin-line-strip.js +0 -295
- package/timetracks/plugin.js +0 -304
- package/timetracks/program-line-strip.js +0 -688
- package/timetracks/program.js +0 -850
- package/timetracks/programpoint-line-strip.js +0 -175
- package/timetracks/programpoint.js +0 -168
- package/timetracks/readme.md +0 -1
- package/tsconfig.json +0 -22
- package/types.ts +0 -17
- package/util/account/bufferoffsetmanager.js +0 -209
- package/util/account/index.js +0 -6
- package/util/account/single-attribute-buffer-management/buffer-manager.ts +0 -119
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.ts +0 -173
- package/util/account/single-attribute-buffer-management/index.ts +0 -13
- package/util/account/single-attribute-buffer-management/object-store.ts +0 -65
- package/util/account/single-attribute-buffer-management/types.ts +0 -39
- package/util/account/util.js +0 -22
- package/util/algorithms/index.js +0 -0
- package/util/algorithms/search-binary.js +0 -26
- package/util/check/get.js +0 -13
- package/util/check/index.js +0 -0
- package/util/check/typecheck.js +0 -39
- package/util/geometry/index.js +0 -53
- package/util/gl-util/buffer/attribute-loader.ts +0 -85
- package/util/gl-util/buffer/index.ts +0 -6
- package/util/gl-util/buffer/types.ts +0 -13
- package/util/gl-util/draw-options/methods.ts +0 -66
- package/util/gl-util/draw-options/types.ts +0 -28
- package/util/gl-util/uniform-block/manager.ts +0 -187
- package/util/gl-util/uniform-block/roadmap.md +0 -70
- package/util/gl-util/uniform-block/shader.js +0 -0
- package/util/gl-util/uniform-block/types.ts +0 -27
- package/util/heatwavedatamanager/datamanager.js +0 -168
- package/util/heatwavedatamanager/index.js +0 -3
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -133
- package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
- package/util/index.js +0 -13
- package/util/interpolation/index.js +0 -0
- package/util/interpolation/timetrack/index.js +0 -9
- package/util/interpolation/timetrack/timetrack-interpolator.js +0 -88
- package/util/interpolation/timetrack/web-worker-str.js +0 -180
- package/util/interpolation/timetrack/web-worker.js +0 -51
- package/util/jshelpers/data-filler.js +0 -19
- package/util/jshelpers/equality.js +0 -17
- package/util/jshelpers/index.js +0 -1
- package/util/jshelpers/timefilters.js +0 -32
- package/util/picking/fence.js +0 -46
- package/util/picking/picker-displayer.js +0 -177
- package/util/programs/draw-texture-on-canvas.js +0 -102
- package/util/programs/index.js +0 -1
- package/util/programs/shapesonglobe.js +0 -246
- package/util/programs/supersampletotextures.js +0 -142
- package/util/programs/texturetoglobe.js +0 -203
- package/util/shaderfunctions/geometrytransformations.ts +0 -388
- package/util/shaderfunctions/index.js +0 -2
- package/util/shaderfunctions/nodata.js +0 -10
- package/util/shaderfunctions/noisefunctions.js +0 -44
- package/util/surface-line-data/arc-bboxes.ts +0 -42
- package/util/surface-line-data/arcs-to-cuts.js +0 -74
- package/util/surface-line-data/cut-arc.js +0 -0
- package/util/surface-line-data/flow.ts +0 -52
- package/util/surface-line-data/rbush-manager.js +0 -0
- package/util/surface-line-data/types.ts +0 -27
- package/util/surface-line-data/web-worker.js +0 -0
- package/util/webglobe/gldefaultstates.js +0 -5
- package/util/webglobe/index.js +0 -2
- package/util/webglobe/rasteroverlay.js +0 -96
- package/util/webglobjectbuilders.ts +0 -456
- package/util/webglobjectbuilders1.js +0 -271
- package/waveparticles/adaptor.js +0 -16
- package/waveparticles/index.js +0 -3
- package/waveparticles/plugin.js +0 -313
- package/wind/imagetovectorfieldandmagnitude.js +0 -39
- package/wind/index.js +0 -5
- package/wind/plugin.js +0 -1057
- package/wind/vectorfieldimage.js +0 -27
- package/write-text/attached-text-writer.js +0 -105
- package/write-text/context-text.js +0 -125
- package/write-text/context-text3.js +0 -178
- package/write-text/index.js +0 -1
- package/write-text/writer-plugin.js +0 -7
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { createProgram } from "../../../util";
|
|
2
|
-
import { UBO_BINDING_POINT, shaderUboSource } from "./ubo.js";
|
|
3
|
-
import { glProgramCache } from "../../programcache";
|
|
4
|
-
/**
|
|
5
|
-
* [+] ubo
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const vertexShaderSource = `#version 300 es
|
|
9
|
-
precision highp float;
|
|
10
|
-
`+ shaderUboSource + `
|
|
11
|
-
uniform sampler2D u_vector_field;
|
|
12
|
-
in vec2 in_position;
|
|
13
|
-
out vec3 base_color;
|
|
14
|
-
vec2 lookup_wind(const vec2 uv) { // gerek kalmayabilir. sampler linear methodu ayni isi yapiyor
|
|
15
|
-
// return texture(u_vector_field, uv).rg; // lower-res hardware filtering
|
|
16
|
-
vec2 res = vec2(textureSize(u_vector_field, 0));
|
|
17
|
-
vec2 px = 1.0 / res;
|
|
18
|
-
vec2 vc = (floor(uv * res)) * px;
|
|
19
|
-
vec2 f = fract(uv * res);
|
|
20
|
-
vec2 tl = texture(u_vector_field, vc).rg;
|
|
21
|
-
vec2 tr = texture(u_vector_field, vc + vec2(px.x, 0)).rg;
|
|
22
|
-
vec2 bl = texture(u_vector_field, vc + vec2(0, px.y)).rg;
|
|
23
|
-
vec2 br = texture(u_vector_field, vc + px).rg;
|
|
24
|
-
return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
void main(){
|
|
29
|
-
vec2 direction_vector = lookup_wind(in_position);
|
|
30
|
-
if (direction_vector.r == 0.0 && direction_vector.g == 0.0){ return;}
|
|
31
|
-
|
|
32
|
-
vec2 limp;
|
|
33
|
-
if ( 0 == gl_VertexID) { limp = -tail_wing_base_limp; }
|
|
34
|
-
else if ( 1 == gl_VertexID) { limp = vec2( tail_wing_base_limp.x, -tail_wing_base_limp.y); }
|
|
35
|
-
else if ( 2 == gl_VertexID) { limp = tail_wing_base_limp; }
|
|
36
|
-
else { limp = vec2(-tail_wing_base_limp.x, tail_wing_base_limp.y); } // if ( 3 == gl_VertexID)
|
|
37
|
-
|
|
38
|
-
limp = (limp * mat2(
|
|
39
|
-
direction_vector.x, -direction_vector.y,
|
|
40
|
-
direction_vector.y, direction_vector.x)) / draw_texture_size;
|
|
41
|
-
|
|
42
|
-
vec2 pos = in_position * 2.0 - 1.0;
|
|
43
|
-
gl_Position = vec4(pos + limp, 0.0, 1.0);
|
|
44
|
-
base_color = color;
|
|
45
|
-
}`;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const fragmentShaderSource = `#version 300 es
|
|
49
|
-
precision highp float;
|
|
50
|
-
out vec4 outColor;
|
|
51
|
-
in vec3 base_color;
|
|
52
|
-
void main(){
|
|
53
|
-
outColor = vec4(base_color, 1.0);
|
|
54
|
-
}`;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
class Logic {
|
|
58
|
-
|
|
59
|
-
constructor(gl) {
|
|
60
|
-
this.gl = gl;
|
|
61
|
-
[this.program,
|
|
62
|
-
this._vector_field_location] = this._createProgram();
|
|
63
|
-
// this.decoyBuffer = new DecoyBufferManager(gl);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
_createProgram() {
|
|
67
|
-
const gl = this.gl;
|
|
68
|
-
const program = createProgram(gl, vertexShaderSource, fragmentShaderSource);
|
|
69
|
-
// ubo point
|
|
70
|
-
const ubo_location = gl.getUniformBlockIndex(program, 'UBO');
|
|
71
|
-
gl.uniformBlockBinding(program, ubo_location, UBO_BINDING_POINT);
|
|
72
|
-
return [program, gl.getUniformLocation(program, 'u_vector_field')];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @param {*} bufferManager | PingPongBufferManager
|
|
79
|
-
* @param {*} vectorTexture | RG32F texture R: x, G: y
|
|
80
|
-
* @param {*} uboManager | WaveParticalUboManager under ubo.js
|
|
81
|
-
*/
|
|
82
|
-
draw(bufferManager, vectorTexture, uboManager) {
|
|
83
|
-
const { gl, program } = this;
|
|
84
|
-
gl.useProgram(program);
|
|
85
|
-
gl.bindVertexArray(bufferManager.getSourceVao());
|
|
86
|
-
// gl.bindVertexArray(this.decoyBuffer.getSourceVao());
|
|
87
|
-
|
|
88
|
-
uboManager.bind();
|
|
89
|
-
|
|
90
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
91
|
-
gl.uniform1i(this._vector_field_location, 0);
|
|
92
|
-
gl.bindTexture(
|
|
93
|
-
gl.TEXTURE_2D,
|
|
94
|
-
vectorTexture
|
|
95
|
-
);
|
|
96
|
-
gl.drawArraysInstanced(gl.TRIANGLE_FAN, 0, 4, bufferManager.length);
|
|
97
|
-
gl.drawArraysInstanced(gl.POINTS, 0, 4, bufferManager.length);
|
|
98
|
-
gl.bindVertexArray(null);
|
|
99
|
-
uboManager.unbind();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
free() {
|
|
103
|
-
this.gl.deleteProgram(this.program);
|
|
104
|
-
this.program = null;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
export default class {
|
|
111
|
-
constructor(gl) {
|
|
112
|
-
this.gl = gl;
|
|
113
|
-
this.logic = glProgramCache.getProgram(gl, Logic);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
draw(bufferManager, vectorTexture, uboManager) {
|
|
117
|
-
this.logic.draw(bufferManager, vectorTexture, uboManager);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
free() {
|
|
121
|
-
glProgramCache.releaseProgram(this.gl, Logic);
|
|
122
|
-
this.logic = null;
|
|
123
|
-
this.gl = null;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { createShader } from "../../../util";
|
|
2
|
-
import { UBO_SIZE, UBO_BINDING_POINT, shaderUboSource } from "./ubo.js";
|
|
3
|
-
import { glProgramCache } from "../../programcache";
|
|
4
|
-
|
|
5
|
-
// program output is buffer
|
|
6
|
-
// TODO: Mechanism for randomness
|
|
7
|
-
// drop out mechanism
|
|
8
|
-
// random particle position mechanism
|
|
9
|
-
|
|
10
|
-
const vertexShaderSource = `#version 300 es
|
|
11
|
-
` + shaderUboSource + `
|
|
12
|
-
|
|
13
|
-
uniform sampler2D vector_field;
|
|
14
|
-
in vec2 in_position;
|
|
15
|
-
out vec2 out_position;
|
|
16
|
-
|
|
17
|
-
// float random(vec2 st){
|
|
18
|
-
// float t = dot(st, vec2(12.9898,78.233));
|
|
19
|
-
// return fract(sin(t) * (t+43758.5453123));
|
|
20
|
-
// }
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const vec3 rand_constants = vec3(12.9898, 78.233, 4375.85453);
|
|
24
|
-
float random(const vec2 co) {
|
|
25
|
-
float t = dot(rand_constants.xy, co);
|
|
26
|
-
return fract(sin(t) * (rand_constants.z + t));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
vec2 lookup_wind(const vec2 uv) { // gerek kalmayabilir. sampler linear methodu ayni isi yapiyor
|
|
30
|
-
// return texture(vector_field, uv).rg; // lower-res hardware filtering
|
|
31
|
-
vec2 res = vec2(textureSize(vector_field, 0));
|
|
32
|
-
if (res.x == 0.0 || res.y == 0.0){ return vec2(0.0);}
|
|
33
|
-
vec2 px = 1.0 / res;
|
|
34
|
-
vec2 vc = (floor(uv * res)) * px;
|
|
35
|
-
vec2 f = fract(uv * res);
|
|
36
|
-
vec2 tl = texture(vector_field, vc).rg;
|
|
37
|
-
vec2 tr = texture(vector_field, vc + vec2(px.x, 0)).rg;
|
|
38
|
-
vec2 bl = texture(vector_field, vc + vec2(0, px.y)).rg;
|
|
39
|
-
vec2 br = texture(vector_field, vc + px).rg;
|
|
40
|
-
if (tl.x == 0.0 && tl.y == 0.0){ return vec2(0.0);}
|
|
41
|
-
if (tr.x == 0.0 && tr.y == 0.0){ return vec2(0.0);}
|
|
42
|
-
if (bl.x == 0.0 && bl.y == 0.0){ return vec2(0.0);}
|
|
43
|
-
if (br.x == 0.0 && br.y == 0.0){ return vec2(0.0);}
|
|
44
|
-
return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
vec2 random_position(vec2 st){
|
|
49
|
-
return vec2(random(st), random(st + 1.0));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
void main(){
|
|
54
|
-
vec2 vec = lookup_wind(in_position).xy;
|
|
55
|
-
if (vec.x == 0.0 && vec.y == 0.0){
|
|
56
|
-
out_position = random_position(in_position);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
float random_value = random(in_position + random_seed);
|
|
60
|
-
if (random_value < drop_rate){ //TODO: more sophisticated drop out mechanism mi
|
|
61
|
-
out_position = random_position(in_position);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
out_position = in_position - (vec / draw_texture_size) * range; //*0.0014
|
|
65
|
-
}
|
|
66
|
-
`;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const fragmentShaderSource = `#version 300 es
|
|
70
|
-
precision highp float;
|
|
71
|
-
void main(){
|
|
72
|
-
}`;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
class Logic {
|
|
76
|
-
constructor(gl) {
|
|
77
|
-
this.gl = gl;
|
|
78
|
-
[this.program, this._vector_field_location] = this._createProgram();
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @param {*} bufferManager | PingPongBufferManager
|
|
84
|
-
* @param {*} vectorTexture RG32F texture R: x, G: y
|
|
85
|
-
* @param {*} uboManager | WaveParticalUboManager under ubo.js
|
|
86
|
-
*/
|
|
87
|
-
move(bufferManager, vectorTexture, uboManager) {
|
|
88
|
-
const { gl, program, _vector_field_location } = this;
|
|
89
|
-
gl.useProgram(program);
|
|
90
|
-
gl.enable(gl.RASTERIZER_DISCARD);
|
|
91
|
-
gl.bindVertexArray(bufferManager.getSourceVao());
|
|
92
|
-
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, bufferManager.getTargetTF());
|
|
93
|
-
gl.beginTransformFeedback(gl.POINTS);
|
|
94
|
-
uboManager.bind();
|
|
95
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
96
|
-
gl.bindTexture(gl.TEXTURE_2D, vectorTexture);
|
|
97
|
-
gl.uniform1i(_vector_field_location, 0);
|
|
98
|
-
gl.drawArraysInstanced(gl.POINTS, 0, 1, bufferManager.length);
|
|
99
|
-
gl.endTransformFeedback();
|
|
100
|
-
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null);
|
|
101
|
-
gl.bindVertexArray(null);
|
|
102
|
-
uboManager.unbind();
|
|
103
|
-
gl.disable(gl.RASTERIZER_DISCARD);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// -- private methods
|
|
108
|
-
|
|
109
|
-
_createProgram() {
|
|
110
|
-
const gl = this.gl;
|
|
111
|
-
const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource);
|
|
112
|
-
const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentShaderSource);
|
|
113
|
-
const program = gl.createProgram();
|
|
114
|
-
gl.attachShader(program, vertexShader);
|
|
115
|
-
gl.attachShader(program, fragmentShader);
|
|
116
|
-
gl.transformFeedbackVaryings(
|
|
117
|
-
program,
|
|
118
|
-
["out_position"],
|
|
119
|
-
gl.SEPARATE_ATTRIBS
|
|
120
|
-
);
|
|
121
|
-
gl.linkProgram(program);
|
|
122
|
-
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
|
123
|
-
throw new Error(gl.getProgramParameter(program));
|
|
124
|
-
}
|
|
125
|
-
const ubo_location = gl.getUniformBlockIndex(program, 'UBO');
|
|
126
|
-
gl.uniformBlockBinding(program, ubo_location, UBO_BINDING_POINT);
|
|
127
|
-
return [program, gl.getUniformLocation(program, 'vector_field')];;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
free() {
|
|
131
|
-
this.gl.deleteProgram(this.program);
|
|
132
|
-
this.program = null;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
getInPositionLocation() {
|
|
136
|
-
return this.gl.getAttribLocation(this.program, 'in_position');
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
export default class {
|
|
142
|
-
constructor(gl) {
|
|
143
|
-
this.gl = gl;
|
|
144
|
-
this.logic = glProgramCache.getProgram(gl, Logic);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
move(bufferManager, vectorTexture, uboManager) {
|
|
148
|
-
this.logic.move(bufferManager, vectorTexture, uboManager);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
free() {
|
|
152
|
-
glProgramCache.releaseProgram(this.gl, Logic);
|
|
153
|
-
this.program = null;
|
|
154
|
-
this.gl = null;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
getInPositionLocation() {
|
|
159
|
-
return this.logic.getInPositionLocation();
|
|
160
|
-
}
|
|
161
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
const UBO_BINDING_POINT = 0;
|
|
2
|
-
const INITIAL_UBO_DATA = new Float32Array([93.17, 0.2, 1.0, 7.0, 1.0, 1.0, 1.0, 0.05, 2000, 2000]);
|
|
3
|
-
const shaderUboSource = `
|
|
4
|
-
layout(std140) uniform UBO {
|
|
5
|
-
float random_seed;
|
|
6
|
-
float range;
|
|
7
|
-
vec2 tail_wing_base_limp;
|
|
8
|
-
vec3 color;
|
|
9
|
-
float drop_rate;
|
|
10
|
-
vec2 draw_texture_size;
|
|
11
|
-
};`;
|
|
12
|
-
|
|
13
|
-
const UBO_SIZE = 40;
|
|
14
|
-
|
|
15
|
-
class WaveParticalUboManager {
|
|
16
|
-
|
|
17
|
-
constructor(gl) {
|
|
18
|
-
this.gl = gl;
|
|
19
|
-
this.ubo = this._createBuffer();
|
|
20
|
-
this._data = null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
update({ range, random_seed, tail_wing_base_limp, draw_texture_size, drop_rate, color }) {
|
|
25
|
-
const { gl, ubo } = this;
|
|
26
|
-
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
27
|
-
if (random_seed !== undefined) gl.bufferSubData(gl.UNIFORM_BUFFER, 0, new Float32Array([random_seed]));
|
|
28
|
-
if (range !== undefined) gl.bufferSubData(gl.UNIFORM_BUFFER, 4, new Float32Array([range]));
|
|
29
|
-
if (tail_wing_base_limp !== undefined) gl.bufferSubData(gl.UNIFORM_BUFFER, 8, new Float32Array(tail_wing_base_limp));
|
|
30
|
-
if (color !== undefined) gl.bufferSubData(gl.UNIFORM_BUFFER, 16, new Float32Array(color));
|
|
31
|
-
if (drop_rate !== undefined) gl.bufferSubData(gl.UNIFORM_BUFFER, 28, new Float32Array([drop_rate]));
|
|
32
|
-
if (draw_texture_size !== undefined) gl.bufferSubData(gl.UNIFORM_BUFFER, 32, new Float32Array(draw_texture_size));
|
|
33
|
-
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
_createBuffer() {
|
|
39
|
-
const gl = this.gl;
|
|
40
|
-
const buffer = gl.createBuffer();
|
|
41
|
-
gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);
|
|
42
|
-
gl.bufferData(gl.UNIFORM_BUFFER, INITIAL_UBO_DATA, gl.STATIC_DRAW);
|
|
43
|
-
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
44
|
-
return buffer;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
bind() {
|
|
49
|
-
const { gl, ubo } = this;
|
|
50
|
-
gl.bindBufferBase(gl.UNIFORM_BUFFER, UBO_BINDING_POINT, ubo);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
unbind() {
|
|
54
|
-
const gl = this.gl;
|
|
55
|
-
gl.bindBufferBase(gl.UNIFORM_BUFFER, UBO_BINDING_POINT, null);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
free() {
|
|
59
|
-
const { gl, _buffer } = this;
|
|
60
|
-
gl.deleteBuffer(_buffer);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export { WaveParticalUboManager, UBO_SIZE, UBO_BINDING_POINT, shaderUboSource };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Manages PingPong Buffers.
|
|
3
|
-
* Updated positions are written to the target buffer.
|
|
4
|
-
* Then source and target buffers are swapped.
|
|
5
|
-
*
|
|
6
|
-
* update coords and draw particles programs will use this class.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export default class {
|
|
10
|
-
constructor(gl, particleCount, inPositionLocation = 0) {
|
|
11
|
-
this.gl = gl;
|
|
12
|
-
this._inPositionLocation = inPositionLocation;
|
|
13
|
-
this._buffers = [gl.createBuffer(), gl.createBuffer()];
|
|
14
|
-
this._tfs = this._createTransformFeedbacksAndBindBuffers();
|
|
15
|
-
this._vaos = this._createVaos();
|
|
16
|
-
this.setParticleCount(particleCount);
|
|
17
|
-
this._index = 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
setParticleCount(count) {
|
|
21
|
-
const gl = this.gl;
|
|
22
|
-
this.length = count;
|
|
23
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._buffers[0]);
|
|
24
|
-
gl.bufferData(gl.ARRAY_BUFFER, randomNumbers(this.length * 2), gl.DYNAMIC_DRAW);
|
|
25
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._buffers[1]);
|
|
26
|
-
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.length * 2), gl.DYNAMIC_DRAW);
|
|
27
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
28
|
-
this._index = 0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
_createTransformFeedbacksAndBindBuffers() {
|
|
32
|
-
const gl = this.gl;
|
|
33
|
-
const tfs = [gl.createTransformFeedback(), gl.createTransformFeedback()];
|
|
34
|
-
tfs.forEach((tf, idx) => {
|
|
35
|
-
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, tf);
|
|
36
|
-
gl.bindBufferBase(gl.TRANSFORM_FEEDBACK_BUFFER, 0, this._buffers[idx]);
|
|
37
|
-
});
|
|
38
|
-
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null);
|
|
39
|
-
return tfs;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
_createVaos() {
|
|
43
|
-
const gl = this.gl;
|
|
44
|
-
const vaos = [gl.createVertexArray(), gl.createVertexArray()];
|
|
45
|
-
vaos.forEach((vao, idx) => { // TODO: try with single vao for both buffers
|
|
46
|
-
gl.bindVertexArray(vao);
|
|
47
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._buffers[idx]);
|
|
48
|
-
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
|
|
49
|
-
gl.vertexAttribDivisor(0, 1);
|
|
50
|
-
gl.enableVertexAttribArray(this._inPositionLocation);
|
|
51
|
-
gl.bindVertexArray(null);
|
|
52
|
-
});
|
|
53
|
-
return vaos;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
getSourceVao() { return this._vaos[this._index]; }
|
|
57
|
-
getTargetVao() { return this._vaos[1 - this._index]; }
|
|
58
|
-
sourceBuffer() { return this._buffers[this._index]; }
|
|
59
|
-
targetBuffer() { return this._buffers[1 - this._index]; }
|
|
60
|
-
getTargetTF() { return this._tfs[1 - this._index]; }
|
|
61
|
-
swap() { this._index = 1 - this._index; }
|
|
62
|
-
|
|
63
|
-
free() {
|
|
64
|
-
this.gl.deleteBuffer(this._buffers[0]);
|
|
65
|
-
this.gl.deleteBuffer(this._buffers[1]);
|
|
66
|
-
this.gl.deleteTransformFeedback(this._tfs[0]);
|
|
67
|
-
this.gl.deleteTransformFeedback(this._tfs[1]);
|
|
68
|
-
this.gl.deleteVertexArray(this._vaos[0]);
|
|
69
|
-
this.gl.deleteVertexArray(this._vaos[1]);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function randomNumbers(count) {
|
|
74
|
-
const result = new Float32Array(count);
|
|
75
|
-
const random = Math.random;
|
|
76
|
-
for (let i = 0; i < count; i++) {
|
|
77
|
-
result[i] = random() * 2 - 1;
|
|
78
|
-
}
|
|
79
|
-
return result;
|
|
80
|
-
}
|
package/publish.bat
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
REM Define the source and destination directories
|
|
3
|
-
set SOURCE_DIR=C:\Users\USER\Desktop\webgl\globeNew\my-app\src\webglobeplugins
|
|
4
|
-
set DEST_DIR=C:\Users\USER\Desktop\npmpub\webglobeplugins
|
|
5
|
-
set BUILD_DIR= %DEST_DIR%\dist
|
|
6
|
-
REM --- Start: Prepare and Compile Package for Publishing ---
|
|
7
|
-
|
|
8
|
-
REM Check if the destination directory exists and clean it if it does
|
|
9
|
-
if exist "%DEST_DIR%" (
|
|
10
|
-
echo Cleaning temporary publication directory: "%DEST_DIR%"
|
|
11
|
-
rd /s /q "%DEST_DIR%"
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
REM Create the temporary destination directory if it doesn't exist
|
|
15
|
-
if not exist "%DEST_DIR%" (
|
|
16
|
-
echo Creating temporary publication directory: "%DEST_DIR%"
|
|
17
|
-
mkdir "%DEST_DIR%"
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
REM Create the build directory inside the destination directory
|
|
21
|
-
if not exist "%BUILD_DIR%" (
|
|
22
|
-
echo Creating build directory: "%BUILD_DIR%"
|
|
23
|
-
mkdir "%BUILD_DIR%"
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
REM Copy the entire package folder (including package.json, tsconfig.json, source files)
|
|
27
|
-
REM to the temporary destination. /E copies directories and subdirectories, /I assumes DEST_DIR is a directory.
|
|
28
|
-
REM /Y suppresses prompts to confirm overwriting existing files.
|
|
29
|
-
echo Copying source files to temporary publication directory...
|
|
30
|
-
xcopy /E /I /Y "%SOURCE_DIR%" "%DEST_DIR%\"
|
|
31
|
-
|
|
32
|
-
REM Change to the temporary publication directory
|
|
33
|
-
cd /d "%DEST_DIR%"
|
|
34
|
-
|
|
35
|
-
REM Install dependencies (this is crucial for TypeScript to be available for compilation)
|
|
36
|
-
REM Using 'call' ensures that control returns to the batch script after npm finishes.
|
|
37
|
-
echo Installing package dependencies for compilation...
|
|
38
|
-
call npm install
|
|
39
|
-
|
|
40
|
-
REM Compile TypeScript files into JavaScript
|
|
41
|
-
REM This assumes you have a "build" script in your package.json (e.g., "build": "tsc")
|
|
42
|
-
echo Compiling TypeScript files...
|
|
43
|
-
call npm run build
|
|
44
|
-
|
|
45
|
-
cd /d "%BUILD_DIR%"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
REM --- End: Prepare and Compile Package for Publishing ---
|
|
49
|
-
|
|
50
|
-
REM Run npm publish
|
|
51
|
-
REM Because package.json's "files" is set to ["dist"], only the compiled output will be published.
|
|
52
|
-
echo Running npm publish from the compiled package root...
|
|
53
|
-
npm publish
|
|
54
|
-
|
|
55
|
-
REM Return to the original directory
|
|
56
|
-
cd /d "%SOURCE_DIR%"
|
|
57
|
-
|
|
58
|
-
echo Folder copied, compiled, and npm publish executed successfully.
|
|
59
|
-
|
|
60
|
-
set /p exitkey= "Press any key to continue..."
|
package/rangerings/enum.js
DELETED
package/rangerings/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { RangeRings } from "./plugin";
|
|
2
|
-
import { ringKeyMethod } from "./ring-account";
|
|
3
|
-
import RangeRingAngleText from './rangeringangletext';
|
|
4
|
-
import { ENUM_HIDE, ENUM_TEXT_HIDE } from './enum';
|
|
5
|
-
export { RangeRings, ENUM_HIDE, ENUM_TEXT_HIDE, RangeRingAngleText, ringKeyMethod };
|