mirror of https://gitee.com/antv-l7/antv-l7
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:
parent
9bf6a17d88
commit
c95f70fa92
|
@ -25,7 +25,7 @@ export default () => {
|
||||||
)
|
)
|
||||||
.shape('base')
|
.shape('base')
|
||||||
.style({
|
.style({
|
||||||
globelOtions: {
|
globalOptions: {
|
||||||
ambientRatio: 0.6, // 环境光
|
ambientRatio: 0.6, // 环境光
|
||||||
diffuseRatio: 0.4, // 漫反射
|
diffuseRatio: 0.4, // 漫反射
|
||||||
specularRatio: 0.1, // 高光反射
|
specularRatio: 0.1, // 高光反射
|
||||||
|
@ -34,7 +34,6 @@ export default () => {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.animate(true);
|
.animate(true);
|
||||||
// earthlayer.setEarthTime(4.0)
|
|
||||||
|
|
||||||
const atomLayer = new EarthLayer()
|
const atomLayer = new EarthLayer()
|
||||||
.color('#2E8AE6')
|
.color('#2E8AE6')
|
||||||
|
|
|
@ -123,7 +123,7 @@ export interface ILegendClassificaItem {
|
||||||
// 图层图例
|
// 图层图例
|
||||||
export type LegendItems = ILegendSegmentItem[] | ILegendClassificaItem[];
|
export type LegendItems = ILegendSegmentItem[] | ILegendClassificaItem[];
|
||||||
|
|
||||||
export interface IAttrubuteAndElements {
|
export interface IAttributeAndElements {
|
||||||
attributes: any;
|
attributes: any;
|
||||||
elements: any;
|
elements: any;
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ export interface ILayer {
|
||||||
threeRenderService?: any;
|
threeRenderService?: any;
|
||||||
|
|
||||||
getShaderPickStat: () => boolean;
|
getShaderPickStat: () => boolean;
|
||||||
updateModelData(data: IAttrubuteAndElements): void;
|
updateModelData(data: IAttributeAndElements): void;
|
||||||
|
|
||||||
addMaskLayer(maskLayer: ILayer): void;
|
addMaskLayer(maskLayer: ILayer): void;
|
||||||
removeMaskLayer(maskLayer: ILayer): void;
|
removeMaskLayer(maskLayer: ILayer): void;
|
||||||
|
@ -341,7 +341,7 @@ export interface ILayer {
|
||||||
options: ILayerModelInitializationOptions &
|
options: ILayerModelInitializationOptions &
|
||||||
Partial<IModelInitializationOptions>,
|
Partial<IModelInitializationOptions>,
|
||||||
): Promise<IModel>;
|
): Promise<IModel>;
|
||||||
createAttrubutes(
|
createAttributes(
|
||||||
options: ILayerModelInitializationOptions &
|
options: ILayerModelInitializationOptions &
|
||||||
Partial<IModelInitializationOptions>,
|
Partial<IModelInitializationOptions>,
|
||||||
): {
|
): {
|
||||||
|
@ -577,7 +577,7 @@ export interface ILayerConfig {
|
||||||
/**
|
/**
|
||||||
* 地球模式参数
|
* 地球模式参数
|
||||||
*/
|
*/
|
||||||
globelOtions: any;
|
globalOptions: any;
|
||||||
/**
|
/**
|
||||||
* layer point text 是否是 iconfont 模式
|
* layer point text 是否是 iconfont 模式
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -165,7 +165,6 @@ export default class BillBoardModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Extrude',
|
name: 'a_Extrude',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -187,14 +186,12 @@ export default class BillBoardModel extends BaseModel {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// point layer size;
|
|
||||||
this.styleAttributeService.registerStyleAttribute({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'uv',
|
name: 'uv',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Uv',
|
name: 'a_Uv',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -204,7 +201,6 @@ export default class BillBoardModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[2], vertex[3]];
|
return [vertex[2], vertex[3]];
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
AttributeType,
|
AttributeType,
|
||||||
gl,
|
gl,
|
||||||
IAttrubuteAndElements,
|
IAttributeAndElements,
|
||||||
IEncodeFeature,
|
IEncodeFeature,
|
||||||
IModel,
|
IModel,
|
||||||
IModelUniform,
|
IModelUniform,
|
||||||
|
@ -267,10 +267,10 @@ export default class PlaneModel extends BaseModel {
|
||||||
const gridY1 = gridY + 1;
|
const gridY1 = gridY + 1;
|
||||||
|
|
||||||
const widthStep = imgWidth / gridX;
|
const widthStep = imgWidth / gridX;
|
||||||
const heihgtStep = imgHeight / gridY;
|
const heightStep = imgHeight / gridY;
|
||||||
|
|
||||||
for (let iy = 0; iy < gridY1; iy++) {
|
for (let iy = 0; iy < gridY1; iy++) {
|
||||||
const imgIndexY = Math.floor(iy * heihgtStep);
|
const imgIndexY = Math.floor(iy * heightStep);
|
||||||
const imgLen = imgIndexY * imgWidth;
|
const imgLen = imgIndexY * imgWidth;
|
||||||
|
|
||||||
for (let ix = 0; ix < gridX1; ix++) {
|
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();
|
this.layerService.throttleRenderLayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +386,6 @@ export default class PlaneModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[3], vertex[4]];
|
return [vertex[3], vertex[4]];
|
||||||
},
|
},
|
||||||
|
|
|
@ -67,7 +67,6 @@ export default class SpriteModel extends BaseModel {
|
||||||
spriteBottom = -100000,
|
spriteBottom = -100000,
|
||||||
} = this.layer.getLayerConfig() as IGeometryLayerStyleOptions;
|
} = this.layer.getLayerConfig() as IGeometryLayerStyleOptions;
|
||||||
const updateZ = this.spriteUpdate;
|
const updateZ = this.spriteUpdate;
|
||||||
// const bottomZ = -100000;
|
|
||||||
const bottomZ = spriteBottom;
|
const bottomZ = spriteBottom;
|
||||||
const topZ = this.spriteTop;
|
const topZ = this.spriteTop;
|
||||||
|
|
||||||
|
@ -94,7 +93,7 @@ export default class SpriteModel extends BaseModel {
|
||||||
|
|
||||||
public updateModel = () => {
|
public updateModel = () => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const attributes = this.layer.createAttrubutes({
|
const attributes = this.layer.createAttributes({
|
||||||
triangulation: this.planeGeometryUpdateTriangulation,
|
triangulation: this.planeGeometryUpdateTriangulation,
|
||||||
});
|
});
|
||||||
this.layer.models.map((m) => {
|
this.layer.models.map((m) => {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {
|
||||||
BlendType,
|
BlendType,
|
||||||
IActiveOption,
|
IActiveOption,
|
||||||
IAnimateOption,
|
IAnimateOption,
|
||||||
IAttrubuteAndElements,
|
IAttributeAndElements,
|
||||||
ICameraService,
|
ICameraService,
|
||||||
ICoordinateSystemService,
|
ICoordinateSystemService,
|
||||||
IDataState,
|
IDataState,
|
||||||
|
@ -151,9 +151,6 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
||||||
@lazyInject(TYPES.IGlobalConfigService)
|
@lazyInject(TYPES.IGlobalConfigService)
|
||||||
protected readonly configService: IGlobalConfigService;
|
protected readonly configService: IGlobalConfigService;
|
||||||
|
|
||||||
// @lazyInject(TYPES.IShaderModuleService)
|
|
||||||
// protected readonly shaderModuleService: IShaderModuleService;
|
|
||||||
|
|
||||||
protected shaderModuleService: IShaderModuleService;
|
protected shaderModuleService: IShaderModuleService;
|
||||||
protected cameraService: ICameraService;
|
protected cameraService: ICameraService;
|
||||||
|
|
||||||
|
@ -191,8 +188,6 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
||||||
|
|
||||||
private encodedData: IEncodeFeature[];
|
private encodedData: IEncodeFeature[];
|
||||||
|
|
||||||
private configSchema: object;
|
|
||||||
|
|
||||||
private currentPickId: number | null = null;
|
private currentPickId: number | null = null;
|
||||||
|
|
||||||
protected rawConfig: Partial<ILayerConfig & ChildLayerStyleOptions>;
|
protected rawConfig: Partial<ILayerConfig & ChildLayerStyleOptions>;
|
||||||
|
@ -214,12 +209,12 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
||||||
|
|
||||||
private animateStartTime: number;
|
private animateStartTime: number;
|
||||||
|
|
||||||
private aniamateStatus: boolean = false;
|
private animateStatus: boolean = false;
|
||||||
|
|
||||||
// Tip: layer 保底颜色
|
// Tip: layer 保底颜色
|
||||||
private bottomColor = 'rgba(0, 0, 0, 0)';
|
private bottomColor = 'rgba(0, 0, 0, 0)';
|
||||||
|
|
||||||
private isDestroied: boolean = false;
|
private isDestroyed: boolean = false;
|
||||||
|
|
||||||
// private pickingPassRender: IPass<'pixelPicking'>;
|
// private pickingPassRender: IPass<'pixelPicking'>;
|
||||||
|
|
||||||
|
@ -304,11 +299,6 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
||||||
}
|
}
|
||||||
|
|
||||||
public addPlugin(plugin: ILayerPlugin): ILayer {
|
public addPlugin(plugin: ILayerPlugin): ILayer {
|
||||||
// TODO: 控制插件注册顺序
|
|
||||||
// @example:
|
|
||||||
// pointLayer.addPlugin(new MyCustomPlugin(), {
|
|
||||||
// before: 'L7BuiltinPlugin'
|
|
||||||
// });
|
|
||||||
this.plugins.push(plugin);
|
this.plugins.push(plugin);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -428,7 +418,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateModelData(data: IAttrubuteAndElements) {
|
public updateModelData(data: IAttributeAndElements) {
|
||||||
if (data.attributes && data.elements) {
|
if (data.attributes && data.elements) {
|
||||||
this.models.map((m) => {
|
this.models.map((m) => {
|
||||||
m.updateAttributesAndElements(data.attributes, data.elements);
|
m.updateAttributesAndElements(data.attributes, data.elements);
|
||||||
|
@ -488,7 +478,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
||||||
const { animateOption } = this.getLayerConfig();
|
const { animateOption } = this.getLayerConfig();
|
||||||
if (animateOption?.enable) {
|
if (animateOption?.enable) {
|
||||||
this.layerService.startAnimate();
|
this.layerService.startAnimate();
|
||||||
this.aniamateStatus = true;
|
this.animateStatus = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public color(
|
public color(
|
||||||
|
@ -583,7 +573,6 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
||||||
this.updateLayerConfig({
|
this.updateLayerConfig({
|
||||||
animateOption: rawAnimate,
|
animateOption: rawAnimate,
|
||||||
});
|
});
|
||||||
// this.animateOptions = options;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -964,7 +953,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
||||||
}
|
}
|
||||||
|
|
||||||
public destroy(refresh = true) {
|
public destroy(refresh = true) {
|
||||||
if (this.isDestroied) {
|
if (this.isDestroyed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1010,7 +999,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
||||||
// 解绑图层容器中的服务
|
// 解绑图层容器中的服务
|
||||||
// this.container.unbind(TYPES.IStyleAttributeService);
|
// this.container.unbind(TYPES.IStyleAttributeService);
|
||||||
|
|
||||||
this.isDestroied = true;
|
this.isDestroyed = true;
|
||||||
}
|
}
|
||||||
public clear() {
|
public clear() {
|
||||||
this.styleAttributeService.clearAllAttributes();
|
this.styleAttributeService.clearAllAttributes();
|
||||||
|
@ -1194,7 +1183,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
||||||
triangulation,
|
triangulation,
|
||||||
segmentNumber,
|
segmentNumber,
|
||||||
);
|
);
|
||||||
const modeloptions = {
|
const modelOptions = {
|
||||||
attributes,
|
attributes,
|
||||||
uniforms,
|
uniforms,
|
||||||
fs,
|
fs,
|
||||||
|
@ -1204,16 +1193,16 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
||||||
...rest,
|
...rest,
|
||||||
};
|
};
|
||||||
if (count) {
|
if (count) {
|
||||||
modeloptions.count = count;
|
modelOptions.count = count;
|
||||||
}
|
}
|
||||||
const m = createModel(modeloptions);
|
const m = createModel(modelOptions);
|
||||||
resolve(m);
|
resolve(m);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public createAttrubutes(
|
public createAttributes(
|
||||||
options: ILayerModelInitializationOptions &
|
options: ILayerModelInitializationOptions &
|
||||||
Partial<IModelInitializationOptions>,
|
Partial<IModelInitializationOptions>,
|
||||||
) {
|
) {
|
||||||
|
@ -1233,9 +1222,9 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
||||||
this.animateStartTime = this.layerService.clock.getElapsedTime();
|
this.animateStartTime = this.layerService.clock.getElapsedTime();
|
||||||
}
|
}
|
||||||
public stopAnimate() {
|
public stopAnimate() {
|
||||||
if (this.aniamateStatus) {
|
if (this.animateStatus) {
|
||||||
this.layerService.stopAnimate();
|
this.layerService.stopAnimate();
|
||||||
this.aniamateStatus = false;
|
this.animateStatus = false;
|
||||||
this.updateLayerConfig({
|
this.updateLayerConfig({
|
||||||
animateOption: {
|
animateOption: {
|
||||||
enable: false,
|
enable: false,
|
||||||
|
|
|
@ -81,7 +81,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
|
||||||
protected cellLength: number; // 单个 cell 的长度
|
protected cellLength: number; // 单个 cell 的长度
|
||||||
protected cellProperties: ICellProperty[]; // 需要进行数据映射的属性集合
|
protected cellProperties: ICellProperty[]; // 需要进行数据映射的属性集合
|
||||||
protected cellTypeLayout: number[];
|
protected cellTypeLayout: number[];
|
||||||
protected stylePropertyesExist: {
|
protected stylePropertiesExist: {
|
||||||
// 记录 style 属性是否存在的中间变量
|
// 记录 style 属性是否存在的中间变量
|
||||||
hasThetaOffset: number;
|
hasThetaOffset: number;
|
||||||
hasOpacity: number;
|
hasOpacity: number;
|
||||||
|
@ -164,7 +164,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
|
||||||
stroke: undefined,
|
stroke: undefined,
|
||||||
offsets: undefined,
|
offsets: undefined,
|
||||||
};
|
};
|
||||||
this.stylePropertyesExist = {
|
this.stylePropertiesExist = {
|
||||||
hasThetaOffset: 0,
|
hasThetaOffset: 0,
|
||||||
hasOpacity: 0,
|
hasOpacity: 0,
|
||||||
hasStrokeOpacity: 0,
|
hasStrokeOpacity: 0,
|
||||||
|
@ -196,7 +196,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
|
||||||
public clearLastCalRes() {
|
public clearLastCalRes() {
|
||||||
this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合
|
this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合
|
||||||
this.cellLength = 0; // 清空上一次计算的 cell 的长度
|
this.cellLength = 0; // 清空上一次计算的 cell 的长度
|
||||||
this.stylePropertyesExist = {
|
this.stylePropertiesExist = {
|
||||||
// 全量清空上一次是否需要对 style 属性进行数据映射的判断
|
// 全量清空上一次是否需要对 style 属性进行数据映射的判断
|
||||||
hasThetaOffset: 0,
|
hasThetaOffset: 0,
|
||||||
hasOpacity: 0,
|
hasOpacity: 0,
|
||||||
|
@ -216,13 +216,13 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
|
||||||
0.0,
|
0.0,
|
||||||
0.0,
|
0.0,
|
||||||
// 1
|
// 1
|
||||||
this.stylePropertyesExist.hasOpacity, // cell 中是否存在 opacity
|
this.stylePropertiesExist.hasOpacity, // cell 中是否存在 opacity
|
||||||
this.stylePropertyesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity
|
this.stylePropertiesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity
|
||||||
this.stylePropertyesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth
|
this.stylePropertiesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth
|
||||||
this.stylePropertyesExist.hasStroke, // cell 中是否存在 stroke
|
this.stylePropertiesExist.hasStroke, // cell 中是否存在 stroke
|
||||||
// 2
|
// 2
|
||||||
this.stylePropertyesExist.hasOffsets, // cell 中是否存在 offsets
|
this.stylePropertiesExist.hasOffsets, // cell 中是否存在 offsets
|
||||||
this.stylePropertyesExist.hasThetaOffset, // cell 中是否存在 thetaOffset
|
this.stylePropertiesExist.hasThetaOffset, // cell 中是否存在 thetaOffset
|
||||||
0.0,
|
0.0,
|
||||||
0.0,
|
0.0,
|
||||||
// 3
|
// 3
|
||||||
|
@ -305,7 +305,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
|
||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
public judgeStyleAttributes(options: {
|
public judgeStyleAttributes(options: {
|
||||||
// TODO: 目前 thetaOffset 只有 lineLayer/arc 使用
|
// Tip: 目前 thetaOffset 只有 lineLayer/arc 使用
|
||||||
thetaOffset?: styleSingle;
|
thetaOffset?: styleSingle;
|
||||||
opacity?: styleSingle;
|
opacity?: styleSingle;
|
||||||
strokeOpacity?: styleSingle;
|
strokeOpacity?: styleSingle;
|
||||||
|
@ -318,7 +318,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
|
||||||
if (options.opacity !== undefined && !isNumber(options.opacity)) {
|
if (options.opacity !== undefined && !isNumber(options.opacity)) {
|
||||||
// 数据映射
|
// 数据映射
|
||||||
this.cellProperties.push({ attr: 'opacity', count: 1 });
|
this.cellProperties.push({ attr: 'opacity', count: 1 });
|
||||||
this.stylePropertyesExist.hasOpacity = 1;
|
this.stylePropertiesExist.hasOpacity = 1;
|
||||||
this.cellLength += 1;
|
this.cellLength += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,21 +328,21 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
|
||||||
) {
|
) {
|
||||||
// 数据映射
|
// 数据映射
|
||||||
this.cellProperties.push({ attr: 'strokeOpacity', count: 1 });
|
this.cellProperties.push({ attr: 'strokeOpacity', count: 1 });
|
||||||
this.stylePropertyesExist.hasStrokeOpacity = 1;
|
this.stylePropertiesExist.hasStrokeOpacity = 1;
|
||||||
this.cellLength += 1;
|
this.cellLength += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.strokeWidth !== undefined && !isNumber(options.strokeWidth)) {
|
if (options.strokeWidth !== undefined && !isNumber(options.strokeWidth)) {
|
||||||
// 数据映射
|
// 数据映射
|
||||||
this.cellProperties.push({ attr: 'strokeWidth', count: 1 });
|
this.cellProperties.push({ attr: 'strokeWidth', count: 1 });
|
||||||
this.stylePropertyesExist.hasStrokeWidth = 1;
|
this.stylePropertiesExist.hasStrokeWidth = 1;
|
||||||
this.cellLength += 1;
|
this.cellLength += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {
|
if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {
|
||||||
// 数据映射
|
// 数据映射
|
||||||
this.cellProperties.push({ attr: 'stroke', count: 4 });
|
this.cellProperties.push({ attr: 'stroke', count: 4 });
|
||||||
this.stylePropertyesExist.hasStroke = 1;
|
this.stylePropertiesExist.hasStroke = 1;
|
||||||
this.cellLength += 4;
|
this.cellLength += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,17 +352,16 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
|
||||||
) {
|
) {
|
||||||
// 数据映射
|
// 数据映射
|
||||||
this.cellProperties.push({ attr: 'offsets', count: 2 });
|
this.cellProperties.push({ attr: 'offsets', count: 2 });
|
||||||
this.stylePropertyesExist.hasOffsets = 1;
|
this.stylePropertiesExist.hasOffsets = 1;
|
||||||
this.cellLength += 2;
|
this.cellLength += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.thetaOffset !== undefined && !isNumber(options.thetaOffset)) {
|
if (options.thetaOffset !== undefined && !isNumber(options.thetaOffset)) {
|
||||||
// 数据映射
|
// 数据映射
|
||||||
this.cellProperties.push({ attr: 'thetaOffset', count: 1 });
|
this.cellProperties.push({ attr: 'thetaOffset', count: 1 });
|
||||||
this.stylePropertyesExist.hasThetaOffset = 1;
|
this.stylePropertiesExist.hasThetaOffset = 1;
|
||||||
this.cellLength += 1;
|
this.cellLength += 1;
|
||||||
}
|
}
|
||||||
// console.log('this.cellLength', this.cellLength)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,7 +11,7 @@ import BaseModel from '../../core/BaseModel';
|
||||||
import { earthTriangulation } from '../../core/triangulation';
|
import { earthTriangulation } from '../../core/triangulation';
|
||||||
import atmoSphereFrag from '../shaders/atmosphere_frag.glsl';
|
import atmoSphereFrag from '../shaders/atmosphere_frag.glsl';
|
||||||
import atmoSphereVert from '../shaders/atmosphere_vert.glsl';
|
import atmoSphereVert from '../shaders/atmosphere_vert.glsl';
|
||||||
interface IAtmoLayerStyleOptions {
|
interface IAtmoSphereLayerStyleOptions {
|
||||||
opacity: number;
|
opacity: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ export default class EarthAtomSphereModel extends BaseModel {
|
||||||
public getUninforms(): IModelUniform {
|
public getUninforms(): IModelUniform {
|
||||||
const {
|
const {
|
||||||
opacity = 1,
|
opacity = 1,
|
||||||
} = this.layer.getLayerConfig() as IAtmoLayerStyleOptions;
|
} = this.layer.getLayerConfig() as IAtmoSphereLayerStyleOptions;
|
||||||
return {
|
return {
|
||||||
u_opacity: isNumber(opacity) ? opacity : 1.0,
|
u_opacity: isNumber(opacity) ? opacity : 1.0,
|
||||||
};
|
};
|
||||||
|
@ -38,7 +38,7 @@ export default class EarthAtomSphereModel extends BaseModel {
|
||||||
this.layer.zIndex = -997;
|
this.layer.zIndex = -997;
|
||||||
this.layer
|
this.layer
|
||||||
.buildLayerModel({
|
.buildLayerModel({
|
||||||
moduleName: 'earthAtmo',
|
moduleName: 'earthAtmoSphere',
|
||||||
vertexShader: atmoSphereVert,
|
vertexShader: atmoSphereVert,
|
||||||
fragmentShader: atmoSphereFrag,
|
fragmentShader: atmoSphereFrag,
|
||||||
triangulation: earthTriangulation,
|
triangulation: earthTriangulation,
|
||||||
|
@ -62,7 +62,6 @@ export default class EarthAtomSphereModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Size',
|
name: 'a_Size',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -70,9 +69,6 @@ export default class EarthAtomSphereModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 1 } = feature;
|
const { size = 1 } = feature;
|
||||||
return Array.isArray(size) ? [size[0]] : [size as number];
|
return Array.isArray(size) ? [size[0]] : [size as number];
|
||||||
|
@ -86,7 +82,6 @@ export default class EarthAtomSphereModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Normal',
|
name: 'a_Normal',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.STATIC_DRAW,
|
usage: gl.STATIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -110,7 +105,6 @@ export default class EarthAtomSphereModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Uv',
|
name: 'a_Uv',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -120,7 +114,6 @@ export default class EarthAtomSphereModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[3], vertex[4]];
|
return [vertex[3], vertex[4]];
|
||||||
},
|
},
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default class BaseEarthModel extends BaseModel {
|
||||||
);
|
);
|
||||||
|
|
||||||
public getUninforms(): IModelUniform {
|
public getUninforms(): IModelUniform {
|
||||||
const { animateOption, globelOtions } = this.layer.getLayerConfig();
|
const { animateOption, globalOptions } = this.layer.getLayerConfig();
|
||||||
if (animateOption?.enable) {
|
if (animateOption?.enable) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
// T: rotateY 方法只有在地球模式下存在
|
// T: rotateY 方法只有在地球模式下存在
|
||||||
|
@ -40,10 +40,9 @@ export default class BaseEarthModel extends BaseModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
u_ambientRatio: globelOtions?.ambientRatio || 0.6, // 环境光
|
u_ambientRatio: globalOptions?.ambientRatio || 0.6, // 环境光
|
||||||
u_diffuseRatio: globelOtions?.diffuseRatio || 0.4, // 漫反射
|
u_diffuseRatio: globalOptions?.diffuseRatio || 0.4, // 漫反射
|
||||||
u_specularRatio: globelOtions?.specularRatio || 0.1, // 高光反射
|
u_specularRatio: globalOptions?.specularRatio || 0.1, // 高光反射
|
||||||
// u_sunLight: [120, 120, 120],
|
|
||||||
u_sunLight: [this.sunX, this.sunY, this.sunZ],
|
u_sunLight: [this.sunX, this.sunY, this.sunZ],
|
||||||
|
|
||||||
u_texture: this.texture,
|
u_texture: this.texture,
|
||||||
|
@ -61,9 +60,9 @@ export default class BaseEarthModel extends BaseModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public initModels(callbackModel: (models: IModel[]) => void) {
|
public initModels(callbackModel: (models: IModel[]) => void) {
|
||||||
const { globelOtions } = this.layer.getLayerConfig();
|
const { globalOptions } = this.layer.getLayerConfig();
|
||||||
if (globelOtions?.earthTime !== undefined) {
|
if (globalOptions?.earthTime !== undefined) {
|
||||||
this.setEarthTime(globelOtions.earthTime);
|
this.setEarthTime(globalOptions.earthTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
const source = this.layer.getSource();
|
const source = this.layer.getSource();
|
||||||
|
@ -89,7 +88,7 @@ export default class BaseEarthModel extends BaseModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public buildModels(callbackModel: (models: IModel[]) => void) {
|
public buildModels(callbackModel: (models: IModel[]) => void) {
|
||||||
// TODO: 调整图层的绘制顺序 地球大气层
|
// Tip: 调整图层的绘制顺序 地球大气层
|
||||||
this.layer.zIndex = -998;
|
this.layer.zIndex = -998;
|
||||||
|
|
||||||
this.layer
|
this.layer
|
||||||
|
@ -111,14 +110,12 @@ export default class BaseEarthModel extends BaseModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected registerBuiltinAttributes() {
|
protected registerBuiltinAttributes() {
|
||||||
// point layer size;
|
|
||||||
this.styleAttributeService.registerStyleAttribute({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'size',
|
name: 'size',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Size',
|
name: 'a_Size',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -126,9 +123,6 @@ export default class BaseEarthModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 1 } = feature;
|
const { size = 1 } = feature;
|
||||||
return Array.isArray(size) ? [size[0]] : [size as number];
|
return Array.isArray(size) ? [size[0]] : [size as number];
|
||||||
|
@ -142,7 +136,6 @@ export default class BaseEarthModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Normal',
|
name: 'a_Normal',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.STATIC_DRAW,
|
usage: gl.STATIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -176,7 +169,6 @@ export default class BaseEarthModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[3], vertex[4]];
|
return [vertex[3], vertex[4]];
|
||||||
},
|
},
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default class EarthBloomSphereModel extends BaseModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public buildModels(callbackModel: (models: IModel[]) => void) {
|
public buildModels(callbackModel: (models: IModel[]) => void) {
|
||||||
// TODO: 调整图层的绘制顺序,让它保持在地球后面(减少锯齿现象)
|
// Tip: 调整图层的绘制顺序,让它保持在地球后面(减少锯齿现象)
|
||||||
this.layer.zIndex = -999;
|
this.layer.zIndex = -999;
|
||||||
this.layer
|
this.layer
|
||||||
.buildLayerModel({
|
.buildLayerModel({
|
||||||
|
@ -55,14 +55,12 @@ export default class EarthBloomSphereModel extends BaseModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected registerBuiltinAttributes() {
|
protected registerBuiltinAttributes() {
|
||||||
// point layer size;
|
|
||||||
this.styleAttributeService.registerStyleAttribute({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'size',
|
name: 'size',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Size',
|
name: 'a_Size',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -70,9 +68,6 @@ export default class EarthBloomSphereModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 1 } = feature;
|
const { size = 1 } = feature;
|
||||||
return Array.isArray(size) ? [size[0]] : [size as number];
|
return Array.isArray(size) ? [size[0]] : [size as number];
|
||||||
|
@ -86,7 +81,6 @@ export default class EarthBloomSphereModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Normal',
|
name: 'a_Normal',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.STATIC_DRAW,
|
usage: gl.STATIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -110,7 +104,6 @@ export default class EarthBloomSphereModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Uv',
|
name: 'a_Uv',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -120,7 +113,6 @@ export default class EarthBloomSphereModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[3], vertex[4]];
|
return [vertex[3], vertex[4]];
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { IAttrubuteAndElements } from '@antv/l7-core';
|
import { IAttributeAndElements } from '@antv/l7-core';
|
||||||
import BaseLayer from '../core/BaseLayer';
|
import BaseLayer from '../core/BaseLayer';
|
||||||
import { IHeatMapLayerStyleOptions } from '../core/interface';
|
import { IHeatMapLayerStyleOptions } from '../core/interface';
|
||||||
import HeatMapModels, { HeatMapModelType } from './models';
|
import HeatMapModels, { HeatMapModelType } from './models';
|
||||||
|
@ -31,8 +31,6 @@ export default class HeatMapLayer extends BaseLayer<IHeatMapLayerStyleOptions> {
|
||||||
}
|
}
|
||||||
if (this.layerModelNeedUpdate) {
|
if (this.layerModelNeedUpdate) {
|
||||||
this.layerModel.buildModels((models) => (this.models = models));
|
this.layerModel.buildModels((models) => (this.models = models));
|
||||||
// @ts-ignore
|
|
||||||
// this.models = this.layerModel.buildModels();
|
|
||||||
this.layerModelNeedUpdate = false;
|
this.layerModelNeedUpdate = false;
|
||||||
}
|
}
|
||||||
this.models.forEach((model) =>
|
this.models.forEach((model) =>
|
||||||
|
@ -43,7 +41,7 @@ export default class HeatMapLayer extends BaseLayer<IHeatMapLayerStyleOptions> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateModelData(data: IAttrubuteAndElements) {
|
public updateModelData(data: IAttributeAndElements) {
|
||||||
if (data.attributes && data.elements) {
|
if (data.attributes && data.elements) {
|
||||||
this.models[0].updateAttributesAndElements(
|
this.models[0].updateAttributesAndElements(
|
||||||
data.attributes,
|
data.attributes,
|
||||||
|
|
|
@ -63,14 +63,12 @@ export default class GridModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Pos',
|
name: 'a_Pos',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
},
|
},
|
||||||
size: 3,
|
size: 3,
|
||||||
update: (feature: IEncodeFeature, featureIdx: number) => {
|
update: (feature: IEncodeFeature) => {
|
||||||
// const coordinates = feature.coordinates as number[];
|
|
||||||
const coordinates = (feature.version === 'GAODE2.x'
|
const coordinates = (feature.version === 'GAODE2.x'
|
||||||
? feature.originCoordinates
|
? feature.originCoordinates
|
||||||
: feature.coordinates) as number[];
|
: feature.coordinates) as number[];
|
||||||
|
|
|
@ -58,14 +58,12 @@ export default class Grid3DModel extends BaseModel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
protected registerBuiltinAttributes() {
|
protected registerBuiltinAttributes() {
|
||||||
// point layer size;
|
|
||||||
this.styleAttributeService.registerStyleAttribute({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'size',
|
name: 'size',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Size',
|
name: 'a_Size',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -73,9 +71,6 @@ export default class Grid3DModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size } = feature;
|
const { size } = feature;
|
||||||
return Array.isArray(size) ? [size[0]] : [size as number];
|
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({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'normal',
|
name: 'normal',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Normal',
|
name: 'a_Normal',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.STATIC_DRAW,
|
usage: gl.STATIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -113,18 +106,15 @@ export default class Grid3DModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Pos',
|
name: 'a_Pos',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
},
|
},
|
||||||
size: 3,
|
size: 3,
|
||||||
update: (feature: IEncodeFeature, featureIdx: number) => {
|
update: (feature: IEncodeFeature) => {
|
||||||
const coordinates = (feature.version === 'GAODE2.x'
|
const coordinates = (feature.version === 'GAODE2.x'
|
||||||
? feature.originCoordinates
|
? feature.originCoordinates
|
||||||
: feature.coordinates) as number[];
|
: feature.coordinates) as number[];
|
||||||
// const coordinates = feature.coordinates as number[];
|
|
||||||
// const coordinates = feature.originCoordinates as number[];
|
|
||||||
return [coordinates[0], coordinates[1], 0];
|
return [coordinates[0], coordinates[1], 0];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -110,7 +110,6 @@ export default class HeatMapModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Dir',
|
name: 'a_Dir',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -120,14 +119,12 @@ export default class HeatMapModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[3], vertex[4]];
|
return [vertex[3], vertex[4]];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// point layer size;
|
|
||||||
this.styleAttributeService.registerStyleAttribute({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'size',
|
name: 'size',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
|
@ -142,9 +139,6 @@ export default class HeatMapModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 1 } = feature;
|
const { size = 1 } = feature;
|
||||||
return [size as number];
|
return [size as number];
|
||||||
|
@ -226,7 +220,6 @@ export default class HeatMapModel extends BaseModel {
|
||||||
enable: false,
|
enable: false,
|
||||||
},
|
},
|
||||||
blend: this.getBlend(),
|
blend: this.getBlend(),
|
||||||
// count: 6,
|
|
||||||
elements: createElements({
|
elements: createElements({
|
||||||
data: [0, 2, 1, 2, 3, 1],
|
data: [0, 2, 1, 2, 3, 1],
|
||||||
type: gl.UNSIGNED_INT,
|
type: gl.UNSIGNED_INT,
|
||||||
|
|
|
@ -65,19 +65,15 @@ export default class HexagonModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Pos',
|
name: 'a_Pos',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
},
|
},
|
||||||
size: 3,
|
size: 3,
|
||||||
update: (feature: IEncodeFeature, featureIdx: number) => {
|
update: (feature: IEncodeFeature) => {
|
||||||
// const coordinates = (feature.verison==='GAODE2.x'?feature.originoordinates:feature.coordinates) as number[];
|
|
||||||
const coordinates = (feature.version === 'GAODE2.x'
|
const coordinates = (feature.version === 'GAODE2.x'
|
||||||
? feature.originCoordinates
|
? feature.originCoordinates
|
||||||
: feature.coordinates) as number[];
|
: feature.coordinates) as number[];
|
||||||
// const coordinates = feature.coordinates as number[];
|
|
||||||
// const coordinates = feature.originCoordinates as number[];
|
|
||||||
return [coordinates[0], coordinates[1], 0];
|
return [coordinates[0], coordinates[1], 0];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// @ts-ignore
|
|
||||||
|
|
||||||
export function heatMap3DTriangulation(width: number, height: number) {
|
export function heatMap3DTriangulation(width: number, height: number) {
|
||||||
const indices = [];
|
const indices = [];
|
||||||
const vertices = [];
|
const vertices = [];
|
||||||
|
|
|
@ -35,7 +35,7 @@ export default class ImageDataModel extends BaseModel {
|
||||||
} = this.layer.getLayerConfig() as IImageLayerStyleOptions;
|
} = this.layer.getLayerConfig() as IImageLayerStyleOptions;
|
||||||
|
|
||||||
if (!isEqual(this.rampColors, rampColors)) {
|
if (!isEqual(this.rampColors, rampColors)) {
|
||||||
this.updateColorTexure();
|
this.updateColorTexture();
|
||||||
this.rampColors = rampColors;
|
this.rampColors = rampColors;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
@ -156,7 +156,7 @@ export default class ImageDataModel extends BaseModel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateColorTexure() {
|
private updateColorTexture() {
|
||||||
const { createTexture2D } = this.rendererService;
|
const { createTexture2D } = this.rendererService;
|
||||||
const {
|
const {
|
||||||
rampColors,
|
rampColors,
|
||||||
|
|
|
@ -111,14 +111,12 @@ export default class ImageModel extends BaseModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected registerBuiltinAttributes() {
|
protected registerBuiltinAttributes() {
|
||||||
// point layer size;
|
|
||||||
this.styleAttributeService.registerStyleAttribute({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'uv',
|
name: 'uv',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Uv',
|
name: 'a_Uv',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -128,7 +126,6 @@ export default class ImageModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[3], vertex[4]];
|
return [vertex[3], vertex[4]];
|
||||||
},
|
},
|
||||||
|
|
|
@ -124,7 +124,7 @@ export default class ArcModel extends BaseModel {
|
||||||
public getAnimateUniforms(): IModelUniform {
|
public getAnimateUniforms(): IModelUniform {
|
||||||
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
|
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
|
||||||
return {
|
return {
|
||||||
u_aimate: this.animateOption2Array(animateOption as IAnimateOption),
|
u_animate: this.animateOption2Array(animateOption as IAnimateOption),
|
||||||
u_time: this.layer.getLayerAnimateTime(),
|
u_time: this.layer.getLayerAnimateTime(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,6 @@ export default class ArcModel extends BaseModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected registerBuiltinAttributes() {
|
protected registerBuiltinAttributes() {
|
||||||
// point layer size;
|
|
||||||
this.styleAttributeService.registerStyleAttribute({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'size',
|
name: 'size',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
|
@ -216,9 +215,6 @@ export default class ArcModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 1 } = feature;
|
const { size = 1 } = feature;
|
||||||
return Array.isArray(size) ? [size[0]] : [size as number];
|
return Array.isArray(size) ? [size[0]] : [size as number];
|
||||||
|
@ -241,7 +237,6 @@ export default class ArcModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[3], vertex[4], vertex[5], vertex[6]];
|
return [vertex[3], vertex[4], vertex[5], vertex[6]];
|
||||||
},
|
},
|
||||||
|
@ -262,9 +257,6 @@ export default class ArcModel extends BaseModel {
|
||||||
size: 2,
|
size: 2,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const iconMap = this.iconService.getIconMap();
|
const iconMap = this.iconService.getIconMap();
|
||||||
const { texture } = feature;
|
const { texture } = feature;
|
||||||
|
|
|
@ -118,7 +118,7 @@ export default class Arc3DModel extends BaseModel {
|
||||||
public getAnimateUniforms(): IModelUniform {
|
public getAnimateUniforms(): IModelUniform {
|
||||||
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
|
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
|
||||||
return {
|
return {
|
||||||
u_aimate: this.animateOption2Array(animateOption as IAnimateOption),
|
u_animate: this.animateOption2Array(animateOption as IAnimateOption),
|
||||||
u_time: this.layer.getLayerAnimateTime(),
|
u_time: this.layer.getLayerAnimateTime(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,6 @@ export default class Arc3DModel extends BaseModel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
protected registerBuiltinAttributes() {
|
protected registerBuiltinAttributes() {
|
||||||
// point layer size;
|
|
||||||
this.styleAttributeService.registerStyleAttribute({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'size',
|
name: 'size',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
|
@ -200,9 +199,6 @@ export default class Arc3DModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 1 } = feature;
|
const { size = 1 } = feature;
|
||||||
return Array.isArray(size) ? [size[0]] : [size as number];
|
return Array.isArray(size) ? [size[0]] : [size as number];
|
||||||
|
@ -225,7 +221,6 @@ export default class Arc3DModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[3], vertex[4], vertex[5], vertex[6]];
|
return [vertex[3], vertex[4], vertex[5], vertex[6]];
|
||||||
},
|
},
|
||||||
|
@ -238,7 +233,6 @@ export default class Arc3DModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_iconMapUV',
|
name: 'a_iconMapUV',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -246,9 +240,6 @@ export default class Arc3DModel extends BaseModel {
|
||||||
size: 2,
|
size: 2,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const iconMap = this.iconService.getIconMap();
|
const iconMap = this.iconService.getIconMap();
|
||||||
const { texture } = feature;
|
const { texture } = feature;
|
||||||
|
|
|
@ -118,7 +118,7 @@ export default class Arc3DModel extends BaseModel {
|
||||||
public getAnimateUniforms(): IModelUniform {
|
public getAnimateUniforms(): IModelUniform {
|
||||||
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
|
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
|
||||||
return {
|
return {
|
||||||
u_aimate: this.animateOption2Array(animateOption as IAnimateOption),
|
u_animate: this.animateOption2Array(animateOption as IAnimateOption),
|
||||||
u_time: this.layer.getLayerAnimateTime(),
|
u_time: this.layer.getLayerAnimateTime(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,6 @@ export default class Arc3DModel extends BaseModel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
protected registerBuiltinAttributes() {
|
protected registerBuiltinAttributes() {
|
||||||
// point layer size;
|
|
||||||
this.styleAttributeService.registerStyleAttribute({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'size',
|
name: 'size',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
|
@ -200,9 +199,6 @@ export default class Arc3DModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 1 } = feature;
|
const { size = 1 } = feature;
|
||||||
return Array.isArray(size) ? [size[0]] : [size as number];
|
return Array.isArray(size) ? [size[0]] : [size as number];
|
||||||
|
@ -225,7 +221,6 @@ export default class Arc3DModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[3], vertex[4], vertex[5], vertex[6]];
|
return [vertex[3], vertex[4], vertex[5], vertex[6]];
|
||||||
},
|
},
|
||||||
|
@ -238,7 +233,6 @@ export default class Arc3DModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_iconMapUV',
|
name: 'a_iconMapUV',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -246,9 +240,6 @@ export default class Arc3DModel extends BaseModel {
|
||||||
size: 2,
|
size: 2,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const iconMap = this.iconService.getIconMap();
|
const iconMap = this.iconService.getIconMap();
|
||||||
const { texture } = feature;
|
const { texture } = feature;
|
||||||
|
|
|
@ -107,7 +107,7 @@ export default class GreatCircleModel extends BaseModel {
|
||||||
public getAnimateUniforms(): IModelUniform {
|
public getAnimateUniforms(): IModelUniform {
|
||||||
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
|
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
|
||||||
return {
|
return {
|
||||||
u_aimate: this.animateOption2Array(animateOption as IAnimateOption),
|
u_animate: this.animateOption2Array(animateOption as IAnimateOption),
|
||||||
u_time: this.layer.getLayerAnimateTime(),
|
u_time: this.layer.getLayerAnimateTime(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ export default class LineModel extends BaseModel {
|
||||||
public getAnimateUniforms(): IModelUniform {
|
public getAnimateUniforms(): IModelUniform {
|
||||||
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
|
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
|
||||||
return {
|
return {
|
||||||
u_aimate: this.animateOption2Array(animateOption as IAnimateOption),
|
u_animate: this.animateOption2Array(animateOption as IAnimateOption),
|
||||||
u_time: this.layer.getLayerAnimateTime(),
|
u_time: this.layer.getLayerAnimateTime(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,6 @@ export default class LinearLineModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[5]];
|
return [vertex[5]];
|
||||||
},
|
},
|
||||||
|
@ -178,9 +177,6 @@ export default class LinearLineModel extends BaseModel {
|
||||||
size: 2,
|
size: 2,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 1 } = feature;
|
const { size = 1 } = feature;
|
||||||
return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];
|
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,
|
type: gl.FLOAT,
|
||||||
},
|
},
|
||||||
size: 3,
|
size: 3,
|
||||||
// @ts-ignore
|
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
|
@ -230,7 +225,6 @@ export default class LinearLineModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[4]];
|
return [vertex[4]];
|
||||||
},
|
},
|
||||||
|
|
|
@ -152,7 +152,6 @@ export default class SimpleLineModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[3]];
|
return [vertex[3]];
|
||||||
},
|
},
|
||||||
|
@ -174,7 +173,6 @@ export default class SimpleLineModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[5]];
|
return [vertex[5]];
|
||||||
},
|
},
|
||||||
|
@ -195,9 +193,6 @@ export default class SimpleLineModel extends BaseModel {
|
||||||
size: 2,
|
size: 2,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 1 } = feature;
|
const { size = 1 } = feature;
|
||||||
return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];
|
return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];
|
||||||
|
|
|
@ -133,7 +133,6 @@ export default class LineModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[4]];
|
return [vertex[4]];
|
||||||
},
|
},
|
||||||
|
|
|
@ -66,7 +66,7 @@ export default class LineWallModel extends BaseModel {
|
||||||
public getAnimateUniforms(): IModelUniform {
|
public getAnimateUniforms(): IModelUniform {
|
||||||
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
|
const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
|
||||||
return {
|
return {
|
||||||
u_aimate: this.animateOption2Array(animateOption as IAnimateOption),
|
u_animate: this.animateOption2Array(animateOption as IAnimateOption),
|
||||||
u_time: this.layer.getLayerAnimateTime(),
|
u_time: this.layer.getLayerAnimateTime(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ varying vec4 v_dash_array;
|
||||||
#pragma include "picking"
|
#pragma include "picking"
|
||||||
|
|
||||||
uniform float u_time;
|
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;
|
varying mat4 styleMappingMat;
|
||||||
// [animate, duration, interval, trailLength],
|
// [animate, duration, interval, trailLength],
|
||||||
|
|
|
@ -7,7 +7,7 @@ attribute vec4 a_Instance;
|
||||||
attribute float a_Size;
|
attribute float a_Size;
|
||||||
uniform mat4 u_ModelMatrix;
|
uniform mat4 u_ModelMatrix;
|
||||||
uniform float segmentNumber;
|
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 vec4 v_color;
|
||||||
varying vec2 v_normal;
|
varying vec2 v_normal;
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ void main() {
|
||||||
float total_Distance = pixelDistance(a_Instance.rg, a_Instance.ba);
|
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);
|
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;
|
v_distance_ratio = segmentIndex / segmentNumber;
|
||||||
}
|
}
|
||||||
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
|
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
|
||||||
|
|
|
@ -20,7 +20,7 @@ uniform float segmentNumber;
|
||||||
varying vec2 v_iconMapUV;
|
varying vec2 v_iconMapUV;
|
||||||
|
|
||||||
uniform float u_time;
|
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;
|
varying mat4 styleMappingMat;
|
||||||
|
|
||||||
|
@ -42,16 +42,16 @@ void main() {
|
||||||
gl_FragColor.a *=flag;
|
gl_FragColor.a *=flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(u_aimate.x == Animate && u_line_texture != LineTexture) {
|
if(u_animate.x == Animate && u_line_texture != LineTexture) {
|
||||||
animateSpeed = u_time / u_aimate.y;
|
animateSpeed = u_time / u_animate.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);
|
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 = smoothstep(0., 1., alpha);
|
||||||
alpha = clamp(alpha, 0.0, 1.0);
|
alpha = clamp(alpha, 0.0, 1.0);
|
||||||
gl_FragColor.a *= alpha;
|
gl_FragColor.a *= alpha;
|
||||||
|
|
||||||
// u_aimate
|
// u_animate
|
||||||
// x enable
|
// x enable
|
||||||
// y duration
|
// y duration
|
||||||
// z interval
|
// z interval
|
||||||
|
@ -64,8 +64,8 @@ void main() {
|
||||||
float count = styleMappingMat[3].b; // // 贴图在弧线上重复的数量
|
float count = styleMappingMat[3].b; // // 贴图在弧线上重复的数量
|
||||||
|
|
||||||
float time = 0.0;
|
float time = 0.0;
|
||||||
if(u_aimate.x == Animate) {
|
if(u_animate.x == Animate) {
|
||||||
time = u_time / u_aimate.y;
|
time = u_time / u_animate.y;
|
||||||
}
|
}
|
||||||
float redioCount = arcRadio * count;
|
float redioCount = arcRadio * count;
|
||||||
|
|
||||||
|
@ -75,9 +75,9 @@ void main() {
|
||||||
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
|
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
|
||||||
vec4 pattern = texture2D(u_texture, uv);
|
vec4 pattern = texture2D(u_texture, uv);
|
||||||
|
|
||||||
if(u_aimate.x == Animate) {
|
if(u_animate.x == Animate) {
|
||||||
float currentPlane = floor(redioCount - time);
|
float currentPlane = floor(redioCount - time);
|
||||||
float textureStep = floor(count * u_aimate.z);
|
float textureStep = floor(count * u_animate.z);
|
||||||
float a = mod(currentPlane, textureStep);
|
float a = mod(currentPlane, textureStep);
|
||||||
if(a < textureStep - 1.0) {
|
if(a < textureStep - 1.0) {
|
||||||
pattern = vec4(0.0);
|
pattern = vec4(0.0);
|
||||||
|
|
|
@ -13,9 +13,9 @@ uniform float u_global_height: 10;
|
||||||
uniform mat4 u_ModelMatrix;
|
uniform mat4 u_ModelMatrix;
|
||||||
uniform mat4 u_Mvp;
|
uniform mat4 u_Mvp;
|
||||||
uniform float segmentNumber;
|
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 vec4 v_color;
|
||||||
// varying vec2 v_normal;
|
|
||||||
uniform float u_line_type: 0.0;
|
uniform float u_line_type: 0.0;
|
||||||
uniform vec4 u_dash_array: [10.0, 5., 0, 0];
|
uniform vec4 u_dash_array: [10.0, 5., 0, 0];
|
||||||
varying vec4 v_dash_array;
|
varying vec4 v_dash_array;
|
||||||
|
@ -135,7 +135,6 @@ void main() {
|
||||||
float d_distance_ratio;
|
float d_distance_ratio;
|
||||||
if(u_line_type == LineTypeDash) {
|
if(u_line_type == LineTypeDash) {
|
||||||
d_distance_ratio = segmentIndex / segmentNumber;
|
d_distance_ratio = segmentIndex / segmentNumber;
|
||||||
// float total_Distance = pixelDistance(a_Instance.rg, a_Instance.ba) / 2.0 * PI;
|
|
||||||
vec2 s = source;
|
vec2 s = source;
|
||||||
vec2 t = target;
|
vec2 t = target;
|
||||||
|
|
||||||
|
@ -146,7 +145,7 @@ void main() {
|
||||||
float total_Distance = pixelDistance(s, t) / 2.0 * PI;
|
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);
|
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;
|
d_distance_ratio = segmentIndex / segmentNumber;
|
||||||
}
|
}
|
||||||
styleMappingMat[3].g = d_distance_ratio; // 当前点位距离占线总长的比例
|
styleMappingMat[3].g = d_distance_ratio; // 当前点位距离占线总长的比例
|
||||||
|
|
|
@ -11,7 +11,7 @@ varying vec4 v_dash_array;
|
||||||
varying vec4 v_color;
|
varying vec4 v_color;
|
||||||
|
|
||||||
uniform float u_time;
|
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 float u_line_texture;
|
||||||
uniform sampler2D u_texture;
|
uniform sampler2D u_texture;
|
||||||
|
@ -34,10 +34,10 @@ void main() {
|
||||||
|
|
||||||
gl_FragColor.a *= opacity;
|
gl_FragColor.a *= opacity;
|
||||||
|
|
||||||
if(u_aimate.x == Animate && u_line_texture != LineTexture) {
|
if(u_animate.x == Animate && u_line_texture != LineTexture) {
|
||||||
animateSpeed = u_time / u_aimate.y;
|
animateSpeed = u_time / u_animate.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);
|
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 = smoothstep(0., 1., alpha);
|
||||||
alpha = clamp(alpha, 0.0, 1.0);
|
alpha = clamp(alpha, 0.0, 1.0);
|
||||||
gl_FragColor.a *= alpha;
|
gl_FragColor.a *= alpha;
|
||||||
|
@ -51,8 +51,8 @@ void main() {
|
||||||
float count = styleMappingMat[3].g; // 贴图在弧线上重复的数量
|
float count = styleMappingMat[3].g; // 贴图在弧线上重复的数量
|
||||||
|
|
||||||
float time = 0.0;
|
float time = 0.0;
|
||||||
if(u_aimate.x == Animate) {
|
if(u_animate.x == Animate) {
|
||||||
time = u_time / u_aimate.y;
|
time = u_time / u_animate.y;
|
||||||
}
|
}
|
||||||
float redioCount = arcRadio * count;
|
float redioCount = arcRadio * count;
|
||||||
|
|
||||||
|
@ -62,9 +62,9 @@ void main() {
|
||||||
|
|
||||||
vec4 pattern = texture2D(u_texture, uv);
|
vec4 pattern = texture2D(u_texture, uv);
|
||||||
|
|
||||||
if(u_aimate.x == Animate) {
|
if(u_animate.x == Animate) {
|
||||||
float currentPlane = floor(redioCount - time);
|
float currentPlane = floor(redioCount - time);
|
||||||
float textureStep = floor(count * u_aimate.z);
|
float textureStep = floor(count * u_animate.z);
|
||||||
float a = mod(currentPlane, textureStep);
|
float a = mod(currentPlane, textureStep);
|
||||||
if(a < textureStep - 1.0) {
|
if(a < textureStep - 1.0) {
|
||||||
pattern = vec4(0.0);
|
pattern = vec4(0.0);
|
||||||
|
@ -85,5 +85,4 @@ void main() {
|
||||||
} else {
|
} else {
|
||||||
gl_FragColor = filterColor(gl_FragColor);
|
gl_FragColor = filterColor(gl_FragColor);
|
||||||
}
|
}
|
||||||
// gl_FragColor = filterColor(gl_FragColor);
|
|
||||||
}
|
}
|
|
@ -13,7 +13,7 @@ varying float v_distance_ratio;
|
||||||
varying vec4 v_color;
|
varying vec4 v_color;
|
||||||
|
|
||||||
uniform float u_time;
|
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 float u_line_texture: 0.0;
|
||||||
uniform sampler2D u_texture;
|
uniform sampler2D u_texture;
|
||||||
|
@ -58,10 +58,10 @@ void main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置弧线的动画模式
|
// 设置弧线的动画模式
|
||||||
if(u_aimate.x == Animate) {
|
if(u_animate.x == Animate) {
|
||||||
animateSpeed = u_time / u_aimate.y;
|
animateSpeed = u_time / u_animate.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);
|
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_aimate.w -1.0) / u_aimate.w;
|
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
|
||||||
alpha = smoothstep(0., 1., alpha);
|
alpha = smoothstep(0., 1., alpha);
|
||||||
gl_FragColor.a *= alpha;
|
gl_FragColor.a *= alpha;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ void main() {
|
||||||
float count = styleMappingMat[3].b; // 贴图在弧线上重复的数量
|
float count = styleMappingMat[3].b; // 贴图在弧线上重复的数量
|
||||||
float u = fract(arcRadio * count - animateSpeed * count);
|
float u = fract(arcRadio * count - animateSpeed * count);
|
||||||
// float u = fract(arcRadio * count - animateSpeed);
|
// float u = fract(arcRadio * count - animateSpeed);
|
||||||
if(u_aimate.x == Animate) {
|
if(u_animate.x == Animate) {
|
||||||
u = gl_FragColor.a/opacity;
|
u = gl_FragColor.a/opacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,8 @@ attribute float a_Size;
|
||||||
uniform mat4 u_ModelMatrix;
|
uniform mat4 u_ModelMatrix;
|
||||||
uniform mat4 u_Mvp;
|
uniform mat4 u_Mvp;
|
||||||
uniform float segmentNumber;
|
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 vec4 v_color;
|
||||||
// varying vec2 v_normal;
|
|
||||||
|
|
||||||
varying float v_distance_ratio;
|
varying float v_distance_ratio;
|
||||||
uniform float u_line_type: 0.0;
|
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;
|
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;
|
v_distance_ratio = segmentIndex / segmentNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ attribute float a_Size;
|
||||||
uniform mat4 u_ModelMatrix;
|
uniform mat4 u_ModelMatrix;
|
||||||
uniform mat4 u_Mvp;
|
uniform mat4 u_Mvp;
|
||||||
uniform float segmentNumber;
|
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 vec4 v_color;
|
||||||
|
|
||||||
uniform float u_lineDir: 1.0;
|
uniform float u_lineDir: 1.0;
|
||||||
|
@ -123,7 +123,7 @@ void main() {
|
||||||
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
|
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
|
||||||
float d_distance_ratio;
|
float d_distance_ratio;
|
||||||
|
|
||||||
if(u_aimate.x == Animate) {
|
if(u_animate.x == Animate) {
|
||||||
d_distance_ratio = segmentIndex / segmentNumber;
|
d_distance_ratio = segmentIndex / segmentNumber;
|
||||||
if(u_lineDir != 1.0) {
|
if(u_lineDir != 1.0) {
|
||||||
d_distance_ratio = 1.0 - d_distance_ratio;
|
d_distance_ratio = 1.0 - d_distance_ratio;
|
||||||
|
|
|
@ -7,7 +7,7 @@ attribute vec4 a_Instance;
|
||||||
attribute float a_Size;
|
attribute float a_Size;
|
||||||
uniform mat4 u_ModelMatrix;
|
uniform mat4 u_ModelMatrix;
|
||||||
uniform float segmentNumber;
|
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 vec4 v_color;
|
||||||
varying vec2 v_normal;
|
varying vec2 v_normal;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ void main() {
|
||||||
float total_Distance = pixelDistance(a_Instance.rg, a_Instance.ba) / 2.0 * PI;
|
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);
|
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;
|
v_distance_ratio = segmentIndex / segmentNumber;
|
||||||
}
|
}
|
||||||
vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio), 0.0, 1.0));
|
vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio), 0.0, 1.0));
|
||||||
|
|
|
@ -19,7 +19,7 @@ varying vec2 v_iconMapUV;
|
||||||
#pragma include "picking"
|
#pragma include "picking"
|
||||||
|
|
||||||
uniform float u_time;
|
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;
|
varying mat4 styleMappingMat;
|
||||||
// [animate, duration, interval, trailLength],
|
// [animate, duration, interval, trailLength],
|
||||||
|
@ -31,10 +31,10 @@ void main() {
|
||||||
// anti-alias
|
// anti-alias
|
||||||
// float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));
|
// float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));
|
||||||
gl_FragColor.a *= opacity; // 全局透明度
|
gl_FragColor.a *= opacity; // 全局透明度
|
||||||
if(u_aimate.x == Animate) {
|
if(u_animate.x == Animate) {
|
||||||
animateSpeed = u_time / u_aimate.y;
|
animateSpeed = u_time / u_animate.y;
|
||||||
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + animateSpeed);
|
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);
|
||||||
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 = smoothstep(0., 1., alpha);
|
||||||
gl_FragColor.a *= alpha;
|
gl_FragColor.a *= alpha;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ attribute vec2 a_DistanceAndIndex;
|
||||||
|
|
||||||
uniform mat4 u_ModelMatrix;
|
uniform mat4 u_ModelMatrix;
|
||||||
uniform mat4 u_Mvp;
|
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_icon_step: 100;
|
||||||
|
|
||||||
uniform float u_heightfixed: 0.0;
|
uniform float u_heightfixed: 0.0;
|
||||||
|
|
|
@ -6,9 +6,8 @@ uniform float u_blur : 0.9;
|
||||||
varying float v_segmentIndex;
|
varying float v_segmentIndex;
|
||||||
uniform float segmentNumber;
|
uniform float segmentNumber;
|
||||||
|
|
||||||
|
|
||||||
uniform float u_time;
|
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 float u_linearColor: 0;
|
||||||
uniform vec4 u_sourceColor;
|
uniform vec4 u_sourceColor;
|
||||||
|
@ -27,16 +26,16 @@ void main() {
|
||||||
|
|
||||||
gl_FragColor.a *= opacity;
|
gl_FragColor.a *= opacity;
|
||||||
|
|
||||||
if(u_aimate.x == Animate) {
|
if(u_animate.x == Animate) {
|
||||||
animateSpeed = u_time / u_aimate.y;
|
animateSpeed = u_time / u_animate.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);
|
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 = smoothstep(0., 1., alpha);
|
||||||
alpha = clamp(alpha, 0.0, 1.0);
|
alpha = clamp(alpha, 0.0, 1.0);
|
||||||
gl_FragColor.a *= alpha;
|
gl_FragColor.a *= alpha;
|
||||||
|
|
||||||
// u_aimate
|
// u_animate
|
||||||
// x enable
|
// x enable
|
||||||
// y duration
|
// y duration
|
||||||
// z interval
|
// z interval
|
||||||
|
|
|
@ -6,6 +6,7 @@ attribute vec3 a_Position;
|
||||||
attribute vec4 a_Instance;
|
attribute vec4 a_Instance;
|
||||||
attribute vec4 a_Color;
|
attribute vec4 a_Color;
|
||||||
attribute float a_Size;
|
attribute float a_Size;
|
||||||
|
attribute vec2 a_iconMapUV;
|
||||||
|
|
||||||
uniform float u_globel;
|
uniform float u_globel;
|
||||||
uniform float u_globel_radius;
|
uniform float u_globel_radius;
|
||||||
|
@ -13,23 +14,21 @@ uniform float u_global_height: 10;
|
||||||
uniform mat4 u_ModelMatrix;
|
uniform mat4 u_ModelMatrix;
|
||||||
uniform mat4 u_Mvp;
|
uniform mat4 u_Mvp;
|
||||||
uniform float segmentNumber;
|
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 float u_line_type: 0.0;
|
||||||
uniform vec4 u_dash_array: [10.0, 5., 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_icon_step: 100;
|
||||||
uniform float u_line_texture: 0.0;
|
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;
|
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; // 用于将在顶点着色器中计算好的样式值传递给片元
|
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
||||||
|
|
||||||
|
|
||||||
#pragma include "styleMapping"
|
#pragma include "styleMapping"
|
||||||
#pragma include "styleMappingCalOpacity"
|
#pragma include "styleMappingCalOpacity"
|
||||||
|
|
||||||
|
@ -146,7 +145,7 @@ void main() {
|
||||||
float total_Distance = pixelDistance(s, t) / 2.0 * PI;
|
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);
|
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;
|
d_distance_ratio = segmentIndex / segmentNumber;
|
||||||
}
|
}
|
||||||
styleMappingMat[3].g = d_distance_ratio; // 当前点位距离占线总长的比例
|
styleMappingMat[3].g = d_distance_ratio; // 当前点位距离占线总长的比例
|
||||||
|
|
|
@ -10,7 +10,7 @@ varying vec4 v_dash_array;
|
||||||
varying vec4 v_color;
|
varying vec4 v_color;
|
||||||
|
|
||||||
uniform float u_time;
|
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 float u_line_texture;
|
||||||
uniform sampler2D u_texture;
|
uniform sampler2D u_texture;
|
||||||
|
|
|
@ -12,7 +12,7 @@ uniform float u_opacity : 1.0;
|
||||||
uniform float u_textureBlend;
|
uniform float u_textureBlend;
|
||||||
uniform float u_iconStepCount;
|
uniform float u_iconStepCount;
|
||||||
uniform float u_time;
|
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 vec2 v_iconMapUV;
|
||||||
varying float v_blur;
|
varying float v_blur;
|
||||||
|
@ -35,10 +35,10 @@ void main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_FragColor.a *= opacity; // 全局透明度
|
gl_FragColor.a *= opacity; // 全局透明度
|
||||||
if(u_aimate.x == Animate) {
|
if(u_animate.x == Animate) {
|
||||||
animateSpeed = u_time / u_aimate.y;
|
animateSpeed = u_time / u_animate.y;
|
||||||
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + animateSpeed);
|
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);
|
||||||
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 = smoothstep(0., 1., alpha);
|
||||||
gl_FragColor.a *= alpha;
|
gl_FragColor.a *= alpha;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ attribute float a_Distance;
|
||||||
|
|
||||||
uniform mat4 u_ModelMatrix;
|
uniform mat4 u_ModelMatrix;
|
||||||
uniform mat4 u_Mvp;
|
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_icon_step: 100;
|
||||||
uniform float u_heightfixed;
|
uniform float u_heightfixed;
|
||||||
uniform float u_linearColor: 0;
|
uniform float u_linearColor: 0;
|
||||||
|
@ -43,7 +43,7 @@ void main() {
|
||||||
d_texPixelLen *= 10.0;
|
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;
|
d_distance_ratio = a_Distance / a_Total_Distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ export default class LayerAnimateStylePlugin implements ILayerPlugin {
|
||||||
public apply(layer: ILayer) {
|
public apply(layer: ILayer) {
|
||||||
layer.hooks.beforeRender.tap('LayerAnimateStylePlugin', () => {
|
layer.hooks.beforeRender.tap('LayerAnimateStylePlugin', () => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const aniamateStatus = layer.aniamateStatus;
|
const animateStatus = layer.animateStatus;
|
||||||
aniamateStatus &&
|
animateStatus &&
|
||||||
layer.models.forEach((model: IModel) => {
|
layer.models.forEach((model: IModel) => {
|
||||||
model.addUniforms({
|
model.addUniforms({
|
||||||
...layer.layerModel.getAnimateUniforms(),
|
...layer.layerModel.getAnimateUniforms(),
|
||||||
|
|
|
@ -85,7 +85,7 @@ export default class PointLayer extends BaseLayer<IPointLayerStyleOptions> {
|
||||||
text: {
|
text: {
|
||||||
blend: 'normal',
|
blend: 'normal',
|
||||||
},
|
},
|
||||||
vectorpoint: {},
|
vectorPoint: {},
|
||||||
tile: {},
|
tile: {},
|
||||||
tileText: {},
|
tileText: {},
|
||||||
earthFill: {},
|
earthFill: {},
|
||||||
|
@ -97,10 +97,8 @@ export default class PointLayer extends BaseLayer<IPointLayerStyleOptions> {
|
||||||
protected getModelType(): PointType {
|
protected getModelType(): PointType {
|
||||||
const parserType = this.layerSource.getParserType();
|
const parserType = this.layerSource.getParserType();
|
||||||
if (isVectorTile(parserType)) {
|
if (isVectorTile(parserType)) {
|
||||||
return 'vectorpoint';
|
return 'vectorPoint';
|
||||||
}
|
}
|
||||||
|
|
||||||
// pointlayer
|
|
||||||
// 2D、 3d、 shape、image、text、normal、
|
// 2D、 3d、 shape、image、text、normal、
|
||||||
const layerData = this.getEncodedData();
|
const layerData = this.getEncodedData();
|
||||||
const { shape2d, shape3d } = this.getLayerConfig();
|
const { shape2d, shape3d } = this.getLayerConfig();
|
||||||
|
|
|
@ -16,7 +16,7 @@ import pointExtrudeVert from '../shaders/earth/extrude_vert.glsl';
|
||||||
|
|
||||||
export default class ExtrudeModel extends BaseModel {
|
export default class ExtrudeModel extends BaseModel {
|
||||||
private raiseCount: number = 0;
|
private raiseCount: number = 0;
|
||||||
private raiserepeat: number = 0;
|
private raiseRepeat: number = 0;
|
||||||
public getUninforms() {
|
public getUninforms() {
|
||||||
const {
|
const {
|
||||||
animateOption = {
|
animateOption = {
|
||||||
|
@ -88,14 +88,14 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
useLinearColor = 1;
|
useLinearColor = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.raiseCount < 1 && this.raiserepeat > 0) {
|
if (this.raiseCount < 1 && this.raiseRepeat > 0) {
|
||||||
if (animateOption.enable) {
|
if (animateOption.enable) {
|
||||||
const { speed = 0.01, repeat = false } = animateOption;
|
const { speed = 0.01 } = animateOption;
|
||||||
this.raiseCount += speed;
|
this.raiseCount += speed;
|
||||||
if (this.raiseCount >= 1) {
|
if (this.raiseCount >= 1) {
|
||||||
if (this.raiserepeat > 1) {
|
if (this.raiseRepeat > 1) {
|
||||||
this.raiseCount = 0;
|
this.raiseCount = 0;
|
||||||
this.raiserepeat--;
|
this.raiseRepeat--;
|
||||||
} else {
|
} else {
|
||||||
this.raiseCount = 1;
|
this.raiseCount = 1;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
// 圆柱体是否固定高度
|
// 圆柱体是否固定高度
|
||||||
u_heightfixed: Number(heightfixed),
|
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_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
||||||
u_cellTypeLayout: this.getCellTypeLayout(),
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
||||||
|
@ -138,7 +138,7 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
const {
|
const {
|
||||||
animateOption: { repeat = 1 },
|
animateOption: { repeat = 1 },
|
||||||
} = this.layer.getLayerConfig() as ILayerConfig;
|
} = this.layer.getLayerConfig() as ILayerConfig;
|
||||||
this.raiserepeat = repeat;
|
this.raiseRepeat = repeat;
|
||||||
|
|
||||||
this.layer
|
this.layer
|
||||||
.buildLayerModel({
|
.buildLayerModel({
|
||||||
|
@ -165,14 +165,12 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
this.dataTexture?.destroy();
|
this.dataTexture?.destroy();
|
||||||
}
|
}
|
||||||
protected registerBuiltinAttributes() {
|
protected registerBuiltinAttributes() {
|
||||||
// point layer size;
|
|
||||||
this.styleAttributeService.registerStyleAttribute({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'size',
|
name: 'size',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Size',
|
name: 'a_Size',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -180,9 +178,6 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
size: 3,
|
size: 3,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size } = feature;
|
const { size } = feature;
|
||||||
if (size) {
|
if (size) {
|
||||||
|
@ -232,13 +227,12 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Pos',
|
name: 'a_Pos',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
},
|
},
|
||||||
size: 3,
|
size: 3,
|
||||||
update: (feature: IEncodeFeature, featureIdx: number) => {
|
update: (feature: IEncodeFeature) => {
|
||||||
const coordinates = calculateCentroid(feature.coordinates);
|
const coordinates = calculateCentroid(feature.coordinates);
|
||||||
return lglt2xyz([coordinates[0], coordinates[1]]) as [
|
return lglt2xyz([coordinates[0], coordinates[1]]) as [
|
||||||
number,
|
number,
|
||||||
|
|
|
@ -94,7 +94,7 @@ export default class FillModel extends BaseModel {
|
||||||
animateOption = { enable: false },
|
animateOption = { enable: false },
|
||||||
} = this.layer.getLayerConfig() as ILayerConfig;
|
} = this.layer.getLayerConfig() as ILayerConfig;
|
||||||
return {
|
return {
|
||||||
u_aimate: this.animateOption2Array(animateOption),
|
u_animate: this.animateOption2Array(animateOption),
|
||||||
u_time: this.layer.getLayerAnimateTime(),
|
u_time: this.layer.getLayerAnimateTime(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import pointExtrudeVert from '../shaders/extrude/extrude_vert.glsl';
|
||||||
|
|
||||||
export default class ExtrudeModel extends BaseModel {
|
export default class ExtrudeModel extends BaseModel {
|
||||||
private raiseCount: number = 0;
|
private raiseCount: number = 0;
|
||||||
private raiserepeat: number = 0;
|
private raiseRepeat: number = 0;
|
||||||
public getUninforms() {
|
public getUninforms() {
|
||||||
const {
|
const {
|
||||||
animateOption = {
|
animateOption = {
|
||||||
|
@ -87,14 +87,14 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
useLinearColor = 1;
|
useLinearColor = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.raiseCount < 1 && this.raiserepeat > 0) {
|
if (this.raiseCount < 1 && this.raiseRepeat > 0) {
|
||||||
if (animateOption.enable) {
|
if (animateOption.enable) {
|
||||||
const { speed = 0.01, repeat = false } = animateOption;
|
const { speed = 0.01 } = animateOption;
|
||||||
this.raiseCount += speed;
|
this.raiseCount += speed;
|
||||||
if (this.raiseCount >= 1) {
|
if (this.raiseCount >= 1) {
|
||||||
if (this.raiserepeat > 1) {
|
if (this.raiseRepeat > 1) {
|
||||||
this.raiseCount = 0;
|
this.raiseCount = 0;
|
||||||
this.raiserepeat--;
|
this.raiseRepeat--;
|
||||||
} else {
|
} else {
|
||||||
this.raiseCount = 1;
|
this.raiseCount = 1;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
// 圆柱体是否固定高度
|
// 圆柱体是否固定高度
|
||||||
u_heightfixed: Number(heightfixed),
|
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_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
||||||
u_cellTypeLayout: this.getCellTypeLayout(),
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
||||||
|
@ -137,7 +137,7 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
depth = true,
|
depth = true,
|
||||||
animateOption: { repeat = 1 },
|
animateOption: { repeat = 1 },
|
||||||
} = this.layer.getLayerConfig() as ILayerConfig;
|
} = this.layer.getLayerConfig() as ILayerConfig;
|
||||||
this.raiserepeat = repeat;
|
this.raiseRepeat = repeat;
|
||||||
|
|
||||||
this.layer
|
this.layer
|
||||||
.buildLayerModel({
|
.buildLayerModel({
|
||||||
|
@ -173,7 +173,6 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Size',
|
name: 'a_Size',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -181,9 +180,6 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
size: 3,
|
size: 3,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size } = feature;
|
const { size } = feature;
|
||||||
if (size) {
|
if (size) {
|
||||||
|
@ -239,7 +235,7 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
},
|
},
|
||||||
size: 3,
|
size: 3,
|
||||||
update: (feature: IEncodeFeature, featureIdx: number) => {
|
update: (feature: IEncodeFeature) => {
|
||||||
const coordinates = calculateCentroid(feature.coordinates);
|
const coordinates = calculateCentroid(feature.coordinates);
|
||||||
return [coordinates[0], coordinates[1], 0];
|
return [coordinates[0], coordinates[1], 0];
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,7 +13,6 @@ import { $window, getMask, PointFillTriangulation } from '@antv/l7-utils';
|
||||||
import { isNumber } from 'lodash';
|
import { isNumber } from 'lodash';
|
||||||
import BaseModel from '../../core/BaseModel';
|
import BaseModel from '../../core/BaseModel';
|
||||||
import { IPointLayerStyleOptions } from '../../core/interface';
|
import { IPointLayerStyleOptions } from '../../core/interface';
|
||||||
// import { PointFillTriangulation } from '../../core/triangulation';
|
|
||||||
// animate pointLayer shader - support animate
|
// animate pointLayer shader - support animate
|
||||||
import waveFillFrag from '../shaders/animate/wave_frag.glsl';
|
import waveFillFrag from '../shaders/animate/wave_frag.glsl';
|
||||||
// static pointLayer shader - not support animate
|
// static pointLayer shader - not support animate
|
||||||
|
@ -24,7 +23,7 @@ import { Version } from '@antv/l7-maps';
|
||||||
|
|
||||||
export default class FillModel extends BaseModel {
|
export default class FillModel extends BaseModel {
|
||||||
private meter2coord: number = 1;
|
private meter2coord: number = 1;
|
||||||
private meteryScale: number = 1; // 兼容 mapbox
|
private meterYScale: number = 1; // 兼容 mapbox
|
||||||
private isMeter: boolean = false;
|
private isMeter: boolean = false;
|
||||||
|
|
||||||
private unit: string = 'l7size';
|
private unit: string = 'l7size';
|
||||||
|
@ -94,7 +93,7 @@ export default class FillModel extends BaseModel {
|
||||||
u_heightfixed: Number(heightfixed),
|
u_heightfixed: Number(heightfixed),
|
||||||
|
|
||||||
u_meter2coord: this.meter2coord,
|
u_meter2coord: this.meter2coord,
|
||||||
u_meteryScale: this.meteryScale,
|
u_meteryScale: this.meterYScale,
|
||||||
u_isMeter: Number(this.isMeter),
|
u_isMeter: Number(this.isMeter),
|
||||||
u_blur: blur,
|
u_blur: blur,
|
||||||
|
|
||||||
|
@ -116,7 +115,7 @@ export default class FillModel extends BaseModel {
|
||||||
animateOption = { enable: false },
|
animateOption = { enable: false },
|
||||||
} = this.layer.getLayerConfig() as ILayerConfig;
|
} = this.layer.getLayerConfig() as ILayerConfig;
|
||||||
return {
|
return {
|
||||||
u_aimate: this.animateOption2Array(animateOption),
|
u_animate: this.animateOption2Array(animateOption),
|
||||||
u_time: this.layer.getLayerAnimateTime(),
|
u_time: this.layer.getLayerAnimateTime(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -172,7 +171,7 @@ export default class FillModel extends BaseModel {
|
||||||
|
|
||||||
this.meter2coord = center[0] - westLnglat.lng;
|
this.meter2coord = center[0] - westLnglat.lng;
|
||||||
|
|
||||||
this.meteryScale = (southLnglat.lat - center[1]) / this.meter2coord;
|
this.meterYScale = (southLnglat.lat - center[1]) / this.meter2coord;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,9 +313,6 @@ export default class FillModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 5 } = feature;
|
const { size = 5 } = feature;
|
||||||
return Array.isArray(size) ? [size[0]] : [size];
|
return Array.isArray(size) ? [size[0]] : [size];
|
||||||
|
@ -339,9 +335,6 @@ export default class FillModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { shape = 2 } = feature;
|
const { shape = 2 } = feature;
|
||||||
const shapeIndex = shape2d.indexOf(shape as string);
|
const shapeIndex = shape2d.indexOf(shape as string);
|
||||||
|
|
|
@ -243,9 +243,6 @@ export default class FillImageModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { rotate = 0 } = feature;
|
const { rotate = 0 } = feature;
|
||||||
return Array.isArray(rotate) ? [rotate[0]] : [rotate as number];
|
return Array.isArray(rotate) ? [rotate[0]] : [rotate as number];
|
||||||
|
@ -266,9 +263,6 @@ export default class FillImageModel extends BaseModel {
|
||||||
size: 2,
|
size: 2,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const iconMap = this.iconService.getIconMap();
|
const iconMap = this.iconService.getIconMap();
|
||||||
const { shape } = feature;
|
const { shape } = feature;
|
||||||
|
@ -323,9 +317,6 @@ export default class FillImageModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 5 } = feature;
|
const { size = 5 } = feature;
|
||||||
return Array.isArray(size)
|
return Array.isArray(size)
|
||||||
|
@ -345,8 +336,7 @@ export default class FillImageModel extends BaseModel {
|
||||||
min: 'linear mipmap nearest',
|
min: 'linear mipmap nearest',
|
||||||
mipmap: true,
|
mipmap: true,
|
||||||
});
|
});
|
||||||
// this.layer.render();
|
// 更新完纹理后在更新的图层的时候需要更新所有的图层
|
||||||
// TODO: 更新完纹理后在更新的图层的时候需要更新所有的图层
|
|
||||||
this.layerService.throttleRenderLayers();
|
this.layerService.throttleRenderLayers();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,9 +135,6 @@ export default class ImageModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 5 } = feature;
|
const { size = 5 } = feature;
|
||||||
return Array.isArray(size) ? [size[0]] : [size as number];
|
return Array.isArray(size) ? [size[0]] : [size as number];
|
||||||
|
@ -182,7 +179,7 @@ export default class ImageModel extends BaseModel {
|
||||||
min: 'linear mipmap nearest',
|
min: 'linear mipmap nearest',
|
||||||
mipmap: true,
|
mipmap: true,
|
||||||
});
|
});
|
||||||
// TODO: 更新完纹理后在更新的图层的时候需要更新所有的图层
|
// 更新完纹理后在更新的图层的时候需要更新所有的图层
|
||||||
this.layerService.throttleRenderLayers();
|
this.layerService.throttleRenderLayers();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import FillImageModel from './fillmage';
|
||||||
import IMageModel from './image';
|
import IMageModel from './image';
|
||||||
import NormalModel from './normal';
|
import NormalModel from './normal';
|
||||||
import Radar from './radar';
|
import Radar from './radar';
|
||||||
import SimplePopint from './simplePoint';
|
import SimplePoint from './simplePoint';
|
||||||
import TextModel from './text';
|
import TextModel from './text';
|
||||||
import TileTextModel from './tileText';
|
import TileTextModel from './tileText';
|
||||||
import TileFillModel from './tile';
|
import TileFillModel from './tile';
|
||||||
|
@ -22,7 +22,7 @@ export type PointType =
|
||||||
| 'simplePoint'
|
| 'simplePoint'
|
||||||
| 'extrude'
|
| 'extrude'
|
||||||
| 'text'
|
| 'text'
|
||||||
| 'vectorpoint'
|
| 'vectorPoint'
|
||||||
| 'tile'
|
| 'tile'
|
||||||
| 'tileText'
|
| 'tileText'
|
||||||
| 'earthFill'
|
| 'earthFill'
|
||||||
|
@ -34,10 +34,10 @@ const PointModels: { [key in PointType]: any } = {
|
||||||
radar: Radar,
|
radar: Radar,
|
||||||
image: IMageModel,
|
image: IMageModel,
|
||||||
normal: NormalModel,
|
normal: NormalModel,
|
||||||
simplePoint: SimplePopint,
|
simplePoint: SimplePoint,
|
||||||
extrude: ExtrudeModel,
|
extrude: ExtrudeModel,
|
||||||
text: TextModel,
|
text: TextModel,
|
||||||
vectorpoint: PointTileModel,
|
vectorPoint: PointTileModel,
|
||||||
tile: TileFillModel,
|
tile: TileFillModel,
|
||||||
tileText: TileTextModel,
|
tileText: TileTextModel,
|
||||||
earthFill: EarthFillModel,
|
earthFill: EarthFillModel,
|
||||||
|
|
|
@ -73,14 +73,12 @@ export default class NormalModel extends BaseModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected registerBuiltinAttributes() {
|
protected registerBuiltinAttributes() {
|
||||||
// point layer size;
|
|
||||||
this.styleAttributeService.registerStyleAttribute({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'size',
|
name: 'size',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Size',
|
name: 'a_Size',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default class RadarModel extends BaseModel {
|
||||||
animateOption = { enable: false },
|
animateOption = { enable: false },
|
||||||
} = this.layer.getLayerConfig() as ILayerConfig;
|
} = this.layer.getLayerConfig() as ILayerConfig;
|
||||||
return {
|
return {
|
||||||
u_aimate: this.animateOption2Array(animateOption),
|
u_animate: this.animateOption2Array(animateOption),
|
||||||
u_time: this.layer.getLayerAnimateTime(),
|
u_time: this.layer.getLayerAnimateTime(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,14 +304,12 @@ export default class TextModel extends BaseModel {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// point layer size;
|
|
||||||
this.styleAttributeService.registerStyleAttribute({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'textUv',
|
name: 'textUv',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_tex',
|
name: 'a_tex',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
|
|
@ -134,7 +134,6 @@ export default class FillModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Size',
|
name: 'a_Size',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -142,9 +141,6 @@ export default class FillModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 5 } = feature;
|
const { size = 5 } = feature;
|
||||||
return Array.isArray(size)
|
return Array.isArray(size)
|
||||||
|
@ -168,9 +164,6 @@ export default class FillModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { shape = 2 } = feature;
|
const { shape = 2 } = feature;
|
||||||
const shape2d = this.layer.getLayerConfig().shape2d as string[];
|
const shape2d = this.layer.getLayerConfig().shape2d as string[];
|
||||||
|
|
|
@ -190,7 +190,6 @@ export default class TextModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[5], vertex[6]];
|
return [vertex[5], vertex[6]];
|
||||||
},
|
},
|
||||||
|
@ -204,7 +203,6 @@ export default class TextModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Size',
|
name: 'a_Size',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -212,9 +210,6 @@ export default class TextModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 12 } = feature;
|
const { size = 12 } = feature;
|
||||||
return Array.isArray(size) ? [size[0]] : [size as number];
|
return Array.isArray(size) ? [size[0]] : [size as number];
|
||||||
|
@ -229,7 +224,6 @@ export default class TextModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_tex',
|
name: 'a_tex',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -239,7 +233,6 @@ export default class TextModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
return [vertex[3], vertex[4]];
|
return [vertex[3], vertex[4]];
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,7 +7,7 @@ varying vec4 v_data;
|
||||||
varying vec4 v_color;
|
varying vec4 v_color;
|
||||||
varying float v_radius;
|
varying float v_radius;
|
||||||
uniform float u_time;
|
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 "sdf_2d"
|
||||||
#pragma include "picking"
|
#pragma include "picking"
|
||||||
|
@ -51,7 +51,7 @@ void main() {
|
||||||
if(d > 0.5) {
|
if(d > 0.5) {
|
||||||
discard;
|
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) {
|
if(u_additive > 0.0) {
|
||||||
|
|
|
@ -176,8 +176,6 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
featureIdx: number,
|
||||||
vertex: number[],
|
vertex: number[],
|
||||||
attributeIdx: number,
|
|
||||||
normal: number[],
|
|
||||||
) => {
|
) => {
|
||||||
const lng = vertex[0];
|
const lng = vertex[0];
|
||||||
const lat = vertex[1];
|
const lat = vertex[1];
|
||||||
|
@ -185,7 +183,6 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// point layer size;
|
|
||||||
this.styleAttributeService.registerStyleAttribute({
|
this.styleAttributeService.registerStyleAttribute({
|
||||||
name: 'normal',
|
name: 'normal',
|
||||||
type: AttributeType.Attribute,
|
type: AttributeType.Attribute,
|
||||||
|
@ -216,7 +213,6 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
descriptor: {
|
descriptor: {
|
||||||
name: 'a_Size',
|
name: 'a_Size',
|
||||||
buffer: {
|
buffer: {
|
||||||
// give the WebGL driver a hint that this buffer may change
|
|
||||||
usage: gl.DYNAMIC_DRAW,
|
usage: gl.DYNAMIC_DRAW,
|
||||||
data: [],
|
data: [],
|
||||||
type: gl.FLOAT,
|
type: gl.FLOAT,
|
||||||
|
@ -224,9 +220,6 @@ export default class ExtrudeModel extends BaseModel {
|
||||||
size: 1,
|
size: 1,
|
||||||
update: (
|
update: (
|
||||||
feature: IEncodeFeature,
|
feature: IEncodeFeature,
|
||||||
featureIdx: number,
|
|
||||||
vertex: number[],
|
|
||||||
attributeIdx: number,
|
|
||||||
) => {
|
) => {
|
||||||
const { size = 10 } = feature;
|
const { size = 10 } = feature;
|
||||||
return Array.isArray(size) ? [size[0]] : [size as number];
|
return Array.isArray(size) ? [size[0]] : [size as number];
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default class RasterModel extends BaseModel {
|
||||||
rampColors,
|
rampColors,
|
||||||
} = this.layer.getLayerConfig() as IRasterLayerStyleOptions;
|
} = this.layer.getLayerConfig() as IRasterLayerStyleOptions;
|
||||||
if (!isEqual(this.rampColors, rampColors)) {
|
if (!isEqual(this.rampColors, rampColors)) {
|
||||||
this.updateColorTexure();
|
this.updateColorTexture();
|
||||||
this.rampColors = rampColors;
|
this.rampColors = rampColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ export default class RasterModel extends BaseModel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateColorTexure() {
|
private updateColorTexture() {
|
||||||
const { createTexture2D } = this.rendererService;
|
const { createTexture2D } = this.rendererService;
|
||||||
const {
|
const {
|
||||||
rampColors,
|
rampColors,
|
||||||
|
|
|
@ -64,7 +64,7 @@ const earthlayer = new EarthLayer()
|
||||||
.style({
|
.style({
|
||||||
opacity: 1.0,
|
opacity: 1.0,
|
||||||
radius: 40,
|
radius: 40,
|
||||||
globelOtions: {
|
globalOptions: {
|
||||||
ambientRatio: 0.6, // 环境光
|
ambientRatio: 0.6, // 环境光
|
||||||
diffuseRatio: 0.4, // 漫反射
|
diffuseRatio: 0.4, // 漫反射
|
||||||
specularRatio: 0.1, // 高光反射
|
specularRatio: 0.1, // 高光反射
|
||||||
|
@ -153,7 +153,7 @@ scene.on('loaded', () => {
|
||||||
|
|
||||||
当用户的 `shape` 参数不被识别时,自动降级为 `base` 类型
|
当用户的 `shape` 参数不被识别时,自动降级为 `base` 类型
|
||||||
|
|
||||||
- globelOtions: 图层样式
|
- globalOptions: 图层样式
|
||||||
- ambientRatio: 环境光
|
- ambientRatio: 环境光
|
||||||
- diffuseRatio: 漫反射
|
- diffuseRatio: 漫反射
|
||||||
- specularRatio: 高光反射
|
- specularRatio: 高光反射
|
||||||
|
@ -170,7 +170,7 @@ const earthlayer = new EarthLayer()
|
||||||
)
|
)
|
||||||
.shape('base')
|
.shape('base')
|
||||||
.style({
|
.style({
|
||||||
globelOtions: {
|
globalOptions: {
|
||||||
ambientRatio: 0.6, // 环境光
|
ambientRatio: 0.6, // 环境光
|
||||||
diffuseRatio: 0.4, // 漫反射
|
diffuseRatio: 0.4, // 漫反射
|
||||||
specularRatio: 0.1, // 高光反射
|
specularRatio: 0.1, // 高光反射
|
||||||
|
|
|
@ -80,7 +80,7 @@ layer.on('terrainImageLoaded', () => {
|
||||||
```
|
```
|
||||||
|
|
||||||
[在线案例](/zh/examples/geometry/geometry#terrain)
|
[在线案例](/zh/examples/geometry/geometry#terrain)
|
||||||
### updateModelData(data: IAttrubuteAndElements)
|
### updateModelData(data: IAttributeAndElements)
|
||||||
- data 是通过 createModelData 方法生成的图层的标准模型数据。
|
- data 是通过 createModelData 方法生成的图层的标准模型数据。
|
||||||
|
|
||||||
我们通过这个方法可以实时更新图层的模型数据。
|
我们通过这个方法可以实时更新图层的模型数据。
|
||||||
|
|
|
@ -20,7 +20,7 @@ const earthlayer = new EarthLayer()
|
||||||
.color('#2E8AE6')
|
.color('#2E8AE6')
|
||||||
.shape('fill')
|
.shape('fill')
|
||||||
.style({
|
.style({
|
||||||
globelOtions: {
|
globalOptions: {
|
||||||
ambientRatio: 0.6, // 环境光
|
ambientRatio: 0.6, // 环境光
|
||||||
diffuseRatio: 0.4, // 漫反射
|
diffuseRatio: 0.4, // 漫反射
|
||||||
specularRatio: 0.1 // 高光反射
|
specularRatio: 0.1 // 高光反射
|
||||||
|
|
|
@ -398,7 +398,7 @@ export default class ScaleComponent extends React.Component {
|
||||||
)
|
)
|
||||||
.shape('base')
|
.shape('base')
|
||||||
.style({
|
.style({
|
||||||
globelOtions: {
|
globalOptions: {
|
||||||
ambientRatio: 0.6, // 环境光
|
ambientRatio: 0.6, // 环境光
|
||||||
diffuseRatio: 0.4, // 漫反射
|
diffuseRatio: 0.4, // 漫反射
|
||||||
specularRatio: 0.1, // 高光反射
|
specularRatio: 0.1, // 高光反射
|
||||||
|
|
|
@ -74,7 +74,7 @@ export default class ScaleComponent extends React.Component {
|
||||||
)
|
)
|
||||||
.shape('base')
|
.shape('base')
|
||||||
.style({
|
.style({
|
||||||
globelOtions: {
|
globalOptions: {
|
||||||
ambientRatio: 0.6, // 环境光
|
ambientRatio: 0.6, // 环境光
|
||||||
diffuseRatio: 0.4, // 漫反射
|
diffuseRatio: 0.4, // 漫反射
|
||||||
specularRatio: 0.1, // 高光反射
|
specularRatio: 0.1, // 高光反射
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default class Demo extends React.Component {
|
||||||
)
|
)
|
||||||
.shape('base')
|
.shape('base')
|
||||||
.style({
|
.style({
|
||||||
globelOtions: {
|
globalOptions: {
|
||||||
ambientRatio: 0.6, // 环境光
|
ambientRatio: 0.6, // 环境光
|
||||||
diffuseRatio: 0.4, // 漫反射
|
diffuseRatio: 0.4, // 漫反射
|
||||||
specularRatio: 0.1, // 高光反射
|
specularRatio: 0.1, // 高光反射
|
||||||
|
|
|
@ -60,7 +60,7 @@ export default class Demo extends React.Component {
|
||||||
)
|
)
|
||||||
.shape('base')
|
.shape('base')
|
||||||
.style({
|
.style({
|
||||||
globelOtions: {
|
globalOptions: {
|
||||||
ambientRatio: 0.6, // 环境光
|
ambientRatio: 0.6, // 环境光
|
||||||
diffuseRatio: 0.4, // 漫反射
|
diffuseRatio: 0.4, // 漫反射
|
||||||
specularRatio: 0.1, // 高光反射
|
specularRatio: 0.1, // 高光反射
|
||||||
|
|
|
@ -16,7 +16,7 @@ export default class Demo extends React.Component {
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const pointlayer = new PointLayer({})
|
const pointLayer = new PointLayer({})
|
||||||
.source(
|
.source(
|
||||||
[
|
[
|
||||||
{ lng: 121.61865234375, lat: 25.29437116258816 },
|
{ lng: 121.61865234375, lat: 25.29437116258816 },
|
||||||
|
@ -49,7 +49,7 @@ export default class Demo extends React.Component {
|
||||||
.color('#f00')
|
.color('#f00')
|
||||||
.size(20)
|
.size(20)
|
||||||
.active(true);
|
.active(true);
|
||||||
const earthlayer = new EarthLayer()
|
const earthLayer = new EarthLayer()
|
||||||
.source(
|
.source(
|
||||||
'https://gw.alipayobjects.com/mdn/rms_23a451/afts/img/A*3-3NSpqRqUoAAAAAAAAAAAAAARQnAQ',
|
'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')
|
.shape('base')
|
||||||
.style({
|
.style({
|
||||||
globelOtions: {
|
globalOptions: {
|
||||||
ambientRatio: 0.6, // 环境光
|
ambientRatio: 0.6, // 环境光
|
||||||
diffuseRatio: 0.4, // 漫反射
|
diffuseRatio: 0.4, // 漫反射
|
||||||
specularRatio: 0.1, // 高光反射
|
specularRatio: 0.1, // 高光反射
|
||||||
|
@ -79,13 +79,13 @@ export default class Demo extends React.Component {
|
||||||
const bloomLayer = new EarthLayer().color('#fff').shape('bloomSphere');
|
const bloomLayer = new EarthLayer().color('#fff').shape('bloomSphere');
|
||||||
|
|
||||||
scene.on('loaded', () => {
|
scene.on('loaded', () => {
|
||||||
scene.addLayer(earthlayer);
|
scene.addLayer(earthLayer);
|
||||||
scene.addLayer(pointlayer);
|
scene.addLayer(pointLayer);
|
||||||
|
|
||||||
scene.addLayer(atomLayer);
|
scene.addLayer(atomLayer);
|
||||||
scene.addLayer(bloomLayer);
|
scene.addLayer(bloomLayer);
|
||||||
|
|
||||||
earthlayer.setEarthTime(4.0);
|
earthLayer.setEarthTime(4.0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue