11.0.0 • Published 5 months ago

angular-stl-model-viewer v11.0.0

Weekly downloads
89
License
MIT
Repository
github
Last release
5 months ago

angular-stl-model-viewer

This is an angular component to render stl-models with THREE.js.

Installation

  • yarn add angular-stl-model-viewer
  • npm install angular-stl-model-viewer

Usage

  • import StlModelViewerModule to your app module
  • use stl-model-viewer component in your html <stl-model-viewer [stlModels]="['example.stl']"></stl-model-viewer>
  • alternatively use [stlModelFiles]="['stlFileContent']"

Example

The working basic example can be found in our live demo.

Configuration

Input Properties

AttrTypeDefaultDetails
stlModelsstring[]empty arrayList of stl model paths
stlModelFilesstring[]empty arrayList of stl model files/content
hasControlsbooleantrueIf true, the user can interact with the stl-models
cameraTHREE.CameraTHREE.PerspectiveCamera( 35, WindowInnerWidth / WindowInnerHeight, 1, 15 )The projection mode used for rendering the scene
cameraTargetTHREE.Vector3THREE.Vector3( 0, 0, 0 )The orientation point for the camera
lightTHREE.LightTHREE.PointLight( 0xffffff )Illuminates the scene
materialTHREE.MeshMaterialTypeTHREE.MeshPhongMaterial({ color: 0xc4c4c4, shininess: 100, specular: 0x111111 })Casts more precisely the possible materials assignable to a [ Mesh] object
sceneTHREE.SceneTHREE.Scene()Scenes allow you to set up what and where is to be rendered by three.js. This is where you place objects, lights and cameras
rendererTHREE.WebGLRendererTHREE.WebGLRenderer({ antialias: true })Displays your beautifully crafted scenes using WebGL
controlsTHREE.OrbitControlsTHREE.OrbitControlsAllow the camera to orbit around a target
meshOptionsMeshOptions[][]customize mesh options per stl-model
centeredbooleantrueFlag if models should be centered

Output Events

AttrDetails
renderedEmitted when the stl-model is rendered.

MeshOptionsType

AttrTypeDefaultDetails
castShadowbooleantrueGets rendered into shadow map
positionTHREE.Vector3THREE.Vector3( 0, 0, 0 )Object's local position
receiveShadowbooleantrueMaterial gets baked in shadow receiving
scaleTHREE.Vector3THREE.Vector3( 0.03, 0.03, 0.03 )Object's local scale
upTHREE.Vector3-Up direction
userData{key: string: any}-An object that can be used to store custom data about the Object3d. It should not hold references to functions as these will not be cloned
visibleboolean-Object gets rendered if true

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using npm run lint and npm run test.

10.0.2

5 months ago

11.0.0

5 months ago

10.0.0

6 months ago

10.0.1

6 months ago

9.0.0

6 months ago

8.0.0

1 year ago

7.0.0

1 year ago

6.0.0

2 years ago

5.0.1

3 years ago

5.0.0

3 years ago

4.0.0

3 years ago

3.2.0

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.0

4 years ago

1.0.0

4 years ago

0.6.0

5 years ago

0.5.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