GithubHelp home page GithubHelp logo

zydan1 / angular-stl-model-viewer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codaline-io/angular-stl-model-viewer

0.0 0.0 0.0 10.8 MB

Angular component for rendering an STL model

License: MIT License

JavaScript 12.30% TypeScript 84.44% CSS 0.53% HTML 2.73%

angular-stl-model-viewer's Introduction

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

Attr Type Default Details
stlModels string[] empty array List of stl model paths
stlModelFiles string[] empty array List of stl model files/content
hasControls boolean true If true, the user can interact with the stl-models
camera THREE.Camera THREE.PerspectiveCamera( 35, WindowInnerWidth / WindowInnerHeight, 1, 15 ) The projection mode used for rendering the scene
cameraTarget THREE.Vector3 THREE.Vector3( 0, 0, 0 ) The orientation point for the camera
light THREE.Light THREE.PointLight( 0xffffff ) Illuminates the scene
material THREE.MeshMaterialType THREE.MeshPhongMaterial({ color: 0xc4c4c4, shininess: 100, specular: 0x111111 }) Casts more precisely the possible materials assignable to a [ [Mesh]] object
scene THREE.Scene THREE.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
renderer THREE.WebGLRenderer THREE.WebGLRenderer({ antialias: true }) Displays your beautifully crafted scenes using WebGL
controls THREE.OrbitControls THREE.OrbitControls Allow the camera to orbit around a target
meshOptions MeshOptions[] [] customize mesh options per stl-model
centered boolean true Flag if models should be centered

Output Events

Attr Details
rendered Emitted when the stl-model is rendered.

MeshOptionsType

Attr Type Default Details
castShadow boolean true Gets rendered into shadow map
position THREE.Vector3 THREE.Vector3( 0, 0, 0 ) Object's local position
receiveShadow boolean true Material gets baked in shadow receiving
scale THREE.Vector3 THREE.Vector3( 0.03, 0.03, 0.03 ) Object's local scale
up THREE.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
visible boolean - 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 yarn lint and yarn test.

angular-stl-model-viewer's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar depfu[bot] avatar janraasch avatar joseandresgomeztovar avatar killercodemonkey avatar marcuskirsch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.