平面。

This commit is contained in:
tengge1 2019-03-29 19:58:32 +08:00
parent 57641bdb57
commit e42ebb54a3
3 changed files with 8 additions and 9 deletions

View File

@ -28,10 +28,13 @@ TiledLayerRenderer.prototype.render = function (layer) {
var alt = this.globe.alt;
this.mesh.material.length = 0;
this.mesh.geometry.groups.length = 0;
this.creator.get(lon, lat, alt).forEach(n => {
this.creator.get(lon, lat, alt).forEach((n, i) => {
if (n.material) {
n.material.group.materialIndex = i;
this.mesh.material.push(n.material);
this.mesh.geometry.groups.push(n.material.group);
}
});
};

View File

@ -4,16 +4,10 @@ import WGS84 from '../../core/WGS84';
* 瓦片几何体
*/
function TiledGeometry() {
THREE.SphereBufferGeometry.call(this, WGS84.a, 16, 16);
this.groups = [{
start: 0,
count: 1440,
materialIndex: 0
}];
THREE.PlaneBufferGeometry.call(this, WGS84.a, WGS84.a);
}
TiledGeometry.prototype = Object.create(THREE.SphereBufferGeometry.prototype);
TiledGeometry.prototype = Object.create(THREE.PlaneBufferGeometry.prototype);
TiledGeometry.prototype.constructor = TiledGeometry;
export default TiledGeometry;

View File

@ -33,6 +33,8 @@ function TiledMaterial(x, y, z) {
value: new THREE.TextureLoader().load((new BingTileSystem()).tileXYToUrl(x, y, z))
}
};
this.group = { start: 0, count: 6, materialIndex: 0 };
}
TiledMaterial.prototype = Object.create(THREE.ShaderMaterial.prototype);