无论如何使用三个js来定义一个对象的剪辑区域?例如,我有一个包含子对象的父对象,我想根据视口剪辑子对象。
就像是...
// Create container and children
var container = new THREE.Object3D();
for(var i = 0; i < 100; i++) {
var geometry = new THREE.PlaneGeometry(i, 0, 0);
var material = new THREE.MeshBasicMaterial({color: 0x00ff00});
var child = new THREE.Mesh(geometry, material);
container.add(child);
}
// Create bounding box which is my viewport
var geom = new THREE.Geometry();
geom.vertices.push(new THREE.Vector3(0, 0, 0));
geom.vertices.push(new THREE.Vector3(10, 0, 0));
geom.vertices.push(new THREE.Vector3(10, 1, 0));
geom.vertices.push(new THREE.Vector3(0, 1, 0));
geom.computeBoundingBox();
// Magic property (THIS DOESNT EXIST)
container.clipRegion = geom.boundingBox;
最后一部分不存在,但是有没有办法用三个 js 来实现呢?我可能想为父级中的子级设置动画,并且只显示边界框定义的可见区域。
更新,添加了下图来描述我的问题。
生成的红色区域是我想要使其可见的区域,同时掩盖了该区域之外的任何东西。所有其他内容都应该可见。