Renderer for JSCAD geometries, both 2D and 3D
- webgl renderer (barebones, uses regl)
- small, compact, and fast
- works in all browsers
- works in Node.js projects (headless rendering to PNG images)
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>
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'
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.
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
The MIT License (MIT) (unless specified otherwise)