@pirireis/webglobeplugins 0.9.8 → 0.9.9
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/index.js +58 -15
- package/package.json +1 -1
- package/dist/Math/angle-calculation.js +0 -15
- package/dist/Math/arc.js +0 -65
- package/dist/Math/bounds/line-bbox.js +0 -188
- package/dist/Math/constants.js +0 -9
- package/dist/Math/frustum/camera.js +0 -24
- package/dist/Math/frustum/from-globeinfo.js +0 -48
- package/dist/Math/frustum/types.js +0 -2
- package/dist/Math/globe-util/horizon-plane.js +0 -112
- package/dist/Math/index.js +0 -1
- package/dist/Math/juction/arc-plane.js +0 -83
- package/dist/Math/juction/line-sphere.js +0 -25
- package/dist/Math/juction/plane-plane.js +0 -58
- package/dist/Math/line.js +0 -56
- package/dist/Math/matrix4.js +0 -1
- package/dist/Math/methods.js +0 -201
- package/dist/Math/plane.js +0 -60
- package/dist/Math/quaternion.js +0 -104
- package/dist/Math/types.js +0 -2
- package/dist/Math/utils.js +0 -4
- package/dist/Math/vec3.js +0 -126
- package/dist/algorithms/search-binary.js +0 -19
- package/dist/altitude-locator/adaptors.js +0 -1
- package/dist/altitude-locator/draw-subset-obj.js +0 -18
- package/dist/altitude-locator/keymethod.js +0 -1
- package/dist/altitude-locator/plugin.js +0 -341
- package/dist/altitude-locator/types.js +0 -23
- package/dist/arrowfield/adaptor.js +0 -14
- package/dist/arrowfield/index.js +0 -10
- package/dist/arrowfield/plugin.js +0 -86
- package/dist/bearing-line/index.js +0 -8
- package/dist/bearing-line/plugin.js +0 -449
- package/dist/circle-line-chain/chain-list-map.js +0 -205
- package/dist/circle-line-chain/init.js +0 -1
- package/dist/circle-line-chain/plugin.js +0 -424
- package/dist/circle-line-chain/util.js +0 -5
- package/dist/compass-rose/compass-rose-padding-flat.js +0 -225
- package/dist/compass-rose/compass-text-writer.js +0 -153
- package/dist/compass-rose/index.js +0 -7
- package/dist/compassrose/compassrose.js +0 -296
- package/dist/compassrose/index.js +0 -8
- package/dist/globe-types.js +0 -1
- package/dist/heatwave/index.js +0 -10
- package/dist/heatwave/isobar/objectarraylabels.js +0 -202
- package/dist/heatwave/isobar/plugin.js +0 -343
- package/dist/heatwave/isobar/quadtreecontours.js +0 -300
- package/dist/heatwave/plugins/heatwaveglobeshell.js +0 -206
- package/dist/index.js +0 -58
- package/dist/jest.config.js +0 -7
- package/dist/partialrings/buffer-manager.js +0 -81
- package/dist/partialrings/index.js +0 -41
- package/dist/partialrings/plugin.js +0 -135
- package/dist/partialrings/program.js +0 -286
- package/dist/pin/pin-object-array.js +0 -305
- package/dist/pin/pin-point-totem.js +0 -60
- package/dist/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -66
- package/dist/point-heat-map/index.js +0 -1
- package/dist/point-heat-map/plugin-webworker.js +0 -126
- package/dist/point-heat-map/point-to-heat-map-flow.js +0 -127
- package/dist/point-tracks/key-methods.js +0 -5
- package/dist/point-tracks/plugin.js +0 -338
- package/dist/programs/arrowfield/index.js +0 -7
- package/dist/programs/arrowfield/logic.js +0 -257
- package/dist/programs/arrowfield/object.js +0 -66
- package/dist/programs/data2legend/density-to-legend.js +0 -101
- package/dist/programs/data2legend/point-to-density-texture.js +0 -100
- package/dist/programs/float2legendwithratio/index.js +0 -8
- package/dist/programs/float2legendwithratio/logic.js +0 -171
- package/dist/programs/float2legendwithratio/object.js +0 -110
- package/dist/programs/globe-util/is-globe-moved.js +0 -21
- package/dist/programs/globeshell/index.js +0 -8
- package/dist/programs/globeshell/noise/noises.js +0 -1
- package/dist/programs/globeshell/wiggle/index.js +0 -8
- package/dist/programs/globeshell/wiggle/logic.js +0 -345
- package/dist/programs/globeshell/wiggle/object.js +0 -72
- package/dist/programs/helpers/blender/index.js +0 -1
- package/dist/programs/helpers/blender/program.js +0 -79
- package/dist/programs/helpers/fadeaway/index.js +0 -7
- package/dist/programs/helpers/fadeaway/logic.js +0 -72
- package/dist/programs/helpers/fadeaway/object.js +0 -20
- package/dist/programs/helpers/index.js +0 -8
- package/dist/programs/index.js +0 -58
- package/dist/programs/interface.js +0 -1
- package/dist/programs/line-on-globe/angled-line.js +0 -176
- package/dist/programs/line-on-globe/circle-accurate-3d.js +0 -141
- package/dist/programs/line-on-globe/circle-accurate-flat.js +0 -216
- package/dist/programs/line-on-globe/circle-accurate.js +0 -178
- package/dist/programs/line-on-globe/circle.js +0 -167
- package/dist/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -159
- package/dist/programs/line-on-globe/index.js +0 -1
- package/dist/programs/line-on-globe/lines-color-instanced-flat.js +0 -136
- package/dist/programs/line-on-globe/linestrip.js +0 -171
- package/dist/programs/line-on-globe/naive-accurate-flexible.js +0 -195
- package/dist/programs/line-on-globe/to-the-surface.js +0 -111
- package/dist/programs/line-on-globe/util.js +0 -8
- package/dist/programs/picking/pickable-renderer.js +0 -188
- package/dist/programs/point-on-globe/element-globe-surface-glow.js +0 -142
- package/dist/programs/point-on-globe/element-point-glow.js +0 -153
- package/dist/programs/point-on-globe/square-pixel-point.js +0 -174
- package/dist/programs/programcache.js +0 -131
- package/dist/programs/rings/distancering/circleflatprogram.js +0 -156
- package/dist/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -369
- package/dist/programs/rings/distancering/circlepaddysharedbuffer.js +0 -357
- package/dist/programs/rings/distancering/index.js +0 -14
- package/dist/programs/rings/distancering/paddyflatprogram.js +0 -172
- package/dist/programs/rings/distancering/paddyflatprogram2d.js +0 -174
- package/dist/programs/rings/distancering/paddyflatprogram3d.js +0 -172
- package/dist/programs/rings/distancering/shader.js +0 -1
- package/dist/programs/rings/index.js +0 -17
- package/dist/programs/rings/partial-ring/piece-of-pie.js +0 -275
- package/dist/programs/totems/camerauniformblock.js +0 -160
- package/dist/programs/totems/canvas-webglobe-info.js +0 -110
- package/dist/programs/totems/gpu-selection-uniform-block.js +0 -108
- package/dist/programs/totems/index.js +0 -40
- package/dist/programs/two-d/pixel-circle.js +0 -1
- package/dist/programs/two-d/pixel-padding-for-compass.js +0 -162
- package/dist/programs/util.js +0 -17
- package/dist/programs/vectorfields/index.js +0 -23
- package/dist/programs/vectorfields/logics/drawrectangleparticles.js +0 -107
- package/dist/programs/vectorfields/logics/index.js +0 -12
- package/dist/programs/vectorfields/logics/pixelbased.js +0 -142
- package/dist/programs/vectorfields/logics/ubo.js +0 -63
- package/dist/programs/vectorfields/pingpongbuffermanager.js +0 -76
- package/dist/rangerings/enum.js +0 -5
- package/dist/rangerings/index.js +0 -15
- package/dist/rangerings/plugin.js +0 -560
- package/dist/rangerings/rangeringangletext.js +0 -329
- package/dist/rangerings/ring-account.js +0 -117
- package/dist/shaders/fragment-toy/firework.js +0 -58
- package/dist/shaders/fragment-toy/singularity.js +0 -59
- package/dist/shape-on-terrain/arc/naive/plugin.js +0 -252
- package/dist/timetracks/adaptors-line-strip.js +0 -71
- package/dist/timetracks/adaptors.js +0 -122
- package/dist/timetracks/index.js +0 -19
- package/dist/timetracks/plugin-line-strip.js +0 -250
- package/dist/timetracks/plugin.js +0 -258
- package/dist/timetracks/program-line-strip.js +0 -611
- package/dist/timetracks/program.js +0 -772
- package/dist/timetracks/programpoint-line-strip.js +0 -154
- package/dist/timetracks/programpoint.js +0 -147
- package/dist/types.js +0 -15
- package/dist/util/account/bufferoffsetmanager.js +0 -179
- package/dist/util/account/index.js +0 -23
- package/dist/util/account/single-attribute-buffer-management/buffer-manager.js +0 -108
- package/dist/util/account/single-attribute-buffer-management/buffer-orchestrator.js +0 -150
- package/dist/util/account/single-attribute-buffer-management/index.js +0 -9
- package/dist/util/account/single-attribute-buffer-management/object-store.js +0 -51
- package/dist/util/account/single-attribute-buffer-management/types.js +0 -2
- package/dist/util/account/util.js +0 -22
- package/dist/util/algorithms/index.js +0 -1
- package/dist/util/algorithms/search-binary.js +0 -28
- package/dist/util/check/get.js +0 -18
- package/dist/util/check/index.js +0 -1
- package/dist/util/check/typecheck.js +0 -49
- package/dist/util/geometry/index.js +0 -51
- package/dist/util/gl-util/buffer/attribute-loader.js +0 -69
- package/dist/util/gl-util/buffer/index.js +0 -6
- package/dist/util/gl-util/buffer/types.js +0 -1
- package/dist/util/gl-util/draw-options/methods.js +0 -38
- package/dist/util/gl-util/draw-options/types.js +0 -15
- package/dist/util/gl-util/uniform-block/manager.js +0 -156
- package/dist/util/gl-util/uniform-block/shader.js +0 -1
- package/dist/util/gl-util/uniform-block/types.js +0 -8
- package/dist/util/heatwavedatamanager/datamanager.js +0 -152
- package/dist/util/heatwavedatamanager/index.js +0 -10
- package/dist/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -122
- package/dist/util/heatwavedatamanager/pointcoordsmeta.js +0 -20
- package/dist/util/index.js +0 -57
- package/dist/util/interpolation/index.js +0 -1
- package/dist/util/interpolation/timetrack/index.js +0 -5
- package/dist/util/interpolation/timetrack/timetrack-interpolator.js +0 -79
- package/dist/util/interpolation/timetrack/web-worker-str.js +0 -183
- package/dist/util/interpolation/timetrack/web-worker.js +0 -48
- package/dist/util/jshelpers/data-filler.js +0 -20
- package/dist/util/jshelpers/equality.js +0 -20
- package/dist/util/jshelpers/index.js +0 -37
- package/dist/util/jshelpers/timefilters.js +0 -32
- package/dist/util/picking/fence.js +0 -46
- package/dist/util/picking/picker-displayer.js +0 -139
- package/dist/util/programs/draw-texture-on-canvas.js +0 -89
- package/dist/util/programs/index.js +0 -17
- package/dist/util/programs/shapesonglobe.js +0 -214
- package/dist/util/programs/supersampletotextures.js +0 -113
- package/dist/util/programs/texturetoglobe.js +0 -182
- package/dist/util/shaderfunctions/geometrytransformations.js +0 -340
- package/dist/util/shaderfunctions/index.js +0 -18
- package/dist/util/shaderfunctions/nodata.js +0 -11
- package/dist/util/shaderfunctions/noisefunctions.js +0 -43
- package/dist/util/surface-line-data/arc-bboxes.js +0 -25
- package/dist/util/surface-line-data/arcs-to-cuts.js +0 -50
- package/dist/util/surface-line-data/cut-arc.js +0 -1
- package/dist/util/surface-line-data/flow.js +0 -28
- package/dist/util/surface-line-data/rbush-manager.js +0 -1
- package/dist/util/surface-line-data/types.js +0 -1
- package/dist/util/surface-line-data/web-worker.js +0 -1
- package/dist/util/webglobe/gldefaultstates.js +0 -7
- package/dist/util/webglobe/index.js +0 -18
- package/dist/util/webglobe/rasteroverlay.js +0 -78
- package/dist/util/webglobjectbuilders.js +0 -388
- package/dist/util/webglobjectbuilders1.js +0 -237
- package/dist/waveparticles/adaptor.js +0 -17
- package/dist/waveparticles/index.js +0 -10
- package/dist/waveparticles/plugin.js +0 -266
- package/dist/wind/imagetovectorfieldandmagnitude.js +0 -35
- package/dist/wind/index.js +0 -14
- package/dist/wind/plugin.js +0 -926
- package/dist/wind/vectorfieldimage.js +0 -25
- package/dist/write-text/attached-text-writer.js +0 -91
- package/dist/write-text/context-text.js +0 -98
- package/dist/write-text/context-text3.js +0 -155
- package/dist/write-text/index.js +0 -5
- package/dist/write-text/writer-plugin.js +0 -8
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const util_1 = require("../../../util");
|
|
4
|
-
const ubo_js_1 = require("./ubo.js");
|
|
5
|
-
const programcache_1 = require("../../programcache");
|
|
6
|
-
/**
|
|
7
|
-
* [+] ubo
|
|
8
|
-
*/
|
|
9
|
-
const vertexShaderSource = `#version 300 es
|
|
10
|
-
precision highp float;
|
|
11
|
-
` + ubo_js_1.shaderUboSource + `
|
|
12
|
-
uniform sampler2D u_vector_field;
|
|
13
|
-
in vec2 in_position;
|
|
14
|
-
out vec3 base_color;
|
|
15
|
-
vec2 lookup_wind(const vec2 uv) { // gerek kalmayabilir. sampler linear methodu ayni isi yapiyor
|
|
16
|
-
// return texture(u_vector_field, uv).rg; // lower-res hardware filtering
|
|
17
|
-
vec2 res = vec2(textureSize(u_vector_field, 0));
|
|
18
|
-
vec2 px = 1.0 / res;
|
|
19
|
-
vec2 vc = (floor(uv * res)) * px;
|
|
20
|
-
vec2 f = fract(uv * res);
|
|
21
|
-
vec2 tl = texture(u_vector_field, vc).rg;
|
|
22
|
-
vec2 tr = texture(u_vector_field, vc + vec2(px.x, 0)).rg;
|
|
23
|
-
vec2 bl = texture(u_vector_field, vc + vec2(0, px.y)).rg;
|
|
24
|
-
vec2 br = texture(u_vector_field, vc + px).rg;
|
|
25
|
-
return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
void main(){
|
|
30
|
-
vec2 direction_vector = lookup_wind(in_position);
|
|
31
|
-
if (direction_vector.r == 0.0 && direction_vector.g == 0.0){ return;}
|
|
32
|
-
|
|
33
|
-
vec2 limp;
|
|
34
|
-
if ( 0 == gl_VertexID) { limp = -tail_wing_base_limp; }
|
|
35
|
-
else if ( 1 == gl_VertexID) { limp = vec2( tail_wing_base_limp.x, -tail_wing_base_limp.y); }
|
|
36
|
-
else if ( 2 == gl_VertexID) { limp = tail_wing_base_limp; }
|
|
37
|
-
else { limp = vec2(-tail_wing_base_limp.x, tail_wing_base_limp.y); } // if ( 3 == gl_VertexID)
|
|
38
|
-
|
|
39
|
-
limp = (limp * mat2(
|
|
40
|
-
direction_vector.x, -direction_vector.y,
|
|
41
|
-
direction_vector.y, direction_vector.x)) / draw_texture_size;
|
|
42
|
-
|
|
43
|
-
vec2 pos = in_position * 2.0 - 1.0;
|
|
44
|
-
gl_Position = vec4(pos + limp, 0.0, 1.0);
|
|
45
|
-
base_color = color;
|
|
46
|
-
}`;
|
|
47
|
-
const fragmentShaderSource = `#version 300 es
|
|
48
|
-
precision highp float;
|
|
49
|
-
out vec4 outColor;
|
|
50
|
-
in vec3 base_color;
|
|
51
|
-
void main(){
|
|
52
|
-
outColor = vec4(base_color, 1.0);
|
|
53
|
-
}`;
|
|
54
|
-
class Logic {
|
|
55
|
-
constructor(gl) {
|
|
56
|
-
this.gl = gl;
|
|
57
|
-
[this.program,
|
|
58
|
-
this._vector_field_location] = this._createProgram();
|
|
59
|
-
// this.decoyBuffer = new DecoyBufferManager(gl);
|
|
60
|
-
}
|
|
61
|
-
_createProgram() {
|
|
62
|
-
const gl = this.gl;
|
|
63
|
-
const program = (0, util_1.createProgram)(gl, vertexShaderSource, fragmentShaderSource);
|
|
64
|
-
// ubo point
|
|
65
|
-
const ubo_location = gl.getUniformBlockIndex(program, 'UBO');
|
|
66
|
-
gl.uniformBlockBinding(program, ubo_location, ubo_js_1.UBO_BINDING_POINT);
|
|
67
|
-
return [program, gl.getUniformLocation(program, 'u_vector_field')];
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* @param {*} bufferManager | PingPongBufferManager
|
|
71
|
-
* @param {*} vectorTexture | RG32F texture R: x, G: y
|
|
72
|
-
* @param {*} uboManager | WaveParticalUboManager under ubo.js
|
|
73
|
-
*/
|
|
74
|
-
draw(bufferManager, vectorTexture, uboManager) {
|
|
75
|
-
const { gl, program } = this;
|
|
76
|
-
gl.useProgram(program);
|
|
77
|
-
gl.bindVertexArray(bufferManager.getSourceVao());
|
|
78
|
-
// gl.bindVertexArray(this.decoyBuffer.getSourceVao());
|
|
79
|
-
uboManager.bind();
|
|
80
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
81
|
-
gl.uniform1i(this._vector_field_location, 0);
|
|
82
|
-
gl.bindTexture(gl.TEXTURE_2D, vectorTexture);
|
|
83
|
-
gl.drawArraysInstanced(gl.TRIANGLE_FAN, 0, 4, bufferManager.length);
|
|
84
|
-
gl.drawArraysInstanced(gl.POINTS, 0, 4, bufferManager.length);
|
|
85
|
-
gl.bindVertexArray(null);
|
|
86
|
-
uboManager.unbind();
|
|
87
|
-
}
|
|
88
|
-
free() {
|
|
89
|
-
this.gl.deleteProgram(this.program);
|
|
90
|
-
this.program = null;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
class default_1 {
|
|
94
|
-
constructor(gl) {
|
|
95
|
-
this.gl = gl;
|
|
96
|
-
this.logic = programcache_1.glProgramCache.getProgram(gl, Logic);
|
|
97
|
-
}
|
|
98
|
-
draw(bufferManager, vectorTexture, uboManager) {
|
|
99
|
-
this.logic.draw(bufferManager, vectorTexture, uboManager);
|
|
100
|
-
}
|
|
101
|
-
free() {
|
|
102
|
-
programcache_1.glProgramCache.releaseProgram(this.gl, Logic);
|
|
103
|
-
this.logic = null;
|
|
104
|
-
this.gl = null;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.default = default_1;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.WaveParticalUboManager = exports.DrawRectangleParticles = exports.PixelBasedMove = void 0;
|
|
7
|
-
const pixelbased_1 = __importDefault(require("./pixelbased"));
|
|
8
|
-
exports.PixelBasedMove = pixelbased_1.default;
|
|
9
|
-
const drawrectangleparticles_1 = __importDefault(require("./drawrectangleparticles"));
|
|
10
|
-
exports.DrawRectangleParticles = drawrectangleparticles_1.default;
|
|
11
|
-
const ubo_1 = require("./ubo");
|
|
12
|
-
Object.defineProperty(exports, "WaveParticalUboManager", { enumerable: true, get: function () { return ubo_1.WaveParticalUboManager; } });
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const util_1 = require("../../../util");
|
|
4
|
-
const ubo_js_1 = require("./ubo.js");
|
|
5
|
-
const programcache_1 = require("../../programcache");
|
|
6
|
-
// program output is buffer
|
|
7
|
-
// TODO: Mechanism for randomness
|
|
8
|
-
// drop out mechanism
|
|
9
|
-
// random particle position mechanism
|
|
10
|
-
const vertexShaderSource = `#version 300 es
|
|
11
|
-
` + ubo_js_1.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
|
-
const fragmentShaderSource = `#version 300 es
|
|
68
|
-
precision highp float;
|
|
69
|
-
void main(){
|
|
70
|
-
}`;
|
|
71
|
-
class Logic {
|
|
72
|
-
constructor(gl) {
|
|
73
|
-
this.gl = gl;
|
|
74
|
-
[this.program, this._vector_field_location] = this._createProgram();
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* @param {*} bufferManager | PingPongBufferManager
|
|
78
|
-
* @param {*} vectorTexture RG32F texture R: x, G: y
|
|
79
|
-
* @param {*} uboManager | WaveParticalUboManager under ubo.js
|
|
80
|
-
*/
|
|
81
|
-
move(bufferManager, vectorTexture, uboManager) {
|
|
82
|
-
const { gl, program, _vector_field_location } = this;
|
|
83
|
-
gl.useProgram(program);
|
|
84
|
-
gl.enable(gl.RASTERIZER_DISCARD);
|
|
85
|
-
gl.bindVertexArray(bufferManager.getSourceVao());
|
|
86
|
-
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, bufferManager.getTargetTF());
|
|
87
|
-
gl.beginTransformFeedback(gl.POINTS);
|
|
88
|
-
uboManager.bind();
|
|
89
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
90
|
-
gl.bindTexture(gl.TEXTURE_2D, vectorTexture);
|
|
91
|
-
gl.uniform1i(_vector_field_location, 0);
|
|
92
|
-
gl.drawArraysInstanced(gl.POINTS, 0, 1, bufferManager.length);
|
|
93
|
-
gl.endTransformFeedback();
|
|
94
|
-
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null);
|
|
95
|
-
gl.bindVertexArray(null);
|
|
96
|
-
uboManager.unbind();
|
|
97
|
-
gl.disable(gl.RASTERIZER_DISCARD);
|
|
98
|
-
}
|
|
99
|
-
// -- private methods
|
|
100
|
-
_createProgram() {
|
|
101
|
-
const gl = this.gl;
|
|
102
|
-
const vertexShader = (0, util_1.createShader)(gl, gl.VERTEX_SHADER, vertexShaderSource);
|
|
103
|
-
const fragmentShader = (0, util_1.createShader)(gl, gl.FRAGMENT_SHADER, fragmentShaderSource);
|
|
104
|
-
const program = gl.createProgram();
|
|
105
|
-
gl.attachShader(program, vertexShader);
|
|
106
|
-
gl.attachShader(program, fragmentShader);
|
|
107
|
-
gl.transformFeedbackVaryings(program, ["out_position"], gl.SEPARATE_ATTRIBS);
|
|
108
|
-
gl.linkProgram(program);
|
|
109
|
-
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
|
110
|
-
throw new Error(gl.getProgramParameter(program));
|
|
111
|
-
}
|
|
112
|
-
const ubo_location = gl.getUniformBlockIndex(program, 'UBO');
|
|
113
|
-
gl.uniformBlockBinding(program, ubo_location, ubo_js_1.UBO_BINDING_POINT);
|
|
114
|
-
return [program, gl.getUniformLocation(program, 'vector_field')];
|
|
115
|
-
;
|
|
116
|
-
}
|
|
117
|
-
free() {
|
|
118
|
-
this.gl.deleteProgram(this.program);
|
|
119
|
-
this.program = null;
|
|
120
|
-
}
|
|
121
|
-
getInPositionLocation() {
|
|
122
|
-
return this.gl.getAttribLocation(this.program, 'in_position');
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
class default_1 {
|
|
126
|
-
constructor(gl) {
|
|
127
|
-
this.gl = gl;
|
|
128
|
-
this.logic = programcache_1.glProgramCache.getProgram(gl, Logic);
|
|
129
|
-
}
|
|
130
|
-
move(bufferManager, vectorTexture, uboManager) {
|
|
131
|
-
this.logic.move(bufferManager, vectorTexture, uboManager);
|
|
132
|
-
}
|
|
133
|
-
free() {
|
|
134
|
-
programcache_1.glProgramCache.releaseProgram(this.gl, Logic);
|
|
135
|
-
this.program = null;
|
|
136
|
-
this.gl = null;
|
|
137
|
-
}
|
|
138
|
-
getInPositionLocation() {
|
|
139
|
-
return this.logic.getInPositionLocation();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
exports.default = default_1;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shaderUboSource = exports.UBO_BINDING_POINT = exports.UBO_SIZE = exports.WaveParticalUboManager = void 0;
|
|
4
|
-
const UBO_BINDING_POINT = 0;
|
|
5
|
-
exports.UBO_BINDING_POINT = UBO_BINDING_POINT;
|
|
6
|
-
const INITIAL_UBO_DATA = new Float32Array([93.17, 0.2, 1.0, 7.0, 1.0, 1.0, 1.0, 0.05, 2000, 2000]);
|
|
7
|
-
const shaderUboSource = `
|
|
8
|
-
layout(std140) uniform UBO {
|
|
9
|
-
float random_seed;
|
|
10
|
-
float range;
|
|
11
|
-
vec2 tail_wing_base_limp;
|
|
12
|
-
vec3 color;
|
|
13
|
-
float drop_rate;
|
|
14
|
-
vec2 draw_texture_size;
|
|
15
|
-
};`;
|
|
16
|
-
exports.shaderUboSource = shaderUboSource;
|
|
17
|
-
const UBO_SIZE = 40;
|
|
18
|
-
exports.UBO_SIZE = UBO_SIZE;
|
|
19
|
-
class WaveParticalUboManager {
|
|
20
|
-
constructor(gl) {
|
|
21
|
-
this.gl = gl;
|
|
22
|
-
this.ubo = this._createBuffer();
|
|
23
|
-
this._data = null;
|
|
24
|
-
}
|
|
25
|
-
update({ range, random_seed, tail_wing_base_limp, draw_texture_size, drop_rate, color }) {
|
|
26
|
-
const { gl, ubo } = this;
|
|
27
|
-
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
28
|
-
if (random_seed !== undefined)
|
|
29
|
-
gl.bufferSubData(gl.UNIFORM_BUFFER, 0, new Float32Array([random_seed]));
|
|
30
|
-
if (range !== undefined)
|
|
31
|
-
gl.bufferSubData(gl.UNIFORM_BUFFER, 4, new Float32Array([range]));
|
|
32
|
-
if (tail_wing_base_limp !== undefined)
|
|
33
|
-
gl.bufferSubData(gl.UNIFORM_BUFFER, 8, new Float32Array(tail_wing_base_limp));
|
|
34
|
-
if (color !== undefined)
|
|
35
|
-
gl.bufferSubData(gl.UNIFORM_BUFFER, 16, new Float32Array(color));
|
|
36
|
-
if (drop_rate !== undefined)
|
|
37
|
-
gl.bufferSubData(gl.UNIFORM_BUFFER, 28, new Float32Array([drop_rate]));
|
|
38
|
-
if (draw_texture_size !== undefined)
|
|
39
|
-
gl.bufferSubData(gl.UNIFORM_BUFFER, 32, new Float32Array(draw_texture_size));
|
|
40
|
-
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
41
|
-
}
|
|
42
|
-
_createBuffer() {
|
|
43
|
-
const gl = this.gl;
|
|
44
|
-
const buffer = gl.createBuffer();
|
|
45
|
-
gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);
|
|
46
|
-
gl.bufferData(gl.UNIFORM_BUFFER, INITIAL_UBO_DATA, gl.STATIC_DRAW);
|
|
47
|
-
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
48
|
-
return buffer;
|
|
49
|
-
}
|
|
50
|
-
bind() {
|
|
51
|
-
const { gl, ubo } = this;
|
|
52
|
-
gl.bindBufferBase(gl.UNIFORM_BUFFER, UBO_BINDING_POINT, ubo);
|
|
53
|
-
}
|
|
54
|
-
unbind() {
|
|
55
|
-
const gl = this.gl;
|
|
56
|
-
gl.bindBufferBase(gl.UNIFORM_BUFFER, UBO_BINDING_POINT, null);
|
|
57
|
-
}
|
|
58
|
-
free() {
|
|
59
|
-
const { gl, _buffer } = this;
|
|
60
|
-
gl.deleteBuffer(_buffer);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.WaveParticalUboManager = WaveParticalUboManager;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Manages PingPong Buffers.
|
|
4
|
-
* Updated positions are written to the target buffer.
|
|
5
|
-
* Then source and target buffers are swapped.
|
|
6
|
-
*
|
|
7
|
-
* update coords and draw particles programs will use this class.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
class default_1 {
|
|
11
|
-
constructor(gl, particleCount, inPositionLocation = 0) {
|
|
12
|
-
this.gl = gl;
|
|
13
|
-
this._inPositionLocation = inPositionLocation;
|
|
14
|
-
this._buffers = [gl.createBuffer(), gl.createBuffer()];
|
|
15
|
-
this._tfs = this._createTransformFeedbacksAndBindBuffers();
|
|
16
|
-
this._vaos = this._createVaos();
|
|
17
|
-
this.setParticleCount(particleCount);
|
|
18
|
-
this._index = 0;
|
|
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
|
-
_createTransformFeedbacksAndBindBuffers() {
|
|
31
|
-
const gl = this.gl;
|
|
32
|
-
const tfs = [gl.createTransformFeedback(), gl.createTransformFeedback()];
|
|
33
|
-
tfs.forEach((tf, idx) => {
|
|
34
|
-
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, tf);
|
|
35
|
-
gl.bindBufferBase(gl.TRANSFORM_FEEDBACK_BUFFER, 0, this._buffers[idx]);
|
|
36
|
-
});
|
|
37
|
-
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null);
|
|
38
|
-
return tfs;
|
|
39
|
-
}
|
|
40
|
-
_createVaos() {
|
|
41
|
-
const gl = this.gl;
|
|
42
|
-
const vaos = [gl.createVertexArray(), gl.createVertexArray()];
|
|
43
|
-
vaos.forEach((vao, idx) => {
|
|
44
|
-
gl.bindVertexArray(vao);
|
|
45
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._buffers[idx]);
|
|
46
|
-
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
|
|
47
|
-
gl.vertexAttribDivisor(0, 1);
|
|
48
|
-
gl.enableVertexAttribArray(this._inPositionLocation);
|
|
49
|
-
gl.bindVertexArray(null);
|
|
50
|
-
});
|
|
51
|
-
return vaos;
|
|
52
|
-
}
|
|
53
|
-
getSourceVao() { return this._vaos[this._index]; }
|
|
54
|
-
getTargetVao() { return this._vaos[1 - this._index]; }
|
|
55
|
-
sourceBuffer() { return this._buffers[this._index]; }
|
|
56
|
-
targetBuffer() { return this._buffers[1 - this._index]; }
|
|
57
|
-
getTargetTF() { return this._tfs[1 - this._index]; }
|
|
58
|
-
swap() { this._index = 1 - this._index; }
|
|
59
|
-
free() {
|
|
60
|
-
this.gl.deleteBuffer(this._buffers[0]);
|
|
61
|
-
this.gl.deleteBuffer(this._buffers[1]);
|
|
62
|
-
this.gl.deleteTransformFeedback(this._tfs[0]);
|
|
63
|
-
this.gl.deleteTransformFeedback(this._tfs[1]);
|
|
64
|
-
this.gl.deleteVertexArray(this._vaos[0]);
|
|
65
|
-
this.gl.deleteVertexArray(this._vaos[1]);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.default = default_1;
|
|
69
|
-
function randomNumbers(count) {
|
|
70
|
-
const result = new Float32Array(count);
|
|
71
|
-
const random = Math.random;
|
|
72
|
-
for (let i = 0; i < count; i++) {
|
|
73
|
-
result[i] = random() * 2 - 1;
|
|
74
|
-
}
|
|
75
|
-
return result;
|
|
76
|
-
}
|
package/dist/rangerings/enum.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ENUM_TEXT_HIDE = exports.ENUM_HIDE = void 0;
|
|
4
|
-
exports.ENUM_HIDE = Object.freeze({ SHOW: 0, HIDE: 1, HIDE_1_DEGREE_PADDINGS: 2 });
|
|
5
|
-
exports.ENUM_TEXT_HIDE = Object.freeze({ SHOW: 0, HIDE: 1 });
|
package/dist/rangerings/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ringKeyMethod = exports.RangeRingAngleText = exports.ENUM_TEXT_HIDE = exports.ENUM_HIDE = exports.RangeRings = void 0;
|
|
7
|
-
const plugin_1 = require("./plugin");
|
|
8
|
-
Object.defineProperty(exports, "RangeRings", { enumerable: true, get: function () { return plugin_1.RangeRings; } });
|
|
9
|
-
const ring_account_1 = require("./ring-account");
|
|
10
|
-
Object.defineProperty(exports, "ringKeyMethod", { enumerable: true, get: function () { return ring_account_1.ringKeyMethod; } });
|
|
11
|
-
const rangeringangletext_1 = __importDefault(require("./rangeringangletext"));
|
|
12
|
-
exports.RangeRingAngleText = rangeringangletext_1.default;
|
|
13
|
-
const enum_1 = require("./enum");
|
|
14
|
-
Object.defineProperty(exports, "ENUM_HIDE", { enumerable: true, get: function () { return enum_1.ENUM_HIDE; } });
|
|
15
|
-
Object.defineProperty(exports, "ENUM_TEXT_HIDE", { enumerable: true, get: function () { return enum_1.ENUM_TEXT_HIDE; } });
|