Ng-Mesh-Viewer
This module will draw a 3D model from OBJ mesh geometry.
demo (Doesn't work in IE)
Install to Angular project
Install package
npm i ng-mesh-viewer --save
Add to app.module.ts
import { MeshViewerModule } from 'ng-mesh-viewer';
@NgModule({
imports: [
...,
MeshViewerModule
]
})
Now Ng-mesh-viewer can be used anywhere using the tag.
<ng-mesh-viewer [data]="data">
</ng-mesh-viewer>
where data is an array of objects formatted in the following way:
{
name: "item name",
uri: "item URI",
geometry: "obj string",
type: "Element or Zone",
opacity: "optional opacity [0-1]",
color: "optional color [defaults to random]"
}
Type | Attribute | Description | Required |
---|---|---|---|
Input | data | Array of objects in the above format | x |
Input | toolbar | Display toolbar? Defaults to false | |
Input | centroids | Display centroids? Defaults to false | |
Input | colors | Array of key/val with {uri: "", color: ""}. By default random colors and 50 % opacity is used for zones and default material is applied to elements | |
Output | clickedRoom | Fired on room click. Returns the URI of the clicked room and the absolute coordinates based on the original geoJSON. | |
Output | clickedCanvas | Fired on canvas click. Use to clear selection or whatever. |