@yangyongtao/gaea 1.1.0 → 1.1.2

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 CHANGED
@@ -28,34 +28,13 @@ export default defineConfig({
28
28
  });
29
29
  ```
30
30
 
31
- | 配置 | 说明 |
32
- |------|------|
33
- | `gaeaVitePlugin()` | 自动注入 `<script src="/Gaea.js">`、提供 public/ 静态文件、设置 COEP/COOP 头 |
34
- | `preserveSymlinks: true` | npm link 本地调试时必需 |
35
- | `exclude` | 跳过 Vite 预构建,避免 `import('../public/index.js')` 在 Node 端解析失败 |
36
-
37
- ### 2. `index.html`
31
+ `gaeaVitePlugin()` 会自动完成:
32
+ - 在 HTML 中注入 `<script src="/Gaea.js">`
33
+ - 提供 `/Gaea.js` `/Gaea.wasm` `/Gaea.pck` 等所有 public/ 静态文件
34
+ - 设置 COEP/COOP 响应头
35
+ - 检测浏览器跨域隔离状态
38
36
 
39
- 无需手动添加任何 script插件会自动注入:
40
-
41
- ```html
42
- <!DOCTYPE html>
43
- <html><head><meta charset="UTF-8" /></head>
44
- <body>
45
- <div id="app"></div>
46
- <script type="module" src="/src/main.js"></script>
47
- </body></html>
48
- ```
49
-
50
- ### 3. `src/main.js`(Vue 入口)
51
-
52
- ```js
53
- import { createApp } from 'vue';
54
- import App from './App.vue';
55
- createApp(App).mount('#app');
56
- ```
57
-
58
- ### 4. `src/App.vue`(完整初始化示例)
37
+ ### 2. `src/App.vue` 完整初始化示例
59
38
 
60
39
  ```vue
61
40
  <template>
@@ -67,16 +46,14 @@ import { onMounted } from 'vue';
67
46
  import { GaeaApp, setConfig } from '@yangyongtao/gaea';
68
47
 
69
48
  const app = new GaeaApp();
70
- window.APP = app; // 控制台调试
49
+ window.APP = app;
71
50
 
