Extruding multiple polygons with multiple holes and texturing the combined shape

梦想与她 提交于 2019-11-28 11:35:58

You can merge geometries as in the following snippet, resulting in just a single mesh. From your prior questions, you already know how to texture a single geometry.

var geometry1 = new THREE.ExtrudeGeometry( shape1, extrusionSettings );
var geometry2 = new THREE.ExtrudeGeometry( shape2, extrusionSettings );

geometry1.merge( geometry2 );

. . .

var mesh = new THREE.Mesh( geometry1, material );

scene.add( mesh );

Fiddle: http://jsfiddle.net/pHn2B/88/

Fiddle: http://jsfiddle.net/C5dga/13/ (with texture)

EDIT: As an alternative to creating separate geometries and using the merge utility, you can create a single geometry using the following pattern, instead:

var geometry1 = new THREE.ExtrudeGeometry( [ shape1, shape2 ], extrusionSettings );

EDIT: updated to three.js r.70

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!