Find file
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (41 sloc) 1.73 KB
<!DOCTYPE html>
CubicVR.js: Using a COLLADA model from a .dae file
<script src="../../CubicVR.js" type="text/javascript">
<script type='text/javascript'>
function webGLStart() {
// by default generate a full screen canvas with automatic resize
var gl = CubicVR.init();
var canvas = CubicVR.getCanvas();
if (!gl) {
alert("Sorry, no WebGL support.");
// load the collada file, specify path for images
var scene = CubicVR.loadCollada("SketchUp/home.dae","SketchUp/");
// set initial camera position and target = [100, 100, 100];
// center target on building
var objectBounds = scene.getSceneObject("SketchUp").getAABB();
var vec3 = CubicVR.vec3; = vec3.multiply(vec3.add(objectBounds[0],objectBounds[1]),0.5);
// Add a simple directional light
scene.bindLight(new CubicVR.Light({type:CubicVR.enums.light.type.DIRECTIONAL,specular:[1,1,1],direction:CubicVR.vec3.normalize([-0.2,-1,-0.5])}));
// Add our scene to the window resize list
// Start our main drawing loop, it provides a timer and the gl context as parameters
CubicVR.MainLoop(function(timer, gl) {
// initialize a mouse view controller
mvc = new CubicVR.MouseViewController(canvas,;
<body onLoad="webGLStart();"></body>