Skip to content

gamedev-js/premitives.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

primitives.js

Primitives for 3D Rendering.

Install

npm install primitives.js

Usage

let meshData = window.primitives.box(1, 1, 1, {
  widthSegments: 10,
  heightSegments: 10,
  lengthSegments: 10
});

Documentation

  • Shapes
    • primitives.box(width, height, lenght, opts)
    • primitives.cone(radius, height, opts)
    • primitives.cylinder(radiusTop, radiusBottom, height, opts)
    • primitives.plane(width, length, opts)
    • primitives.quad()
    • primitives.sphere(radius, opts)
    • primitives.torus(radius, tube, opts)
  • Utils
    • primitives.wireframe(indices)
    • primitives.normals(positions, normals, length)

License

MIT © 2017 Johnny Wu