bluegem
v1.0.11
Published
**Simple Command queue that executed the commnad usign a FIFO policy.**
Downloads
3
Readme
Blue Gem Graphics
A basic 3D library for Javascript. The purpose of the library is not speed or top graphics, but ease of use. The entire API is built around the Java Script Promise Objects.
Example
Creating a camera.
function camera_create () {
return world.createCamera("camera1");
};
function camera_move(camera) {
return camera.setPosition([0,0,2]);
};
function camera_set_bg(camera) {
return camera.setBackgroundColor(bluegem.Color3d.rgba(100,100,100,255));
};
Create a light source
function light_create() {
return world.createLight("light1");
};
function light_move(light) {
return light.setPosition([0,1,2]);
};
Add a sphere to the scene.
function entity_create() {
return world.createEntity("entity1");
};
function entity_attach_sphere(entity) {
return entity.attachModel("sphere");
};
Putting everything together.
let world = new bluegem.World3d()
// all setup functions go here
// bind world to canvas
world.init("myCanvas")
// create the camera
.then(camera_create)
.then(camera_move)
.then(camera_set_bg)
// create a sphere
.then(entity_create)
.then(entity_attach_sphere)
// create light
.then(light_create)
.then(light_move)
// catch all errors
.catch(console.error);
// start the main loop.
world.start();
![alt text][sphere.png]