@treasuryspatial/map-kit 0.1.19 → 0.1.21
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/dist/mapThreeLayer.d.ts.map +1 -1
- package/dist/mapThreeLayer.js +29 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapThreeLayer.d.ts","sourceRoot":"","sources":["../src/mapThreeLayer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC;IACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C,SAAS,EAAE,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IACjE,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC;IAC3F,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"mapThreeLayer.d.ts","sourceRoot":"","sources":["../src/mapThreeLayer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC;IACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C,SAAS,EAAE,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IACjE,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC;IAC3F,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CA+gBhF"}
|
package/dist/mapThreeLayer.js
CHANGED
|
@@ -80,6 +80,18 @@ export function createMapThreeLayer(options) {
|
|
|
80
80
|
renderer.setRenderTarget(renderTarget);
|
|
81
81
|
renderer.resetState();
|
|
82
82
|
const gl = renderer.getContext();
|
|
83
|
+
if (targetWidth <= 0 || targetHeight <= 0) {
|
|
84
|
+
renderer.setRenderTarget(null);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const fbStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
|
|
88
|
+
if (fbStatus !== gl.FRAMEBUFFER_COMPLETE) {
|
|
89
|
+
if (debug) {
|
|
90
|
+
log(`Framebuffer incomplete (prerender)`, fbStatus);
|
|
91
|
+
}
|
|
92
|
+
renderer.setRenderTarget(null);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
83
95
|
gl.disable(gl.SCISSOR_TEST);
|
|
84
96
|
gl.disable(gl.STENCIL_TEST);
|
|
85
97
|
gl.colorMask(true, true, true, true);
|
|
@@ -96,6 +108,16 @@ export function createMapThreeLayer(options) {
|
|
|
96
108
|
renderer.clear(true, true, true);
|
|
97
109
|
checkFramebuffer(gl, 'prerender');
|
|
98
110
|
renderer.render(scene, camera);
|
|
111
|
+
if (debug && renderTicks < 1) {
|
|
112
|
+
try {
|
|
113
|
+
const pixel = new Uint8Array(4);
|
|
114
|
+
gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
|
|
115
|
+
log('renderTarget sample', { r: pixel[0], g: pixel[1], b: pixel[2], a: pixel[3] });
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
logError('renderTarget sample failed', err);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
99
121
|
logGlError(gl, 'prerender');
|
|
100
122
|
renderer.setRenderTarget(null);
|
|
101
123
|
};
|
|
@@ -173,7 +195,7 @@ export function createMapThreeLayer(options) {
|
|
|
173
195
|
canvas: map.getCanvas(),
|
|
174
196
|
context: gl,
|
|
175
197
|
antialias: true,
|
|
176
|
-
logarithmicDepthBuffer:
|
|
198
|
+
logarithmicDepthBuffer: false,
|
|
177
199
|
alpha: true,
|
|
178
200
|
premultipliedAlpha: true,
|
|
179
201
|
});
|
|
@@ -190,8 +212,13 @@ export function createMapThreeLayer(options) {
|
|
|
190
212
|
depthBuffer: true,
|
|
191
213
|
stencilBuffer: false,
|
|
192
214
|
});
|
|
193
|
-
renderTarget.texture.
|
|
215
|
+
renderTarget.texture.format = THREE.RGBAFormat;
|
|
216
|
+
renderTarget.texture.type = THREE.UnsignedByteType;
|
|
217
|
+
renderTarget.texture.colorSpace = THREE.LinearSRGBColorSpace;
|
|
194
218
|
renderTarget.texture.premultiplyAlpha = true;
|
|
219
|
+
renderTarget.texture.generateMipmaps = false;
|
|
220
|
+
renderTarget.texture.minFilter = THREE.LinearFilter;
|
|
221
|
+
renderTarget.texture.magFilter = THREE.LinearFilter;
|
|
195
222
|
log('renderTarget', { width: targetWidth, height: targetHeight });
|
|
196
223
|
const vsrc = `
|
|
197
224
|
attribute vec2 a_pos;
|