chore: fix spelling mistake (#1344)

* fix: 修复 featureScale 错误

* style: lint style

* fix: remove featureScalePlugin async

* chore: fix spelling mistake

* style: lint style

Co-authored-by: shihui <yiqianyao.yqy@alibaba-inc.com>
This commit is contained in:
YiQianYao 2022-09-19 17:19:13 +08:00 committed by GitHub
parent 9bf6a17d88
commit c95f70fa92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
68 changed files with 182 additions and 354 deletions

View File

@ -25,7 +25,7 @@ export default () => {
)
.shape('base')
.style({
globelOtions: {
globalOptions: {
ambientRatio: 0.6, // 环境光
diffuseRatio: 0.4, // 漫反射
specularRatio: 0.1, // 高光反射
@ -34,7 +34,6 @@ export default () => {
},
})
.animate(true);
// earthlayer.setEarthTime(4.0)
const atomLayer = new EarthLayer()
.color('#2E8AE6')

View File

@ -123,7 +123,7 @@ export interface ILegendClassificaItem {
// 图层图例
export type LegendItems = ILegendSegmentItem[] | ILegendClassificaItem[];
export interface IAttrubuteAndElements {
export interface IAttributeAndElements {
attributes: any;
elements: any;
}
@ -318,7 +318,7 @@ export interface ILayer {
threeRenderService?: any;
getShaderPickStat: () => boolean;
updateModelData(data: IAttrubuteAndElements): void;
updateModelData(data: IAttributeAndElements): void;
addMaskLayer(maskLayer: ILayer): void;
removeMaskLayer(maskLayer: ILayer): void;
@ -341,7 +341,7 @@ export interface ILayer {
options: ILayerModelInitializationOptions &
Partial<IModelInitializationOptions>,
): Promise<IModel>;
createAttrubutes(
createAttributes(
options: ILayerModelInitializationOptions &
Partial<IModelInitializationOptions>,
): {
@ -577,7 +577,7 @@ export interface ILayerConfig {
/**
*
*/
globelOtions: any;
globalOptions: any;
/**
* layer point text iconfont
*/

View File

@ -165,7 +165,6 @@ export default class BillBoardModel extends BaseModel {
descriptor: {
name: 'a_Extrude',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -187,14 +186,12 @@ export default class BillBoardModel extends BaseModel {
},
},
});
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'uv',
type: AttributeType.Attribute,
descriptor: {
name: 'a_Uv',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -204,7 +201,6 @@ export default class BillBoardModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[2], vertex[3]];
},

View File

@ -1,7 +1,7 @@
import {
AttributeType,
gl,
IAttrubuteAndElements,
IAttributeAndElements,
IEncodeFeature,
IModel,
IModelUniform,
@ -267,10 +267,10 @@ export default class PlaneModel extends BaseModel {
const gridY1 = gridY + 1;
const widthStep = imgWidth / gridX;
const heihgtStep = imgHeight / gridY;
const heightStep = imgHeight / gridY;
for (let iy = 0; iy < gridY1; iy++) {
const imgIndexY = Math.floor(iy * heihgtStep);
const imgIndexY = Math.floor(iy * heightStep);
const imgLen = imgIndexY * imgWidth;
for (let ix = 0; ix < gridX1; ix++) {
@ -297,7 +297,7 @@ export default class PlaneModel extends BaseModel {
};
},
);
this.layer.updateModelData(modelData as IAttrubuteAndElements);
this.layer.updateModelData(modelData as IAttributeAndElements);
this.layerService.throttleRenderLayers();
}
@ -386,7 +386,6 @@ export default class PlaneModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[3], vertex[4]];
},

View File

@ -67,7 +67,6 @@ export default class SpriteModel extends BaseModel {
spriteBottom = -100000,
} = this.layer.getLayerConfig() as IGeometryLayerStyleOptions;
const updateZ = this.spriteUpdate;
// const bottomZ = -100000;
const bottomZ = spriteBottom;
const topZ = this.spriteTop;
@ -94,7 +93,7 @@ export default class SpriteModel extends BaseModel {
public updateModel = () => {
// @ts-ignore
const attributes = this.layer.createAttrubutes({
const attributes = this.layer.createAttributes({
triangulation: this.planeGeometryUpdateTriangulation,
});
this.layer.models.map((m) => {

View File

@ -4,7 +4,7 @@ import {
BlendType,
IActiveOption,
IAnimateOption,
IAttrubuteAndElements,
IAttributeAndElements,
ICameraService,
ICoordinateSystemService,
IDataState,
@ -151,9 +151,6 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
@lazyInject(TYPES.IGlobalConfigService)
protected readonly configService: IGlobalConfigService;
// @lazyInject(TYPES.IShaderModuleService)
// protected readonly shaderModuleService: IShaderModuleService;
protected shaderModuleService: IShaderModuleService;
protected cameraService: ICameraService;
@ -191,8 +188,6 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
private encodedData: IEncodeFeature[];
private configSchema: object;
private currentPickId: number | null = null;
protected rawConfig: Partial<ILayerConfig & ChildLayerStyleOptions>;
@ -214,12 +209,12 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
private animateStartTime: number;
private aniamateStatus: boolean = false;
private animateStatus: boolean = false;
// Tip: layer 保底颜色
private bottomColor = 'rgba(0, 0, 0, 0)';
private isDestroied: boolean = false;
private isDestroyed: boolean = false;
// private pickingPassRender: IPass<'pixelPicking'>;
@ -304,11 +299,6 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
}
public addPlugin(plugin: ILayerPlugin): ILayer {
// TODO: 控制插件注册顺序
// @example:
// pointLayer.addPlugin(new MyCustomPlugin(), {
// before: 'L7BuiltinPlugin'
// });
this.plugins.push(plugin);
return this;
}
@ -428,7 +418,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
return this;
}
public updateModelData(data: IAttrubuteAndElements) {
public updateModelData(data: IAttributeAndElements) {
if (data.attributes && data.elements) {
this.models.map((m) => {
m.updateAttributesAndElements(data.attributes, data.elements);
@ -488,7 +478,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
const { animateOption } = this.getLayerConfig();
if (animateOption?.enable) {
this.layerService.startAnimate();
this.aniamateStatus = true;
this.animateStatus = true;
}
}
public color(
@ -583,7 +573,6 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
this.updateLayerConfig({
animateOption: rawAnimate,
});
// this.animateOptions = options;
return this;
}
@ -964,7 +953,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
}
public destroy(refresh = true) {
if (this.isDestroied) {
if (this.isDestroyed) {
return;
}
@ -1010,7 +999,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
// 解绑图层容器中的服务
// this.container.unbind(TYPES.IStyleAttributeService);
this.isDestroied = true;
this.isDestroyed = true;
}
public clear() {
this.styleAttributeService.clearAllAttributes();
@ -1194,7 +1183,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
triangulation,
segmentNumber,
);
const modeloptions = {
const modelOptions = {
attributes,
uniforms,
fs,
@ -1204,16 +1193,16 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
...rest,
};
if (count) {
modeloptions.count = count;
modelOptions.count = count;
}
const m = createModel(modeloptions);
const m = createModel(modelOptions);
resolve(m);
}
});
});
}
public createAttrubutes(
public createAttributes(
options: ILayerModelInitializationOptions &
Partial<IModelInitializationOptions>,
) {
@ -1233,9 +1222,9 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
this.animateStartTime = this.layerService.clock.getElapsedTime();
}
public stopAnimate() {
if (this.aniamateStatus) {
if (this.animateStatus) {
this.layerService.stopAnimate();
this.aniamateStatus = false;
this.animateStatus = false;
this.updateLayerConfig({
animateOption: {
enable: false,

View File

@ -81,7 +81,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
protected cellLength: number; // 单个 cell 的长度
protected cellProperties: ICellProperty[]; // 需要进行数据映射的属性集合
protected cellTypeLayout: number[];
protected stylePropertyesExist: {
protected stylePropertiesExist: {
// 记录 style 属性是否存在的中间变量
hasThetaOffset: number;
hasOpacity: number;
@ -164,7 +164,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
stroke: undefined,
offsets: undefined,
};
this.stylePropertyesExist = {
this.stylePropertiesExist = {
hasThetaOffset: 0,
hasOpacity: 0,
hasStrokeOpacity: 0,
@ -196,7 +196,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
public clearLastCalRes() {
this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合
this.cellLength = 0; // 清空上一次计算的 cell 的长度
this.stylePropertyesExist = {
this.stylePropertiesExist = {
// 全量清空上一次是否需要对 style 属性进行数据映射的判断
hasThetaOffset: 0,
hasOpacity: 0,
@ -216,13 +216,13 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
0.0,
0.0,
// 1
this.stylePropertyesExist.hasOpacity, // cell 中是否存在 opacity
this.stylePropertyesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity
this.stylePropertyesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth
this.stylePropertyesExist.hasStroke, // cell 中是否存在 stroke
this.stylePropertiesExist.hasOpacity, // cell 中是否存在 opacity
this.stylePropertiesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity
this.stylePropertiesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth
this.stylePropertiesExist.hasStroke, // cell 中是否存在 stroke
// 2
this.stylePropertyesExist.hasOffsets, // cell 中是否存在 offsets
this.stylePropertyesExist.hasThetaOffset, // cell 中是否存在 thetaOffset
this.stylePropertiesExist.hasOffsets, // cell 中是否存在 offsets
this.stylePropertiesExist.hasThetaOffset, // cell 中是否存在 thetaOffset
0.0,
0.0,
// 3
@ -305,7 +305,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
* @param options
*/
public judgeStyleAttributes(options: {
// TODO: 目前 thetaOffset 只有 lineLayer/arc 使用
// Tip: 目前 thetaOffset 只有 lineLayer/arc 使用
thetaOffset?: styleSingle;
opacity?: styleSingle;
strokeOpacity?: styleSingle;
@ -318,7 +318,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
if (options.opacity !== undefined && !isNumber(options.opacity)) {
// 数据映射
this.cellProperties.push({ attr: 'opacity', count: 1 });
this.stylePropertyesExist.hasOpacity = 1;
this.stylePropertiesExist.hasOpacity = 1;
this.cellLength += 1;
}
@ -328,21 +328,21 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
) {
// 数据映射
this.cellProperties.push({ attr: 'strokeOpacity', count: 1 });
this.stylePropertyesExist.hasStrokeOpacity = 1;
this.stylePropertiesExist.hasStrokeOpacity = 1;
this.cellLength += 1;
}
if (options.strokeWidth !== undefined && !isNumber(options.strokeWidth)) {
// 数据映射
this.cellProperties.push({ attr: 'strokeWidth', count: 1 });
this.stylePropertyesExist.hasStrokeWidth = 1;
this.stylePropertiesExist.hasStrokeWidth = 1;
this.cellLength += 1;
}
if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {
// 数据映射
this.cellProperties.push({ attr: 'stroke', count: 4 });
this.stylePropertyesExist.hasStroke = 1;
this.stylePropertiesExist.hasStroke = 1;
this.cellLength += 4;
}
@ -352,17 +352,16 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
) {
// 数据映射
this.cellProperties.push({ attr: 'offsets', count: 2 });
this.stylePropertyesExist.hasOffsets = 1;
this.stylePropertiesExist.hasOffsets = 1;
this.cellLength += 2;
}
if (options.thetaOffset !== undefined && !isNumber(options.thetaOffset)) {
// 数据映射
this.cellProperties.push({ attr: 'thetaOffset', count: 1 });
this.stylePropertyesExist.hasThetaOffset = 1;
this.stylePropertiesExist.hasThetaOffset = 1;
this.cellLength += 1;
}
// console.log('this.cellLength', this.cellLength)
}
/**

View File

@ -11,7 +11,7 @@ import BaseModel from '../../core/BaseModel';
import { earthTriangulation } from '../../core/triangulation';
import atmoSphereFrag from '../shaders/atmosphere_frag.glsl';
import atmoSphereVert from '../shaders/atmosphere_vert.glsl';
interface IAtmoLayerStyleOptions {
interface IAtmoSphereLayerStyleOptions {
opacity: number;
}
@ -19,7 +19,7 @@ export default class EarthAtomSphereModel extends BaseModel {
public getUninforms(): IModelUniform {
const {
opacity = 1,
} = this.layer.getLayerConfig() as IAtmoLayerStyleOptions;
} = this.layer.getLayerConfig() as IAtmoSphereLayerStyleOptions;
return {
u_opacity: isNumber(opacity) ? opacity : 1.0,
};
@ -38,7 +38,7 @@ export default class EarthAtomSphereModel extends BaseModel {
this.layer.zIndex = -997;
this.layer
.buildLayerModel({
moduleName: 'earthAtmo',
moduleName: 'earthAtmoSphere',
vertexShader: atmoSphereVert,
fragmentShader: atmoSphereFrag,
triangulation: earthTriangulation,
@ -62,7 +62,6 @@ export default class EarthAtomSphereModel extends BaseModel {
descriptor: {
name: 'a_Size',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -70,9 +69,6 @@ export default class EarthAtomSphereModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 1 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
@ -86,7 +82,6 @@ export default class EarthAtomSphereModel extends BaseModel {
descriptor: {
name: 'a_Normal',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.STATIC_DRAW,
data: [],
type: gl.FLOAT,
@ -110,7 +105,6 @@ export default class EarthAtomSphereModel extends BaseModel {
descriptor: {
name: 'a_Uv',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -120,7 +114,6 @@ export default class EarthAtomSphereModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[3], vertex[4]];
},

View File

@ -25,7 +25,7 @@ export default class BaseEarthModel extends BaseModel {
);
public getUninforms(): IModelUniform {
const { animateOption, globelOtions } = this.layer.getLayerConfig();
const { animateOption, globalOptions } = this.layer.getLayerConfig();
if (animateOption?.enable) {
// @ts-ignore
// T: rotateY 方法只有在地球模式下存在
@ -40,10 +40,9 @@ export default class BaseEarthModel extends BaseModel {
}
return {
u_ambientRatio: globelOtions?.ambientRatio || 0.6, // 环境光
u_diffuseRatio: globelOtions?.diffuseRatio || 0.4, // 漫反射
u_specularRatio: globelOtions?.specularRatio || 0.1, // 高光反射
// u_sunLight: [120, 120, 120],
u_ambientRatio: globalOptions?.ambientRatio || 0.6, // 环境光
u_diffuseRatio: globalOptions?.diffuseRatio || 0.4, // 漫反射
u_specularRatio: globalOptions?.specularRatio || 0.1, // 高光反射
u_sunLight: [this.sunX, this.sunY, this.sunZ],
u_texture: this.texture,
@ -61,9 +60,9 @@ export default class BaseEarthModel extends BaseModel {
}
public initModels(callbackModel: (models: IModel[]) => void) {
const { globelOtions } = this.layer.getLayerConfig();
if (globelOtions?.earthTime !== undefined) {
this.setEarthTime(globelOtions.earthTime);
const { globalOptions } = this.layer.getLayerConfig();
if (globalOptions?.earthTime !== undefined) {
this.setEarthTime(globalOptions.earthTime);
}
const source = this.layer.getSource();
@ -89,7 +88,7 @@ export default class BaseEarthModel extends BaseModel {
}
public buildModels(callbackModel: (models: IModel[]) => void) {
// TODO: 调整图层的绘制顺序 地球大气层
// Tip: 调整图层的绘制顺序 地球大气层
this.layer.zIndex = -998;
this.layer
@ -111,14 +110,12 @@ export default class BaseEarthModel extends BaseModel {
}
protected registerBuiltinAttributes() {
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'size',
type: AttributeType.Attribute,
descriptor: {
name: 'a_Size',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -126,9 +123,6 @@ export default class BaseEarthModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 1 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
@ -142,7 +136,6 @@ export default class BaseEarthModel extends BaseModel {
descriptor: {
name: 'a_Normal',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.STATIC_DRAW,
data: [],
type: gl.FLOAT,
@ -176,7 +169,6 @@ export default class BaseEarthModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[3], vertex[4]];
},

View File

@ -34,7 +34,7 @@ export default class EarthBloomSphereModel extends BaseModel {
}
public buildModels(callbackModel: (models: IModel[]) => void) {
// TODO: 调整图层的绘制顺序,让它保持在地球后面(减少锯齿现象)
// Tip: 调整图层的绘制顺序,让它保持在地球后面(减少锯齿现象)
this.layer.zIndex = -999;
this.layer
.buildLayerModel({
@ -55,14 +55,12 @@ export default class EarthBloomSphereModel extends BaseModel {
}
protected registerBuiltinAttributes() {
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'size',
type: AttributeType.Attribute,
descriptor: {
name: 'a_Size',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -70,9 +68,6 @@ export default class EarthBloomSphereModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 1 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
@ -86,7 +81,6 @@ export default class EarthBloomSphereModel extends BaseModel {
descriptor: {
name: 'a_Normal',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.STATIC_DRAW,
data: [],
type: gl.FLOAT,
@ -110,7 +104,6 @@ export default class EarthBloomSphereModel extends BaseModel {
descriptor: {
name: 'a_Uv',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -120,7 +113,6 @@ export default class EarthBloomSphereModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[3], vertex[4]];
},

View File

@ -1,4 +1,4 @@
import { IAttrubuteAndElements } from '@antv/l7-core';
import { IAttributeAndElements } from '@antv/l7-core';
import BaseLayer from '../core/BaseLayer';
import { IHeatMapLayerStyleOptions } from '../core/interface';
import HeatMapModels, { HeatMapModelType } from './models';
@ -31,8 +31,6 @@ export default class HeatMapLayer extends BaseLayer<IHeatMapLayerStyleOptions> {
}
if (this.layerModelNeedUpdate) {
this.layerModel.buildModels((models) => (this.models = models));
// @ts-ignore
// this.models = this.layerModel.buildModels();
this.layerModelNeedUpdate = false;
}
this.models.forEach((model) =>
@ -43,7 +41,7 @@ export default class HeatMapLayer extends BaseLayer<IHeatMapLayerStyleOptions> {
return this;
}
public updateModelData(data: IAttrubuteAndElements) {
public updateModelData(data: IAttributeAndElements) {
if (data.attributes && data.elements) {
this.models[0].updateAttributesAndElements(
data.attributes,

View File

@ -63,14 +63,12 @@ export default class GridModel extends BaseModel {
descriptor: {
name: 'a_Pos',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
},
size: 3,
update: (feature: IEncodeFeature, featureIdx: number) => {
// const coordinates = feature.coordinates as number[];
update: (feature: IEncodeFeature) => {
const coordinates = (feature.version === 'GAODE2.x'
? feature.originCoordinates
: feature.coordinates) as number[];

View File

@ -58,14 +58,12 @@ export default class Grid3DModel extends BaseModel {
});
}
protected registerBuiltinAttributes() {
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'size',
type: AttributeType.Attribute,
descriptor: {
name: 'a_Size',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -73,9 +71,6 @@ export default class Grid3DModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
@ -83,14 +78,12 @@ export default class Grid3DModel extends BaseModel {
},
});
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'normal',
type: AttributeType.Attribute,
descriptor: {
name: 'a_Normal',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.STATIC_DRAW,
data: [],
type: gl.FLOAT,
@ -113,18 +106,15 @@ export default class Grid3DModel extends BaseModel {
descriptor: {
name: 'a_Pos',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
},
size: 3,
update: (feature: IEncodeFeature, featureIdx: number) => {
update: (feature: IEncodeFeature) => {
const coordinates = (feature.version === 'GAODE2.x'
? feature.originCoordinates
: feature.coordinates) as number[];
// const coordinates = feature.coordinates as number[];
// const coordinates = feature.originCoordinates as number[];
return [coordinates[0], coordinates[1], 0];
},
},

View File

@ -110,7 +110,6 @@ export default class HeatMapModel extends BaseModel {
descriptor: {
name: 'a_Dir',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -120,14 +119,12 @@ export default class HeatMapModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[3], vertex[4]];
},
},
});
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'size',
type: AttributeType.Attribute,
@ -142,9 +139,6 @@ export default class HeatMapModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 1 } = feature;
return [size as number];
@ -226,7 +220,6 @@ export default class HeatMapModel extends BaseModel {
enable: false,
},
blend: this.getBlend(),
// count: 6,
elements: createElements({
data: [0, 2, 1, 2, 3, 1],
type: gl.UNSIGNED_INT,

View File

@ -65,19 +65,15 @@ export default class HexagonModel extends BaseModel {
descriptor: {
name: 'a_Pos',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
},
size: 3,
update: (feature: IEncodeFeature, featureIdx: number) => {
// const coordinates = (feature.verison==='GAODE2.x'?feature.originoordinates:feature.coordinates) as number[];
update: (feature: IEncodeFeature) => {
const coordinates = (feature.version === 'GAODE2.x'
? feature.originCoordinates
: feature.coordinates) as number[];
// const coordinates = feature.coordinates as number[];
// const coordinates = feature.originCoordinates as number[];
return [coordinates[0], coordinates[1], 0];
},
},

View File

@ -1,5 +1,3 @@
// @ts-ignore
export function heatMap3DTriangulation(width: number, height: number) {
const indices = [];
const vertices = [];

View File

@ -35,7 +35,7 @@ export default class ImageDataModel extends BaseModel {
} = this.layer.getLayerConfig() as IImageLayerStyleOptions;
if (!isEqual(this.rampColors, rampColors)) {
this.updateColorTexure();
this.updateColorTexture();
this.rampColors = rampColors;
}
return {
@ -156,7 +156,7 @@ export default class ImageDataModel extends BaseModel {
});
}
private updateColorTexure() {
private updateColorTexture() {
const { createTexture2D } = this.rendererService;
const {
rampColors,

View File

@ -111,14 +111,12 @@ export default class ImageModel extends BaseModel {
}
protected registerBuiltinAttributes() {
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'uv',
type: AttributeType.Attribute,
descriptor: {
name: 'a_Uv',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -128,7 +126,6 @@ export default class ImageModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[3], vertex[4]];
},

View File

@ -124,7 +124,7 @@ export default class ArcModel extends BaseModel {
public getAnimateUniforms(): IModelUniform {
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
return {
u_aimate: this.animateOption2Array(animateOption as IAnimateOption),
u_animate: this.animateOption2Array(animateOption as IAnimateOption),
u_time: this.layer.getLayerAnimateTime(),
};
}
@ -201,7 +201,6 @@ export default class ArcModel extends BaseModel {
}
protected registerBuiltinAttributes() {
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'size',
type: AttributeType.Attribute,
@ -216,9 +215,6 @@ export default class ArcModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 1 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
@ -241,7 +237,6 @@ export default class ArcModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[3], vertex[4], vertex[5], vertex[6]];
},
@ -262,9 +257,6 @@ export default class ArcModel extends BaseModel {
size: 2,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const iconMap = this.iconService.getIconMap();
const { texture } = feature;

View File

@ -118,7 +118,7 @@ export default class Arc3DModel extends BaseModel {
public getAnimateUniforms(): IModelUniform {
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
return {
u_aimate: this.animateOption2Array(animateOption as IAnimateOption),
u_animate: this.animateOption2Array(animateOption as IAnimateOption),
u_time: this.layer.getLayerAnimateTime(),
};
}
@ -185,7 +185,6 @@ export default class Arc3DModel extends BaseModel {
});
}
protected registerBuiltinAttributes() {
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'size',
type: AttributeType.Attribute,
@ -200,9 +199,6 @@ export default class Arc3DModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 1 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
@ -225,7 +221,6 @@ export default class Arc3DModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[3], vertex[4], vertex[5], vertex[6]];
},
@ -238,7 +233,6 @@ export default class Arc3DModel extends BaseModel {
descriptor: {
name: 'a_iconMapUV',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -246,9 +240,6 @@ export default class Arc3DModel extends BaseModel {
size: 2,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const iconMap = this.iconService.getIconMap();
const { texture } = feature;

View File

@ -118,7 +118,7 @@ export default class Arc3DModel extends BaseModel {
public getAnimateUniforms(): IModelUniform {
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
return {
u_aimate: this.animateOption2Array(animateOption as IAnimateOption),
u_animate: this.animateOption2Array(animateOption as IAnimateOption),
u_time: this.layer.getLayerAnimateTime(),
};
}
@ -185,7 +185,6 @@ export default class Arc3DModel extends BaseModel {
});
}
protected registerBuiltinAttributes() {
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'size',
type: AttributeType.Attribute,
@ -200,9 +199,6 @@ export default class Arc3DModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 1 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
@ -225,7 +221,6 @@ export default class Arc3DModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[3], vertex[4], vertex[5], vertex[6]];
},
@ -238,7 +233,6 @@ export default class Arc3DModel extends BaseModel {
descriptor: {
name: 'a_iconMapUV',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -246,9 +240,6 @@ export default class Arc3DModel extends BaseModel {
size: 2,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const iconMap = this.iconService.getIconMap();
const { texture } = feature;

View File

@ -107,7 +107,7 @@ export default class GreatCircleModel extends BaseModel {
public getAnimateUniforms(): IModelUniform {
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
return {
u_aimate: this.animateOption2Array(animateOption as IAnimateOption),
u_animate: this.animateOption2Array(animateOption as IAnimateOption),
u_time: this.layer.getLayerAnimateTime(),
};
}

View File

@ -146,7 +146,7 @@ export default class LineModel extends BaseModel {
public getAnimateUniforms(): IModelUniform {
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
return {
u_aimate: this.animateOption2Array(animateOption as IAnimateOption),
u_animate: this.animateOption2Array(animateOption as IAnimateOption),
u_time: this.layer.getLayerAnimateTime(),
};
}

View File

@ -157,7 +157,6 @@ export default class LinearLineModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[5]];
},
@ -178,9 +177,6 @@ export default class LinearLineModel extends BaseModel {
size: 2,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 1 } = feature;
return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];
@ -201,7 +197,6 @@ export default class LinearLineModel extends BaseModel {
type: gl.FLOAT,
},
size: 3,
// @ts-ignore
update: (
feature: IEncodeFeature,
featureIdx: number,
@ -230,7 +225,6 @@ export default class LinearLineModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[4]];
},

View File

@ -152,7 +152,6 @@ export default class SimpleLineModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[3]];
},
@ -174,7 +173,6 @@ export default class SimpleLineModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[5]];
},
@ -195,9 +193,6 @@ export default class SimpleLineModel extends BaseModel {
size: 2,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 1 } = feature;
return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];

View File

@ -133,7 +133,6 @@ export default class LineModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[4]];
},

View File

@ -66,7 +66,7 @@ export default class LineWallModel extends BaseModel {
public getAnimateUniforms(): IModelUniform {
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
return {
u_aimate: this.animateOption2Array(animateOption as IAnimateOption),
u_animate: this.animateOption2Array(animateOption as IAnimateOption),
u_time: this.layer.getLayerAnimateTime(),
};
}

View File

@ -9,7 +9,7 @@ varying vec4 v_dash_array;
#pragma include "picking"
uniform float u_time;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ]; // 控制运动
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; // 控制运动
varying mat4 styleMappingMat;
// [animate, duration, interval, trailLength],

View File

@ -7,7 +7,7 @@ attribute vec4 a_Instance;
attribute float a_Size;
uniform mat4 u_ModelMatrix;
uniform float segmentNumber;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
varying vec4 v_color;
varying vec2 v_normal;
@ -98,7 +98,7 @@ void main() {
float total_Distance = pixelDistance(a_Instance.rg, a_Instance.ba);
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);
}
if(u_aimate.x == Animate) {
if(u_animate.x == Animate) {
v_distance_ratio = segmentIndex / segmentNumber;
}
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);

View File

@ -20,7 +20,7 @@ uniform float segmentNumber;
varying vec2 v_iconMapUV;
uniform float u_time;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
varying mat4 styleMappingMat;
@ -42,16 +42,16 @@ void main() {
gl_FragColor.a *=flag;
}
if(u_aimate.x == Animate && u_line_texture != LineTexture) {
animateSpeed = u_time / u_aimate.y;
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + u_time / u_aimate.y);
if(u_animate.x == Animate && u_line_texture != LineTexture) {
animateSpeed = u_time / u_animate.y;
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
// alpha = smoothstep(0., 1., alpha);
alpha = clamp(alpha, 0.0, 1.0);
gl_FragColor.a *= alpha;
// u_aimate
// u_animate
// x enable
// y duration
// z interval
@ -64,8 +64,8 @@ void main() {
float count = styleMappingMat[3].b; // // 贴图在弧线上重复的数量
float time = 0.0;
if(u_aimate.x == Animate) {
time = u_time / u_aimate.y;
if(u_animate.x == Animate) {
time = u_time / u_animate.y;
}
float redioCount = arcRadio * count;
@ -75,9 +75,9 @@ void main() {
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
vec4 pattern = texture2D(u_texture, uv);
if(u_aimate.x == Animate) {
if(u_animate.x == Animate) {
float currentPlane = floor(redioCount - time);
float textureStep = floor(count * u_aimate.z);
float textureStep = floor(count * u_animate.z);
float a = mod(currentPlane, textureStep);
if(a < textureStep - 1.0) {
pattern = vec4(0.0);

View File

@ -13,9 +13,9 @@ uniform float u_global_height: 10;
uniform mat4 u_ModelMatrix;
uniform mat4 u_Mvp;
uniform float segmentNumber;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
varying vec4 v_color;
// varying vec2 v_normal;
uniform float u_line_type: 0.0;
uniform vec4 u_dash_array: [10.0, 5., 0, 0];
varying vec4 v_dash_array;
@ -135,7 +135,6 @@ void main() {
float d_distance_ratio;
if(u_line_type == LineTypeDash) {
d_distance_ratio = segmentIndex / segmentNumber;
// float total_Distance = pixelDistance(a_Instance.rg, a_Instance.ba) / 2.0 * PI;
vec2 s = source;
vec2 t = target;
@ -146,7 +145,7 @@ void main() {
float total_Distance = pixelDistance(s, t) / 2.0 * PI;
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);
}
if(u_aimate.x == Animate) {
if(u_animate.x == Animate) {
d_distance_ratio = segmentIndex / segmentNumber;
}
styleMappingMat[3].g = d_distance_ratio; // 当前点位距离占线总长的比例

View File

@ -11,7 +11,7 @@ varying vec4 v_dash_array;
varying vec4 v_color;
uniform float u_time;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
uniform float u_line_texture;
uniform sampler2D u_texture;
@ -34,10 +34,10 @@ void main() {
gl_FragColor.a *= opacity;
if(u_aimate.x == Animate && u_line_texture != LineTexture) {
animateSpeed = u_time / u_aimate.y;
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + u_time / u_aimate.y);
alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;
if(u_animate.x == Animate && u_line_texture != LineTexture) {
animateSpeed = u_time / u_animate.y;
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
// alpha = smoothstep(0., 1., alpha);
alpha = clamp(alpha, 0.0, 1.0);
gl_FragColor.a *= alpha;
@ -51,8 +51,8 @@ void main() {
float count = styleMappingMat[3].g; // 贴图在弧线上重复的数量
float time = 0.0;
if(u_aimate.x == Animate) {
time = u_time / u_aimate.y;
if(u_animate.x == Animate) {
time = u_time / u_animate.y;
}
float redioCount = arcRadio * count;
@ -62,9 +62,9 @@ void main() {
vec4 pattern = texture2D(u_texture, uv);
if(u_aimate.x == Animate) {
if(u_animate.x == Animate) {
float currentPlane = floor(redioCount - time);
float textureStep = floor(count * u_aimate.z);
float textureStep = floor(count * u_animate.z);
float a = mod(currentPlane, textureStep);
if(a < textureStep - 1.0) {
pattern = vec4(0.0);
@ -85,5 +85,4 @@ void main() {
} else {
gl_FragColor = filterColor(gl_FragColor);
}
// gl_FragColor = filterColor(gl_FragColor);
}

View File

@ -13,7 +13,7 @@ varying float v_distance_ratio;
varying vec4 v_color;
uniform float u_time;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
uniform float u_line_texture: 0.0;
uniform sampler2D u_texture;
@ -58,10 +58,10 @@ void main() {
}
// 设置弧线的动画模式
if(u_aimate.x == Animate) {
animateSpeed = u_time / u_aimate.y;
float alpha =1.0 - fract( mod(1.0- v_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + u_time / u_aimate.y);
alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;
if(u_animate.x == Animate) {
animateSpeed = u_time / u_animate.y;
float alpha =1.0 - fract( mod(1.0- v_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
alpha = smoothstep(0., 1., alpha);
gl_FragColor.a *= alpha;
}
@ -73,7 +73,7 @@ void main() {
float count = styleMappingMat[3].b; // 贴图在弧线上重复的数量
float u = fract(arcRadio * count - animateSpeed * count);
// float u = fract(arcRadio * count - animateSpeed);
if(u_aimate.x == Animate) {
if(u_animate.x == Animate) {
u = gl_FragColor.a/opacity;
}

View File

@ -10,9 +10,8 @@ attribute float a_Size;
uniform mat4 u_ModelMatrix;
uniform mat4 u_Mvp;
uniform float segmentNumber;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
varying vec4 v_color;
// varying vec2 v_normal;
varying float v_distance_ratio;
uniform float u_line_type: 0.0;
@ -172,7 +171,7 @@ void main() {
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;
}
if(u_aimate.x == Animate) {
if(u_animate.x == Animate) {
v_distance_ratio = segmentIndex / segmentNumber;
}

View File

@ -8,7 +8,7 @@ attribute float a_Size;
uniform mat4 u_ModelMatrix;
uniform mat4 u_Mvp;
uniform float segmentNumber;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
varying vec4 v_color;
uniform float u_lineDir: 1.0;
@ -123,7 +123,7 @@ void main() {
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
float d_distance_ratio;
if(u_aimate.x == Animate) {
if(u_animate.x == Animate) {
d_distance_ratio = segmentIndex / segmentNumber;
if(u_lineDir != 1.0) {
d_distance_ratio = 1.0 - d_distance_ratio;

View File

@ -7,7 +7,7 @@ attribute vec4 a_Instance;
attribute float a_Size;
uniform mat4 u_ModelMatrix;
uniform float segmentNumber;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
varying vec4 v_color;
varying vec2 v_normal;
@ -72,7 +72,7 @@ void main() {
float total_Distance = pixelDistance(a_Instance.rg, a_Instance.ba) / 2.0 * PI;
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);
}
if(u_aimate.x == Animate) {
if(u_animate.x == Animate) {
v_distance_ratio = segmentIndex / segmentNumber;
}
vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio), 0.0, 1.0));

View File

@ -19,7 +19,7 @@ varying vec2 v_iconMapUV;
#pragma include "picking"
uniform float u_time;
uniform vec4 u_aimate: [ 1, 2., 1.0, 0.2 ]; // 控制运动
uniform vec4 u_animate: [ 1, 2., 1.0, 0.2 ]; // 控制运动
varying mat4 styleMappingMat;
// [animate, duration, interval, trailLength],
@ -31,10 +31,10 @@ void main() {
// anti-alias
// float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));
gl_FragColor.a *= opacity; // 全局透明度
if(u_aimate.x == Animate) {
animateSpeed = u_time / u_aimate.y;
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + animateSpeed);
alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;
if(u_animate.x == Animate) {
animateSpeed = u_time / u_animate.y;
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
alpha = smoothstep(0., 1., alpha);
gl_FragColor.a *= alpha;
}

View File

@ -15,7 +15,7 @@ attribute vec2 a_DistanceAndIndex;
uniform mat4 u_ModelMatrix;
uniform mat4 u_Mvp;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
uniform float u_icon_step: 100;
uniform float u_heightfixed: 0.0;

View File

@ -6,9 +6,8 @@ uniform float u_blur : 0.9;
varying float v_segmentIndex;
uniform float segmentNumber;
uniform float u_time;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
uniform float u_linearColor: 0;
uniform vec4 u_sourceColor;
@ -27,16 +26,16 @@ void main() {
gl_FragColor.a *= opacity;
if(u_aimate.x == Animate) {
animateSpeed = u_time / u_aimate.y;
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + u_time / u_aimate.y);
if(u_animate.x == Animate) {
animateSpeed = u_time / u_animate.y;
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
// alpha = smoothstep(0., 1., alpha);
alpha = clamp(alpha, 0.0, 1.0);
gl_FragColor.a *= alpha;
// u_aimate
// u_animate
// x enable
// y duration
// z interval

View File

@ -6,6 +6,7 @@ attribute vec3 a_Position;
attribute vec4 a_Instance;
attribute vec4 a_Color;
attribute float a_Size;
attribute vec2 a_iconMapUV;
uniform float u_globel;
uniform float u_globel_radius;
@ -13,23 +14,21 @@ uniform float u_global_height: 10;
uniform mat4 u_ModelMatrix;
uniform mat4 u_Mvp;
uniform float segmentNumber;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
varying vec4 v_color;
// varying vec2 v_normal;
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
uniform float u_line_type: 0.0;
uniform vec4 u_dash_array: [10.0, 5., 0, 0];
varying vec4 v_dash_array;
uniform float u_icon_step: 100;
uniform float u_line_texture: 0.0;
varying float v_segmentIndex;
attribute vec2 a_iconMapUV;
varying vec2 v_iconMapUV;
uniform float u_opacity: 1.0;
varying vec4 v_dash_array;
varying vec4 v_color;
varying float v_segmentIndex;
varying vec2 v_iconMapUV;
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
#pragma include "styleMapping"
#pragma include "styleMappingCalOpacity"
@ -146,7 +145,7 @@ void main() {
float total_Distance = pixelDistance(s, t) / 2.0 * PI;
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);
}
if(u_aimate.x == Animate) {
if(u_animate.x == Animate) {
d_distance_ratio = segmentIndex / segmentNumber;
}
styleMappingMat[3].g = d_distance_ratio; // 当前点位距离占线总长的比例

View File

@ -10,7 +10,7 @@ varying vec4 v_dash_array;
varying vec4 v_color;
uniform float u_time;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
uniform float u_line_texture;
uniform sampler2D u_texture;

View File

@ -12,7 +12,7 @@ uniform float u_opacity : 1.0;
uniform float u_textureBlend;
uniform float u_iconStepCount;
uniform float u_time;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ]; // 控制运动
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; // 控制运动
varying vec2 v_iconMapUV;
varying float v_blur;
@ -35,10 +35,10 @@ void main() {
}
gl_FragColor.a *= opacity; // 全局透明度
if(u_aimate.x == Animate) {
animateSpeed = u_time / u_aimate.y;
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + animateSpeed);
alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;
if(u_animate.x == Animate) {
animateSpeed = u_time / u_animate.y;
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
alpha = smoothstep(0., 1., alpha);
gl_FragColor.a *= alpha;
}

View File

@ -11,7 +11,7 @@ attribute float a_Distance;
uniform mat4 u_ModelMatrix;
uniform mat4 u_Mvp;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
uniform float u_icon_step: 100;
uniform float u_heightfixed;
uniform float u_linearColor: 0;
@ -43,7 +43,7 @@ void main() {
d_texPixelLen *= 10.0;
}
if(u_aimate.x == Animate || u_linearColor == 1.0) {
if(u_animate.x == Animate || u_linearColor == 1.0) {
d_distance_ratio = a_Distance / a_Total_Distance;
}

View File

@ -7,8 +7,8 @@ export default class LayerAnimateStylePlugin implements ILayerPlugin {
public apply(layer: ILayer) {
layer.hooks.beforeRender.tap('LayerAnimateStylePlugin', () => {
// @ts-ignore
const aniamateStatus = layer.aniamateStatus;
aniamateStatus &&
const animateStatus = layer.animateStatus;
animateStatus &&
layer.models.forEach((model: IModel) => {
model.addUniforms({
...layer.layerModel.getAnimateUniforms(),

View File

@ -85,7 +85,7 @@ export default class PointLayer extends BaseLayer<IPointLayerStyleOptions> {
text: {
blend: 'normal',
},
vectorpoint: {},
vectorPoint: {},
tile: {},
tileText: {},
earthFill: {},
@ -97,10 +97,8 @@ export default class PointLayer extends BaseLayer<IPointLayerStyleOptions> {
protected getModelType(): PointType {
const parserType = this.layerSource.getParserType();
if (isVectorTile(parserType)) {
return 'vectorpoint';
return 'vectorPoint';
}
// pointlayer
// 2D、 3d、 shape、image、text、normal、
const layerData = this.getEncodedData();
const { shape2d, shape3d } = this.getLayerConfig();

View File

@ -16,7 +16,7 @@ import pointExtrudeVert from '../shaders/earth/extrude_vert.glsl';
export default class ExtrudeModel extends BaseModel {
private raiseCount: number = 0;
private raiserepeat: number = 0;
private raiseRepeat: number = 0;
public getUninforms() {
const {
animateOption = {
@ -88,14 +88,14 @@ export default class ExtrudeModel extends BaseModel {
useLinearColor = 1;
}
if (this.raiseCount < 1 && this.raiserepeat > 0) {
if (this.raiseCount < 1 && this.raiseRepeat > 0) {
if (animateOption.enable) {
const { speed = 0.01, repeat = false } = animateOption;
const { speed = 0.01 } = animateOption;
this.raiseCount += speed;
if (this.raiseCount >= 1) {
if (this.raiserepeat > 1) {
if (this.raiseRepeat > 1) {
this.raiseCount = 0;
this.raiserepeat--;
this.raiseRepeat--;
} else {
this.raiseCount = 1;
}
@ -109,7 +109,7 @@ export default class ExtrudeModel extends BaseModel {
// 圆柱体是否固定高度
u_heightfixed: Number(heightfixed),
u_r: animateOption.enable && this.raiserepeat > 0 ? this.raiseCount : 1.0,
u_r: animateOption.enable && this.raiseRepeat > 0 ? this.raiseCount : 1.0,
u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
u_cellTypeLayout: this.getCellTypeLayout(),
@ -138,7 +138,7 @@ export default class ExtrudeModel extends BaseModel {
const {
animateOption: { repeat = 1 },
} = this.layer.getLayerConfig() as ILayerConfig;
this.raiserepeat = repeat;
this.raiseRepeat = repeat;
this.layer
.buildLayerModel({
@ -165,14 +165,12 @@ export default class ExtrudeModel extends BaseModel {
this.dataTexture?.destroy();
}
protected registerBuiltinAttributes() {
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'size',
type: AttributeType.Attribute,
descriptor: {
name: 'a_Size',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -180,9 +178,6 @@ export default class ExtrudeModel extends BaseModel {
size: 3,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size } = feature;
if (size) {
@ -232,13 +227,12 @@ export default class ExtrudeModel extends BaseModel {
descriptor: {
name: 'a_Pos',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
},
size: 3,
update: (feature: IEncodeFeature, featureIdx: number) => {
update: (feature: IEncodeFeature) => {
const coordinates = calculateCentroid(feature.coordinates);
return lglt2xyz([coordinates[0], coordinates[1]]) as [
number,

View File

@ -94,7 +94,7 @@ export default class FillModel extends BaseModel {
animateOption = { enable: false },
} = this.layer.getLayerConfig() as ILayerConfig;
return {
u_aimate: this.animateOption2Array(animateOption),
u_animate: this.animateOption2Array(animateOption),
u_time: this.layer.getLayerAnimateTime(),
};
}

View File

@ -15,7 +15,7 @@ import pointExtrudeVert from '../shaders/extrude/extrude_vert.glsl';
export default class ExtrudeModel extends BaseModel {
private raiseCount: number = 0;
private raiserepeat: number = 0;
private raiseRepeat: number = 0;
public getUninforms() {
const {
animateOption = {
@ -87,14 +87,14 @@ export default class ExtrudeModel extends BaseModel {
useLinearColor = 1;
}
if (this.raiseCount < 1 && this.raiserepeat > 0) {
if (this.raiseCount < 1 && this.raiseRepeat > 0) {
if (animateOption.enable) {
const { speed = 0.01, repeat = false } = animateOption;
const { speed = 0.01 } = animateOption;
this.raiseCount += speed;
if (this.raiseCount >= 1) {
if (this.raiserepeat > 1) {
if (this.raiseRepeat > 1) {
this.raiseCount = 0;
this.raiserepeat--;
this.raiseRepeat--;
} else {
this.raiseCount = 1;
}
@ -107,7 +107,7 @@ export default class ExtrudeModel extends BaseModel {
// 圆柱体是否固定高度
u_heightfixed: Number(heightfixed),
u_r: animateOption.enable && this.raiserepeat > 0 ? this.raiseCount : 1.0,
u_r: animateOption.enable && this.raiseRepeat > 0 ? this.raiseCount : 1.0,
u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
u_cellTypeLayout: this.getCellTypeLayout(),
@ -137,7 +137,7 @@ export default class ExtrudeModel extends BaseModel {
depth = true,
animateOption: { repeat = 1 },
} = this.layer.getLayerConfig() as ILayerConfig;
this.raiserepeat = repeat;
this.raiseRepeat = repeat;
this.layer
.buildLayerModel({
@ -173,7 +173,6 @@ export default class ExtrudeModel extends BaseModel {
descriptor: {
name: 'a_Size',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -181,9 +180,6 @@ export default class ExtrudeModel extends BaseModel {
size: 3,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size } = feature;
if (size) {
@ -239,7 +235,7 @@ export default class ExtrudeModel extends BaseModel {
type: gl.FLOAT,
},
size: 3,
update: (feature: IEncodeFeature, featureIdx: number) => {
update: (feature: IEncodeFeature) => {
const coordinates = calculateCentroid(feature.coordinates);
return [coordinates[0], coordinates[1], 0];
},

View File

@ -13,7 +13,6 @@ import { $window, getMask, PointFillTriangulation } from '@antv/l7-utils';
import { isNumber } from 'lodash';
import BaseModel from '../../core/BaseModel';
import { IPointLayerStyleOptions } from '../../core/interface';
// import { PointFillTriangulation } from '../../core/triangulation';
// animate pointLayer shader - support animate
import waveFillFrag from '../shaders/animate/wave_frag.glsl';
// static pointLayer shader - not support animate
@ -24,7 +23,7 @@ import { Version } from '@antv/l7-maps';
export default class FillModel extends BaseModel {
private meter2coord: number = 1;
private meteryScale: number = 1; // 兼容 mapbox
private meterYScale: number = 1; // 兼容 mapbox
private isMeter: boolean = false;
private unit: string = 'l7size';
@ -94,7 +93,7 @@ export default class FillModel extends BaseModel {
u_heightfixed: Number(heightfixed),
u_meter2coord: this.meter2coord,
u_meteryScale: this.meteryScale,
u_meteryScale: this.meterYScale,
u_isMeter: Number(this.isMeter),
u_blur: blur,
@ -116,7 +115,7 @@ export default class FillModel extends BaseModel {
animateOption = { enable: false },
} = this.layer.getLayerConfig() as ILayerConfig;
return {
u_aimate: this.animateOption2Array(animateOption),
u_animate: this.animateOption2Array(animateOption),
u_time: this.layer.getLayerAnimateTime(),
};
}
@ -172,7 +171,7 @@ export default class FillModel extends BaseModel {
this.meter2coord = center[0] - westLnglat.lng;
this.meteryScale = (southLnglat.lat - center[1]) / this.meter2coord;
this.meterYScale = (southLnglat.lat - center[1]) / this.meter2coord;
return;
}
@ -314,9 +313,6 @@ export default class FillModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 5 } = feature;
return Array.isArray(size) ? [size[0]] : [size];
@ -339,9 +335,6 @@ export default class FillModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { shape = 2 } = feature;
const shapeIndex = shape2d.indexOf(shape as string);

View File

@ -243,9 +243,6 @@ export default class FillImageModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { rotate = 0 } = feature;
return Array.isArray(rotate) ? [rotate[0]] : [rotate as number];
@ -266,9 +263,6 @@ export default class FillImageModel extends BaseModel {
size: 2,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const iconMap = this.iconService.getIconMap();
const { shape } = feature;
@ -323,9 +317,6 @@ export default class FillImageModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 5 } = feature;
return Array.isArray(size)
@ -345,8 +336,7 @@ export default class FillImageModel extends BaseModel {
min: 'linear mipmap nearest',
mipmap: true,
});
// this.layer.render();
// TODO: 更新完纹理后在更新的图层的时候需要更新所有的图层
// 更新完纹理后在更新的图层的时候需要更新所有的图层
this.layerService.throttleRenderLayers();
return;
}

View File

@ -135,9 +135,6 @@ export default class ImageModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 5 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
@ -182,7 +179,7 @@ export default class ImageModel extends BaseModel {
min: 'linear mipmap nearest',
mipmap: true,
});
// TODO: 更新完纹理后在更新的图层的时候需要更新所有的图层
// 更新完纹理后在更新的图层的时候需要更新所有的图层
this.layerService.throttleRenderLayers();
return;
}

View File

@ -8,7 +8,7 @@ import FillImageModel from './fillmage';
import IMageModel from './image';
import NormalModel from './normal';
import Radar from './radar';
import SimplePopint from './simplePoint';
import SimplePoint from './simplePoint';
import TextModel from './text';
import TileTextModel from './tileText';
import TileFillModel from './tile';
@ -22,7 +22,7 @@ export type PointType =
| 'simplePoint'
| 'extrude'
| 'text'
| 'vectorpoint'
| 'vectorPoint'
| 'tile'
| 'tileText'
| 'earthFill'
@ -34,10 +34,10 @@ const PointModels: { [key in PointType]: any } = {
radar: Radar,
image: IMageModel,
normal: NormalModel,
simplePoint: SimplePopint,
simplePoint: SimplePoint,
extrude: ExtrudeModel,
text: TextModel,
vectorpoint: PointTileModel,
vectorPoint: PointTileModel,
tile: TileFillModel,
tileText: TileTextModel,
earthFill: EarthFillModel,

View File

@ -73,14 +73,12 @@ export default class NormalModel extends BaseModel {
}
protected registerBuiltinAttributes() {
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'size',
type: AttributeType.Attribute,
descriptor: {
name: 'a_Size',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,

View File

@ -42,7 +42,7 @@ export default class RadarModel extends BaseModel {
animateOption = { enable: false },
} = this.layer.getLayerConfig() as ILayerConfig;
return {
u_aimate: this.animateOption2Array(animateOption),
u_animate: this.animateOption2Array(animateOption),
u_time: this.layer.getLayerAnimateTime(),
};
}

View File

@ -304,14 +304,12 @@ export default class TextModel extends BaseModel {
},
});
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'textUv',
type: AttributeType.Attribute,
descriptor: {
name: 'a_tex',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,

View File

@ -134,7 +134,6 @@ export default class FillModel extends BaseModel {
descriptor: {
name: 'a_Size',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -142,9 +141,6 @@ export default class FillModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 5 } = feature;
return Array.isArray(size)
@ -168,9 +164,6 @@ export default class FillModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { shape = 2 } = feature;
const shape2d = this.layer.getLayerConfig().shape2d as string[];

View File

@ -190,7 +190,6 @@ export default class TextModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[5], vertex[6]];
},
@ -204,7 +203,6 @@ export default class TextModel extends BaseModel {
descriptor: {
name: 'a_Size',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -212,9 +210,6 @@ export default class TextModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 12 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
@ -229,7 +224,6 @@ export default class TextModel extends BaseModel {
descriptor: {
name: 'a_tex',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -239,7 +233,6 @@ export default class TextModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
return [vertex[3], vertex[4]];
},

View File

@ -7,7 +7,7 @@ varying vec4 v_data;
varying vec4 v_color;
varying float v_radius;
uniform float u_time;
uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
#pragma include "sdf_2d"
#pragma include "picking"
@ -51,7 +51,7 @@ void main() {
if(d > 0.5) {
discard;
}
float intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_aimate.z - u_aimate.y * u_time)), 0.0, 1.0);
float intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_animate.z - u_animate.y * u_time)), 0.0, 1.0);
// 根据叠加模式选择效果
if(u_additive > 0.0) {

View File

@ -176,8 +176,6 @@ export default class ExtrudeModel extends BaseModel {
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
normal: number[],
) => {
const lng = vertex[0];
const lat = vertex[1];
@ -185,7 +183,6 @@ export default class ExtrudeModel extends BaseModel {
},
},
});
// point layer size;
this.styleAttributeService.registerStyleAttribute({
name: 'normal',
type: AttributeType.Attribute,
@ -216,7 +213,6 @@ export default class ExtrudeModel extends BaseModel {
descriptor: {
name: 'a_Size',
buffer: {
// give the WebGL driver a hint that this buffer may change
usage: gl.DYNAMIC_DRAW,
data: [],
type: gl.FLOAT,
@ -224,9 +220,6 @@ export default class ExtrudeModel extends BaseModel {
size: 1,
update: (
feature: IEncodeFeature,
featureIdx: number,
vertex: number[],
attributeIdx: number,
) => {
const { size = 10 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];

View File

@ -26,7 +26,7 @@ export default class RasterModel extends BaseModel {
rampColors,
} = this.layer.getLayerConfig() as IRasterLayerStyleOptions;
if (!isEqual(this.rampColors, rampColors)) {
this.updateColorTexure();
this.updateColorTexture();
this.rampColors = rampColors;
}
@ -123,7 +123,7 @@ export default class RasterModel extends BaseModel {
});
}
private updateColorTexure() {
private updateColorTexture() {
const { createTexture2D } = this.rendererService;
const {
rampColors,

View File

@ -64,7 +64,7 @@ const earthlayer = new EarthLayer()
.style({
opacity: 1.0,
radius: 40,
globelOtions: {
globalOptions: {
ambientRatio: 0.6, // 环境光
diffuseRatio: 0.4, // 漫反射
specularRatio: 0.1, // 高光反射
@ -153,7 +153,7 @@ scene.on('loaded', () => {
当用户的 `shape` 参数不被识别时,自动降级为 `base` 类型
- globelOtions: 图层样式
- globalOptions: 图层样式
- ambientRatio: 环境光
- diffuseRatio: 漫反射
- specularRatio: 高光反射
@ -170,7 +170,7 @@ const earthlayer = new EarthLayer()
)
.shape('base')
.style({
globelOtions: {
globalOptions: {
ambientRatio: 0.6, // 环境光
diffuseRatio: 0.4, // 漫反射
specularRatio: 0.1, // 高光反射

View File

@ -80,7 +80,7 @@ layer.on('terrainImageLoaded', () => {
```
[在线案例](/zh/examples/geometry/geometry#terrain)
### updateModelData(data: IAttrubuteAndElements)
### updateModelData(data: IAttributeAndElements)
- data 是通过 createModelData 方法生成的图层的标准模型数据。
我们通过这个方法可以实时更新图层的模型数据。

View File

@ -20,7 +20,7 @@ const earthlayer = new EarthLayer()
.color('#2E8AE6')
.shape('fill')
.style({
globelOtions: {
globalOptions: {
ambientRatio: 0.6, // 环境光
diffuseRatio: 0.4, // 漫反射
specularRatio: 0.1 // 高光反射

View File

@ -398,7 +398,7 @@ export default class ScaleComponent extends React.Component {
)
.shape('base')
.style({
globelOtions: {
globalOptions: {
ambientRatio: 0.6, // 环境光
diffuseRatio: 0.4, // 漫反射
specularRatio: 0.1, // 高光反射

View File

@ -74,7 +74,7 @@ export default class ScaleComponent extends React.Component {
)
.shape('base')
.style({
globelOtions: {
globalOptions: {
ambientRatio: 0.6, // 环境光
diffuseRatio: 0.4, // 漫反射
specularRatio: 0.1, // 高光反射

View File

@ -47,7 +47,7 @@ export default class Demo extends React.Component {
)
.shape('base')
.style({
globelOtions: {
globalOptions: {
ambientRatio: 0.6, // 环境光
diffuseRatio: 0.4, // 漫反射
specularRatio: 0.1, // 高光反射

View File

@ -60,7 +60,7 @@ export default class Demo extends React.Component {
)
.shape('base')
.style({
globelOtions: {
globalOptions: {
ambientRatio: 0.6, // 环境光
diffuseRatio: 0.4, // 漫反射
specularRatio: 0.1, // 高光反射

View File

@ -16,7 +16,7 @@ export default class Demo extends React.Component {
}),
});
const pointlayer = new PointLayer({})
const pointLayer = new PointLayer({})
.source(
[
{ lng: 121.61865234375, lat: 25.29437116258816 },
@ -49,7 +49,7 @@ export default class Demo extends React.Component {
.color('#f00')
.size(20)
.active(true);
const earthlayer = new EarthLayer()
const earthLayer = new EarthLayer()
.source(
'https://gw.alipayobjects.com/mdn/rms_23a451/afts/img/A*3-3NSpqRqUoAAAAAAAAAAAAAARQnAQ',
{
@ -60,7 +60,7 @@ export default class Demo extends React.Component {
)
.shape('base')
.style({
globelOtions: {
globalOptions: {
ambientRatio: 0.6, // 环境光
diffuseRatio: 0.4, // 漫反射
specularRatio: 0.1, // 高光反射
@ -79,13 +79,13 @@ export default class Demo extends React.Component {
const bloomLayer = new EarthLayer().color('#fff').shape('bloomSphere');
scene.on('loaded', () => {
scene.addLayer(earthlayer);
scene.addLayer(pointlayer);
scene.addLayer(earthLayer);
scene.addLayer(pointLayer);
scene.addLayer(atomLayer);
scene.addLayer(bloomLayer);
earthlayer.setEarthTime(4.0);
earthLayer.setEarthTime(4.0);
});
}