GithubHelp home page GithubHelp logo

rjduran / threemfviewer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jvfl/threemfviewer

0.0 2.0 0.0 7.43 MB

Contains a 3MF file loader and a 3D printing simulator, as well as an index that already assembles all the code in a viewer/printing simulator.

License: Apache License 2.0

HTML 1.34% JavaScript 98.66%

threemfviewer's Introduction

Description

A THREE loader for 3mf files. Done according to the specs in http://www.3mf.io/what-is-3mf/3mf-specification/.

Limitations

No support for alpha channel on ColorGroups. No support for BaseMaterials, CompositeMaterials and MultiProperties tags.

Usage

   var loader = new THREE.ThreeMFLoader();
   loader.load( './models/3mf/textured/sphere_logo.3mf', function ( meshesInfo ) {
 
     // Several 3mf objects might be loaded at once
     for ( var i = 0; i < meshesInfo.length; i ++ ) {
 
       var meshInfo = meshesInfo[ i ];
 
       var geometry = meshInfo.geometry;
       var textures = meshInfo.textures;
 
       // For one texture.
       // The vertexColors attribute is only needed if the 3mf is colored.
       // To check if it's colored, simply check geometry.hasColors.
       var meshMaterial = new THREE.MeshPhongMaterial( { map: textures , vertexColors: THREE.FaceColors } );
 
       // For more than one texture, add materials as needed.
       var material = new THREE.MeshPhongMaterial( { map: textures[ 0 ] , vertexColors: THREE.FaceColors } );
 		var material2 = new THREE.MeshPhongMaterial( { map: textures[ 1 ] , vertexColors: THREE.FaceColors } );
 		var meshMaterial = new THREE.MeshFaceMaterial( [ material, material2 ] );
 
       scene.add( new THREE.Mesh( geometry, meshMaterial ) );
 
     }
 
 
   });

Acknowledgments

The research results reported in this paper have been partly funded by a R&D project between HP Brazil R&D division and UFPE originated from tax exemption (IPI -Law number 8.248, of 1991 and later updates).

threemfviewer's People

Contributors

jvfl avatar

Watchers

RJ Duran avatar 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.