Modern, JS-friendly API for real-time 3D-rendering over WebGL.
API documentation | Guide | Samples | Contributing | Developer guide | FAQ
- Linear algebra (vectors, rotations, transformations) and geometry primitives
- Staging graphics core (designed for custom rendering pipelines and shaders)
- Common implementations (frustum culling, attributes & uniforms binding, context lost handling)
- WebGL Extensions supported / WebGL 2.0 oriented
The current version is v.0.1.0
- Download minified library (source map)
- Download debug library
BLACKCELL is licensed under the MIT license.
var M = B.Math, R = B.Render,
dev = R.makeDevice(canvas);
dev.stage("main").output(dev.target()).
view(M.makeMatrix4().lookAt(M.makeVector3(0,1,-1), M.Vector3.ZERO, M.Vector3.Y)).
proj(M.makeMatrix4().perspective(Math.PI / 3, canvas.width / canvas.height, 0.1, 1000)).
uniform("mxVP", R.Stage.VIEW_PROJ);
dev.material("default").
pass("main", dev.makePass(
"attribute vec3 position;" +
"uniform mat4 mxT;" +
"uniform mat4 mxVP;" +
"void main() { gl_Position = mxVP * mxT * vec4(position, 1.0); }",
"void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); }"));
dev.instance("default",
dev.makeMesh().
attribute("position", R.Attribute.POSITION).
vertices([-1,0,-1, -1,0,1, 1,0,1, 1,0,-1, 0,1,0]).
indices([0,1, 1,2, 2,3, 3,0, 0,4, 1,4, 2,4, 3,4]).
primitive(R.Primitive.LINE),
M.makeMatrix4().scale(0.3, 0.4, 0.3)
).
uniform("mxT", R.Instance.TRANSFORM);
dev.frame();