Skip to content

kindredjs/kindred-geometry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kindred-geometry

Load, bind and draw geometry data in WebGL.

const Geometry = require('kindred-geometry')
const shader = require('./some-shader')
const icosphere = require('icosphere')
const bunny = require('bunny')

const geom = Geometry(icosphere(2))
  .attrFaceNormals('hardNormal')
  .attrVertNormals('softNormal')

function render () {
  geom.bind(gl, shader.attributes)
  geom.draw(gl)
}

Usage

geom = Geometry(cells, positions, normals, uvs)

geom.attr(name, data, opts)

geom.attrFaceNormals(name)

geom.attrVertNormals(name)

geom.bind(gl, attributes)

geom.draw(gl, primitive)

geom.dipose()

License

MIT. See LICENSE.md for details.