@metagl/sdk-render 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +156 -4
- package/README_EN.md +156 -4
- package/amd/lacdt.render.amd.js +61 -56
- package/cjs/lacdt.render.cjs.js +62 -56
- package/cjs/lacdt.render.d.ts +21 -1
- package/esm/lacdt.render.d.ts +21 -1
- package/esm/lacdt.render.js +58 -56
- package/lacdt.render.d.ts +21 -1
- package/lacdt.render.js +62 -56
- package/package.json +1 -1
- package/resources/readme.txt +1 -0
- package/resources/textures/grey.png +0 -0
- package/resources/textures/mesh.png +0 -0
- package/resources/textures/waterNormalsSmall.jpg +0 -0
- package/resources/thirdParty/html2canvas/0.5.0-beta4/html2canvas.js +3519 -0
- package/resources/thirdParty/html2canvas/0.5.0-beta4/html2canvas.min.js +8 -0
- package/resources/thirdParty/wangEditor/colorpicker.js +481 -0
- package/resources/thirdParty/wangEditor/wangEditor.js +50897 -0
- package/resources/thirdParty/wangEditor/wangeditor.css +945 -0
- package/resources/water/sea 50_1.json.json +578 -0
- package/resources/workers/satellite.worker.js +3175 -0
- /package/assets/{images → Images}/rain.png +0 -0
- /package/{Textures → assets/Images}/waterNormals.jpg +0 -0
- /package/{Textures → assets/Textures}/bluenoise.png +0 -0
- /package/assets/{images → Textures}/waterNormals.jpg +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<h1 align="center">LACDT Render WebSDK- 三维地球渲染引擎</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">一个基于Cesium的三维地球渲染引擎,提供了丰富的地图操作和数据分析功能。它采用模块化架构,包含多个功能系统,支持地图加载、图层管理、建筑模型展示、测量工具、3D Tiles搜索等功能。</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://github.com/ASunYC/sdk-render/blob/main/LICENSE">
|
|
7
|
+
<img src="https://img.shields.io/github/license/ASunYC/sdk-render.svg?style=flat&colorA=080f12&colorB=1fa669" alt="License">
|
|
8
|
+
</a>
|
|
9
|
+
<a href="https://github.com/ASunYC/sdk-render">
|
|
10
|
+
<img src="https://img.shields.io/github/stars/ASunYC/sdk-render?style=flat&colorA=080f12&colorB=1fa669" alt="Stars">
|
|
11
|
+
</a>
|
|
12
|
+
<a href="https://github.com/ASunYC/sdk-render/issues">
|
|
13
|
+
<img src="https://img.shields.io/github/issues/ASunYC/sdk-render?style=flat&colorA=080f12&colorB=1fa669" alt="Issues">
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://www.npmjs.com/package/@metagl/sdk-render">
|
|
16
|
+
<img src="https://img.shields.io/npm/v/@metagl/sdk-render.svg?style=flat&colorA=080f12&colorB=1fa669" alt="NPM Version">
|
|
17
|
+
</a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="#核心特性">功能特性</a> •
|
|
22
|
+
<a href="#快速开始">快速开始</a> •
|
|
23
|
+
<a href="#系统架构">系统架构</a> •
|
|
24
|
+
<a href="#更新日志">更新日志</a> •
|
|
25
|
+
<a href="#联系方式">联系方式</a>
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
<picture>
|
|
29
|
+
<source
|
|
30
|
+
width="100%"
|
|
31
|
+
srcset="https://gitee.com/ASun001/Resource/raw/master/RenderPreview.png"
|
|
32
|
+
media="(prefers-color-scheme: dark)"
|
|
33
|
+
/>
|
|
34
|
+
<source
|
|
35
|
+
width="100%"
|
|
36
|
+
srcset="https://gitee.com/ASun001/Resource/raw/master/RenderPreview.png"
|
|
37
|
+
media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
|
|
38
|
+
/>
|
|
39
|
+
<img width="250" src="https://gitee.com/ASun001/Resource/raw/master/RenderPreview.png" />
|
|
40
|
+
</picture>
|
|
41
|
+
|
|
42
|
+
---
|
|
4
43
|
|
|
5
44
|
## 项目简介
|
|
6
45
|
|
|
@@ -61,7 +100,8 @@ const viewer = new Viewer(container);
|
|
|
61
100
|
// 配置渲染引擎
|
|
62
101
|
const config: RenderConfig = {
|
|
63
102
|
viewer: viewer,
|
|
64
|
-
token: 'your-access-token' // 访问 LACDT 资源的 token(必填)
|
|
103
|
+
token: 'your-access-token', // 访问 LACDT 资源的 token(必填)
|
|
104
|
+
assetsBasePath: '/' // 资源文件基础路径(可选,默认自动检测)
|
|
65
105
|
};
|
|
66
106
|
|
|
67
107
|
// 初始化渲染引擎(异步方式)
|
|
@@ -71,6 +111,102 @@ const render = await Render.create(config);
|
|
|
71
111
|
**Token 说明**:
|
|
72
112
|
- `token` 是访问 LACDT 资源的必填参数
|
|
73
113
|
|
|
114
|
+
**资源路径说明**:
|
|
115
|
+
- `assetsBasePath` 用于指定 SDK 资源文件(纹理、数据等)的基础路径
|
|
116
|
+
- 默认会自动检测,但在某些打包工具(如 Vite)中可能需要手动设置
|
|
117
|
+
- 开发模式和生产模式的路径可能不同,需要根据实际情况配置
|
|
118
|
+
|
|
119
|
+
### 资源路径配置
|
|
120
|
+
|
|
121
|
+
SDK 需要加载资源文件(纹理、数据等),需要正确配置资源路径:
|
|
122
|
+
|
|
123
|
+
#### 方式1:初始化时设置(推荐)
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
const render = await Render.create({
|
|
127
|
+
viewer: viewer,
|
|
128
|
+
token: 'your-token',
|
|
129
|
+
assetsBasePath: '/' // 资源在网站根目录
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### 方式2:手动设置
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { setSdkBasePath } from '@metagl/sdk-render';
|
|
137
|
+
|
|
138
|
+
// 在使用任何系统之前设置
|
|
139
|
+
setSdkBasePath('/');
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### 方式3:全局变量设置
|
|
143
|
+
|
|
144
|
+
```html
|
|
145
|
+
<script>
|
|
146
|
+
window.__SDK_RENDER_BASE_PATH__ = '/';
|
|
147
|
+
</script>
|
|
148
|
+
<script src="lacdt.render.js"></script>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 打包工具配置
|
|
152
|
+
|
|
153
|
+
#### Vite 项目
|
|
154
|
+
|
|
155
|
+
安装 `vite-plugin-static-copy` 插件:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
npm install -D vite-plugin-static-copy
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
配置 `vite.config.js`:
|
|
162
|
+
|
|
163
|
+
```javascript
|
|
164
|
+
import { viteStaticCopy } from 'vite-plugin-static-copy'
|
|
165
|
+
|
|
166
|
+
export default defineConfig({
|
|
167
|
+
plugins: [
|
|
168
|
+
viteStaticCopy({
|
|
169
|
+
targets: [
|
|
170
|
+
// Cesium 资源
|
|
171
|
+
{ src: 'node_modules/cesium/Build/Cesium/*', dest: 'cesium' },
|
|
172
|
+
// SDK 资源
|
|
173
|
+
{ src: 'node_modules/@metagl/sdk-render/assets', dest: 'assets' },
|
|
174
|
+
{ src: 'node_modules/@metagl/sdk-render/resources', dest: 'resources' }
|
|
175
|
+
]
|
|
176
|
+
})
|
|
177
|
+
],
|
|
178
|
+
define: {
|
|
179
|
+
CESIUM_BASE_URL: JSON.stringify('/cesium')
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
然后在代码中设置:
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
import { setSdkBasePath } from '@metagl/sdk-render';
|
|
188
|
+
setSdkBasePath('/');
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### Webpack 项目
|
|
192
|
+
|
|
193
|
+
在 `webpack.config.js` 中添加:
|
|
194
|
+
|
|
195
|
+
```javascript
|
|
196
|
+
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
197
|
+
|
|
198
|
+
module.exports = {
|
|
199
|
+
plugins: [
|
|
200
|
+
new CopyWebpackPlugin({
|
|
201
|
+
patterns: [
|
|
202
|
+
{ from: 'node_modules/@metagl/sdk-render/assets', to: 'assets' },
|
|
203
|
+
{ from: 'node_modules/@metagl/sdk-render/resources', to: 'resources' }
|
|
204
|
+
]
|
|
205
|
+
})
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
74
210
|
### 基本使用
|
|
75
211
|
|
|
76
212
|
```typescript
|
|
@@ -168,6 +304,22 @@ SDK渲染引擎采用模块化架构,包含以下系统:
|
|
|
168
304
|
|
|
169
305
|
## 更新日志
|
|
170
306
|
|
|
307
|
+
### V1.0.12 (2026-04-09)
|
|
308
|
+
|
|
309
|
+
#### 新增功能
|
|
310
|
+
- **资源路径管理系统**
|
|
311
|
+
- 新增 `AssetPathResolver` 资源路径解析器,统一管理 SDK 资源路径
|
|
312
|
+
- 支持开发模式自动检测和生产模式路径配置
|
|
313
|
+
- 新增 `setSdkBasePath()`、`getSdkBasePath()`、`resolveAssetPath()` API
|
|
314
|
+
- `RenderConfig` 新增 `assetsBasePath` 配置项
|
|
315
|
+
|
|
316
|
+
#### 资源目录调整
|
|
317
|
+
- 统一资源目录结构至 `assets` 和 `resources` 目录
|
|
318
|
+
- `assets/Textures/` - 体积云纹理
|
|
319
|
+
- `assets/Images/` - 水体法线贴图等图片资源
|
|
320
|
+
- `resources/water/` - 海洋数据
|
|
321
|
+
- `resources/textures/` - 其他纹理资源
|
|
322
|
+
|
|
171
323
|
### V1.0.11 (2026-04-02)
|
|
172
324
|
|
|
173
325
|
#### 新增功能
|
package/README_EN.md
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<h1 align="center">LACDT Render WebSDK - 3D Earth Rendering Engine</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">A Cesium-based 3D Earth rendering engine providing rich map operations and data analysis capabilities. It adopts a modular architecture with multiple functional systems, supporting map loading, layer management, building model display, measurement tools, 3D Tiles search, and more.</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://github.com/ASunYC/sdk-render/blob/main/LICENSE">
|
|
7
|
+
<img src="https://img.shields.io/github/license/ASunYC/sdk-render.svg?style=flat&colorA=080f12&colorB=1fa669" alt="License">
|
|
8
|
+
</a>
|
|
9
|
+
<a href="https://github.com/ASunYC/sdk-render">
|
|
10
|
+
<img src="https://img.shields.io/github/stars/ASunYC/sdk-render?style=flat&colorA=080f12&colorB=1fa669" alt="Stars">
|
|
11
|
+
</a>
|
|
12
|
+
<a href="https://github.com/ASunYC/sdk-render/issues">
|
|
13
|
+
<img src="https://img.shields.io/github/issues/ASunYC/sdk-render?style=flat&colorA=080f12&colorB=1fa669" alt="Issues">
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://www.npmjs.com/package/@metagl/sdk-render">
|
|
16
|
+
<img src="https://img.shields.io/npm/v/@metagl/sdk-render.svg?style=flat&colorA=080f12&colorB=1fa669" alt="NPM">
|
|
17
|
+
</a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="#core-features">Core Features</a> •
|
|
22
|
+
<a href="#quick-start">Quick Start</a> •
|
|
23
|
+
<a href="#system-architecture">System Architecture</a> •
|
|
24
|
+
<a href="#changelog">Changelog</a> •
|
|
25
|
+
<a href="#contact-information">Contact</a>
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
<picture>
|
|
29
|
+
<source
|
|
30
|
+
width="100%"
|
|
31
|
+
srcset="https://gitee.com/ASun001/Resource/raw/master/RenderPreview.png"
|
|
32
|
+
media="(prefers-color-scheme: dark)"
|
|
33
|
+
/>
|
|
34
|
+
<source
|
|
35
|
+
width="100%"
|
|
36
|
+
srcset="https://gitee.com/ASun001/Resource/raw/master/RenderPreview.png"
|
|
37
|
+
media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
|
|
38
|
+
/>
|
|
39
|
+
<img width="250" src="https://gitee.com/ASun001/Resource/raw/master/RenderPreview.png" />
|
|
40
|
+
</picture>
|
|
41
|
+
|
|
42
|
+
---
|
|
4
43
|
|
|
5
44
|
## Project Introduction
|
|
6
45
|
|
|
@@ -61,7 +100,8 @@ const viewer = new Viewer(container);
|
|
|
61
100
|
// Configure rendering engine
|
|
62
101
|
const config: RenderConfig = {
|
|
63
102
|
viewer: viewer,
|
|
64
|
-
token: 'your-access-token' // Token for accessing LACDT resources (required)
|
|
103
|
+
token: 'your-access-token', // Token for accessing LACDT resources (required)
|
|
104
|
+
assetsBasePath: '/' // Base path for resource files (optional, auto-detected by default)
|
|
65
105
|
};
|
|
66
106
|
|
|
67
107
|
// Initialize rendering engine (async method)
|
|
@@ -71,6 +111,102 @@ const render = await Render.create(config);
|
|
|
71
111
|
**Token Description**:
|
|
72
112
|
- `token` is a required parameter for accessing LACDT resources
|
|
73
113
|
|
|
114
|
+
**Resource Path Description**:
|
|
115
|
+
- `assetsBasePath` specifies the base path for SDK resource files (textures, data, etc.)
|
|
116
|
+
- Auto-detection is enabled by default, but manual configuration may be needed in some bundlers (e.g., Vite)
|
|
117
|
+
- Development and production modes may require different paths
|
|
118
|
+
|
|
119
|
+
### Resource Path Configuration
|
|
120
|
+
|
|
121
|
+
SDK requires loading resource files (textures, data, etc.). Proper path configuration is essential:
|
|
122
|
+
|
|
123
|
+
#### Method 1: Set During Initialization (Recommended)
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
const render = await Render.create({
|
|
127
|
+
viewer: viewer,
|
|
128
|
+
token: 'your-token',
|
|
129
|
+
assetsBasePath: '/' // Resources at website root
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### Method 2: Manual Setup
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { setSdkBasePath } from '@metagl/sdk-render';
|
|
137
|
+
|
|
138
|
+
// Set before using any system
|
|
139
|
+
setSdkBasePath('/');
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Method 3: Global Variable Setup
|
|
143
|
+
|
|
144
|
+
```html
|
|
145
|
+
<script>
|
|
146
|
+
window.__SDK_RENDER_BASE_PATH__ = '/';
|
|
147
|
+
</script>
|
|
148
|
+
<script src="lacdt.render.js"></script>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Build Tool Configuration
|
|
152
|
+
|
|
153
|
+
#### Vite Project
|
|
154
|
+
|
|
155
|
+
Install `vite-plugin-static-copy` plugin:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
npm install -D vite-plugin-static-copy
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Configure `vite.config.js`:
|
|
162
|
+
|
|
163
|
+
```javascript
|
|
164
|
+
import { viteStaticCopy } from 'vite-plugin-static-copy'
|
|
165
|
+
|
|
166
|
+
export default defineConfig({
|
|
167
|
+
plugins: [
|
|
168
|
+
viteStaticCopy({
|
|
169
|
+
targets: [
|
|
170
|
+
// Cesium resources
|
|
171
|
+
{ src: 'node_modules/cesium/Build/Cesium/*', dest: 'cesium' },
|
|
172
|
+
// SDK resources
|
|
173
|
+
{ src: 'node_modules/@metagl/sdk-render/assets', dest: 'assets' },
|
|
174
|
+
{ src: 'node_modules/@metagl/sdk-render/resources', dest: 'resources' }
|
|
175
|
+
]
|
|
176
|
+
})
|
|
177
|
+
],
|
|
178
|
+
define: {
|
|
179
|
+
CESIUM_BASE_URL: JSON.stringify('/cesium')
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Then set in your code:
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
import { setSdkBasePath } from '@metagl/sdk-render';
|
|
188
|
+
setSdkBasePath('/');
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### Webpack Project
|
|
192
|
+
|
|
193
|
+
Add to `webpack.config.js`:
|
|
194
|
+
|
|
195
|
+
```javascript
|
|
196
|
+
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
197
|
+
|
|
198
|
+
module.exports = {
|
|
199
|
+
plugins: [
|
|
200
|
+
new CopyWebpackPlugin({
|
|
201
|
+
patterns: [
|
|
202
|
+
{ from: 'node_modules/@metagl/sdk-render/assets', to: 'assets' },
|
|
203
|
+
{ from: 'node_modules/@metagl/sdk-render/resources', to: 'resources' }
|
|
204
|
+
]
|
|
205
|
+
})
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
74
210
|
### Basic Usage
|
|
75
211
|
|
|
76
212
|
```typescript
|
|
@@ -168,6 +304,22 @@ The SDK rendering engine adopts a modular architecture, including the following
|
|
|
168
304
|
|
|
169
305
|
## Changelog
|
|
170
306
|
|
|
307
|
+
### V1.0.12 (2026-04-09)
|
|
308
|
+
|
|
309
|
+
#### New Features
|
|
310
|
+
- **Resource Path Management System**
|
|
311
|
+
- Added `AssetPathResolver` for unified SDK resource path management
|
|
312
|
+
- Support for auto-detection in development mode and path configuration in production mode
|
|
313
|
+
- Added `setSdkBasePath()`, `getSdkBasePath()`, `resolveAssetPath()` APIs
|
|
314
|
+
- Added `assetsBasePath` configuration option to `RenderConfig`
|
|
315
|
+
|
|
316
|
+
#### Resource Directory Adjustment
|
|
317
|
+
- Unified resource directory structure to `assets` and `resources` directories
|
|
318
|
+
- `assets/Textures/` - Volumetric cloud textures
|
|
319
|
+
- `assets/Images/` - Water normal maps and other image resources
|
|
320
|
+
- `resources/water/` - Ocean data
|
|
321
|
+
- `resources/textures/` - Other texture resources
|
|
322
|
+
|
|
171
323
|
### V1.0.11 (2026-04-02)
|
|
172
324
|
|
|
173
325
|
#### New Features
|