javascript 在 Three.js 中创建一个带圆角的立方体
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12994175/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Creating a cube with rounded corners in Three.js
提问by fncombo
Is it possible to create a cube with rounded corners of custom radius in three.js and then be able to texture that cube with an image?
是否可以在three.js中创建一个带有自定义半径圆角的立方体,然后能够用图像对该立方体进行纹理化?
回答by WestLangley
You can round the corners of a cube using the Loop subdivision algorithm implemented in THREE.SubdivisionModifier
.
您可以使用在THREE.SubdivisionModifier
.
Here it is in action: http://threejs.org/examples/webgl_modifier_subdivision.html.
这是在行动:http: //threejs.org/examples/webgl_modifier_subdivision.html。
You can texture this geometry just as you would texture any other geometry.
您可以像纹理任何其他几何体一样为该几何体添加纹理。
three.js r.70
三.js r.70
回答by Lee Stemkoski
For a simple and straightforward example of subdivision modifiers on cubes (and other basic geometries), check out
有关立方体(和其他基本几何图形)上的细分修饰符的简单而直接的示例,请查看