# regl-primitive

> Create a regl draw command from a simplicial complex

Latest version **1.0.1** (published 2016-10-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install regl-primitive
pnpm add regl-primitive
yarn add regl-primitive
bun add regl-primitive
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-10-02 |
| First published | 2016-10-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Joseph Werle |
| Maintainers | littlstar, werle |
| Keywords | regl, primitive, gl |

## Links

- npm: https://www.npmjs.com/package/regl-primitive
- Repository: https://github.com/jwerle/regl-primitive
- Homepage: https://github.com/jwerle/regl-primitive#readme
- Issues: https://github.com/jwerle/regl-primitive/issues
- npm.io page: https://npm.io/package/regl-primitive

## Dependencies (1)

- [angle-normals](https://npm.io/package/angle-normals.md) ^1.0.0

## Recent versions

- 1.0.1 (latest) — 2016-10-02
- 1.0.0 — 2016-10-01

## README

regl-primitive
==============

Create a [regl](https://github.com/regl-project/regl) draw command from a
[simplicial complex](https://github.com/mikolalysenko/simplicial-complex).

## Example

```js
const primitive = require('regl-primitive')
const bunny = require('bunny')
const regl = require('regl')()

const camera = require('regl-camera')(regl, {
  center: [0, 2.5, 0],
  distance: 20
})

const drawBunny = primitive(regl, bunny, {
  vert: `
  precision mediump float;
  attribute vec3 position, normal;
  uniform mat4 projection, view;
  varying vec3 vnormal;
  void main () {
    vnormal = normal;
    gl_Position = projection * view * vec4(position, 1.0);
  }
  `,

  frag:`
  precision mediump float;
  varying vec3 vnormal;
  void main () {
    gl_FragColor = vec4(abs(vnormal), 1.0);
  }
  `
})

regl.frame(() => camera(() => drawBunny()))

```
## Installation

```sh
$ npm install regl-primitive --save
```

See [demo here](https://jwerle.github.io/regl-primitive/example/)

## API

### Constructor

#### `const primitive = require('regl-primitive')(regl, complex[, options])`

where `regl-primitive` expects the following arguments:

* `regl` - A handle to a regl instance
* `complex` - An object exposing at least `positions` (See [simplicial-complex](https://github.com/mikolalysenko/simplicial-complex))
* `[configuration]` - An optional object that extends the
  initial state used to create a regl draw command

## License

MIT

---
_Source: https://npm.io/package/regl-primitive · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
