mirror of https://gitee.com/antv-l7/antv-l7
feat: 在核心模块移除 threejs 的引用
This commit is contained in:
parent
1b87bacf11
commit
4df80d0577
|
@ -1,7 +1,6 @@
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';
|
import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';
|
||||||
import { Container } from 'inversify';
|
import { Container } from 'inversify';
|
||||||
import { AnimationMixer, Matrix4, Object3D } from 'three';
|
|
||||||
import Clock from '../../utils/clock';
|
import Clock from '../../utils/clock';
|
||||||
import { ISceneConfig } from '../config/IConfigService';
|
import { ISceneConfig } from '../config/IConfigService';
|
||||||
import { IMapService } from '../map/IMapService';
|
import { IMapService } from '../map/IMapService';
|
||||||
|
@ -235,35 +234,35 @@ export interface ILayer {
|
||||||
altitude: number,
|
altitude: number,
|
||||||
rotation: [number, number, number],
|
rotation: [number, number, number],
|
||||||
scale: [number, number, number],
|
scale: [number, number, number],
|
||||||
): Matrix4;
|
): any;
|
||||||
|
|
||||||
// 获取对应地图的经纬度平移矩阵
|
// 获取对应地图的经纬度平移矩阵
|
||||||
getTranslateMatrix?(lnglat: ILngLat, altitude?: number): Matrix4;
|
getTranslateMatrix?(lnglat: ILngLat, altitude?: number): any;
|
||||||
|
|
||||||
// 设置模型对应地图在经纬度和高度方向的平移
|
// 设置模型对应地图在经纬度和高度方向的平移
|
||||||
applyObjectLngLat?(
|
applyObjectLngLat?(
|
||||||
object: Object3D,
|
object: any,
|
||||||
lnglat: ILngLat,
|
lnglat: ILngLat,
|
||||||
altitude?: number,
|
altitude?: number,
|
||||||
): void;
|
): void;
|
||||||
|
|
||||||
// 根据经纬度设置模型对应地图的平移
|
// 根据经纬度设置模型对应地图的平移
|
||||||
setObjectLngLat?(object: Object3D, lnglat: ILngLat, altitude?: number): void;
|
setObjectLngLat?(object: any, lnglat: ILngLat, altitude?: number): void;
|
||||||
|
|
||||||
// 返回物体在场景中的经纬度
|
// 返回物体在场景中的经纬度
|
||||||
getObjectLngLat?(object: Object3D): ILngLat;
|
getObjectLngLat?(object: any): ILngLat;
|
||||||
|
|
||||||
// 将经纬度转为 three 世界坐标
|
// 将经纬度转为 three 世界坐标
|
||||||
lnglatToCoord?(lnglat: ILngLat): ILngLat;
|
lnglatToCoord?(lnglat: ILngLat): ILngLat;
|
||||||
|
|
||||||
// 设置网格适配到地图坐标系
|
// 设置网格适配到地图坐标系
|
||||||
adjustMeshToMap?(object: Object3D): void;
|
adjustMeshToMap?(object: any): void;
|
||||||
|
|
||||||
// 设置网格的缩放 (主要是抹平 mapbox 底图时的差异,若是高德底图则可以直接设置网格的 scale 属性/方法)
|
// 设置网格的缩放 (主要是抹平 mapbox 底图时的差异,若是高德底图则可以直接设置网格的 scale 属性/方法)
|
||||||
setMeshScale?(object: Object3D, x: number, y: number, z: number): void;
|
setMeshScale?(object: any, x: number, y: number, z: number): void;
|
||||||
|
|
||||||
// 增加加载模型的动画混合器
|
// 增加加载模型的动画混合器
|
||||||
addAnimateMixer?(mixer: AnimationMixer): void;
|
addAnimateMixer?(mixer: any): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地球模式相关的方法
|
* 地球模式相关的方法
|
||||||
|
|
|
@ -1,13 +1,4 @@
|
||||||
import { Scene } from '@antv/l7-scene';
|
import { Scene } from '@antv/l7-scene';
|
||||||
import {
|
|
||||||
AnimationMixer,
|
|
||||||
Camera,
|
|
||||||
Matrix4,
|
|
||||||
PCFSoftShadowMap,
|
|
||||||
PerspectiveCamera,
|
|
||||||
Scene as ThreeScene,
|
|
||||||
WebGLRenderer,
|
|
||||||
} from 'three';
|
|
||||||
import {
|
import {
|
||||||
IThreeRenderService,
|
IThreeRenderService,
|
||||||
ThreeRenderService,
|
ThreeRenderService,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { Object3D } from 'three';
|
|
||||||
import ThreeLayer from './core/baseLayer';
|
import ThreeLayer from './core/baseLayer';
|
||||||
// import { IThreeJSLayer } from './core/IThreeJSLayer';
|
// import { IThreeJSLayer } from './core/IThreeJSLayer';
|
||||||
import ThreeRender from './core/threeRender';
|
import ThreeRender from './core/threeRender';
|
||||||
export { ThreeLayer, ThreeRender, Object3D };
|
export { ThreeLayer, ThreeRender };
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { Scene } from '@antv/l7';
|
import { Scene } from '@antv/l7';
|
||||||
import { GaodeMap, GaodeMapV2, Mapbox } from '@antv/l7-maps';
|
import { GaodeMap, GaodeMapV2, Mapbox } from '@antv/l7-maps';
|
||||||
import { ThreeLayer, ThreeRender, Object3D } from '@antv/l7-three';
|
import { ThreeLayer, ThreeRender } from '@antv/l7-three';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
// import { DirectionalLight, Scene as ThreeScene } from 'three';
|
// import { DirectionalLight, Scene as ThreeScene } from 'three';
|
||||||
import * as THREE from 'three';
|
import * as THREE from 'three';
|
||||||
|
@ -57,7 +57,7 @@ export default class GlTFThreeJSDemo extends React.Component {
|
||||||
'https://gw.alipayobjects.com/os/bmw-prod/3ca0a546-92d8-4ba0-a89c-017c218d5bea.gltf',
|
'https://gw.alipayobjects.com/os/bmw-prod/3ca0a546-92d8-4ba0-a89c-017c218d5bea.gltf',
|
||||||
(gltf) => {
|
(gltf) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const model: Object3D = gltf.scene;
|
const model = gltf.scene;
|
||||||
|
|
||||||
layer.getSource().data.dataArray.forEach(({ coordinates }) => {
|
layer.getSource().data.dataArray.forEach(({ coordinates }) => {
|
||||||
layer.adjustMeshToMap(model);
|
layer.adjustMeshToMap(model);
|
||||||
|
|
Loading…
Reference in New Issue