@pirireis/webglobeplugins 0.8.21 → 0.8.22
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 +1 -1
- package/waveparticles/plugin.js +4 -17
package/package.json
CHANGED
package/waveparticles/plugin.js
CHANGED
|
@@ -139,6 +139,7 @@ export default class Plugin {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
|
|
142
|
+
|
|
142
143
|
setCycleStepCount(value) {
|
|
143
144
|
if (value < 3) {
|
|
144
145
|
this._fullCycleStepCount = 3;
|
|
@@ -147,21 +148,6 @@ export default class Plugin {
|
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
|
|
150
|
-
setFlipY(value) {
|
|
151
|
-
if (typeof value === "boolean") {
|
|
152
|
-
if (this._flipY === value) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
// TODO: read data from texture and write it back instead of keeping on the cpu memory
|
|
156
|
-
this._flipY = value;
|
|
157
|
-
this.gl.deleteTexture(this._rgVectorFieldTexture);
|
|
158
|
-
this._rgVectorFieldTexture = this._createRGTexture();
|
|
159
|
-
this.setVectorFieldData(this.__data);
|
|
160
|
-
this.globe.DrawRender();
|
|
161
|
-
} else {
|
|
162
|
-
throw new Error("flipY must be a boolean value");
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
151
|
|
|
166
152
|
_createRGTexture() {
|
|
167
153
|
const { gl, _dataWidth, _dataHeight, } = this;
|
|
@@ -173,12 +159,12 @@ export default class Plugin {
|
|
|
173
159
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
174
160
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
175
161
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
176
|
-
|
|
177
|
-
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, this._flipY);
|
|
162
|
+
|
|
178
163
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
179
164
|
return texture;
|
|
180
165
|
}
|
|
181
166
|
|
|
167
|
+
|
|
182
168
|
// TODO: free all resources
|
|
183
169
|
free() {
|
|
184
170
|
const { gl, fadeAway, globeShellWiggle, _rgVectorFieldTexture, bufferManager, waveUbo, _drawTextures, _frameBuffer } = this;
|
|
@@ -213,6 +199,7 @@ export default class Plugin {
|
|
|
213
199
|
this.__data = data;
|
|
214
200
|
const { gl, _dataWidth, _dataHeight } = this;
|
|
215
201
|
gl.bindTexture(gl.TEXTURE_2D, this._rgVectorFieldTexture);
|
|
202
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, this._flipY);
|
|
216
203
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RG32F, _dataWidth, _dataHeight, 0, gl.RG, gl.FLOAT, data);
|
|
217
204
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
218
205
|
}
|