Git Product home page Git Product logo

react-jsc3d's Introduction

React JSC3D

Travis npm package Coveralls

React.js component that wraps JSC3D, a CPU ray tracer for STL and OBJ files.

Originally built for OmniConverter - a stateless microservice framework that creates on-the-fly thumbs and previews of a zillion different filetypes.

Example screenshot

Usage

Install:

npm install --save react-jsc3d

Use as you would any other React component:

import React, { Component } from 'react';
import Jsc3dViewer from 'react-jsc3d';
class Example extends Component {
    render() {
        return (
            <Jsc3dViewer sceneUrl={'/some/path/to/mesh.stl'} />
        );
    }
}

Properties

With the exception of height, width, and mouse, all the props relate directly to original JSC3D options. Available parameters are, with their original description from the JSC3D source code:

  • sceneUrl: (REQUIRED) URL string that describes where to load the scene
  • initRotationX: initial rotation angle around x-axis for the whole scene, default to 45
  • initRotationY: initial rotation angle around y-axis for the whole scene, default to -45
  • initRotationZ: initial rotation angle around z-axis for the whole scene, default to -135
  • creaseAngle: an angle to control the shading smoothness between faces. Two adjacent faces will be shaded with discontinuity at the edge if the angle between their normals exceeds this value. Not used by default
  • modelColor: fallback color for all meshes, default to #ffffff
  • backgroundColor1: color at the top of the background, default to '#ffffff'
  • backgroundColor2: color at the bottom of the background, default to '#ffffff'
  • backgroundImageUrl: URL string that describes where to load the image used for background, default to ''
  • background: turn on/off rendering of background. If this is set to false, the background area will be transparent. Default to false
  • renderMode: render mode, default to 'flat'. Available options: 'point', 'wireframe', 'flat', 'smooth', 'texture', 'textureflat', 'texturesmooth'
  • faceCulling: turn on/off back-face culling for all meshes, default to true
  • definition: quality level of rendering, default to "high"
  • mipMapping: turn on/off mip-mapping, default to false
  • sphereMapUrl: URL string that describes where to load the image used for sphere mapping, default to ''
  • progressBar: turn on/off the progress bar when loading, default to false.
  • renderer: set to 'webgl' to enable WebGL for rendering, default to 'webgl'.

  • mouse: mouse behavior. Set to false to be non-interactive. Available: false, 'rotate', 'zoom', 'pan' (defaults to 'rotate')

  • height: canvas height. Set to 'auto' to attempt to fill container (default).

  • width: canvas width. Set to 'auto' to attempt to fill container (default).

Contribution

react-jsc3d's People

Contributors

michaelpb avatar alaasarhan avatar

Watchers

James Cloos 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.