refactor source

This commit is contained in:
thinkinggis 2019-06-18 20:10:10 +08:00
parent f0ee6ee175
commit b1f5c3272a
4 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
import * as THREE from '../../core/three';
import Material from './material'; import Material from './material';
import { getModule } from '../../util/shaderModule'; import { getModule } from '../../util/shaderModule';
export default class PointMaterial extends Material { export default class PointMaterial extends Material {
@ -26,7 +26,7 @@ export default class PointMaterial extends Material {
this.vertexShader = vs; this.vertexShader = vs;
this.fragmentShader = fs; this.fragmentShader = fs;
this.transparent = true; this.transparent = true;
if (!this.uniforms.shape) { this.blending = THREE.AdditiveBlending; } // if (!this.uniforms.shape) { this.blending = THREE.AdditiveBlending; }
if (this.uniforms.u_texture) { if (this.uniforms.u_texture) {
this.defines.TEXCOORD_0 = true; this.defines.TEXCOORD_0 = true;
} }

View File

@ -90,8 +90,8 @@ export default class TileLayer extends Layer {
const zoom = Math.floor(this.scene.getZoom()) - 1; const zoom = Math.floor(this.scene.getZoom()) - 1;
const minZoom = this.get('minZoom'); const minZoom = this.get('minZoom');
const maxZoom = this.get('maxZoom'); const maxZoom = this.get('maxZoom');
const minSourceZoom = this.get('minSourceZoom'); const minSourceZoom = this.tileSource.get('minSourceZoom');
const maxSourceZoom = this.get('maxSourceZoom'); const maxSourceZoom = this.tileSource.get('maxSourceZoom');
const currentZoom = this.scene.getZoom(); const currentZoom = this.scene.getZoom();
this.tileZoom = zoom > maxSourceZoom ? maxSourceZoom : zoom; this.tileZoom = zoom > maxSourceZoom ? maxSourceZoom : zoom;
if (currentZoom < minZoom || currentZoom >= maxZoom || currentZoom < minSourceZoom) { if (currentZoom < minZoom || currentZoom >= maxZoom || currentZoom < minSourceZoom) {

View File

@ -55,7 +55,7 @@ export default class VectorTile extends Tile {
context.disable(context.STENCIL_TEST); context.disable(context.STENCIL_TEST);
}; };
this._object3D.add(this.mesh); this._object3D.add(this.mesh);
} else { } else { // 如果是热力图
this._object3D = this.mesh; this._object3D = this.mesh;
} }
setTimeout(() => { setTimeout(() => {

View File

@ -78,7 +78,7 @@ export default class TileSource extends Source {
}); });
} }
tileDestroy(tile) { tileDestroy(tile) {
if (!tile || !tile.data || tile.loading) { if (!tile || !tile.data || tile.loading || !tile.data.data.dataArray) {
return; return;
} }
const tileData = tile.data; const tileData = tile.data;