17.0.0 • Published 3 months ago

@lumiscaphe/ng-viewer v17.0.0

Weekly downloads
12
License
-
Repository
-
Last release
3 months ago

ng-viewer

Official Angular component for Lumiscaphe 3D Viewer

Installation

$ npm i @lumiscaphe/ng-viewer

or

$ yarn add @lumiscaphe/ng-viewer

Usage

Import

import { NgViewerModule } from '@lumiscaphe/ng-viewer';

Basic

<NgViewer [server]="server" [scene]="scene" [view]="view"></NgViewer>
server = 'https://wr.lumiscaphe.com';

scene = [
  {
    database: 'ee294840-5689-49b0-9edb-527598602df0',
    configuration: 'Bin.Blue/Cabin.Yellow/Style.Design1/Wheels.Red'
  }
];

view = {
  mode: 'image',
  camera: 'EXTER/1'
};

Hotspot

Hotspots are interactive elements that can be selected to engage in additional content or media.\ Hotspots are overlaid on top of the viewer to provide additional media for informational purposes.

<NgViewer ... [hotspots]="hotspots">
  <ng-template #hotspotTemplate let-hotspot let-index="index">
    <ng-container *ngIf="hotspot.visibility === 'Visible'">
      <button>{{ index + 1 }}</button>
    </ng-container>
  </ng-template>
</NgViewer>
hotspots = [{ x: 0, y: 0, z: 0 }];

Pick

Pick allow to retrieve information of a 3D point from a 2D point.

<NgViewer ...></NgViewer>

<button type="button" (click)="pick()">Pick</button>
import { NgViewerComponent } from '@lumiscaphe/ng-viewer';

...

@ViewChild(NgViewerComponent) viewer: NgViewerComponent;
@ViewChild(ngViewerComponent, { read: ElementRef }) viewerElement: ElementRef<HTMLDivElement>;

...

pick(): void {
  this.viewerElement.nativeElement.addEventListener('click', e => {
    const position = { x: e.clientX, y: e.clientY };
    this.viewer.pick(position).then(pickResult => console.log(pickResult))
  }, { once: true });
};

API

Properties

NameTypeDefaultDescription
serverstringundefinedWebRender URL to use.
sceneSceneundefinedScene to render.
viewViewundefinedView to render.
api'v1'\|'v2''v1'API version to use.
encoderEncoder{ format: 'jpeg', quality: 80 }Image encoder to use.
parametersParameters{ antialiasing: false, superSampling: 2 }Rendering parameters to use.
hotspotsVector3D[]undefinedHotspot array to display.
vrcubeVRCubeundefinedVRCube point of view to display.
vrobjectVRObjectundefinedVRObject position to display.

Emitters

NameParametersDescription
onLoadStartprogress: numberCallback to invoke when load starts.
onLoadProgressprogress: numberCallback to invoke when load makes progress.
onLoadEndprogress: numberCallback to invoke when load ends.
onLoadErrorErrorCallback to invoke when load failed.
onInteractionVRCube \| VRObjectCallback to invoke when interaction happened.
onVrcubeInteractionVRCubeCallback to invoke when VRCube interaction happened.
onVrobjectInteractionVRObjectCallback to invoke when VRObject interaction happened.

Methods

NameParametersDescriptionReturns
pickposition: PositionGet the 3D point from a 2D position.PickResult
snapshottype: string, quality: numberGet a snapshot of the viewer.string - Image URL

Templates

NameParametersDescription
hotspotTemplatecontext: { $implicit: Hotspot, index: number }Custom hotspot template.

Interfaces

Scene

NameTypeDescription
databasestringDatabase id of the 3D model.
configurationstringProduct configuration of the 3D model.
animationsstring[]Animations of the 3D model

View

NameTypeDescription
mode'image'\|'vrcube'\|'vrobject'Mode of the view.
camerastringCamera or camera group name of the view.

Encoder

NameTypeDescription
format'jpeg'Format of the encoder.
qualitynumberQuality of the encoder (0 - 100).

Parameters

NameTypeDescription
superSamplingnumberSuper sampling to use for antialiasing (1 -2).

Hotspot

NameTypeDescription
idstringId of the hotspot (when hotspot is provided by the 3D model).
namestringName of the hotspot (when hotspot is provided by the 3D model).
position2DVector2D2D position of the hotspot in the viewer.
position3DVector3D3D position of the hotspot.
visibilityVisiblityVisiblity of the hotspot.
Visibility
NameDescription
VisibleHotspot found and visible.
OccludedHotspot found but occluded by another surface.
OutOfFrustumHotspot not found.

PickResult

NameTypeDescription
productstringProduct id of the picked point.
surfaceSurfaceSurface of the picked point.
normalVector3DNormal coordinates of the picked point.
pointVector3DPoint coordinates of the picked point.
uvwUVWUV coordinates of the picked point.
Surface
NameTypeDescription
idstringId of the surface.
namestringName of the surface.
tagsstring[]Tag list of the surface.
UVW
NameTypeDescription
unumberU coordinate.
vnumberV coordinate.
wnumberW coordinate.

Vector2D

NameTypeDescription
xnumberX coordinate.
ynumberY coordinate.

Vector3D

NameTypeDescription
xnumberX coordinate.
ynumberY coordinate.
znumberZ coordinate.

VRCube

NameTypeDescription
povPointOfViewPoint of view of the VRCube widget.
fovnumberField of view in degrees of the VRCube widget.

VRObject

NameTypeDescription
positionnumberImage inde of the VRObject widget.
17.0.0

3 months ago

16.2.3

4 months ago

14.2.3

5 months ago

16.2.2

5 months ago

14.1.0

7 months ago

14.2.0

7 months ago

14.2.1

7 months ago

14.2.2

6 months ago

16.2.0

7 months ago

16.1.1

7 months ago

16.1.0

7 months ago

16.2.1

6 months ago

16.0.0

11 months ago

15.0.0

1 year ago

14.0.0

2 years ago

4.1.1

2 years ago

4.1.0

2 years ago

3.0.4

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.1.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.3.2

3 years ago

2.3.0

3 years ago

2.3.1

3 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.1

4 years ago

2.0.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago