由viewer.impl.hitTestViewport()
返回的對象中的Three.face是什麼?什麼是viewer.impl.hitTestViewport中的Three.Face3返回的對象?
下面是一個例子:
是什麼代表什麼呢?
由viewer.impl.hitTestViewport()
返回的對象中的Three.face是什麼?什麼是viewer.impl.hitTestViewport中的Three.Face3返回的對象?
下面是一個例子:
是什麼代表什麼呢?
只要看看在three.js viewer implementation源代碼在行#8228。
// 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文檔:
在幾何中使用三角臉。這些是爲所有標準幾何類型自動創建的,但是如果您要構建自定義幾何,則必須手動創建它們。
我無法回答。但是,我可以肯定地說,如何在查看器中實現光線追蹤,即如何定義要拍攝的光線以及如何確定Forge模型中與它相交的三個物體。這表現在ForgeFader項目在GitHub上:
很高興知道那張臉是什麼,也許我可以用它來做某件事。 – shinzou
從hitTestViewport返回它的目的是什麼?它在這種情況下用於什麼? – shinzou
這只是Face3實體被相交。你想要達到什麼目的? –