Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including obscene with all npm packages installed. Try it out:

var obscene = require("obscene")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

obscene v1.0.1

A minimal scene graph library

Obscene

A minimal scene graph library.

Constructable

//Creates a scene node at the origin with no rotation
var origin = obscene.origin();

//Creates a scene node translated forward 1 unit
var forward = obscene.translate([1, 0, 0]);

//Creates a scene node rotated about the right vector 45 degrees
var rotated = obscene.rotate([0, 1, 0], Math.radians(45))

Combinable

//Combine two scene nodes and return the merged result
var combined = obscene.combine(parent, child)

Composable


var childSceneNode = addChild(parent, sceneNode);

Persistable to a database


dbutil.insert(sceneNode, sceneNodeFields, 'scenenodes', dbclient, function(err, result) {

   if (err) {console.error(err); return;}

   //sceneNode is now persisted
})

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free