Installation & Usage
Add the Reactive Reality registry
To use the Pictofit SDK, you need to add our registry to npm so that the package can be fetched.
You can add our registry globally by running the following command:
npm config set @reactivereality-public:registry=https://gitlab.com/api/v4/projects/24837467/packages/npm/
Or to give npm
access to the registry on the project scope, you have to add a .npmrc
file in project root (on the same level as package.json
):
; reactive reality public registry
@reactivereality-public:registry=https://gitlab.com/api/v4/projects/24837467/packages/npm/
Then add to your package.json
dependencies: "@reactivereality-public/pictofit-web-sdk": "major.minor.patch"
Setup the DOM and init a WebViewer
Now you will have to add a canvas element to your DOM for the SDK to render your content into:
<html>
<body>
<pictofit-web id="canvas3d" style="width:100%;height:100%;"></pictofit-web>
</body>
</html>
Then you can import the module an use its components like so:
import { WebViewer } from "@reactivereality-public/pictofit-web-sdk";
const viewer = new WebViewer("canvas3d"); // ID of the canvas element
All you have to provide here is the ID of the canvas element so that the viewer can use it as the rendering target.
A note on BabylonJS
The rendering within our SDK is based on the Babylon.js engine. Depending on the use case, additional extensions might be required (which can be seen from the respective documentation/samples).