@pirireis/webglobeplugins 0.11.1-alpha → 0.12.0-alpha
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/Math/arc-cdf-points.js +252 -0
- package/Math/{arc-generate-points.js → arc-generate-points copy.js } +4 -0
- package/Math/arc-generate-points-exponantial.js +254 -0
- package/Math/arc.js +5 -5
- package/Math/circle-cdf-points.js +249 -0
- package/Math/circle.js +39 -0
- package/Math/methods.js +13 -3
- package/Math/vec3.js +3 -3
- package/package.json +1 -1
- package/programs/line-on-globe/linestrip.js +5 -6
- package/programs/totems/camerauniformblock.js +35 -8
- package/programs/totems/canvas-webglobe-info.js +55 -20
- package/programs/totems/{camerauniformblock1.js → canvas-webglobe-info1.js} +11 -76
- package/programs/vectorfields/logics/pixelbased.js +1 -1
- package/shape-on-terrain/arc/naive/plugin.js +204 -288
- package/shape-on-terrain/circle/plugin.js +252 -0
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +2 -2
- package/util/build-strategy/general-strategy.js +62 -0
- package/util/build-strategy/static-dynamic.js +31 -0
- package/util/gl-util/draw-options/types.js +1 -1
- package/globe-types.js +0 -1
- package/programs/interface.js +0 -1
- package/programs/totems/camerauniformblock copy.js +0 -171
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import { globeProgramCache } from "../programcache";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
vec2 mapWH; // 8 bytes 144
|
|
12
|
-
vec2 screenWH; // 8 bytes 152
|
|
13
|
-
float z_level; // 4 bytes 160 | 164
|
|
14
|
-
float world_distance; // 4 bytes 164
|
|
15
|
-
float world_tilt; // 4 bytes 168
|
|
16
|
-
float world_north_angle; // 4 bytes 172
|
|
17
|
-
vec2 world_center_radian; // 8 bytes 176 | 184
|
|
18
|
-
}; // 14 lines
|
|
2
|
+
export const WebglobeInfoUniformBlockString = `
|
|
3
|
+
layout(std140) uniform WebglobeInfo {
|
|
4
|
+
vec2 canvas_resolution;
|
|
5
|
+
vec2 mouse_radian_long_lat;
|
|
6
|
+
vec2 mouse_pixel_xy;
|
|
7
|
+
float north_angle;
|
|
8
|
+
float world_tilt;
|
|
9
|
+
float earth_distance;
|
|
10
|
+
};
|
|
19
11
|
`;
|
|
20
|
-
const Radian = Math.PI / 180.0;
|
|
21
12
|
export default class CameraUniformBlockTotem {
|
|
22
13
|
constructor() {
|
|
23
14
|
this.id = "CameraUniformBlockTotem";
|
|
@@ -25,18 +16,6 @@ export default class CameraUniformBlockTotem {
|
|
|
25
16
|
this.gl = null;
|
|
26
17
|
this.globe = null;
|
|
27
18
|
this.ubo = null;
|
|
28
|
-
// this._frustumPlanes = {
|
|
29
|
-
// left: new Plane(),
|
|
30
|
-
// right: new Plane(),
|
|
31
|
-
// top: new Plane(),
|
|
32
|
-
// bottom: new Plane(),
|
|
33
|
-
// near: new Plane(),
|
|
34
|
-
// far: new Plane()
|
|
35
|
-
// }
|
|
36
|
-
this._isMovedParams = {
|
|
37
|
-
lastLod: null,
|
|
38
|
-
isMoved: false,
|
|
39
|
-
};
|
|
40
19
|
}
|
|
41
20
|
init(globe, gl) {
|
|
42
21
|
this.gl = gl;
|
|
@@ -51,8 +30,7 @@ export default class CameraUniformBlockTotem {
|
|
|
51
30
|
const { gl } = this;
|
|
52
31
|
const ubo = gl.createBuffer();
|
|
53
32
|
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
54
|
-
|
|
55
|
-
gl.bufferData(gl.UNIFORM_BUFFER, 200, gl.STREAM_DRAW);
|
|
33
|
+
gl.bufferData(gl.UNIFORM_BUFFER, 164, gl.STREAM_DRAW);
|
|
56
34
|
gl.bindBufferBase(gl.UNIFORM_BUFFER, 0, ubo);
|
|
57
35
|
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
58
36
|
return ubo;
|
|
@@ -72,7 +50,7 @@ export default class CameraUniformBlockTotem {
|
|
|
72
50
|
draw3D(projection, modelView, translate) {
|
|
73
51
|
const { gl, traslateFloat32, ubo, mapWHFloat32, globe } = this;
|
|
74
52
|
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
75
|
-
{ // view, projection,
|
|
53
|
+
{ // view, projection, translate
|
|
76
54
|
gl.bufferSubData(gl.UNIFORM_BUFFER, 0, modelView);
|
|
77
55
|
gl.bufferSubData(gl.UNIFORM_BUFFER, 64, projection);
|
|
78
56
|
traslateFloat32.set([translate.x, translate.y, translate.z], 0);
|
|
@@ -89,42 +67,11 @@ export default class CameraUniformBlockTotem {
|
|
|
89
67
|
gl.bufferSubData(gl.UNIFORM_BUFFER, 144, mapWHFloat32);
|
|
90
68
|
}
|
|
91
69
|
}
|
|
92
|
-
{
|
|
93
|
-
// float world_distance; // 4 bytes 164
|
|
94
|
-
// float world_tilt; // 4 bytes 168
|
|
95
|
-
// float world_north_angle; // 4 bytes 172
|
|
96
|
-
// vec2 world_center_radian; // 8 bytes 180
|
|
97
|
-
const { CenterLong, CenterLat, Distance, Tilt, NorthAng } = globe.api_GetCurrentLookInfo();
|
|
98
|
-
gl.bufferSubData(gl.UNIFORM_BUFFER, 164, new Float32Array([
|
|
99
|
-
Distance, Radian * Tilt, Radian * NorthAng, Radian * CenterLong, Radian * CenterLat
|
|
100
|
-
]));
|
|
101
|
-
}
|
|
102
|
-
// this._frustumPlanes = getFrustumPlanes(projection, translate);
|
|
103
70
|
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
104
|
-
{ // isMoved
|
|
105
|
-
const currentLOD = globe.api_GetCurrentLODWithDecimal();
|
|
106
|
-
this._isMovedParams.isMoved = this._isMovedParams.lastLod !== currentLOD || globe.api_IsScreenMoving();
|
|
107
|
-
this._isMovedParams.lastLod = currentLOD;
|
|
108
|
-
}
|
|
109
|
-
// getFrustum(globe, 50, this._frustumPlanes);
|
|
110
|
-
this._normalizedCameraVector = (() => {
|
|
111
|
-
const { Fp, FUPos } = globe;
|
|
112
|
-
const cameraVector = [Fp.x, Fp.y, Fp.z];
|
|
113
|
-
const length = Math.sqrt(cameraVector.reduce((sum, val) => sum + val * val, 0));
|
|
114
|
-
return normalizedCameraVector.map(val => val / length);
|
|
115
|
-
})();
|
|
116
|
-
}
|
|
117
|
-
assignBindingPoint(program, bindingPoint) {
|
|
118
|
-
const { gl } = this;
|
|
119
|
-
const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
120
|
-
gl.uniformBlockBinding(program, cameraBlockIndex, bindingPoint);
|
|
121
71
|
}
|
|
122
72
|
getUBO() {
|
|
123
73
|
return this.ubo;
|
|
124
74
|
}
|
|
125
|
-
getFrustumPlanes() {
|
|
126
|
-
return this._frustumPlanes;
|
|
127
|
-
}
|
|
128
75
|
bind(bindingPoint) {
|
|
129
76
|
const { gl, ubo } = this;
|
|
130
77
|
gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, ubo);
|
|
@@ -133,18 +80,6 @@ export default class CameraUniformBlockTotem {
|
|
|
133
80
|
const { gl } = this;
|
|
134
81
|
gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, null);
|
|
135
82
|
}
|
|
136
|
-
isMoved() {
|
|
137
|
-
return this._isMovedParams.isMoved;
|
|
138
|
-
}
|
|
139
|
-
getCameraVector() {
|
|
140
|
-
return [this.globe.Fp.x, this.globe.Fp.y, this.globe.Fp.z];
|
|
141
|
-
}
|
|
142
|
-
getNormalizedCameraVector() {
|
|
143
|
-
return this._normalizedCameraVector;
|
|
144
|
-
}
|
|
145
|
-
getCameraUpPosition() {
|
|
146
|
-
return [this.globe.FUPos.x, this.globe.FUPos.y, this.globe.FUPos.z];
|
|
147
|
-
}
|
|
148
83
|
free() {
|
|
149
84
|
const { gl, ubo } = this;
|
|
150
85
|
gl.deleteBuffer(ubo);
|