|
@@ -22,8 +22,6 @@
|
|
|
<script src="js/Detector.js"></script>
|
|
|
<script src="js/libs/stats.min.js"></script>
|
|
|
|
|
|
- <script src='js/libs/dat.gui.min.js'></script>
|
|
|
-
|
|
|
<script>
|
|
|
|
|
|
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
|
|
@@ -39,10 +37,6 @@
|
|
|
var cubeGeo, cubeMaterial;
|
|
|
var i, intersector;
|
|
|
|
|
|
- var gui, voxelConfig = {
|
|
|
- orthographicProjection: false
|
|
|
- };
|
|
|
-
|
|
|
init();
|
|
|
animate();
|
|
|
|
|
@@ -56,10 +50,10 @@
|
|
|
info.style.top = '10px';
|
|
|
info.style.width = '100%';
|
|
|
info.style.textAlign = 'center';
|
|
|
- info.innerHTML = '<a href="http://threejs.org" target="_blank">three.js</a> - voxel painter - webgl<br><strong>click</strong>: add voxel, <strong>control + click</strong>: remove voxel, <strong>shift + click</strong>: rotate, <a href="javascript:save();return false;">save .png</a>';
|
|
|
+ info.innerHTML = '<a href="http://threejs.org" target="_blank">three.js</a> - voxel painter - webgl<br><strong>click</strong>: add voxel, <strong>control + click</strong>: remove voxel, <strong>shift + click</strong>: rotate';
|
|
|
container.appendChild( info );
|
|
|
|
|
|
- camera = new THREE.CombinedCamera( window.innerWidth, window.innerHeight, 45, 1, 10000, -2000, 10000 );
|
|
|
+ camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 10000 );
|
|
|
camera.position.y = 800;
|
|
|
|
|
|
scene = new THREE.Scene();
|
|
@@ -117,35 +111,11 @@
|
|
|
|
|
|
window.addEventListener( 'resize', onWindowResize, false );
|
|
|
|
|
|
- // add GUI
|
|
|
-
|
|
|
- gui = new dat.GUI();
|
|
|
- gui.add( voxelConfig, 'orthographicProjection' ).onChange( function(){
|
|
|
-
|
|
|
- if ( voxelConfig.orthographicProjection ) {
|
|
|
-
|
|
|
- camera.toOrthographic();
|
|
|
- camera.position.x = 1000;
|
|
|
- camera.position.y = 707.106;
|
|
|
- camera.position.z = 1000;
|
|
|
- theta = 90;
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- camera.toPerspective();
|
|
|
- camera.position.y = 800;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- } );
|
|
|
-
|
|
|
- gui.close();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
function onWindowResize() {
|
|
|
|
|
|
- camera.setSize( window.innerWidth, window.innerHeight );
|
|
|
+ camera.aspect = window.innerWidth / window.innerHeight;
|
|
|
camera.updateProjectionMatrix();
|
|
|
|
|
|
renderer.setSize( window.innerWidth, window.innerHeight );
|
|
@@ -243,17 +213,12 @@
|
|
|
|
|
|
function onDocumentKeyUp( event ) {
|
|
|
|
|
|
- switch( event.keyCode ) {
|
|
|
+ switch ( event.keyCode ) {
|
|
|
|
|
|
case 16: isShiftDown = false; break;
|
|
|
case 17: isCtrlDown = false; break;
|
|
|
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- function save() {
|
|
|
-
|
|
|
- window.open( renderer.domElement.toDataURL('image/png'), 'mywindow' );
|
|
|
|
|
|
}
|
|
|
|