2017-04-26 1 views

답변

0

그냥 라인 # 8228에서 three.js viewer implementation의 소스 코드를 볼.

// File:src/core/Face3.js 

    /** 
    * @author mrdoob/http://mrdoob.com/ 
    * @author alteredq/http://alteredqualia.com/ 
    */ 

    THREE.Face3 = function (a, b, c, normal, color, materialIndex) { 

    this.a = a; 
    this.b = b; 
    this.c = c; 

    this.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3(); 
    this.vertexNormals = normal instanceof Array ? normal : []; 

    this.color = color instanceof THREE.Color ? color : new THREE.Color(); 
    this.vertexColors = color instanceof Array ? color : []; 

    this.vertexTangents = []; 

    this.materialIndex = materialIndex !== undefined ? materialIndex : 0; 

    }; 

    THREE.Face3.prototype = { 

    constructor: THREE.Face3, 

    clone: function() { 

     var face = new THREE.Face3(this.a, this.b, this.c); 

     face.normal.copy(this.normal); 
     face.color.copy(this.color); 

     face.materialIndex = this.materialIndex; 

     for (var i = 0, il = this.vertexNormals.length; i < il; i ++) { 

     face.vertexNormals[ i ] = this.vertexNormals[ i ].clone(); 

     } 

     for (var i = 0, il = this.vertexColors.length; i < il; i ++) { 

     face.vertexColors[ i ] = this.vertexColors[ i ].clone(); 

     } 

     for (var i = 0, il = this.vertexTangents.length; i < il; i ++) { 

     face.vertexTangents[ i ] = this.vertexTangents[ i ].clone(); 

     } 

     return face; 

    } 

    }; 

도 타고 three.js를 Face3 문서를 살펴 : 기하에 사용

삼각형 얼굴. 모든 표준 지오메트리 유형에 대해 자동으로 작성되지만 사용자 정의 지오메트리를 작성하는 경우 수동으로 작성해야합니다.

+0

'hitTestViewport'에서 반환하는 목적은 무엇입니까? 이 경우에 어떤 용도로 사용됩니까? – shinzou

+0

이것은 교차되는 Face3 엔티티입니다. 정확히 달성하기를 원하십니까? –

0

나는 대답 할 수 없다. 그러나 확실하게 말할 수있는 것은 뷰어에 광선 추적을 구현하는 방법, 즉 촬영할 광선을 정의하는 방법과 Forge 모델에서 광선이 교차하는 three.js 객체를 결정하는 방법입니다. 이것은 GitHub의에 ForgeFader 프로젝트에 의해 입증된다

https://github.com/jeremytammik/forgefader

+0

그 얼굴이 무엇인지 알면 좋을 것입니다. – shinzou

관련 문제