New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

three-js-csg

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three-js-csg

An NPM module for ThreeJS's CSG (Constructive Solid Geometry) port

latest
Source
npmnpm
Version
72.0.0
Version published
Weekly downloads
369
-40.77%
Maintainers
1
Weekly downloads
 
Created
Source

three-js-csg

three-js-csg is a wrapper for NPM around chandlerprall's Constructive Solid Geometry port to three.js. This package provides support for use with ES2015/AMD/CommonJS style modularity and composability.

install

npm i --save three-js-csg

example mesh module

import THREE from 'three';
const ThreeBSP = require('../../index.js')(THREE);

export const meshFactory = () => {
  const box = new THREE.Mesh(new THREE.BoxGeometry(500, 100, 100));
  const sphere = new THREE.Mesh(new THREE.SphereGeometry(100, 50, 50));

  const sBSP = new ThreeBSP(sphere);
  const bBSP = new ThreeBSP(box);

  const sub = bBSP.subtract(sBSP);
  const newMesh = sub.toMesh();

  newMesh.material = new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x1a1a1a, shininess: 30, shading: THREE.FlatShading  });

  return Object.assign({}, { csg: newMesh  });

};

When instantiating the NPM module, it takes an instance of three.js therefore doesn't need to sit globally on the window object. In a currying-esque manner, the NPM module returns a function with which you can pass in three.js geometry like usual.

demo

three-js-csg

See a full demo in this demo at ./demo. First clone the repo, run npm install and then npm run watch. Open ./demo/index.html in browser to see the demo in action.

Keywords

threejs

FAQs

Package last updated on 15 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts