原出处:http://hewebgl.com/article/getarticle/58
话说,原出处代码居然还有语法错误,真是坑爹了,简单修改了,不多说,上代码,想说的都在注释里。
html5-canvas版本:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Three框架</title>
<script type="text/javascript" script src="three.js"></script>
<script type="text/javascript" script src="stats.min.js"></script>
<style type="text/css">
div#canvas-frame {
border: none;
cursor: pointer;
width: 100%;
height: 600px;
background-color: #EEEEEE;
}
</style>
<script>
var renderer;
var stats;
function initThree() {
width = document.getElementById('canvas-frame').clientWidth;
height = document.getElementById('canvas-frame').clientHeight;
renderer = new THREE.WebGLRenderer({ antialias : true });
renderer.setSize(width, height);
document.getElementById('canv