@navaramap/three-default-plugin 0.0.7 → 0.1.0
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/LICENSE +1 -1
- package/README.md +8 -17
- package/package.json +4 -4
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
# @navaramap/three-default-plugin
|
|
2
2
|
|
|
3
|
-
The default plugin for `@navaramap/three`. It registers all built-in mesh, light, and effect
|
|
3
|
+
The default plugin for `@navaramap/three`. It registers all built-in mesh, light, and effect Descriptors from `@navaramap/three-default-descs` (boxes, GLTF models, sky, stars, sun, ambient light, SSAO, bloom, tone mapping, and so on) under their standard keys, so they can be used through `view.addMesh()`, `view.addLight()`, and `view.addEffect()`.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
Add the plugin before `view.init()`, and parameterize the view with `DefaultDescriptions` so
|
|
7
|
+
Add the plugin before `view.init()`, and parameterize the view with `DefaultDescriptions` so Descriptor keys are typed:
|
|
8
8
|
|
|
9
9
|
```typescript
|
|
10
|
-
import ThreeView
|
|
11
|
-
degreeToRadian,
|
|
12
|
-
geodeticToVector3,
|
|
13
|
-
northUpEastToFixedFrame,
|
|
14
|
-
} from "@navaramap/three";
|
|
10
|
+
import ThreeView from "@navaramap/three";
|
|
15
11
|
import {
|
|
16
12
|
DefaultPlugin,
|
|
17
13
|
type DefaultDescriptions,
|
|
@@ -22,19 +18,14 @@ const defaultPlugin = new DefaultPlugin();
|
|
|
22
18
|
view.addPlugin(defaultPlugin); // must happen before init()
|
|
23
19
|
await view.init();
|
|
24
20
|
|
|
25
|
-
// Place the mesh on the globe
|
|
26
|
-
const origin = geodeticToVector3({
|
|
27
|
-
lng: degreeToRadian(139.77),
|
|
28
|
-
lat: degreeToRadian(35.68),
|
|
29
|
-
height: 0,
|
|
30
|
-
});
|
|
21
|
+
// Place the mesh on the globe at the target lng/lat (degrees, meters).
|
|
31
22
|
view.addMesh({
|
|
32
23
|
box: { width: 100, height: 100, depth: 100 },
|
|
33
|
-
|
|
24
|
+
geodetic: { lng: 139.77, lat: 35.68, height: 0 },
|
|
34
25
|
});
|
|
35
26
|
```
|
|
36
27
|
|
|
37
|
-
After `init()`, `addDefaultPhotorealScene()` sets up a photorealistic base scene in one call
|
|
28
|
+
After `init()`, `addDefaultPhotorealScene()` sets up a photorealistic base scene in one call (sky, stars, sun, sky light probe, aerial perspective, lens flare, tone mapping, and antialiasing) and returns the handles so each piece can be updated or removed later. Combine it with terrain and satellite imagery (credited through the view's built-in attribution UI) for a realistic globe:
|
|
38
29
|
|
|
39
30
|
```typescript
|
|
40
31
|
const scene = defaultPlugin.addDefaultPhotorealScene();
|
|
@@ -80,11 +71,11 @@ view.attribution?.add([
|
|
|
80
71
|
scene.sun.update({ sun: { castShadow: true } });
|
|
81
72
|
```
|
|
82
73
|
|
|
83
|
-
The package also re-exports every
|
|
74
|
+
The package also re-exports every Descriptor class and config type from `@navaramap/three-default-descs`, so typed `addMesh<T>` / `addEffect<T>` / `addLight<T>` calls need only this one import.
|
|
84
75
|
|
|
85
76
|
## Documentation
|
|
86
77
|
|
|
87
|
-
See https://navara-docs.reearth.workers.dev
|
|
78
|
+
See https://navara-docs.reearth.workers.dev/ for the full list of built-in Descriptors and their options.
|
|
88
79
|
|
|
89
80
|
## License
|
|
90
81
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navaramap/three-default-plugin",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"main": "dist/index.umd.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@navaramap/three": "0.0
|
|
22
|
+
"@navaramap/three": "0.1.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@navaramap/three-default-descs": "0.0
|
|
25
|
+
"@navaramap/three-default-descs": "0.1.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@navaramap/three": "0.0
|
|
28
|
+
"@navaramap/three": "0.1.0"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"type-check": "tsc && tsc -p tsconfig.node.json",
|