Created
March 12, 2013 11:12
-
-
Save hurry07/5142091 to your computer and use it in GitHub Desktop.
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
/** | |
* Created with JetBrains WebStorm. | |
* User: lijie | |
* Date: 13-3-12 | |
* Time: 下午6:12 | |
* To change this template use File | Settings | File Templates. | |
*/ |
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
/** | |
* Created with JetBrains WebStorm. | |
* User: lijie | |
* Date: 13-3-12 | |
* Time: 下午6:30 | |
* To change this template use File | Settings | File Templates. | |
*/ | |
var container, stats; | |
var camera, scene, renderer; | |
var start = Date.now(); | |
function initStatsBar(Stats) { | |
stats = new Stats(); | |
stats.domElement.style.position = 'absolute'; | |
stats.domElement.style.top = '0px'; | |
container.appendChild(stats.domElement); | |
} | |
function init() { | |
container = document.createElement( 'div' ); | |
document.body.appendChild( container ); | |
var width = window.innerWidth || 2; | |
var height = window.innerHeight || 2; | |
camera = new THREE.OrthographicCamera(-width / 2, width / 2, height / 2, -height / 2, -100, 100); | |
camera.position.x = 0; | |
camera.position.y = 0; | |
camera.position.z = 0; | |
//camera.lookAt(0, 0, 0); | |
scene = new THREE.Scene(); | |
scene.position.x = 0; | |
scene.position.y = 0; | |
scene.position.z = 0; | |
//renderer = new THREE.WebGLRenderer(); | |
renderer = new THREE.CanvasRenderer(); | |
renderer.setSize( width, height ); | |
renderer.setClearColorHex(0x000000, 1.0); | |
container.appendChild( renderer.domElement ); | |
initScene(); | |
initStatsBar(Stats); | |
window.addEventListener( 'resize', onWindowResize, false ); | |
} | |
function initScene() { | |
var sphere = createPlane('pictures/b_close_01.png'); | |
scene.add( sphere ); | |
// var string = 'hello three.js'; | |
// var text3d = new THREE.TextGeometry( string, { | |
// size: 40, | |
// height: 20, | |
// curveSegments: 2, | |
// font: "helvetiker" | |
// }); | |
// | |
// text3d.computeBoundingBox(); | |
// var centerOffset = -0.5 * ( text3d.boundingBox.max.x - text3d.boundingBox.min.x ); | |
// var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xff0000, overdraw: true } ); | |
// var text = new THREE.Mesh( text3d, textMaterial ); | |
// | |
// // Potentially, we can extract the vertices or faces of the text to generate particles too. | |
// // Geo > Vertices > Position | |
// text.position.set(centerOffset, 0, 0); | |
// | |
// text.rotation.x = 0; | |
// text.rotation.y = Math.PI * 2; | |
// scene.add( text ); | |
scene.add(createText('hello three.js')); | |
} | |
function onWindowResize() { | |
camera.left = -window.innerWidth / 2; | |
camera.right = window.innerWidth / 2; | |
camera.bottom = -window.innerHeight / 2; | |
camera.top = window.innerHeight / 2; | |
camera.updateProjectionMatrix(); | |
renderer.setSize( window.innerWidth, window.innerHeight ); | |
} | |
// | |
function animate() { | |
requestAnimationFrame( animate ); | |
render(); | |
stats.update(); | |
} | |
function render() { | |
var timer = Date.now() - start; | |
//camera.position.x = Math.cos( timer ) * 500; | |
//camera.position.y = Math.sin( timer ) * 500; | |
camera.lookAt( scene.position ); | |
renderer.render(scene, camera); | |
} | |
init(); | |
animate(); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>datasource visiul tool</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | |
<style> | |
body { | |
color: #808080; | |
font-family:Monospace; | |
font-size:13px; | |
text-align:center; | |
background-color: #ffffff; | |
margin: 0px; | |
overflow: hidden; | |
} | |
#info { | |
position: absolute; | |
top: 0px; width: 100%; | |
padding: 5px; | |
} | |
a { | |
color: #0080ff; | |
} | |
</style> | |
</head> | |
<body> | |
<script src="../build/three.js"></script> | |
<script src="utils.js"></script> | |
<script src="../examples/js/libs/stats.min.js"></script> | |
<script src="../examples/fonts/helvetiker_regular.typeface.js"></script> | |
<script src="impl.js"></script> | |
</body> | |
</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
�PNG | |