let extruedeSetting = {
step1: 1,
depth: 1,
bevelEnable: false,
bevelThickness: 5,
bevelSize: -0.1,
bevelSegments: 3,
wireframe:true,
};
let extrudeGeo = new ExtrudeGeometry(shape, extruedeSetting);
let extrudeMat = new MeshBasicMaterial({
color: 0xff0000,
side: DoubleSide,
wireframe: false,
});
let shape3d = new Mesh(extrudeGeo, extrudeMat);
scene.add(shape3d);
let gui = new dat.GUI();
//区间
shape3dFolder.add(extruedeSetting, "depth", 0, 5).onChange(function (e) {
scene.remove(shape3d);
extrudeGeo = new ExtrudeGeometry(shape, extruedeSetting);
shape3d = new Mesh(extrudeGeo, extrudeMat);
scene.add(shape3d);
});
//checkbox
shape3dFolder
.add(extruedeSetting, "wireframe")
.onChange(function (e) {
scene.remove(shape3d);
extrudeMat.wireframe = extruedeSetting.wireframe
extrudeGeo = new ExtrudeGeometry(shape, extruedeSetting);
shape3d = new Mesh(extrudeGeo, extrudeMat);
scene.add(shape3d);
});
//举例 修改颜色
hemisphereLightFolder.addColor(controlObj,"skyColor").onChange(function(e){
hemisphereLight.color = new Color(e)
})
dat.GUI()功能简单实现
最新推荐文章于 2024-05-23 18:59:02 发布