@antv/l7-core
Advanced tools
Comparing version 2.20.5 to 2.20.6
@@ -6,3 +6,4 @@ /** | ||
import 'reflect-metadata'; | ||
import { Container, interfaces } from 'inversify'; | ||
import type { interfaces } from 'inversify'; | ||
import { Container } from 'inversify'; | ||
declare const container: Container; | ||
@@ -9,0 +10,0 @@ interface IBabelPropertyDescriptor extends PropertyDescriptor { |
import { EventEmitter } from 'eventemitter3'; | ||
import 'reflect-metadata'; | ||
import { IFontAtlas, IFontMapping, IFontOptions, IFontService, IIconFontGlyph } from './IFontService'; | ||
import type { IFontAtlas, IFontMapping, IFontOptions, IFontService, IIconFontGlyph } from './IFontService'; | ||
export declare const DEFAULT_CHAR_SET: string[]; | ||
@@ -5,0 +5,0 @@ export declare const DEFAULT_FONT_FAMILY = "sans-serif"; |
import { EventEmitter } from 'eventemitter3'; | ||
import 'reflect-metadata'; | ||
import { ITexture2D } from '../renderer/ITexture2D'; | ||
import { ISceneService } from '../scene/ISceneService'; | ||
import { IICONMap, IIconService, IImage } from './IIconService'; | ||
import type { ITexture2D } from '../renderer/ITexture2D'; | ||
import type { ISceneService } from '../scene/ISceneService'; | ||
import type { IICONMap, IIconService, IImage } from './IIconService'; | ||
export default class IconService extends EventEmitter implements IIconService { | ||
@@ -7,0 +7,0 @@ canvasHeight: number; |
@@ -1,2 +0,2 @@ | ||
import EventEmitter from 'eventemitter3'; | ||
import type EventEmitter from 'eventemitter3'; | ||
export interface IFontOptions { | ||
@@ -3,0 +3,0 @@ fontFamily: string; |
@@ -1,4 +0,4 @@ | ||
import EventEmitter from 'eventemitter3'; | ||
import { ITexture2D } from '../renderer/ITexture2D'; | ||
import { ISceneService } from '../scene/ISceneService'; | ||
import type EventEmitter from 'eventemitter3'; | ||
import type { ITexture2D } from '../renderer/ITexture2D'; | ||
import type { ISceneService } from '../scene/ISceneService'; | ||
export type IImage = HTMLImageElement | File | string; | ||
@@ -5,0 +5,0 @@ export type Listener = (...args: any[]) => void; |
@@ -1,3 +0,3 @@ | ||
import { IColorRamp } from '@antv/l7-utils'; | ||
import { ITexture2D } from '../renderer/ITexture2D'; | ||
import type { IColorRamp } from '@antv/l7-utils'; | ||
import type { ITexture2D } from '../renderer/ITexture2D'; | ||
export interface ITextureService { | ||
@@ -4,0 +4,0 @@ setColorTexture(texture: ITexture2D, colorRamp: IColorRamp, domain?: [number, number]): void; |
import 'reflect-metadata'; | ||
import { ICameraService, IViewport } from './ICameraService'; | ||
import type { ICameraService, IViewport } from './ICameraService'; | ||
export default class CameraService implements ICameraService { | ||
@@ -4,0 +4,0 @@ private viewport; |
@@ -1,2 +0,2 @@ | ||
import { IMapCamera } from '../map/IMapService'; | ||
import type { IMapCamera } from '../map/IMapService'; | ||
export declare const CameraUniform: { | ||
@@ -3,0 +3,0 @@ ProjectionMatrix: string; |
@@ -1,2 +0,2 @@ | ||
import Camera from './Camera'; | ||
import type Camera from './Camera'; | ||
/** | ||
@@ -3,0 +3,0 @@ * 保存相机状态,便于后续在多个 Landmark 间移动 |
@@ -1,5 +0,5 @@ | ||
import { Container } from 'inversify'; | ||
import type { Container } from 'inversify'; | ||
import 'reflect-metadata'; | ||
import { IMapService } from '../map/IMapService'; | ||
import { IControl, IControlCorners, IControlService, IControlServiceCfg } from './IControlService'; | ||
import type { IMapService } from '../map/IMapService'; | ||
import type { IControl, IControlCorners, IControlService, IControlServiceCfg } from './IControlService'; | ||
export default class ControlService implements IControlService { | ||
@@ -6,0 +6,0 @@ container: HTMLElement; |
@@ -1,2 +0,2 @@ | ||
import { Container } from 'inversify'; | ||
import type { Container } from 'inversify'; | ||
export declare enum PositionType { | ||
@@ -3,0 +3,0 @@ 'TOPRIGHT' = "topright", |
@@ -1,5 +0,5 @@ | ||
import { anchorType, IBounds } from '@antv/l7-utils'; | ||
import { Container } from 'inversify'; | ||
import { ILngLat, IMapService, IPoint } from '../map/IMapService'; | ||
import { IPopup } from './IPopupService'; | ||
import type { anchorType, IBounds } from '@antv/l7-utils'; | ||
import type { Container } from 'inversify'; | ||
import type { ILngLat, IMapService, IPoint } from '../map/IMapService'; | ||
import type { IPopup } from './IPopupService'; | ||
export interface IMarkerScene { | ||
@@ -6,0 +6,0 @@ getMapService(): IMapService<unknown>; |
@@ -1,5 +0,6 @@ | ||
import { anchorType, DOM } from '@antv/l7-utils'; | ||
import EventEmitter from 'eventemitter3'; | ||
import { Container } from 'inversify'; | ||
import { ILngLat } from '../map/IMapService'; | ||
import type { anchorType } from '@antv/l7-utils'; | ||
import type EventEmitter from 'eventemitter3'; | ||
import type { Container } from 'inversify'; | ||
import type { ILngLat } from '../map/IMapService'; | ||
import type { DOM } from '@antv/l7-utils'; | ||
export interface IPopupOption { | ||
@@ -6,0 +7,0 @@ /** |
@@ -1,4 +0,4 @@ | ||
import { Container } from 'inversify'; | ||
import type { Container } from 'inversify'; | ||
import 'reflect-metadata'; | ||
import { IMarker, IMarkerLayer, IMarkerService } from './IMarkerService'; | ||
import type { IMarker, IMarkerLayer, IMarkerService } from './IMarkerService'; | ||
export default class MarkerService implements IMarkerService { | ||
@@ -5,0 +5,0 @@ container: HTMLElement; |
@@ -1,4 +0,4 @@ | ||
import { Container } from 'inversify'; | ||
import type { Container } from 'inversify'; | ||
import 'reflect-metadata'; | ||
import { IPopup, IPopupService } from './IPopupService'; | ||
import type { IPopup, IPopupService } from './IPopupService'; | ||
export default class PopupService implements IPopupService { | ||
@@ -5,0 +5,0 @@ private scene; |
import 'reflect-metadata'; | ||
import { ILayerAttributesOption, ILayerConfig } from '../layer/ILayerService'; | ||
import { IGlobalConfigService, ISceneConfig } from './IConfigService'; | ||
import type { ILayerAttributesOption, ILayerConfig } from '../layer/ILayerService'; | ||
import type { IGlobalConfigService, ISceneConfig } from './IConfigService'; | ||
export default class GlobalConfigService implements IGlobalConfigService { | ||
@@ -5,0 +5,0 @@ /** |
@@ -1,5 +0,5 @@ | ||
import { PositionName } from '../component/IControlService'; | ||
import { ILayerAttributesOption, ILayerConfig } from '../layer/ILayerService'; | ||
import { IMapWrapper } from '../map/IMapService'; | ||
import { IRenderConfig } from '../renderer/IRendererService'; | ||
import type { PositionName } from '../component/IControlService'; | ||
import type { ILayerAttributesOption, ILayerConfig } from '../layer/ILayerService'; | ||
import type { IMapWrapper } from '../map/IMapService'; | ||
import type { IRenderConfig } from '../renderer/IRendererService'; | ||
export interface ISceneConfig extends IRenderConfig { | ||
@@ -9,3 +9,2 @@ id: string | HTMLDivElement; | ||
gl?: any; | ||
hasBaseMap?: boolean; | ||
map: IMapWrapper; | ||
@@ -12,0 +11,0 @@ logoPosition?: PositionName; |
import 'reflect-metadata'; | ||
import { CoordinateSystem, ICoordinateSystemService } from './ICoordinateSystemService'; | ||
import type { ICoordinateSystemService } from './ICoordinateSystemService'; | ||
import { CoordinateSystem } from './ICoordinateSystemService'; | ||
export default class CoordinateSystemService implements ICoordinateSystemService { | ||
@@ -4,0 +5,0 @@ needRefresh: boolean; |
@@ -13,3 +13,5 @@ import _initializerDefineProperty from "@babel/runtime/helpers/esm/initializerDefineProperty"; | ||
import { getDistanceScales } from "../../utils/project"; | ||
// import { IMapService } from '../map/IMapService' | ||
import { CoordinateSystem } from "./ICoordinateSystemService"; | ||
@@ -16,0 +18,0 @@ var VECTOR_TO_POINT_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]; |
import { EventEmitter } from 'eventemitter3'; | ||
import { IDebugService, ILog } from './IDebugService'; | ||
import type { IDebugService, ILog } from './IDebugService'; | ||
export default class DebugService extends EventEmitter implements IDebugService { | ||
@@ -4,0 +4,0 @@ private renderMap; |
@@ -1,2 +0,2 @@ | ||
import { ILngLat } from '../map/IMapService'; | ||
import type { ILngLat } from '../map/IMapService'; | ||
export declare enum InteractionEvent { | ||
@@ -3,0 +3,0 @@ Hover = "hover", |
import EventEmitter from 'eventemitter3'; | ||
import 'reflect-metadata'; | ||
import { IInteractionService } from './IInteractionService'; | ||
import type { IInteractionService } from './IInteractionService'; | ||
/** | ||
@@ -5,0 +5,0 @@ * 由于目前 L7 与地图结合的方案为双 canvas 而非共享 WebGL Context,事件监听注册在地图底图上。 |
@@ -1,4 +0,4 @@ | ||
import { IInteractionTarget } from '../interaction/IInteractionService'; | ||
import { ILayer } from '../layer/ILayerService'; | ||
import { ILngLat } from '../map/IMapService'; | ||
import type { IInteractionTarget } from '../interaction/IInteractionService'; | ||
import type { ILayer } from '../layer/ILayerService'; | ||
import type { ILngLat } from '../map/IMapService'; | ||
export interface IPickingService { | ||
@@ -5,0 +5,0 @@ pickedColors: Uint8Array | undefined; |
import 'reflect-metadata'; | ||
import { IInteractionTarget } from '../interaction/IInteractionService'; | ||
import { ILayer } from '../layer/ILayerService'; | ||
import { ILngLat } from '../map/IMapService'; | ||
import { IPickingService } from './IPickingService'; | ||
import type { IInteractionTarget } from '../interaction/IInteractionService'; | ||
import type { ILayer } from '../layer/ILayerService'; | ||
import type { ILngLat } from '../map/IMapService'; | ||
import type { IPickingService } from './IPickingService'; | ||
export default class PickingService implements IPickingService { | ||
@@ -7,0 +7,0 @@ pickedColors: Uint8Array | undefined; |
@@ -19,2 +19,3 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import { gl } from "../renderer/gl"; | ||
import { TextureUsage } from "../renderer/ITexture2D"; | ||
var PickingService = (_dec = injectable(), _dec2 = inject(TYPES.IMapService), _dec3 = inject(TYPES.IRendererService), _dec4 = inject(TYPES.IGlobalConfigService), _dec5 = inject(TYPES.IInteractionService), _dec6 = inject(TYPES.ILayerService), _dec(_class = (_class2 = /*#__PURE__*/function () { | ||
@@ -141,10 +142,16 @@ function PickingService() { | ||
this.pickBufferScale = this.configService.getSceneConfig(id).pickBufferScale || 1; | ||
width = Math.round(width / this.pickBufferScale); | ||
height = Math.round(height / this.pickBufferScale); | ||
// 创建 picking framebuffer,后续实时 resize | ||
this.pickingFBO = createFramebuffer({ | ||
color: createTexture2D({ | ||
width: Math.round(width / this.pickBufferScale), | ||
height: Math.round(height / this.pickBufferScale), | ||
width: width, | ||
height: height, | ||
wrapS: gl.CLAMP_TO_EDGE, | ||
wrapT: gl.CLAMP_TO_EDGE | ||
}) | ||
wrapT: gl.CLAMP_TO_EDGE, | ||
usage: TextureUsage.RENDER_TARGET | ||
}), | ||
depth: true, | ||
width: width, | ||
height: height | ||
}); | ||
@@ -364,9 +371,9 @@ | ||
var _this4 = this; | ||
var _this$rendererService5, useFramebuffer, clear; | ||
var clear; | ||
return _regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
while (1) switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_this$rendererService5 = this.rendererService, useFramebuffer = _this$rendererService5.useFramebuffer, clear = _this$rendererService5.clear; | ||
clear = this.rendererService.clear; | ||
this.resizePickingFBO(); | ||
useFramebuffer(this.pickingFBO, function () { | ||
this.rendererService.useFramebuffer(this.pickingFBO, function () { | ||
var layers = _this4.layerService.getRenderList(); | ||
@@ -373,0 +380,0 @@ layers.filter(function (layer) { |
@@ -1,19 +0,19 @@ | ||
import { AsyncSeriesBailHook, AsyncWaterfallHook, SyncBailHook, SyncHook } from '@antv/async-hook'; | ||
import { IColorRamp, SourceTile, TilesetManager } from '@antv/l7-utils'; | ||
import { Container } from 'inversify'; | ||
import Clock from '../../utils/clock'; | ||
import { ITextureService } from '../asset/ITextureService'; | ||
import { ISceneConfig } from '../config/IConfigService'; | ||
import { IInteractionTarget } from '../interaction/IInteractionService'; | ||
import { ILayerPickService, IPickingService } from '../interaction/IPickingService'; | ||
import { IMapService } from '../map/IMapService'; | ||
import { IAttribute } from '../renderer/IAttribute'; | ||
import { IBuffer } from '../renderer/IBuffer'; | ||
import { IBlendOptions, IModel, IModelInitializationOptions, IStencilOptions } from '../renderer/IModel'; | ||
import { IMultiPassRenderer, IPass, IPostProcessingPass } from '../renderer/IMultiPassRenderer'; | ||
import { IRendererService } from '../renderer/IRendererService'; | ||
import { ITexture2D } from '../renderer/ITexture2D'; | ||
import { IUniform } from '../renderer/IUniform'; | ||
import { IParseDataItem, ISource, ISourceCFG, ITransform } from '../source/ISourceService'; | ||
import { IAnimateOption, IEncodeFeature, IScale, IScaleOptions, IScaleValue, IStyleAttribute, IStyleAttributeService, IStyleAttributeUpdateOptions, ScaleTypeName, StyleAttrField, StyleAttributeField, StyleAttributeOption, Triangulation } from './IStyleAttributeService'; | ||
import type { AsyncSeriesBailHook, AsyncWaterfallHook, SyncBailHook, SyncHook } from '@antv/async-hook'; | ||
import type { IColorRamp, SourceTile, TilesetManager } from '@antv/l7-utils'; | ||
import type { Container } from 'inversify'; | ||
import type Clock from '../../utils/clock'; | ||
import type { ITextureService } from '../asset/ITextureService'; | ||
import type { ISceneConfig } from '../config/IConfigService'; | ||
import type { IInteractionTarget } from '../interaction/IInteractionService'; | ||
import type { ILayerPickService, IPickingService } from '../interaction/IPickingService'; | ||
import type { IMapService } from '../map/IMapService'; | ||
import type { IAttribute } from '../renderer/IAttribute'; | ||
import type { IBuffer } from '../renderer/IBuffer'; | ||
import type { IBlendOptions, IModel, IModelInitializationOptions, IStencilOptions } from '../renderer/IModel'; | ||
import type { IMultiPassRenderer, IPass, IPostProcessingPass } from '../renderer/IMultiPassRenderer'; | ||
import type { IRendererService } from '../renderer/IRendererService'; | ||
import type { ITexture2D } from '../renderer/ITexture2D'; | ||
import type { IUniform } from '../renderer/IUniform'; | ||
import type { IParseDataItem, ISource, ISourceCFG, ITransform } from '../source/ISourceService'; | ||
import type { IAnimateOption, IEncodeFeature, IScale, IScaleOptions, IScaleValue, IStyleAttribute, IStyleAttributeService, IStyleAttributeUpdateOptions, ScaleTypeName, StyleAttrField, StyleAttributeField, StyleAttributeOption, Triangulation } from './IStyleAttributeService'; | ||
export declare enum BlendType { | ||
@@ -434,2 +434,10 @@ normal = "normal", | ||
setEarthTime(time: number): void; | ||
/** | ||
* WebGL2 下更新 Layer 级 Uniform | ||
*/ | ||
getLayerUniformBuffer(): IBuffer; | ||
/** | ||
* WebGL2 下更新 Layer 级 Uniform | ||
*/ | ||
getPickingUniformBuffer(): IBuffer; | ||
} | ||
@@ -436,0 +444,0 @@ /** |
@@ -1,5 +0,5 @@ | ||
import { IAttribute, IAttributeInitializationOptions } from '../renderer/IAttribute'; | ||
import { IBufferInitializationOptions } from '../renderer/IBuffer'; | ||
import { IElements } from '../renderer/IElements'; | ||
import { ILayer } from './ILayerService'; | ||
import type { IAttribute, IAttributeInitializationOptions } from '../renderer/IAttribute'; | ||
import type { IBufferInitializationOptions } from '../renderer/IBuffer'; | ||
import type { IElements } from '../renderer/IElements'; | ||
import type { ILayer } from './ILayerService'; | ||
/** | ||
@@ -6,0 +6,0 @@ * 1. 提供各个 Layer 样式属性初始值的注册服务 |
import { EventEmitter } from 'eventemitter3'; | ||
import 'reflect-metadata'; | ||
import Clock from '../../utils/clock'; | ||
import { ILayer, ILayerService, LayerServiceEvent } from './ILayerService'; | ||
import type { ILayer, ILayerService, LayerServiceEvent } from './ILayerService'; | ||
export default class LayerService extends EventEmitter<LayerServiceEvent> implements ILayerService { | ||
@@ -6,0 +6,0 @@ pickedLayerId: number; |
@@ -1,4 +0,4 @@ | ||
import { IAttributeScale, IStyleAttribute, StyleScaleType } from '../layer/IStyleAttributeService'; | ||
import { IAttribute } from '../renderer/IAttribute'; | ||
import { AttributeType, IEncodeFeature, IFeatureRange, IStyleAttributeInitializationOptions, IVertexAttributeDescriptor } from './IStyleAttributeService'; | ||
import type { IAttributeScale, IStyleAttribute, StyleScaleType } from '../layer/IStyleAttributeService'; | ||
import type { IAttribute } from '../renderer/IAttribute'; | ||
import type { AttributeType, IEncodeFeature, IFeatureRange, IStyleAttributeInitializationOptions, IVertexAttributeDescriptor } from './IStyleAttributeService'; | ||
export default class StyleAttribute implements IStyleAttribute { | ||
@@ -5,0 +5,0 @@ name: string; |
import 'reflect-metadata'; | ||
import { IAttribute } from '../renderer/IAttribute'; | ||
import { IElements } from '../renderer/IElements'; | ||
import { ILayer } from './ILayerService'; | ||
import { IEncodeFeature, IScaleOptions, IStyleAttribute, IStyleAttributeInitializationOptions, IStyleAttributeService, IStyleAttributeUpdateOptions, Triangulation } from './IStyleAttributeService'; | ||
import type { IAttribute } from '../renderer/IAttribute'; | ||
import type { IElements } from '../renderer/IElements'; | ||
import type { ILayer } from './ILayerService'; | ||
import type { IEncodeFeature, IScaleOptions, IStyleAttribute, IStyleAttributeInitializationOptions, IStyleAttributeService, IStyleAttributeUpdateOptions, Triangulation } from './IStyleAttributeService'; | ||
/** | ||
@@ -7,0 +7,0 @@ * 每个 Layer 都拥有一个,用于管理样式属性的注册和更新 |
@@ -1,3 +0,3 @@ | ||
import { Container } from 'inversify'; | ||
import { IViewport } from '../camera/ICameraService'; | ||
import type { Container } from 'inversify'; | ||
import type { IViewport } from '../camera/ICameraService'; | ||
export type Point = [number, number]; | ||
@@ -33,3 +33,3 @@ export type Bounds = [[number, number], [number, number]]; | ||
export interface IMapWrapper { | ||
setContainer(container: Container, id: string | HTMLDivElement, canvas?: HTMLCanvasElement, hasBaseMap?: boolean): void; | ||
setContainer(container: Container, id: string | HTMLDivElement, canvas?: HTMLCanvasElement): void; | ||
} | ||
@@ -36,0 +36,0 @@ interface ISimpleMapCoord { |
@@ -1,2 +0,2 @@ | ||
import { IBuffer } from './IBuffer'; | ||
import type { IBuffer } from './IBuffer'; | ||
export interface IAttributeInitializationOptions { | ||
@@ -3,0 +3,0 @@ buffer: IBuffer; |
@@ -1,2 +0,2 @@ | ||
import { gl } from './gl'; | ||
import type { gl } from './gl'; | ||
export interface IBufferInitializationOptions { | ||
@@ -17,2 +17,6 @@ data: number[] | number[][] | Uint8Array | Uint16Array | Uint32Array | Float32Array; | ||
isUBO?: boolean; | ||
/** | ||
* Used later in Spector.js. | ||
*/ | ||
label?: string; | ||
} | ||
@@ -19,0 +23,0 @@ export interface IBuffer { |
@@ -1,2 +0,2 @@ | ||
import { gl } from './gl'; | ||
import type { gl } from './gl'; | ||
export interface IElementsInitializationOptions { | ||
@@ -3,0 +3,0 @@ data: number[] | number[][] | Uint8Array | Uint16Array | Uint32Array; |
@@ -1,3 +0,3 @@ | ||
import { IRenderbuffer } from './IRenderbuffer'; | ||
import { ITexture2D } from './ITexture2D'; | ||
import type { IRenderbuffer } from './IRenderbuffer'; | ||
import type { ITexture2D } from './ITexture2D'; | ||
export interface IFramebufferInitializationOptions { | ||
@@ -4,0 +4,0 @@ width?: number; |
@@ -1,7 +0,7 @@ | ||
import { gl } from './gl'; | ||
import { IAttribute } from './IAttribute'; | ||
import { IBuffer } from './IBuffer'; | ||
import { IElements } from './IElements'; | ||
import { ITexture2D } from './ITexture2D'; | ||
import { IUniform } from './IUniform'; | ||
import type { gl } from './gl'; | ||
import type { IAttribute } from './IAttribute'; | ||
import type { IBuffer } from './IBuffer'; | ||
import type { IElements } from './IElements'; | ||
import type { ITexture2D } from './ITexture2D'; | ||
import type { IUniform } from './IUniform'; | ||
export interface IBlendOptions { | ||
@@ -114,2 +114,3 @@ enable: boolean; | ||
stencil?: Partial<IStencilOptions>; | ||
textures?: ITexture2D[]; | ||
} | ||
@@ -116,0 +117,0 @@ /** |
@@ -1,4 +0,4 @@ | ||
import { ILayer } from '../layer/ILayerService'; | ||
import { IFramebuffer } from './IFramebuffer'; | ||
import { ITexture2D } from './ITexture2D'; | ||
import type { ILayer } from '../layer/ILayerService'; | ||
import type { IFramebuffer } from './IFramebuffer'; | ||
import type { ITexture2D } from './ITexture2D'; | ||
export declare enum PassType { | ||
@@ -5,0 +5,0 @@ Normal = "normal", |
@@ -1,2 +0,2 @@ | ||
import { gl } from './gl'; | ||
import type { gl } from './gl'; | ||
export interface IRenderbufferInitializationOptions { | ||
@@ -3,0 +3,0 @@ width: number; |
@@ -1,8 +0,8 @@ | ||
import { IAttribute, IAttributeInitializationOptions } from './IAttribute'; | ||
import { IBuffer, IBufferInitializationOptions } from './IBuffer'; | ||
import { IElements, IElementsInitializationOptions } from './IElements'; | ||
import { IFramebuffer, IFramebufferInitializationOptions } from './IFramebuffer'; | ||
import { IModel, IModelInitializationOptions } from './IModel'; | ||
import { IPass } from './IMultiPassRenderer'; | ||
import { ITexture2D, ITexture2DInitializationOptions } from './ITexture2D'; | ||
import type { IAttribute, IAttributeInitializationOptions } from './IAttribute'; | ||
import type { IBuffer, IBufferInitializationOptions } from './IBuffer'; | ||
import type { IElements, IElementsInitializationOptions } from './IElements'; | ||
import type { IFramebuffer, IFramebufferInitializationOptions } from './IFramebuffer'; | ||
import type { IModel, IModelInitializationOptions } from './IModel'; | ||
import type { IPass } from './IMultiPassRenderer'; | ||
import type { ITexture2D, ITexture2DInitializationOptions } from './ITexture2D'; | ||
export interface IRenderConfig { | ||
@@ -9,0 +9,0 @@ /** |
@@ -1,2 +0,6 @@ | ||
import { gl } from './gl'; | ||
import type { gl } from './gl'; | ||
export declare enum TextureUsage { | ||
SAMPLED = 0, | ||
RENDER_TARGET = 1 | ||
} | ||
export interface ITexture2DInitializationOptions { | ||
@@ -8,2 +12,3 @@ /** | ||
height: number; | ||
usage?: TextureUsage; | ||
/** | ||
@@ -10,0 +15,0 @@ * 纹理格式 |
@@ -1,1 +0,5 @@ | ||
export {}; | ||
export var TextureUsage = /*#__PURE__*/function (TextureUsage) { | ||
TextureUsage[TextureUsage["SAMPLED"] = 0] = "SAMPLED"; | ||
TextureUsage[TextureUsage["RENDER_TARGET"] = 1] = "RENDER_TARGET"; | ||
return TextureUsage; | ||
}({}); |
@@ -1,3 +0,3 @@ | ||
import { IFramebuffer } from './IFramebuffer'; | ||
import { ITexture2D } from './ITexture2D'; | ||
import type { IFramebuffer } from './IFramebuffer'; | ||
import type { ITexture2D } from './ITexture2D'; | ||
interface IStruct { | ||
@@ -4,0 +4,0 @@ [structPropName: string]: number | number[] | boolean | IStruct | IStruct[]; |
import 'reflect-metadata'; | ||
import { ICameraService } from '../../camera/ICameraService'; | ||
import { IInteractionService } from '../../interaction/IInteractionService'; | ||
import { ILayer, ILayerService } from '../../layer/ILayerService'; | ||
import { IMapService } from '../../map/IMapService'; | ||
import { IShaderModuleService } from '../../shader/IShaderModuleService'; | ||
import { IPass, PassType } from '../IMultiPassRenderer'; | ||
import { IRendererService } from '../IRendererService'; | ||
import type { ICameraService } from '../../camera/ICameraService'; | ||
import type { IInteractionService } from '../../interaction/IInteractionService'; | ||
import type { ILayer, ILayerService } from '../../layer/ILayerService'; | ||
import type { IMapService } from '../../map/IMapService'; | ||
import type { IShaderModuleService } from '../../shader/IShaderModuleService'; | ||
import type { IPass } from '../IMultiPassRenderer'; | ||
import { PassType } from '../IMultiPassRenderer'; | ||
import type { IRendererService } from '../IRendererService'; | ||
/** | ||
@@ -10,0 +11,0 @@ * 常规 Pass 基类 |
import 'reflect-metadata'; | ||
import { IShaderModuleService } from '../../shader/IShaderModuleService'; | ||
import { IRendererService } from '../IRendererService'; | ||
import { ILayer } from '../../layer/ILayerService'; | ||
import { IPostProcessingPass, PassType } from '../IMultiPassRenderer'; | ||
import { ITexture2D } from '../ITexture2D'; | ||
import { IUniform } from '../IUniform'; | ||
import type { IShaderModuleService } from '../../shader/IShaderModuleService'; | ||
import type { IRendererService } from '../IRendererService'; | ||
import type { ILayer } from '../../layer/ILayerService'; | ||
import type { IPostProcessingPass } from '../IMultiPassRenderer'; | ||
import { PassType } from '../IMultiPassRenderer'; | ||
import type { ITexture2D } from '../ITexture2D'; | ||
import type { IUniform } from '../IUniform'; | ||
/** | ||
@@ -9,0 +10,0 @@ * 后处理 Pass 基类,通过 PostProcessor 驱动。 |
import 'reflect-metadata'; | ||
import { ILayer } from '../../layer/ILayerService'; | ||
import type { ILayer } from '../../layer/ILayerService'; | ||
import BaseNormalPass from './BaseNormalPass'; | ||
@@ -4,0 +4,0 @@ /** |
import 'reflect-metadata'; | ||
import { ILayer } from '../../layer/ILayerService'; | ||
import { IMultiPassRenderer, IPass, IPostProcessor } from '../IMultiPassRenderer'; | ||
import type { ILayer } from '../../layer/ILayerService'; | ||
import type { IMultiPassRenderer, IPass, IPostProcessor } from '../IMultiPassRenderer'; | ||
/** | ||
@@ -5,0 +5,0 @@ * ported from Three.js EffectComposer |
import 'reflect-metadata'; | ||
import { ILayer } from '../../layer/ILayerService'; | ||
import type { ILayer } from '../../layer/ILayerService'; | ||
import { PassType } from '../IMultiPassRenderer'; | ||
@@ -4,0 +4,0 @@ import BaseNormalPass from './BaseNormalPass'; |
import 'reflect-metadata'; | ||
import { IUniform } from '../../IUniform'; | ||
import type { IUniform } from '../../IUniform'; | ||
import BasePostProcessingPass from '../BasePostProcessingPass'; | ||
@@ -4,0 +4,0 @@ export interface IBloomPassConfig { |
import 'reflect-metadata'; | ||
import { IUniform } from '../../IUniform'; | ||
import type { IUniform } from '../../IUniform'; | ||
import BasePostProcessingPass from '../BasePostProcessingPass'; | ||
@@ -4,0 +4,0 @@ export interface IBlurHPassConfig { |
@@ -1,2 +0,2 @@ | ||
import { IUniform } from '../../IUniform'; | ||
import type { IUniform } from '../../IUniform'; | ||
import BasePostProcessingPass from '../BasePostProcessingPass'; | ||
@@ -3,0 +3,0 @@ export interface IBlurVPassConfig { |
import 'reflect-metadata'; | ||
import { ILayer } from '../../layer/ILayerService'; | ||
import { IFramebuffer } from '../IFramebuffer'; | ||
import { IPostProcessingPass, IPostProcessor } from '../IMultiPassRenderer'; | ||
import { IRendererService } from '../IRendererService'; | ||
import { ITexture2D } from '../ITexture2D'; | ||
import type { ILayer } from '../../layer/ILayerService'; | ||
import type { IFramebuffer } from '../IFramebuffer'; | ||
import type { IPostProcessingPass, IPostProcessor } from '../IMultiPassRenderer'; | ||
import type { IRendererService } from '../IRendererService'; | ||
import type { ITexture2D } from '../ITexture2D'; | ||
/** | ||
@@ -8,0 +8,0 @@ * ported from Three.js EffectComposer |
import 'reflect-metadata'; | ||
import { ILayer } from '../../layer/ILayerService'; | ||
import type { ILayer } from '../../layer/ILayerService'; | ||
import { PassType } from '../IMultiPassRenderer'; | ||
@@ -4,0 +4,0 @@ import BaseNormalPass from './BaseNormalPass'; |
import 'reflect-metadata'; | ||
import { ILayer } from '../../layer/ILayerService'; | ||
import { IShaderModuleService } from '../../shader/IShaderModuleService'; | ||
import type { ILayer } from '../../layer/ILayerService'; | ||
import type { IShaderModuleService } from '../../shader/IShaderModuleService'; | ||
import { PassType } from '../IMultiPassRenderer'; | ||
@@ -5,0 +5,0 @@ import BaseNormalPass from './BaseNormalPass'; |
@@ -1,4 +0,4 @@ | ||
import EventEmitter from 'eventemitter3'; | ||
import { ISceneConfig } from '../config/IConfigService'; | ||
import { ILayer } from '../layer/ILayerService'; | ||
import type EventEmitter from 'eventemitter3'; | ||
import type { ISceneConfig } from '../config/IConfigService'; | ||
import type { ILayer } from '../layer/ILayerService'; | ||
export interface ISceneService extends EventEmitter { | ||
@@ -5,0 +5,0 @@ destroyed: boolean; |
import { EventEmitter } from 'eventemitter3'; | ||
import 'reflect-metadata'; | ||
import { ISceneConfig } from '../config/IConfigService'; | ||
import { ILayer } from '../layer/ILayerService'; | ||
import { ISceneService } from './ISceneService'; | ||
import type { ISceneConfig } from '../config/IConfigService'; | ||
import type { ILayer } from '../layer/ILayerService'; | ||
import type { ISceneService } from './ISceneService'; | ||
/** | ||
@@ -7,0 +7,0 @@ * will emit `loaded` `resize` `destroy` event panstart panmove panend |
@@ -1,3 +0,3 @@ | ||
import { IInject } from '../renderer/IModel'; | ||
import { IUniform } from '../renderer/IUniform'; | ||
import type { IInject } from '../renderer/IModel'; | ||
import type { IUniform } from '../renderer/IUniform'; | ||
/** | ||
@@ -4,0 +4,0 @@ * 提供 ShaderModule 管理服务 |
import 'reflect-metadata'; | ||
import { IModuleParams, IShaderModuleService } from './IShaderModuleService'; | ||
import type { IModuleParams, IShaderModuleService } from './IShaderModuleService'; | ||
export default class ShaderModuleService implements IShaderModuleService { | ||
@@ -4,0 +4,0 @@ private moduleCache; |
@@ -16,13 +16,13 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
/* babel-plugin-inline-import '../../shaders/scene_uniforms.glsl' */ | ||
var scene_uniforms = "layout(std140) uniform SceneUniforms {\n mat4 u_ViewMatrix;\n mat4 u_ProjectionMatrix;\n mat4 u_ViewProjectionMatrix;\n mat4 u_ModelMatrix;\n mat4 u_Mvp;\n vec4 u_ViewportCenterProjection;\n vec3 u_PixelsPerDegree;\n float u_Zoom;\n vec3 u_PixelsPerDegree2;\n float u_ZoomScale;\n vec3 u_PixelsPerMeter;\n float u_CoordinateSystem;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_ViewportCenter;\n vec2 u_ViewportSize;\n vec2 u_sceneCenterMercator;\n float u_FocalDistance;\n};"; | ||
var scene_uniforms = "layout(std140) uniform SceneUniforms {\n mat4 u_ViewMatrix;\n mat4 u_ProjectionMatrix;\n mat4 u_ViewProjectionMatrix;\n mat4 u_ModelMatrix;\n vec4 u_ViewportCenterProjection;\n vec3 u_PixelsPerDegree;\n float u_Zoom;\n vec3 u_PixelsPerDegree2;\n float u_ZoomScale;\n vec3 u_PixelsPerMeter;\n float u_CoordinateSystem;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_ViewportCenter;\n vec2 u_ViewportSize;\n float u_FocalDistance;\n};\n\nlayout(std140) uniform LayerUniforms {\n mat4 u_Mvp;\n vec2 u_sceneCenterMercator;\n};\n"; | ||
/* babel-plugin-inline-import '../../shaders/picking_uniforms.glsl' */ | ||
var picking_uniforms = "layout(std140) uniform PickingUniforms {\n vec4 u_HighlightColor;\n vec4 u_SelectColor;\n vec3 u_PickingColor;\n float u_PickingStage;\n vec3 u_CurrentSelectedId;\n float u_PickingThreshold;\n float u_PickingBuffer;\n float u_shaderPick;\n float u_EnableSelect;\n float u_activeMix;\n};"; | ||
/* babel-plugin-inline-import '../../shaders/light2.glsl' */ | ||
/* babel-plugin-inline-import '../../shaders/common_light.glsl' */ | ||
var light = "#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\n\nfloat calc_lighting(vec4 pos) {\n\n vec3 worldPos = vec3(pos * u_ModelMatrix);\n\n vec3 worldNormal = a_Normal;\n // //cal light weight\n vec3 viewDir = normalize(u_CameraPosition - worldPos);\n\n vec3 lightDir = normalize(vec3(1, -10.5, 12));\n\n vec3 halfDir = normalize(viewDir+lightDir);\n // //lambert\n float lambert = dot(worldNormal, lightDir);\n //specular\n float specular = pow(max(0.0, dot(worldNormal, halfDir)), 32.0);\n //sum to light weight\n float lightWeight = ambientRatio + diffuseRatio * lambert + specularRatio * specular;\n\n return lightWeight;\n}\n"; | ||
/* babel-plugin-inline-import '../../shaders/lighting.glsl' */ | ||
var lighting = "// Blinn-Phong model\n// apply lighting in vertex shader instead of fragment shader\n// @see https://learnopengl.com/Advanced-Lighting/Advanced-Lighting\nuniform float u_Ambient : 1.0;\nuniform float u_Diffuse : 1.0;\nuniform float u_Specular : 1.0;\nuniform int u_NumOfDirectionalLights : 1;\nuniform int u_NumOfSpotLights : 0;\n\n#define SHININESS 32.0\n#define MAX_NUM_OF_DIRECTIONAL_LIGHTS 3\n#define MAX_NUM_OF_SPOT_LIGHTS 3\n\nstruct DirectionalLight {\n vec3 direction;\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nstruct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n float constant;\n float linear;\n float quadratic;\n float angle;\n float blur;\n float exponent;\n};\n\nuniform DirectionalLight u_DirectionalLights[MAX_NUM_OF_DIRECTIONAL_LIGHTS];\nuniform SpotLight u_SpotLights[MAX_NUM_OF_SPOT_LIGHTS];\n\nvec3 calc_directional_light(DirectionalLight light, vec3 normal, vec3 viewDir) {\n vec3 lightDir = normalize(light.direction);\n // diffuse shading\n float diff = max(dot(normal, lightDir), 0.0);\n // Blinn-Phong specular shading\n vec3 halfwayDir = normalize(lightDir + viewDir);\n float spec = pow(max(dot(normal, halfwayDir), 0.0), SHININESS);\n\n vec3 ambient = light.ambient * u_Ambient;\n vec3 diffuse = light.diffuse * diff * u_Diffuse;\n vec3 specular = light.specular * spec * u_Specular;\n\n return ambient + diffuse + specular;\n}\n\n// vec3 calc_spot_light(SpotLight light, vec3 normal, vec3 fragPos, vec3 viewDir) {\n// vec3 lightDir = normalize(light.position - fragPos);\n// // diffuse shading\n// float diff = max(dot(normal, lightDir), 0.0);\n// // specular shading\n// vec3 reflectDir = reflect(-lightDir, normal);\n// float spec = pow(max(dot(viewDir, reflectDir), 0.0), SHININESS);\n// // attenuation\n// float distance = length(light.position - fragPos);\n// float attenuation = 1.0 / (light.constant + light.linear * distance +\n// light.quadratic * (distance * distance));\n\n// vec3 ambient = light.ambient * u_Ambient;\n// vec3 diffuse = light.diffuse * diff * u_Diffuse;\n// vec3 specular = light.specular * spec * u_Specular;\n\n// float spotEffect = dot(normalize(light.direction), -lightDir);\n// float spotCosCutoff = cos(light.angle / 180.0 * PI);\n// float spotCosOuterCutoff = cos((light.angle + light.blur) / 180.0 * PI);\n// float spotCosInnerCutoff = cos((light.angle - light.blur) / 180.0 * PI);\n// if (spotEffect > spotCosCutoff) {\n// spotEffect = pow(smoothstep(spotCosOuterCutoff, spotCosInnerCutoff, spotEffect), light.exponent);\n// } else {\n// spotEffect = 0.0;\n// }\n\n// return ambient + attenuation * (spotEffect * diffuse + specular);\n// }\n\nvec3 calc_lighting(vec3 position, vec3 normal, vec3 viewDir) {\n vec3 weight = vec3(0.0);\n for (int i = 0; i < MAX_NUM_OF_DIRECTIONAL_LIGHTS; i++) {\n if (i >= u_NumOfDirectionalLights) {\n break;\n }\n weight += calc_directional_light(u_DirectionalLights[i], normal, viewDir);\n }\n // for (int i = 0; i < MAX_NUM_OF_SPOT_LIGHTS; i++) {\n // if (i >= u_NumOfSpotLights) {\n // break;\n // }\n // weight += calc_spot_light(u_SpotLights[i], normal, position, viewDir);\n // }\n return weight;\n}\n"; | ||
var lighting = "// Blinn-Phong model\n// apply lighting in vertex shader instead of fragment shader\n// @see https://learnopengl.com/Advanced-Lighting/Advanced-Lighting\nuniform float u_Ambient : 1.0;\nuniform float u_Diffuse : 1.0;\nuniform float u_Specular : 1.0;\nuniform int u_NumOfDirectionalLights : 1;\nuniform int u_NumOfSpotLights : 0;\n\n#define SHININESS 32.0\n#define MAX_NUM_OF_DIRECTIONAL_LIGHTS 3\n#define MAX_NUM_OF_SPOT_LIGHTS 3\n\nstruct DirectionalLight {\n vec3 direction;\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nstruct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n float constant;\n float linear;\n float quadratic;\n float angle;\n float blur;\n float exponent;\n};\n\nuniform DirectionalLight u_DirectionalLights[MAX_NUM_OF_DIRECTIONAL_LIGHTS];\nuniform SpotLight u_SpotLights[MAX_NUM_OF_SPOT_LIGHTS];\n\nvec3 calc_directional_light(DirectionalLight light, vec3 normal, vec3 viewDir) {\n vec3 lightDir = normalize(light.direction);\n // diffuse shading\n float diff = max(dot(normal, lightDir), 0.0);\n // Blinn-Phong specular shading\n vec3 halfwayDir = normalize(lightDir + viewDir);\n float spec = pow(max(dot(normal, halfwayDir), 0.0), SHININESS);\n\n vec3 ambient = light.ambient * u_Ambient;\n vec3 diffuse = light.diffuse * diff * u_Diffuse;\n vec3 specular = light.specular * spec * u_Specular;\n\n return ambient + diffuse + specular;\n}\n\n\nvec3 calc_lighting(vec3 position, vec3 normal, vec3 viewDir) {\n vec3 weight = vec3(0.0);\n for (int i = 0; i < MAX_NUM_OF_DIRECTIONAL_LIGHTS; i++) {\n if (i >= u_NumOfDirectionalLights) {\n break;\n }\n weight += calc_directional_light(u_DirectionalLights[i], normal, viewDir);\n }\n return weight;\n}\n"; | ||
/* babel-plugin-inline-import '../../shaders/picking.frag.glsl' */ | ||
var pickingFrag = "\nin vec4 v_PickingResult;\n\n#pragma include \"picking_uniforms\"\n\n#define PICKING_NONE 0.0\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\n#define HIGHLIGHT 1.0\n#define SELECT 2.0\n\n/*\n * Returns highlight color if this item is selected.\n */\nvec4 filterHighlightColor(vec4 color, float weight) {\n // float selected = v_PickingResult.a;\n bool selected = bool(v_PickingResult.a);\n\n // if (selected == SELECT) {\n if (selected) {\n // // \u70B9\u51FB\u9009\u4E2D\u72B6\u6001\n // vec4 selectColor = u_SelectColor * COLOR_SCALE;\n // return selectColor;\n // } else if (selected == HIGHLIGHT) {\n // // hover \u9AD8\u4EAE\u72B6\u6001\n vec4 highLightColor = u_HighlightColor * COLOR_SCALE;\n\n float highLightAlpha = highLightColor.a;\n float highLightRatio = highLightAlpha / (highLightAlpha + color.a * (1.0 - highLightAlpha));\n\n vec3 resultRGB = mix(color.rgb, highLightColor.rgb, highLightRatio);\n return vec4(mix(resultRGB * weight, color.rgb, u_activeMix), color.a);\n } else {\n return color;\n }\n}\n\n/*\n * Returns picking color if picking enabled else unmodified argument.\n */\nvec4 filterPickingColor(vec4 color) {\n vec3 pickingColor = v_PickingResult.rgb;\n if (u_PickingStage == PICKING_ENCODE && length(pickingColor) < 0.001) {\n discard;\n }\n return u_PickingStage == PICKING_ENCODE ? vec4(pickingColor, step(0.001,color.a)): color;\n}\n\n/*\n * Returns picking color if picking is enabled if not\n * highlight color if this item is selected, otherwise unmodified argument.\n */\nvec4 filterColor(vec4 color) {\n // \u8FC7\u6EE4\u591A\u4F59\u7684 shader \u8BA1\u7B97\n // return color;\n if(u_shaderPick < 0.5) {\n return color; // \u6682\u65F6\u53BB\u9664 \u76F4\u63A5\u53D6\u6D88\u8BA1\u7B97\u5728\u9009\u4E2D\u65F6\u62D6\u62FD\u5730\u56FE\u4F1A\u6709\u95EE\u9898\n } else {\n return filterPickingColor(filterHighlightColor(color, 1.0));\n }\n \n}\n\nvec4 filterColorAlpha(vec4 color, float alpha) {\n // \u8FC7\u6EE4\u591A\u4F59\u7684 shader \u8BA1\u7B97\n // return color;\n if(u_shaderPick < 0.5) {\n return color; // \u6682\u65F6\u53BB\u9664 \u76F4\u63A5\u53D6\u6D88\u8BA1\u7B97\u5728\u9009\u4E2D\u65F6\u62D6\u62FD\u5730\u56FE\u4F1A\u6709\u95EE\u9898\n } else {\n return filterPickingColor(filterHighlightColor(color, alpha));\n }\n}\n\n"; | ||
/* babel-plugin-inline-import '../../shaders/picking.vert.glsl' */ | ||
var pickingVert = "layout(location = 2) in vec3 a_PickingColor;\nout vec4 v_PickingResult;\n\n#pragma include \"picking_uniforms\"\n\n#define PICKING_NONE 0.0\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\n#define NORMAL 0.0\n#define HIGHLIGHT 1.0\n#define SELECT 2.0\n\nbool isVertexPicked(vec3 vertexColor) {\n return distance(vertexColor,u_PickingColor.rgb) < 0.01;\n}\n\n// \u5224\u65AD\u5F53\u524D\u70B9\u662F\u5426\u5DF2\u7ECF\u88AB select \u9009\u4E2D\nbool isVertexSelected(vec3 vertexColor) {\n return distance(vertexColor,u_CurrentSelectedId.rgb) < 0.01;\n}\n\nvoid setPickingColor(vec3 pickingColor) {\n if(u_shaderPick < 0.5) {\n return;\n }\n // compares only in highlight stage\n\n v_PickingResult.a = float((u_PickingStage == PICKING_HIGHLIGHT) && isVertexPicked(pickingColor));\n\n // Stores the picking color so that the fragment shader can render it during picking\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\n\nfloat setPickingSize(float x) {\n return u_PickingStage == PICKING_ENCODE ? x + u_PickingBuffer : x;\n}\n\nfloat setPickingOrder(float z) {\n bool selected = bool(v_PickingResult.a);\n return selected ? z + 1. : 0.;\n}\n"; | ||
var pickingVert = "layout(location = 3) in vec3 a_PickingColor;\nout vec4 v_PickingResult;\n\n#pragma include \"picking_uniforms\"\n\n#define PICKING_NONE 0.0\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\n#define NORMAL 0.0\n#define HIGHLIGHT 1.0\n#define SELECT 2.0\n\nbool isVertexPicked(vec3 vertexColor) {\n return distance(vertexColor,u_PickingColor.rgb) < 0.01;\n}\n\n// \u5224\u65AD\u5F53\u524D\u70B9\u662F\u5426\u5DF2\u7ECF\u88AB select \u9009\u4E2D\nbool isVertexSelected(vec3 vertexColor) {\n return distance(vertexColor,u_CurrentSelectedId.rgb) < 0.01;\n}\n\nvoid setPickingColor(vec3 pickingColor) {\n if(u_shaderPick < 0.5) {\n return;\n }\n // compares only in highlight stage\n\n v_PickingResult.a = float((u_PickingStage == PICKING_HIGHLIGHT) && isVertexPicked(pickingColor));\n\n // Stores the picking color so that the fragment shader can render it during picking\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\n\nfloat setPickingSize(float x) {\n return u_PickingStage == PICKING_ENCODE ? x + u_PickingBuffer : x;\n}\n\nfloat setPickingOrder(float z) {\n bool selected = bool(v_PickingResult.a);\n return selected ? z + 1. : 0.;\n}\n"; | ||
/* babel-plugin-inline-import '../../shaders/project.glsl' */ | ||
@@ -29,0 +29,0 @@ var project = "\n#define E 2.718281828459045\nvec2 ProjectFlat(vec2 lnglat){\n float maxs=85.0511287798;\n float lat=max(min(maxs,lnglat.y),-maxs);\n float scale= 268435456.;\n float d=PI/180.;\n float x=lnglat.x*d;\n float y=lat*d;\n y=log(tan((PI/4.)+(y/2.)));\n\n float a=.5/PI,\n b=.5,\n c=-.5/PI;\n d=.5;\n x=scale*(a*x+b);\n y=scale*(c*y+d);\n return vec2(x,y);\n}\n\nvec2 unProjectFlat(vec2 px){\n float a=.5/PI;\n float b=.5;\n float c=-.5/PI;\n float d=.5;\n float scale = 268435456.;\n float x=(px.x/scale-b)/a;\n float y=(px.y/scale-d)/c;\n y=(atan(pow(E,y))-(PI/4.))*2.;\n d=PI/180.;\n float lat=y/d;\n float lng=x/d;\n return vec2(lng,lat);\n}\n\nfloat pixelDistance(vec2 from, vec2 to) {\n vec2 a1 = ProjectFlat(from);\n vec2 b1 = ProjectFlat(to);\n return distance(a1, b1);\n}\n\n// gaode2.0\nvec2 customProject(vec2 lnglat) { // \u7ECF\u7EAC\u5EA6 => \u5E73\u9762\u5750\u6807\n float t = lnglat.x;\n float e = lnglat.y;\n float Sm = 180.0 / PI;\n float Tm = 6378137.0;\n float Rm = PI / 180.0;\n float r = 85.0511287798;\n e = max(min(r, e), -r);\n t *= Rm;\n e *= Rm;\n e = log(tan(PI / 4.0 + e / 2.0));\n return vec2(t * Tm, e * Tm);\n}\n\nvec2 unProjCustomCoord(vec2 point) { // \u5E73\u9762\u5750\u6807 => \u7ECF\u7EAC\u5EA6\n float Sm = 57.29577951308232; //180 / Math.PI\n float Tm = 6378137.0;\n float t = point.x;\n float e = point.y;\n return vec2(t / Tm * Sm, (2.0 * atan(exp(e / Tm)) - PI / 2.0) * Sm);\n}\n\n\nfloat customPixelDistance(vec2 from, vec2 to) {\n vec2 a1 = ProjectFlat(from);\n vec2 b1 = ProjectFlat(to);\n return distance(a1, b1);\n}"; |
@@ -1,3 +0,3 @@ | ||
import { RequestParameters, SourceTile, TilesetManager } from '@antv/l7-utils'; | ||
import { BBox } from '@turf/helpers'; | ||
import type { RequestParameters, SourceTile, TilesetManager } from '@antv/l7-utils'; | ||
import type { BBox } from '@turf/helpers'; | ||
export type DataType = string | object[] | object; | ||
@@ -4,0 +4,0 @@ export type SourceEventType = 'inited' | 'sourceUpdate' | 'update'; |
@@ -1,3 +0,3 @@ | ||
import { IFontMappingOption } from '../services/asset/IFontService'; | ||
import { IIcon, IICONMap } from '../services/asset/IIconService'; | ||
import type { IFontMappingOption } from '../services/asset/IFontService'; | ||
import type { IIcon, IICONMap } from '../services/asset/IIconService'; | ||
export declare function buildMapping({ characterSet, getFontWidth, fontHeight, buffer, maxCanvasWidth, mapping, xOffset, yOffset, }: IFontMappingOption): { | ||
@@ -4,0 +4,0 @@ mapping: import("../services/asset/IFontService").IFontMapping; |
@@ -25,2 +25,3 @@ "use strict"; | ||
var _gl = require("../renderer/gl"); | ||
var _ITexture2D = require("../renderer/ITexture2D"); | ||
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5; | ||
@@ -148,10 +149,16 @@ var PickingService = exports.default = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inversify.inject)(_types.TYPES.IMapService), _dec3 = (0, _inversify.inject)(_types.TYPES.IRendererService), _dec4 = (0, _inversify.inject)(_types.TYPES.IGlobalConfigService), _dec5 = (0, _inversify.inject)(_types.TYPES.IInteractionService), _dec6 = (0, _inversify.inject)(_types.TYPES.ILayerService), _dec(_class = (_class2 = /*#__PURE__*/function () { | ||
this.pickBufferScale = this.configService.getSceneConfig(id).pickBufferScale || 1; | ||
width = Math.round(width / this.pickBufferScale); | ||
height = Math.round(height / this.pickBufferScale); | ||
// 创建 picking framebuffer,后续实时 resize | ||
this.pickingFBO = createFramebuffer({ | ||
color: createTexture2D({ | ||
width: Math.round(width / this.pickBufferScale), | ||
height: Math.round(height / this.pickBufferScale), | ||
width: width, | ||
height: height, | ||
wrapS: _gl.gl.CLAMP_TO_EDGE, | ||
wrapT: _gl.gl.CLAMP_TO_EDGE | ||
}) | ||
wrapT: _gl.gl.CLAMP_TO_EDGE, | ||
usage: _ITexture2D.TextureUsage.RENDER_TARGET | ||
}), | ||
depth: true, | ||
width: width, | ||
height: height | ||
}); | ||
@@ -371,9 +378,9 @@ | ||
var _this4 = this; | ||
var _this$rendererService5, useFramebuffer, clear; | ||
var clear; | ||
return _regenerator.default.wrap(function _callee3$(_context3) { | ||
while (1) switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_this$rendererService5 = this.rendererService, useFramebuffer = _this$rendererService5.useFramebuffer, clear = _this$rendererService5.clear; | ||
clear = this.rendererService.clear; | ||
this.resizePickingFBO(); | ||
useFramebuffer(this.pickingFBO, function () { | ||
this.rendererService.useFramebuffer(this.pickingFBO, function () { | ||
var layers = _this4.layerService.getRenderList(); | ||
@@ -380,0 +387,0 @@ layers.filter(function (layer) { |
@@ -5,2 +5,8 @@ "use strict"; | ||
value: true | ||
}); | ||
}); | ||
exports.TextureUsage = void 0; | ||
var TextureUsage = exports.TextureUsage = /*#__PURE__*/function (TextureUsage) { | ||
TextureUsage[TextureUsage["SAMPLED"] = 0] = "SAMPLED"; | ||
TextureUsage[TextureUsage["RENDER_TARGET"] = 1] = "RENDER_TARGET"; | ||
return TextureUsage; | ||
}({}); |
@@ -23,13 +23,13 @@ "use strict"; | ||
/* babel-plugin-inline-import '../../shaders/scene_uniforms.glsl' */ | ||
var scene_uniforms = "layout(std140) uniform SceneUniforms {\n mat4 u_ViewMatrix;\n mat4 u_ProjectionMatrix;\n mat4 u_ViewProjectionMatrix;\n mat4 u_ModelMatrix;\n mat4 u_Mvp;\n vec4 u_ViewportCenterProjection;\n vec3 u_PixelsPerDegree;\n float u_Zoom;\n vec3 u_PixelsPerDegree2;\n float u_ZoomScale;\n vec3 u_PixelsPerMeter;\n float u_CoordinateSystem;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_ViewportCenter;\n vec2 u_ViewportSize;\n vec2 u_sceneCenterMercator;\n float u_FocalDistance;\n};"; | ||
var scene_uniforms = "layout(std140) uniform SceneUniforms {\n mat4 u_ViewMatrix;\n mat4 u_ProjectionMatrix;\n mat4 u_ViewProjectionMatrix;\n mat4 u_ModelMatrix;\n vec4 u_ViewportCenterProjection;\n vec3 u_PixelsPerDegree;\n float u_Zoom;\n vec3 u_PixelsPerDegree2;\n float u_ZoomScale;\n vec3 u_PixelsPerMeter;\n float u_CoordinateSystem;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_ViewportCenter;\n vec2 u_ViewportSize;\n float u_FocalDistance;\n};\n\nlayout(std140) uniform LayerUniforms {\n mat4 u_Mvp;\n vec2 u_sceneCenterMercator;\n};\n"; | ||
/* babel-plugin-inline-import '../../shaders/picking_uniforms.glsl' */ | ||
var picking_uniforms = "layout(std140) uniform PickingUniforms {\n vec4 u_HighlightColor;\n vec4 u_SelectColor;\n vec3 u_PickingColor;\n float u_PickingStage;\n vec3 u_CurrentSelectedId;\n float u_PickingThreshold;\n float u_PickingBuffer;\n float u_shaderPick;\n float u_EnableSelect;\n float u_activeMix;\n};"; | ||
/* babel-plugin-inline-import '../../shaders/light2.glsl' */ | ||
/* babel-plugin-inline-import '../../shaders/common_light.glsl' */ | ||
var light = "#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\n\nfloat calc_lighting(vec4 pos) {\n\n vec3 worldPos = vec3(pos * u_ModelMatrix);\n\n vec3 worldNormal = a_Normal;\n // //cal light weight\n vec3 viewDir = normalize(u_CameraPosition - worldPos);\n\n vec3 lightDir = normalize(vec3(1, -10.5, 12));\n\n vec3 halfDir = normalize(viewDir+lightDir);\n // //lambert\n float lambert = dot(worldNormal, lightDir);\n //specular\n float specular = pow(max(0.0, dot(worldNormal, halfDir)), 32.0);\n //sum to light weight\n float lightWeight = ambientRatio + diffuseRatio * lambert + specularRatio * specular;\n\n return lightWeight;\n}\n"; | ||
/* babel-plugin-inline-import '../../shaders/lighting.glsl' */ | ||
var lighting = "// Blinn-Phong model\n// apply lighting in vertex shader instead of fragment shader\n// @see https://learnopengl.com/Advanced-Lighting/Advanced-Lighting\nuniform float u_Ambient : 1.0;\nuniform float u_Diffuse : 1.0;\nuniform float u_Specular : 1.0;\nuniform int u_NumOfDirectionalLights : 1;\nuniform int u_NumOfSpotLights : 0;\n\n#define SHININESS 32.0\n#define MAX_NUM_OF_DIRECTIONAL_LIGHTS 3\n#define MAX_NUM_OF_SPOT_LIGHTS 3\n\nstruct DirectionalLight {\n vec3 direction;\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nstruct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n float constant;\n float linear;\n float quadratic;\n float angle;\n float blur;\n float exponent;\n};\n\nuniform DirectionalLight u_DirectionalLights[MAX_NUM_OF_DIRECTIONAL_LIGHTS];\nuniform SpotLight u_SpotLights[MAX_NUM_OF_SPOT_LIGHTS];\n\nvec3 calc_directional_light(DirectionalLight light, vec3 normal, vec3 viewDir) {\n vec3 lightDir = normalize(light.direction);\n // diffuse shading\n float diff = max(dot(normal, lightDir), 0.0);\n // Blinn-Phong specular shading\n vec3 halfwayDir = normalize(lightDir + viewDir);\n float spec = pow(max(dot(normal, halfwayDir), 0.0), SHININESS);\n\n vec3 ambient = light.ambient * u_Ambient;\n vec3 diffuse = light.diffuse * diff * u_Diffuse;\n vec3 specular = light.specular * spec * u_Specular;\n\n return ambient + diffuse + specular;\n}\n\n// vec3 calc_spot_light(SpotLight light, vec3 normal, vec3 fragPos, vec3 viewDir) {\n// vec3 lightDir = normalize(light.position - fragPos);\n// // diffuse shading\n// float diff = max(dot(normal, lightDir), 0.0);\n// // specular shading\n// vec3 reflectDir = reflect(-lightDir, normal);\n// float spec = pow(max(dot(viewDir, reflectDir), 0.0), SHININESS);\n// // attenuation\n// float distance = length(light.position - fragPos);\n// float attenuation = 1.0 / (light.constant + light.linear * distance +\n// light.quadratic * (distance * distance));\n\n// vec3 ambient = light.ambient * u_Ambient;\n// vec3 diffuse = light.diffuse * diff * u_Diffuse;\n// vec3 specular = light.specular * spec * u_Specular;\n\n// float spotEffect = dot(normalize(light.direction), -lightDir);\n// float spotCosCutoff = cos(light.angle / 180.0 * PI);\n// float spotCosOuterCutoff = cos((light.angle + light.blur) / 180.0 * PI);\n// float spotCosInnerCutoff = cos((light.angle - light.blur) / 180.0 * PI);\n// if (spotEffect > spotCosCutoff) {\n// spotEffect = pow(smoothstep(spotCosOuterCutoff, spotCosInnerCutoff, spotEffect), light.exponent);\n// } else {\n// spotEffect = 0.0;\n// }\n\n// return ambient + attenuation * (spotEffect * diffuse + specular);\n// }\n\nvec3 calc_lighting(vec3 position, vec3 normal, vec3 viewDir) {\n vec3 weight = vec3(0.0);\n for (int i = 0; i < MAX_NUM_OF_DIRECTIONAL_LIGHTS; i++) {\n if (i >= u_NumOfDirectionalLights) {\n break;\n }\n weight += calc_directional_light(u_DirectionalLights[i], normal, viewDir);\n }\n // for (int i = 0; i < MAX_NUM_OF_SPOT_LIGHTS; i++) {\n // if (i >= u_NumOfSpotLights) {\n // break;\n // }\n // weight += calc_spot_light(u_SpotLights[i], normal, position, viewDir);\n // }\n return weight;\n}\n"; | ||
var lighting = "// Blinn-Phong model\n// apply lighting in vertex shader instead of fragment shader\n// @see https://learnopengl.com/Advanced-Lighting/Advanced-Lighting\nuniform float u_Ambient : 1.0;\nuniform float u_Diffuse : 1.0;\nuniform float u_Specular : 1.0;\nuniform int u_NumOfDirectionalLights : 1;\nuniform int u_NumOfSpotLights : 0;\n\n#define SHININESS 32.0\n#define MAX_NUM_OF_DIRECTIONAL_LIGHTS 3\n#define MAX_NUM_OF_SPOT_LIGHTS 3\n\nstruct DirectionalLight {\n vec3 direction;\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nstruct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n float constant;\n float linear;\n float quadratic;\n float angle;\n float blur;\n float exponent;\n};\n\nuniform DirectionalLight u_DirectionalLights[MAX_NUM_OF_DIRECTIONAL_LIGHTS];\nuniform SpotLight u_SpotLights[MAX_NUM_OF_SPOT_LIGHTS];\n\nvec3 calc_directional_light(DirectionalLight light, vec3 normal, vec3 viewDir) {\n vec3 lightDir = normalize(light.direction);\n // diffuse shading\n float diff = max(dot(normal, lightDir), 0.0);\n // Blinn-Phong specular shading\n vec3 halfwayDir = normalize(lightDir + viewDir);\n float spec = pow(max(dot(normal, halfwayDir), 0.0), SHININESS);\n\n vec3 ambient = light.ambient * u_Ambient;\n vec3 diffuse = light.diffuse * diff * u_Diffuse;\n vec3 specular = light.specular * spec * u_Specular;\n\n return ambient + diffuse + specular;\n}\n\n\nvec3 calc_lighting(vec3 position, vec3 normal, vec3 viewDir) {\n vec3 weight = vec3(0.0);\n for (int i = 0; i < MAX_NUM_OF_DIRECTIONAL_LIGHTS; i++) {\n if (i >= u_NumOfDirectionalLights) {\n break;\n }\n weight += calc_directional_light(u_DirectionalLights[i], normal, viewDir);\n }\n return weight;\n}\n"; | ||
/* babel-plugin-inline-import '../../shaders/picking.frag.glsl' */ | ||
var pickingFrag = "\nin vec4 v_PickingResult;\n\n#pragma include \"picking_uniforms\"\n\n#define PICKING_NONE 0.0\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\n#define HIGHLIGHT 1.0\n#define SELECT 2.0\n\n/*\n * Returns highlight color if this item is selected.\n */\nvec4 filterHighlightColor(vec4 color, float weight) {\n // float selected = v_PickingResult.a;\n bool selected = bool(v_PickingResult.a);\n\n // if (selected == SELECT) {\n if (selected) {\n // // \u70B9\u51FB\u9009\u4E2D\u72B6\u6001\n // vec4 selectColor = u_SelectColor * COLOR_SCALE;\n // return selectColor;\n // } else if (selected == HIGHLIGHT) {\n // // hover \u9AD8\u4EAE\u72B6\u6001\n vec4 highLightColor = u_HighlightColor * COLOR_SCALE;\n\n float highLightAlpha = highLightColor.a;\n float highLightRatio = highLightAlpha / (highLightAlpha + color.a * (1.0 - highLightAlpha));\n\n vec3 resultRGB = mix(color.rgb, highLightColor.rgb, highLightRatio);\n return vec4(mix(resultRGB * weight, color.rgb, u_activeMix), color.a);\n } else {\n return color;\n }\n}\n\n/*\n * Returns picking color if picking enabled else unmodified argument.\n */\nvec4 filterPickingColor(vec4 color) {\n vec3 pickingColor = v_PickingResult.rgb;\n if (u_PickingStage == PICKING_ENCODE && length(pickingColor) < 0.001) {\n discard;\n }\n return u_PickingStage == PICKING_ENCODE ? vec4(pickingColor, step(0.001,color.a)): color;\n}\n\n/*\n * Returns picking color if picking is enabled if not\n * highlight color if this item is selected, otherwise unmodified argument.\n */\nvec4 filterColor(vec4 color) {\n // \u8FC7\u6EE4\u591A\u4F59\u7684 shader \u8BA1\u7B97\n // return color;\n if(u_shaderPick < 0.5) {\n return color; // \u6682\u65F6\u53BB\u9664 \u76F4\u63A5\u53D6\u6D88\u8BA1\u7B97\u5728\u9009\u4E2D\u65F6\u62D6\u62FD\u5730\u56FE\u4F1A\u6709\u95EE\u9898\n } else {\n return filterPickingColor(filterHighlightColor(color, 1.0));\n }\n \n}\n\nvec4 filterColorAlpha(vec4 color, float alpha) {\n // \u8FC7\u6EE4\u591A\u4F59\u7684 shader \u8BA1\u7B97\n // return color;\n if(u_shaderPick < 0.5) {\n return color; // \u6682\u65F6\u53BB\u9664 \u76F4\u63A5\u53D6\u6D88\u8BA1\u7B97\u5728\u9009\u4E2D\u65F6\u62D6\u62FD\u5730\u56FE\u4F1A\u6709\u95EE\u9898\n } else {\n return filterPickingColor(filterHighlightColor(color, alpha));\n }\n}\n\n"; | ||
/* babel-plugin-inline-import '../../shaders/picking.vert.glsl' */ | ||
var pickingVert = "layout(location = 2) in vec3 a_PickingColor;\nout vec4 v_PickingResult;\n\n#pragma include \"picking_uniforms\"\n\n#define PICKING_NONE 0.0\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\n#define NORMAL 0.0\n#define HIGHLIGHT 1.0\n#define SELECT 2.0\n\nbool isVertexPicked(vec3 vertexColor) {\n return distance(vertexColor,u_PickingColor.rgb) < 0.01;\n}\n\n// \u5224\u65AD\u5F53\u524D\u70B9\u662F\u5426\u5DF2\u7ECF\u88AB select \u9009\u4E2D\nbool isVertexSelected(vec3 vertexColor) {\n return distance(vertexColor,u_CurrentSelectedId.rgb) < 0.01;\n}\n\nvoid setPickingColor(vec3 pickingColor) {\n if(u_shaderPick < 0.5) {\n return;\n }\n // compares only in highlight stage\n\n v_PickingResult.a = float((u_PickingStage == PICKING_HIGHLIGHT) && isVertexPicked(pickingColor));\n\n // Stores the picking color so that the fragment shader can render it during picking\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\n\nfloat setPickingSize(float x) {\n return u_PickingStage == PICKING_ENCODE ? x + u_PickingBuffer : x;\n}\n\nfloat setPickingOrder(float z) {\n bool selected = bool(v_PickingResult.a);\n return selected ? z + 1. : 0.;\n}\n"; | ||
var pickingVert = "layout(location = 3) in vec3 a_PickingColor;\nout vec4 v_PickingResult;\n\n#pragma include \"picking_uniforms\"\n\n#define PICKING_NONE 0.0\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\n#define NORMAL 0.0\n#define HIGHLIGHT 1.0\n#define SELECT 2.0\n\nbool isVertexPicked(vec3 vertexColor) {\n return distance(vertexColor,u_PickingColor.rgb) < 0.01;\n}\n\n// \u5224\u65AD\u5F53\u524D\u70B9\u662F\u5426\u5DF2\u7ECF\u88AB select \u9009\u4E2D\nbool isVertexSelected(vec3 vertexColor) {\n return distance(vertexColor,u_CurrentSelectedId.rgb) < 0.01;\n}\n\nvoid setPickingColor(vec3 pickingColor) {\n if(u_shaderPick < 0.5) {\n return;\n }\n // compares only in highlight stage\n\n v_PickingResult.a = float((u_PickingStage == PICKING_HIGHLIGHT) && isVertexPicked(pickingColor));\n\n // Stores the picking color so that the fragment shader can render it during picking\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\n\nfloat setPickingSize(float x) {\n return u_PickingStage == PICKING_ENCODE ? x + u_PickingBuffer : x;\n}\n\nfloat setPickingOrder(float z) {\n bool selected = bool(v_PickingResult.a);\n return selected ? z + 1. : 0.;\n}\n"; | ||
/* babel-plugin-inline-import '../../shaders/project.glsl' */ | ||
@@ -36,0 +36,0 @@ var project = "\n#define E 2.718281828459045\nvec2 ProjectFlat(vec2 lnglat){\n float maxs=85.0511287798;\n float lat=max(min(maxs,lnglat.y),-maxs);\n float scale= 268435456.;\n float d=PI/180.;\n float x=lnglat.x*d;\n float y=lat*d;\n y=log(tan((PI/4.)+(y/2.)));\n\n float a=.5/PI,\n b=.5,\n c=-.5/PI;\n d=.5;\n x=scale*(a*x+b);\n y=scale*(c*y+d);\n return vec2(x,y);\n}\n\nvec2 unProjectFlat(vec2 px){\n float a=.5/PI;\n float b=.5;\n float c=-.5/PI;\n float d=.5;\n float scale = 268435456.;\n float x=(px.x/scale-b)/a;\n float y=(px.y/scale-d)/c;\n y=(atan(pow(E,y))-(PI/4.))*2.;\n d=PI/180.;\n float lat=y/d;\n float lng=x/d;\n return vec2(lng,lat);\n}\n\nfloat pixelDistance(vec2 from, vec2 to) {\n vec2 a1 = ProjectFlat(from);\n vec2 b1 = ProjectFlat(to);\n return distance(a1, b1);\n}\n\n// gaode2.0\nvec2 customProject(vec2 lnglat) { // \u7ECF\u7EAC\u5EA6 => \u5E73\u9762\u5750\u6807\n float t = lnglat.x;\n float e = lnglat.y;\n float Sm = 180.0 / PI;\n float Tm = 6378137.0;\n float Rm = PI / 180.0;\n float r = 85.0511287798;\n e = max(min(r, e), -r);\n t *= Rm;\n e *= Rm;\n e = log(tan(PI / 4.0 + e / 2.0));\n return vec2(t * Tm, e * Tm);\n}\n\nvec2 unProjCustomCoord(vec2 point) { // \u5E73\u9762\u5750\u6807 => \u7ECF\u7EAC\u5EA6\n float Sm = 57.29577951308232; //180 / Math.PI\n float Tm = 6378137.0;\n float t = point.x;\n float e = point.y;\n return vec2(t / Tm * Sm, (2.0 * atan(exp(e / Tm)) - PI / 2.0) * Sm);\n}\n\n\nfloat customPixelDistance(vec2 from, vec2 to) {\n vec2 a1 = ProjectFlat(from);\n vec2 b1 = ProjectFlat(to);\n return distance(a1, b1);\n}"; |
{ | ||
"name": "@antv/l7-core", | ||
"version": "2.20.5", | ||
"version": "2.20.6", | ||
"description": "", | ||
@@ -28,3 +28,3 @@ "main": "lib/index.js", | ||
"@antv/async-hook": "^2.2.9", | ||
"@antv/l7-utils": "2.20.5", | ||
"@antv/l7-utils": "2.20.6", | ||
"@babel/runtime": "^7.7.7", | ||
@@ -40,3 +40,3 @@ "@mapbox/tiny-sdf": "^1.2.5", | ||
"inversify-inject-decorators": "^3.1.0", | ||
"reflect-metadata": "^0.1.13", | ||
"reflect-metadata": "^0.2.1", | ||
"viewport-mercator-project": "^6.2.1" | ||
@@ -52,3 +52,3 @@ }, | ||
}, | ||
"gitHead": "9c6df5f2ef050d18102f4aa4ccbb598bc1b5ee4d", | ||
"gitHead": "b5af1f23f8f5524cbbb2ea858399fefba63b0163", | ||
"publishConfig": { | ||
@@ -55,0 +55,0 @@ "access": "public" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
20718
976714
+ Added@antv/l7-utils@2.20.6(transitive)
+ Addedreflect-metadata@0.2.2(transitive)
- Removed@antv/l7-utils@2.20.5(transitive)
- Removedreflect-metadata@0.1.14(transitive)
Updated@antv/l7-utils@2.20.6
Updatedreflect-metadata@^0.2.1