Skip to content

Instantly share code, notes, and snippets.

@xeolabs
Created July 18, 2010 09:33
Show Gist options
  • Save xeolabs/480266 to your computer and use it in GitHub Desktop.
Save xeolabs/480266 to your computer and use it in GitHub Desktop.
SceneJS 7.6 Intro Example
<!-- Airplane model -->
<script src="models/airplane.js" type="text/javascript"><script/>
<canvas id="theCanvas" width: 900 height: 900><script/>
<script type="text/javascript">
/* Scene definition
*/
with (SceneJS) {
var rotateX,
var rotateY;
var myScene = scene({
canvasId: 'theCanvas'
},
lookAt({
eye : { x: -1.0, y: 0.0, z: 15 },
look : { x: -1.0, y: 0, z: 0 },
up : { y: 1.0 }
},
camera({
optics: {
type: "perspective",
fovy : 55.0,
aspect : 1.0,
near : 0.10,
far : 1000.0
}
},
light({
mode: "dir",
color: { r: 1.0, g: 1.0, b: 1.0 },
dir: { x: 1.0, y: -1.0, z: 1.0 }
}),
light({
mode: "dir",
color: { r: 1.0, g: 1.0, b: 1.0 },
dir: { x: -1.0, y: -1.0, z: -3.0 }
}),
rotateY = rotate({ y: 1.0 },
rotateX = rotate({ x: 1.0 },
myPlane
)
)
)
);
/* Set rotation angles
*/
rotateY.setAngle(315);
rotateX.setAngle(20);
/* Render the scene
*/
myScene.render();
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment