2017-04-12 6 views
0

PLY 파일 (60Mb 이상)에서 매우 복잡한 3D 모델을로드 중입니다. 내 프로젝트에서 나는 궤도 - 컨트롤을 사용하여 객체 주위를 이동해야합니다. 분명히 대용량 파일로 인해 일부 영업 담당자는 작업 속도가 매우 느립니다.THREE JS가 PLY 파일을로드 할 때 Geometry의 BufferGeometry로 변환되지 않습니다.

this.loader.load('assets/data/GuyFawkesMask.ply', function (geometry) { 
     var bufferGeometry = new THREE.BufferGeometry().fromGeometry(geometry); 

     console.log(bufferGeometry); 

     // Create object 
     let object = 
      new THREE.Mesh(bufferGeometry, 
      new THREE.MeshPhongMaterial(
       { 
        color: 0xFFFFFF, 
        //vertexColors: THREE.VertexColors, 
        shading: THREE.FlatShading, 
        shininess: 0 
       }) 
      ); 

     _this.add(object); 
    }); 

그러나 나는 다음과 같은 오류가 점점 오전 :

TypeError: Cannot read property '0' of undefined at DirectGeometry.fromGeometry (three.module.js:12219) at BufferGeometry.fromGeometry (three.module.js:14307) at threed-viewer.component.ts:379 at index.js:52 at XMLHttpRequest. (three.module.js:29263) at ZoneDelegate.webpackJsonp.818.ZoneDelegate.invokeTask (zone.js:367) at Object.onInvokeTask (ng_zone.js:264) at ZoneDelegate.webpackJsonp.818.ZoneDelegate.invokeTask (zone.js:366) at Zone.webpackJsonp.818.Zone.runTask (zone.js:166) at XMLHttpRequest.ZoneTask.invoke (zone.js:420)

어떤 생각을 일을 내가 다음 코드 줄을 가진 버퍼 구조로 내 형상을 변환하려고 조금 속도를 위해 ?

디노 감사

+0

내가 바로 그것을 얻을 경우,'PLYLoader의 소스 코드를 찾고. js'의 경우, 콜백 함수가 리턴하는'geometry'는 이미'THREE.BufferGeometry()'입니다. – prisoner849

+0

어머, 너 말이 맞아! – Dino

답변

0

그냥 나중에 참조 할 수 있도록 (답변)을 prisoner849 코멘트를 게시 :

If I get it right, looking into the source code of PLYLoader.js, the geometry, which the callback function returns, is already of THREE.BufferGeometry()