0.0.0 • Published 1 year ago

usd-viewer v0.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

usd-viewer

npm version

Experimental Web Component for rendering USDZ 3d format. Built on the experimental work and efforts of https://github.com/autodesk-forks/USD/tree/release

Instalation

npm install usd-viewer

Web Assembly Dependencies

Currently this depends on the SharedArrayBuffer so to enable in the browser the following response headers must be set:

"Cross-Origin-Embedder-Policy": "require-corp"
"Cross-Origin-Opener-Policy": "same-origin"

To load the Wasm dependencies in the browser copy them from the node_modules into your host env.

cpy node_modules/usd-viewer/wasm/**/* dist/wasm

To change the default path (./wasm) of the Wasm resources add the following meta tag to the document.

<meta name="usd-viewer:wasm" content="custom-path/wasm" />

Usage

<script type="module">
  import 'usd-viewer/include.js';
</script>

<usd-viewer src="./usd/perseverance.usdz" alt="Perseverance Mars Rover"></usd-viewer>

API

PropertyAttributeTypeDescription
srcsrcstringsource path for usd/usdz file
altaltstringalt descriptive text
controlsconrolsbooleanenable or disable model touch/mouse controls
fileNamefile-namebooleanenable or disable display of file name
autoRotateauto-rotatebooleanenable or disable auto rotation of model
autoRotateSpeedauto-rotate-speednumberadjust speed of rotations of model
minDistancemin-distancenumberminimum zoom distance of model
maxDistancemax-distancenumbermaximum zoom distance of model
zoomzoomnumberdefault zoom level of camera relative to model

Licensing

The Web Component of this project is MIT licensed, however refer to the following external dependencies and explicitly marked file headers. For additional license details see:

0.0.0

1 year ago