72
51
  onMounted(async () => {
73
- // ① 配置
74
52
  setConfig({
75
53
  serveLocal: `${window.location.origin}/static/`,
76
54
  serveUrl: 'http://192.168.3.151:8088/gaeaExplorerServer/',
77
55
  });
78
56
 
79
- // ② 启动 Godot WASM 引擎
80
57
  new window.Engine({
81
58
  args: [],
82
59
  canvasResizePolicy: 2,
@@ -92,10 +69,8 @@ onMounted(async () => {
92
69
  onProgress: (current, total) => console.log(`加载: ${current}/${total}`),
93
70
  });
94
71
 
95
- // ③ 初始化环境(雾、光照、AssetHost 等)
96
72
  await app.initDefaultEnvironment();
97
73
 
98
- // ④ 加载 WMTS 影像图层
99
74
  app.getAllServe().then(() => {
100
75
  app.addLayer({ layerName: 'earthland', forMat: 'image/png', min: 0, max: 18, transparency: 0.3 });
101
76
  app.addLayer({ layerName: '苍南L19', forMat: 'image/png', min: 5, max: 17 });
@@ -104,55 +79,45 @@ onMounted(async () => {
104
79
  </script>
105
80
  ```
106
81
 
107
- > **注意**:`fileSizes` 中的数值需与实际 `public/Gaea.pck` 和 `public/Gaea.wasm` 文件大小一致。
82
+ > **注意**:`fileSizes` 需与 npm 包 `public/Gaea.pck` 和 `public/Gaea.wasm` 实际文件大小一致。
108
83
 
109
84
  ## API
110
85
 
111
86
  ### 配置
112
87
 
113
- | 方法 | 说明 |
114
- |------|------|
115
- | `setConfig({ serveUrl, serveLocal })` | 全局配置,必须在 `new GaeaApp()` 前调用 |
116
- | `getConfig()` | 读取当前配置 |
88
+ ```js
89
+ import { setConfig } from '@yangyongtao/gaea';
90
+
91
+ setConfig({
92
+ serveUrl: 'http://192.168.3.151:8088/gaeaExplorerServer/',
93
+ serveLocal: 'http://localhost:8080/static/',
94
+ });
95
+ ```
117
96
 
118
97
  ### 环境初始化
119
98
 
120
- | 方法 | 说明 |
121
- |------|------|
122
- | `await app.initDefaultEnvironment()` | 关闭雾、设置 AssetHost、环境光、日照 |
99
+ ```js
100
+ await app.initDefaultEnvironment();
101
+ ```
123
102
 
124
103
  ### 影像图层
125
104
 
126
- | 方法 | 说明 |
127
- |------|------|
128
- | `await app.getAllServe()` | 获取 WMTS 服务图层列表,存到 `app.layers` |
129
- | `app.addLayer({ layerName, max, min, transparency, forMat, inserIndex })` | 添加单张影像图层到 3D 地球 |
130
-
131
105
  ```js
106
+ await app.getAllServe();
107
+
132
108
  app.addLayer({
133
- layerName: 'earthland', // 图层名称(与 WMTS Capabilities 中的 Title 一致)
134
- forMat: 'image/png', // 图像格式
135
- min: 0, max: 18, // 显示层级范围
136
- transparency: 0.3, // 透明度 0~1
109
+ layerName: 'earthland',
110
+ forMat: 'image/png',
111
+ min: 0, max: 18,
112
+ transparency: 0.3,
137
113
  });
138
114
  ```
139
115
 
140
116
  ### 相机控制
141
117
 
142
- | 方法 | 说明 |
143
- |------|------|
144
- | `app.SetPosition("lat,lng,alt,dist,pitch,heading")` | 定位到指定视角 |
145
- | `app.favorite()` | 记录当前视角,返回 URI 字符串 |
146
- | `app.favoritePosition(uri)` | 定位到已保存的视角 URI |
147
-
148
118
  ```js
149
- // 定位到 27.38°N, 120.45°E, 高度 0, 距离 3000, 俯仰 0, 朝向 0
150
119
  app.SetPosition('27.3809, 120.4499, 0, 3000, 0, 0');
151
-
152
- // 保存视角
153
120
  const uri = app.favorite();
154
-
155
- // 恢复视角
156
121
  app.favoritePosition(uri);
157
122
  ```
158
123
 
@@ -161,12 +126,11 @@ app.favoritePosition(uri);
161
126
  ```vue
162
127
  <script setup>
163
128
  import { WeatherControl, FlyAlongRoute } from '@yangyongtao/gaea/components';
164
- const app = window.APP;
165
129
  </script>
166
130
 
167
131
  <template>
168
- <WeatherControl :appInstance="app" @close="show = false" />
169
- <FlyAlongRoute :appInstance="app" @close="show = false" />
132
+ <WeatherControl :appInstance="app" @close="close" />
133
+ <FlyAlongRoute :appInstance="app" @close="close" />
170
134
  </template>
171
135
  ```
172
136
 
@@ -174,31 +138,20 @@ const app = window.APP;
174
138
 
175
139
  | 导出 | 路径 |
176
140
  |------|------|
177
- | `GaeaPlugin` (v-drag 指令) | `@yangyongtao/gaea/plugin` |
178
141
  | `gaeaVitePlugin` | `@yangyongtao/gaea/plugin` |
142
+ | `GaeaPlugin` (v-drag 指令) | `@yangyongtao/gaea/plugin` |
179
143
  | `loadResource`, `screenToLatLng` | `@yangyongtao/gaea` |
180
144
 
181
145
  ## 静态资源
182
146
 
183
- npm 包 `public/` 目录包含以下文件,由 `gaeaVitePlugin` 自动提供:
147
+ npm 包 `public/` 中的文件由 `gaeaVitePlugin` 自动提供服务。
184
148
 
185
149
  ```
186
150
  public/
187
- ├── Gaea.js # Godot HTML5 引擎
188
- ├── Gaea.wasm # WebAssembly 模块
189
- ├── Gaea.pck # 引擎资源包
190
- ├── Gaea.worker.js # Worker 线程
191
- ├── Gaea.audio.worklet.js
192
- ├── index.js # Godot 类绑定(≈185K 行)
193
- ├── config.js / constants.js
194
- ├── math/ # 数学工具
195
- ├── static/
196
- │ ├── 1111.res # 点标注资源
197
- │ ├── Global2.jpg # 全球底图
198
- │ ├── Cloud.png / SkyDay.png
199
- │ ├── gltf/ # 3D 模型
200
- │ └── js/ # 业务脚本
201
- └── image/ # 图标资源
151
+ ├── Gaea.js / Gaea.wasm / Gaea.pck # Godot 引擎核心
152
+ ├── index.js # Godot 类绑定
153
+ ├── math/ # 数学工具
154
+ └── static/ # 点标注、底图、模型等资源
202
155
  ```
203
156
 
204
157
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yangyongtao/gaea",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Gaea 3D visualization component library - Vue 3 components based on Godot WASM engine. Includes WMTS layer loading, camera view control, Vite plugin auto-injection, etc.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -81,6 +81,6 @@
81
81
  "author": "yangyongtao",
82
82
  "repository": {
83
83
  "type": "git",
84
- "url": "https://github.com/yangyongtao/gaea.git"
84
+ "url": "https://github.com/smallflypig/Gaea.git"
85
85
  }
86
86
  }
@@ -26,7 +26,7 @@ const PKG = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT, 'package.json'),
26
26
  const VERSION = PKG.version;
27
27
 
28
28
  const ZIP_NAME = `gaea-assets-v${VERSION}.zip`;
29
- const GITHUB_RELEASES = `https://github.com/yangyongtao/gaea/releases/download/v${VERSION}`;
29
+ const GITHUB_RELEASES = `https://github.com/smallflypig/Gaea/releases/download/v${VERSION}`;
30
30
  const ZIP_URL = `${GITHUB_RELEASES}/${ZIP_NAME}`;
31
31
 
32
32
  // ── helpers ──────────────────────────────────────────────────────────