-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
13,178 additions
and
12,978 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
/* | |||
Javascript port of CubicVR 3D engine for WebGL | |||
by Charles J. Cliffe | |||
http://www.cubicvr.org/ | |||
|
|||
May be used under the terms of the MIT license. | |||
http://www.opensource.org/licenses/mit-license.php | |||
*/ | |||
|
|||
/*globals alert: false */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -130,4 +130,4 @@ | ||
|
|
||
<body onLoad="webGLStart();"></body> | <body onLoad="webGLStart();"></body> | ||
|
|
||
</html> | </html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,71 @@ | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> | |||
<html> | |||
|
|||
<head> | |||
<title> | |||
CubicVR.js: Using a COLLADA scene from a .dae file | |||
</title> | |||
<script src="../../CubicVR.js" type="text/javascript"> | |||
</script> | |||
<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."); | |||
return; | |||
}; | |||
|
|||
// load the collada file, specify path for images | |||
var scene = CubicVR.loadCollada("WallSmash/wall_smash.dae","WallSmash/"); | |||
scene.resize(canvas.width,canvas.height); | |||
// scene.camera.position = [20,20,-20]; // set our camera position | |||
// scene.camera.target = [0,5,-5]; // set our camera position | |||
scene.camera.position = [0,1,3.5]; | |||
scene.camera.rotation = [0,0,0]; | |||
scene.camera.targeted = false; | |||
scene.camera.setParent(scene.getSceneObject("Sphere")); | |||
scene.camera.motion = null; // remove any camera motion | |||
scene.lights = []; // clear the loaded lights | |||
|
|||
// Add a simple shadowed directional light | |||
scene.bindLight(new CubicVR.Light({ | |||
type:CubicVR.enums.light.type.AREA, | |||
distance:90, | |||
areaCeiling:90, | |||
specular:[1,1,1], | |||
areaAxis:[-25,-10] | |||
})); | |||
|
|||
CubicVR.setSoftShadows(true); | |||
|
|||
// Add our scene to the window resize list | |||
CubicVR.addResizeable(scene); | |||
|
|||
// Use a basic envelope to loop/stretch the time | |||
var looper = new CubicVR.Envelope({ | |||
in_behavior:CubicVR.enums.envelope.behavior.REPEAT, | |||
out_behavior:CubicVR.enums.envelope.behavior.REPEAT | |||
}); | |||
looper.addKey(0,0); | |||
looper.addKey(10,10); | |||
looper.addKey(15,0); | |||
|
|||
// Start our main drawing loop, it provides a timer and the gl context as parameters | |||
CubicVR.MainLoop(function(timer, gl) { | |||
scene.evaluate(looper.evaluate(timer.getSeconds())); | |||
scene.updateShadows(); | |||
scene.render(); | |||
}); | |||
|
|||
// initialize a mouse view controller | |||
mvc = new CubicVR.MouseViewController(canvas, scene.camera); | |||
} | |||
</script> | |||
</head> | |||
|
|||
<body onLoad="webGLStart();"></body> | |||
|
|||
</html> |
Oops, something went wrong.