支持材质自定义

This commit is contained in:
xief
2021-03-03 15:07:59 +08:00
parent 01110a8858
commit 93ac737777
5 changed files with 198 additions and 17 deletions

View File

@@ -1,6 +1,6 @@
// import { Color, Face3, MeshBasicMaterial, Object3D, Vector2, Vector3 } from "three";
// import "./style.css";
import { Vector3 } from "three";
import { Color, MeshBasicMaterial, Vector3 } from "three";
import { CameraControlState } from "../CameraControls";
import { data } from "../data";
import { GetBox } from "../GeUtils";
@@ -25,7 +25,17 @@ el.style.width = "80%";
el.style.height = "80%";
document.body.appendChild(el);
let view = new Viewer(el);
let view = new Viewer(el, (settings) =>
{
settings.boardMaterial = new MeshBasicMaterial({
color: new Color(0.8, 0.8, 0.8),
polygonOffset: true,
polygonOffsetFactor: 1, // positive value pushes polygon further away
polygonOffsetUnits: 1,
transparent: true,
opacity: 0.5
});
});
//修改这个顺序 改变1 2 3 个触摸点时的触发状态.
view.m_CameraCtrl.m_TouthTypeList = [CameraControlState.Rotate, CameraControlState.Scale, CameraControlState.Pan];