mirror of https://gitee.com/antv-l7/antv-l7
fix: 修复 option 错误、shader 路径错误 (#1235)
* feat: 在点图层中去除 global 的耦合 * style: lint style * fix: 修复更新 style 的同时更新了 option 带来的问题 * style: lint style * feat: 拆除 arc3d 地球模式和普通模式的耦合 * style: lint style * fix: 修复 earthExtrude shader 路径错误、option 更新错误 * style: lint style
This commit is contained in:
parent
f05073fb07
commit
aad31d37bb
|
@ -246,6 +246,13 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
|||
public updateLayerConfig(
|
||||
configToUpdate: Partial<ILayerConfig | ChildLayerStyleOptions>,
|
||||
) {
|
||||
// 同步 rawConfig
|
||||
Object.keys(configToUpdate).map((key) => {
|
||||
if (key in this.rawConfig) {
|
||||
// @ts-ignore
|
||||
this.rawConfig[key] = configToUpdate[key];
|
||||
}
|
||||
});
|
||||
if (!this.inited) {
|
||||
this.needUpdateConfig = {
|
||||
...this.needUpdateConfig,
|
||||
|
@ -635,13 +642,12 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
|||
);
|
||||
}
|
||||
|
||||
// this.rawConfig = {
|
||||
// ...this.rawConfig,
|
||||
// ...rest,
|
||||
// };
|
||||
this.rawConfig = {
|
||||
...this.rawConfig,
|
||||
...rest,
|
||||
};
|
||||
if (this.container) {
|
||||
// this.updateLayerConfig(this.rawConfig);
|
||||
this.updateLayerConfig(rest);
|
||||
this.updateLayerConfig(this.rawConfig);
|
||||
this.styleNeedUpdate = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ import { IPointLayerStyleOptions } from '../../core/interface';
|
|||
import { PointExtrudeTriangulation } from '../../core/triangulation';
|
||||
import { lglt2xyz } from '../../earth/utils';
|
||||
import { calculateCentroid } from '../../utils/geo';
|
||||
import pointExtrudeFrag from '../shaders/earth/extrude/extrude_frag.glsl';
|
||||
import pointExtrudeVert from '../shaders/earth/extrude/extrude_vert.glsl';
|
||||
import pointExtrudeFrag from '../shaders/earth/extrude_frag.glsl';
|
||||
import pointExtrudeVert from '../shaders/earth/extrude_vert.glsl';
|
||||
|
||||
export default class ExtrudeModel extends BaseModel {
|
||||
private raiseCount: number = 0;
|
||||
|
@ -162,8 +162,6 @@ export default class ExtrudeModel extends BaseModel {
|
|||
this.dataTexture?.destroy();
|
||||
}
|
||||
protected registerBuiltinAttributes() {
|
||||
// TODO: 判断当前的点图层的模型是普通地图模式还是地球模式
|
||||
const isGlobel = this.mapService.version === 'GLOBEL';
|
||||
// point layer size;
|
||||
this.styleAttributeService.registerStyleAttribute({
|
||||
name: 'size',
|
||||
|
@ -239,16 +237,11 @@ export default class ExtrudeModel extends BaseModel {
|
|||
size: 3,
|
||||
update: (feature: IEncodeFeature, featureIdx: number) => {
|
||||
const coordinates = calculateCentroid(feature.coordinates);
|
||||
if (isGlobel) {
|
||||
// TODO: 在地球模式下需要将传入 shader 的经纬度转化成对应的 xyz 坐标
|
||||
return lglt2xyz([coordinates[0], coordinates[1]]) as [
|
||||
number,
|
||||
number,
|
||||
number,
|
||||
];
|
||||
} else {
|
||||
return [coordinates[0], coordinates[1], 0];
|
||||
}
|
||||
return lglt2xyz([coordinates[0], coordinates[1]]) as [
|
||||
number,
|
||||
number,
|
||||
number,
|
||||
];
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -10,7 +10,6 @@ import { isNumber } from 'lodash';
|
|||
import BaseModel from '../../core/BaseModel';
|
||||
import { IPointLayerStyleOptions } from '../../core/interface';
|
||||
import { PointExtrudeTriangulation } from '../../core/triangulation';
|
||||
import { lglt2xyz } from '../../earth/utils';
|
||||
import { calculateCentroid } from '../../utils/geo';
|
||||
import pointExtrudeFrag from '../shaders/extrude/extrude_frag.glsl';
|
||||
import pointExtrudeVert from '../shaders/extrude/extrude_vert.glsl';
|
||||
|
@ -103,7 +102,6 @@ export default class ExtrudeModel extends BaseModel {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
// 圆柱体的拾取高亮是否要计算光照
|
||||
u_pickLight: Number(pickLight),
|
||||
|
@ -162,8 +160,6 @@ export default class ExtrudeModel extends BaseModel {
|
|||
this.dataTexture?.destroy();
|
||||
}
|
||||
protected registerBuiltinAttributes() {
|
||||
// TODO: 判断当前的点图层的模型是普通地图模式还是地球模式
|
||||
const isGlobel = this.mapService.version === 'GLOBEL';
|
||||
// point layer size;
|
||||
this.styleAttributeService.registerStyleAttribute({
|
||||
name: 'size',
|
||||
|
@ -239,16 +235,7 @@ export default class ExtrudeModel extends BaseModel {
|
|||
size: 3,
|
||||
update: (feature: IEncodeFeature, featureIdx: number) => {
|
||||
const coordinates = calculateCentroid(feature.coordinates);
|
||||
if (isGlobel) {
|
||||
// TODO: 在地球模式下需要将传入 shader 的经纬度转化成对应的 xyz 坐标
|
||||
return lglt2xyz([coordinates[0], coordinates[1]]) as [
|
||||
number,
|
||||
number,
|
||||
number,
|
||||
];
|
||||
} else {
|
||||
return [coordinates[0], coordinates[1], 0];
|
||||
}
|
||||
return [coordinates[0], coordinates[1], 0];
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue