-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check in raytracing_sandbox_workers.html this time
- Loading branch information
Showing
1 changed file
with
74 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>three.js - raytracing renderer with web workers</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 { | ||
font-family: Monospace; | ||
color: #ffffff; | ||
margin: 0px; | ||
padding: 0px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<script src="../build/three.min.js"></script> | ||
<script src="js/renderers/RaytracingWorkerRenderer.js"></script> | ||
|
||
<script> | ||
|
||
var hash = location.hash ? location.hash.substring(1) : '4'; | ||
|
||
var WORKERS = +hash || navigator.hardwareConcurrency || 4; | ||
|
||
var container; | ||
|
||
var camera, controls, scene, renderer; | ||
|
||
var torus, cube; | ||
|
||
init(); | ||
render(); | ||
|
||
function init() { | ||
|
||
container = document.createElement( 'div' ); | ||
document.body.appendChild( container ); | ||
|
||
var info = document.createElement( 'div' ); | ||
info.style.position = 'absolute'; | ||
info.style.top = '10px'; | ||
info.style.width = '100%'; | ||
info.style.zIndex = '100'; | ||
info.style.textAlign = 'center'; | ||
info.innerHTML = '<a href="http://threejs.org" target="_blank">three.js<a/> - raytracing renderer (using ' + WORKERS + ' web workers)'; | ||
container.appendChild( info ); | ||
|
||
// | ||
|
||
renderer = new THREE.RaytracingWorkerRenderer({ | ||
workers: WORKERS | ||
}); | ||
renderer.setClearColor( 0xf0f0f0 ); | ||
renderer.setSize( window.innerWidth, window.innerHeight ); | ||
|
||
renderer.domElement.style.position = "absolute"; | ||
renderer.domElement.style.top = "0px"; | ||
renderer.domElement.style.left = "0px"; | ||
|
||
container.appendChild( renderer.domElement ); | ||
|
||
} | ||
|
||
function render() { | ||
|
||
renderer.render( scene, camera ); | ||
|
||
} | ||
|
||
</script> | ||
|
||
</body> | ||
</html> |