我创建了这个javascript代码,以便从加载的网格中细分相交的面:
function onDocumentMouseDown( event )
{
console.log("Click.");
mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
var vector = new THREE.Vector3( mouse.x, mouse.y, 1 );
projector.unprojectVector( vector, camera );
var ray = new THREE.Raycaster( camera.position, vector.sub( camera.position ).normalize() );
var intersects = ray.intersectObjects( targetList );
if ( intersects.length > 0 )
{
var smooth = THREE.GeometryUtils.clone( intersects[0].object.geometry );
var modifier = new THREE.SubdivisionModifier(1);
modifier.modify( smooth );
intersects[0].object.geometry = smooth;
}
但是代码细分了网格的整体。 你能帮助我吗。 谢谢