-
Notifications
You must be signed in to change notification settings - Fork 466
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:Ovilia/ThreeExample.js
- Loading branch information
Showing
5 changed files
with
9,502 additions
and
43 deletions.
There are no files selected for viewing
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html> | ||
<head> | ||
<script type="text/javascript" src="../lib/three.js"></script> | ||
<script type="text/javascript" src="../lib/ColladaLoader.js"></script> | ||
|
||
<script type="text/javascript"> | ||
var scene = null; | ||
var camera = null; | ||
var renderer = null; | ||
|
||
var mesh = null; | ||
var id = null; | ||
|
||
function init() { | ||
renderer = new THREE.WebGLRenderer({ | ||
canvas: document.getElementById('mainCanvas') | ||
}); | ||
renderer.setClearColor(0x000000); | ||
scene = new THREE.Scene(); | ||
|
||
camera = new THREE.OrthographicCamera(-5, 5, 3.75, -3.75, 0.1, 100); | ||
camera.position.set(15, 25, 25); | ||
camera.lookAt(new THREE.Vector3(0, 2, 0)); | ||
scene.add(camera); | ||
|
||
var loader = new THREE.ColladaLoader(); | ||
loader.load('../lib/port.dae', function (collada) { | ||
if (collada.scene.children.length > 0) { | ||
scene.add(collada.scene.children[0]); | ||
} | ||
}); | ||
|
||
var light = new THREE.DirectionalLight(0xffffff); | ||
light.position.set(20, 10, 5); | ||
scene.add(light); | ||
|
||
id = setInterval(draw, 20); | ||
} | ||
|
||
function draw() { | ||
renderer.render(scene, camera); | ||
} | ||
</script> | ||
</head> | ||
|
||
<body onload="init()"> | ||
<canvas id="mainCanvas" width="400px" height="300px" ></canvas> | ||
</body> | ||
</html> |
Oops, something went wrong.