svg - 给定 SVG 路径,使用 THREE.js 创建 3D 表面
问题描述
如何在给定 SVG 路径的情况下创建 3D 表面。我希望通过绕轴旋转路径来创建这个表面。
我使用 SVGLoader 加载我的 SVG;这就像一个旋转的挤压。我不确定如何做到这一点。
const loader = new SVGLoader();
loader.load(
'data/svgSample.svg',
function ( data ) {
const paths = data.paths;
const group = new THREE.Group();
for ( let i = 0; i < paths.length; i ++ ) {
const path = paths[ i ];
const material = new THREE.MeshBasicMaterial( {
color: path.color,
side: THREE.DoubleSide,
depthWrite: false
} );
const shapes = path.toShapes( true );
for ( let j = 0; j < shapes.length; j ++ ) {
const shape = shapes[ j ];
const geometry = new THREE.ShapeGeometry( shape );
const mesh = new THREE.Mesh( geometry, material );
group.add( mesh );
}
}
scene.add( group );
}
);
解决方案
推荐阅读
- jquery - 如何从页面中删除 div 以使其即使在使用 jQuery 刷新页面后也不会返回
- laravel - Laravel 5.7 多对多同步()不起作用
- jquery - jquery Datatable 没有正确排序
- java - 使用 DataProvider 进行多次测试,每次使用不同的 DP 参数
- java - Virtuoso 批量加载程序和数据库问题
- model - 使用 OR 条件设置 Sequelize.js 关联
- unit-testing - 通过接口引入对象以模拟它
- ionic-framework - 如何修复“FacebookOriginal”类型中缺少“提供”属性?
- typescript - 如何仅在 Angular 7 的一个组件中使用 jquery-scrollify?
- ansible - 无法运行 Ansible 'expect' 模块