@pascal-app/viewer 0.1.8 → 0.1.10
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 +103 -0
- package/dist/lib/asset-url.d.ts +1 -1
- package/dist/lib/asset-url.d.ts.map +1 -1
- package/dist/lib/asset-url.js +1 -1
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# @pascal-app/viewer
|
|
2
|
+
|
|
3
|
+
3D viewer component for Pascal building editor.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @pascal-app/viewer @pascal-app/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Peer Dependencies
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install react three @react-three/fiber @react-three/drei
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## What's Included
|
|
18
|
+
|
|
19
|
+
- **Viewer Component** - WebGPU-powered 3D viewer with camera controls
|
|
20
|
+
- **Node Renderers** - React Three Fiber components for all node types
|
|
21
|
+
- **Post-Processing** - SSGI (ambient occlusion + global illumination), TRAA (anti-aliasing), outline effects
|
|
22
|
+
- **Level System** - Level visibility and positioning (stacked/exploded/solo modes)
|
|
23
|
+
- **Wall Cutout System** - Dynamic wall hiding based on camera position
|
|
24
|
+
- **Asset URL Helpers** - CDN URL resolution for models and textures
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { Viewer, useViewer } from '@pascal-app/viewer'
|
|
30
|
+
import { useScene } from '@pascal-app/core'
|
|
31
|
+
|
|
32
|
+
function App() {
|
|
33
|
+
return (
|
|
34
|
+
<div style={{ width: '100vw', height: '100vh' }}>
|
|
35
|
+
<Viewer />
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Custom Camera Controls
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { Viewer } from '@pascal-app/viewer'
|
|
45
|
+
import { CameraControls } from '@react-three/drei'
|
|
46
|
+
|
|
47
|
+
function App() {
|
|
48
|
+
return (
|
|
49
|
+
<Viewer selectionManager="custom">
|
|
50
|
+
<CameraControls />
|
|
51
|
+
</Viewer>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Viewer State
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { useViewer } from '@pascal-app/viewer'
|
|
60
|
+
|
|
61
|
+
function ViewerControls() {
|
|
62
|
+
const levelMode = useViewer(s => s.levelMode)
|
|
63
|
+
const setLevelMode = useViewer(s => s.setLevelMode)
|
|
64
|
+
const wallMode = useViewer(s => s.wallMode)
|
|
65
|
+
const setWallMode = useViewer(s => s.setWallMode)
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div>
|
|
69
|
+
<button onClick={() => setLevelMode('stacked')}>Stacked</button>
|
|
70
|
+
<button onClick={() => setLevelMode('exploded')}>Exploded</button>
|
|
71
|
+
<button onClick={() => setWallMode('cutaway')}>Cutaway</button>
|
|
72
|
+
<button onClick={() => setWallMode('up')}>Full Height</button>
|
|
73
|
+
</div>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Asset CDN Helpers
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { resolveCdnUrl, ASSETS_CDN_URL } from '@pascal-app/viewer'
|
|
82
|
+
|
|
83
|
+
// Resolves relative paths to CDN URLs
|
|
84
|
+
const url = resolveCdnUrl('/items/chair/model.glb')
|
|
85
|
+
// → 'https://pascal-cdn.wawasensei.dev/items/chair/model.glb'
|
|
86
|
+
|
|
87
|
+
// Handles external URLs and asset:// protocol
|
|
88
|
+
const externalUrl = resolveCdnUrl('https://example.com/model.glb')
|
|
89
|
+
// → 'https://example.com/model.glb' (unchanged)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Features
|
|
93
|
+
|
|
94
|
+
- **WebGPU Rendering** - Hardware-accelerated rendering via Three.js WebGPU
|
|
95
|
+
- **Post-Processing** - SSGI for realistic lighting, outline effects for selection
|
|
96
|
+
- **Level Modes** - Stacked, exploded, or solo level display
|
|
97
|
+
- **Wall Cutaway** - Automatic wall hiding for interior views
|
|
98
|
+
- **Camera Modes** - Perspective and orthographic projection
|
|
99
|
+
- **Scan/Guide Support** - 3D scans and 2D guide images
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
MIT
|
package/dist/lib/asset-url.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ASSETS_CDN_URL = "https://pascal
|
|
1
|
+
export declare const ASSETS_CDN_URL = "https://editor.pascal.app";
|
|
2
2
|
/**
|
|
3
3
|
* Resolves an asset URL to the appropriate format:
|
|
4
4
|
* - If URL starts with http:// or https://, return as-is (external URL)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-url.d.ts","sourceRoot":"","sources":["../../src/lib/asset-url.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"asset-url.d.ts","sourceRoot":"","sources":["../../src/lib/asset-url.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,8BAA8B,CAAA;AAEzD;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgB5F;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAiB3E"}
|
package/dist/lib/asset-url.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { loadAssetUrl } from '@pascal-app/core';
|
|
2
|
-
export const ASSETS_CDN_URL = 'https://pascal
|
|
2
|
+
export const ASSETS_CDN_URL = 'https://editor.pascal.app';
|
|
3
3
|
/**
|
|
4
4
|
* Resolves an asset URL to the appropriate format:
|
|
5
5
|
* - If URL starts with http:// or https://, return as-is (external URL)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pascal-app/viewer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "3D viewer component for Pascal building editor",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "tsc --
|
|
21
|
-
"dev": "tsc --
|
|
20
|
+
"build": "tsc --build",
|
|
21
|
+
"dev": "tsc --build --watch",
|
|
22
22
|
"prepublishOnly": "npm run build"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|