2013-09-22 6 views
-1

밤에 더 많은 부분을 내보내기 큐브로 만들려고 노력 했었습니다. 큐브를 텍스처 큐브로 만들고이를 내가 만든 게임으로 내보낼 수있게 해주었습니다. 내가 큐브를 만들어서 전체 크기 128x128 너비와 높이를 가질 수없는 이유가 있습니다.아이소 메트릭 큐브, 크기가 타일 크기와 일치하지 않습니다. 128x128

function init(){ 

     if(Detector.webgl){ 
      renderer = new THREE.WebGLRenderer({ 
       antialias  : false, // to get smoother output 
       preserveDrawingBuffer : true // to allow screenshot 
      }); 
      renderer.setClearColorHex(0xBBBBBB, 1); 
     // uncomment if webgl is required 
     //}else{ 
     // Detector.addGetWebGLMessage(); 
     // return true; 
     }else{ 
      renderer = new THREE.CanvasRenderer(); 
     } 
     renderer.setSize(128,128); 
     document.getElementById('container').appendChild(renderer.domElement); 

     // add Stats.js - https://github.com/mrdoob/stats.js 
     stats = new Stats(); 
     stats.domElement.style.position = 'absolute'; 
     stats.domElement.style.bottom = '0px'; 
     document.body.appendChild(stats.domElement); 

     var zoom = 1.0; 

     // create a scene 
     scene = new THREE.Scene(); 

     // put a camera in the scene 
     camera = new THREE.OrthographicCamera(WIDTH/-zoom, HEIGHT/zoom, WIDTH/zoom, HEIGHT/-zoom, -2000, 1000); 
     //camera = new THREE.PerspectiveCamera(35, window.innerWidth/window.innerHeight, 1, 10000); 
     camera.position.set(0.45,0.45,0.45); 
     camera.lookAt(scene.position); 
     //camera.position.set(0, 0, 5); 
     scene.add(camera); 

     // create a camera contol 
     //cameraControls = new THREEx.DragPanControls(camera) 

     // transparently support window resize 
     THREEx.WindowResize.bind(renderer, camera); 
     // allow 'p' to make screenshot 
     THREEx.Screenshot.bindKey(renderer); 
     // allow 'f' to go fullscreen where this feature is supported 
     //if(THREEx.FullScreen.available()){ 
     // THREEx.FullScreen.bindKey();   
     // document.getElementById('inlineDoc').innerHTML += "- <i>f</i> for fullscreen"; 
     //} 

     // here you add your objects 
     // - you will most likely replace this part by your own 
     //var geometry = new THREE.TorusGeometry(1, 0.42); 
     var cubeSize = 128; 

     var geometry = new THREE.CubeGeometry(cubeSize, cubeSize, cubeSize); 
     var material = new THREE.MeshNormalMaterial(); 
     mesh= new THREE.Mesh(geometry, material); 
     mesh.rotation.x = 0; 
     mesh.rotation.y = 0; 
     mesh.rotation.z = 0; 
     scene.add(mesh); 
    } 

나는 다른 "확대"하지만 여전히 너무 크거나 작아 끝 시도했습니다 :

나는 다음과 같은 코드가 있습니다. 내가 잘못

https://dl.dropboxusercontent.com/u/5256694/cube_ex.png

를하고있는 중이 야 무엇 : 모든이와 포인트는 다음과 같이 생성 할 수 코드로 끝날 것입니다?

+0

예 때때로 emperical 데이터 논리를 발견하는 것보다 낫다. 나는 그것을 해결했다. 그러나 나는 내가 사용하는 가치들, 일하는 것에 관해서 천국과 같은 생각을했다. / – Hiam

답변

0

대신 "줌"수준으로 THREE.OrthographicCamera의 매개 변수에 대해 생각의

친절 감사

하이 앰, 당신은 카메라가 볼 수 무엇에 대한 경계면의 좌표로 생각해야한다.

는 또한 Three.js를

에 직교 카메라를 사용하는 방법에 대한 자세한 내용은 Three.js - Orthographic camera에 대한 답을 참조
관련 문제