UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

54 lines (53 loc) 1.22 kB
"use strict"; import { FrontSide, LineBasicMaterial, MeshStandardMaterial, PointsMaterial } from "three"; export const step = 1e-6; const GROUP_COLOR = 1170688; const MESH_MAT = new MeshStandardMaterial({ color: 16777215, // vertexColors: true, side: FrontSide, metalness: 0, roughness: 0.9 }); const MESH_GROUP_MAT = new MeshStandardMaterial({ color: GROUP_COLOR, // vertexColors: true, side: FrontSide, metalness: 0, roughness: 0.9, emissive: 0.5 }); const LINES_MAT = new LineBasicMaterial({ color: 16777215, linewidth: 1 }); const LINES_GROUP_MAT = new LineBasicMaterial({ color: GROUP_COLOR, linewidth: 5 // depthWrite: false, }); const POINTS_MAT = new PointsMaterial({ color: 16777215, size: 0.1 }); export function cadMaterialMesh(color, wireframe) { const mat = MESH_MAT.clone(); mat.wireframe = wireframe; mat.color = color; return mat; } export function cadMaterialMeshGroup() { return MESH_GROUP_MAT; } export function cadMaterialLine(color) { const mat = LINES_MAT.clone(); mat.color = color; return mat; } export function cadMaterialLineGroup() { return LINES_GROUP_MAT; } export function cadMaterialPoint() { const mat = POINTS_MAT; return mat; }