Skip to content

Latest commit

 

History

History
83 lines (54 loc) · 3.21 KB

File metadata and controls

83 lines (54 loc) · 3.21 KB

@jscad-regl-renderer

Renderer for JSCAD geometries, both 2D and 3D

NPM version NPM downloads Build Status Stability License

User Group lerna--lite JavaScript Style Guide

Backers Sponsors

Open Collective

What is it?

  • webgl renderer (barebones, uses regl)
  • small, compact, and fast
  • works in all browsers
  • works in Node.js projects (headless rendering to PNG images)

Installation

This package is published and available for download via NPM

npm install @jscad/regl-renderer

In addition this package is hosted at UNPKG, and can be imported directly into webpages.

  <script type="module" id="MODELING">
import { cameras, commands, controls, entitiesFromSolids, prepareRender } from "./dist/jscad-regl-renderer.es.js"

... YOUR CODE
  </script>

Usage

Node.js (HEADLESS)

Install the following packages manually.

NOTE: There are issues with continous integration testing, so 'gl' is not installed initially.

pnpm install gl

Try the demo by running pnpm run demo-cli.

If all goes well you should end up with an image (test.png) that renders the demo design.

The source code of the demo can be found in 'demo-cli.js'

Browsers

This module has been tested using several browsers, includig Firefox, Chrome, Safari, etc. For an exmple of how to use the module, please see 'demo.es.html'

NOTE: 'demo.es.html' cannot be opened from the local file system. This is due to CORS security limitiations. See the next section.

Developers

Run the development web server using pnpm run dev, then open the URL shown using any browser. From the index of files, select 'demo.es.html'.

If all goes well you should end up with a web page that displays the demo design (a few solids). The standard mouse controls are also available for rotation, etc.

After making changes, just reload the web page.

If making changes, please make sure that all tests must pass. Run pnpm test

License

The MIT License (MIT) (unless specified otherwise)