修复bug。

This commit is contained in:
tengge1 2019-04-05 10:09:55 +08:00
parent 4d755f251b
commit ee83ea2a33
4 changed files with 14 additions and 6 deletions

View File

@ -21,6 +21,10 @@ function Globe(camera, renderer) {
this.lat = 0;
this.alt = MathUtils.zoomToAlt(0);
this.rotation.x = - Math.PI / 2;
this.updateMatrix();
this.matrixAutoUpdate = false;
this.layer = new BingTiledLayer();
this.tiledLayerRenderer = new TiledLayerRenderer(this);
this.viewer = new OrbitViewer(this.camera, this.renderer.domElement);

View File

@ -135,7 +135,7 @@ TiledLayerRenderer.prototype.render = function (layer) {
this.creator.get().forEach((n, i) => {
if (!n.mesh) {
n.mesh = new THREE.ArrowHelper(new THREE.Vector3(1, 0, 0), new THREE.Vector3(), WGS84.a * 1.5);
n.mesh = new THREE.ArrowHelper(new THREE.Vector3().copy(n._p0).normalize(), new THREE.Vector3().copy(n._p0), WGS84.a * 0.2);
}
this.globe.add(n.mesh);
@ -165,6 +165,7 @@ TiledLayerRenderer.prototype.renderMesh = function () {
gl.disable(gl.DEPTH_TEST);
// gl.depthFunc(gl.LEQUAL);
gl.depthMask(true);
gl.uniformMatrix4fv(this.uniforms.modelMatrix, false, this.mesh.matrix.elements);
gl.uniformMatrix4fv(this.uniforms.viewMatrix, false, camera.matrixWorldInverse.elements);

View File

@ -56,7 +56,9 @@ SphereTileCreator.prototype.fork = function (x, y, z) {
this.fork(x * 2, y * 2 + 1, z + 1);
this.fork(x * 2 + 1, y * 2 + 1, z + 1);
} else {
// if (tile.x === 1 && tile.y === 0 && tile.z === 1) {
this.tiles.push(tile);
// }
}
};
@ -68,7 +70,7 @@ SphereTileCreator.prototype.canFork = function () {
var xyz = new THREE.Vector3();
return function (tile) {
if (tile.z <= 1) {
if (tile.z < 1) {
return true;
}

View File

@ -23,10 +23,11 @@ function Tile(x = 0, y = 0, z = 0) {
this._aabb.getCenter(this._center);
// 顶点
this._p1 = MathUtils._lonlatToXYZ(lonlat.set(this._aabb.min.x, this._aabb.min.y, 0));
this._p2 = MathUtils._lonlatToXYZ(lonlat.set(this._aabb.max.x, this._aabb.min.y, 0));
this._p3 = MathUtils._lonlatToXYZ(lonlat.set(this._aabb.max.x, this._aabb.max.y, 0));
this._p4 = MathUtils._lonlatToXYZ(lonlat.set(this._aabb.min.x, this._aabb.max.y, 0));
this._p0 = MathUtils._lonlatToXYZ(lonlat.set(this._center.x, this._center.y, 0)); // 中心点
this._p1 = MathUtils._lonlatToXYZ(lonlat.set(this._aabb.min.x, this._aabb.min.y, 0)); // 左下
this._p2 = MathUtils._lonlatToXYZ(lonlat.set(this._aabb.max.x, this._aabb.min.y, 0)); // 右下
this._p3 = MathUtils._lonlatToXYZ(lonlat.set(this._aabb.max.x, this._aabb.max.y, 0)); // 右上
this._p4 = MathUtils._lonlatToXYZ(lonlat.set(this._aabb.min.x, this._aabb.max.y, 0)); // 左上
}
/**