排钻显示改成实体显示.

This commit is contained in:
ChenX
2018-05-31 21:01:30 +08:00
parent f72bb04ff5
commit fa20fa5f48
8 changed files with 26 additions and 15 deletions

View File

@@ -1,10 +1,11 @@
import * as THREE from "three";
import { Mesh } from "three";
import { CameraControls, PointPick, boardMaterial, selectMaterial } from ".";
import { CameraUpdate } from "./CameraUpdate";
import { ColorMaterial } from "./ColorPalette";
import { GetBox, GetBoxArr, cZeroVec } from "./GeUtils";
import { PlaneExt } from "./PlaneExt";
import { PointPick, boardMaterial, CameraControls, selectMaterial } from ".";
import { MeshBasicMaterial, Color, Mesh } from "three";
export class Viewer
{
@@ -38,7 +39,7 @@ export class Viewer
let mesh = PointPick(this, e.offsetX, e.offsetY);
if (oldMesh)
oldMesh.material = boardMaterial;
if (mesh)
if (mesh && mesh.material !== ColorMaterial.GetLineMaterial(1))
{
oldMesh = mesh;
mesh.material = selectMaterial;

View File

@@ -1,5 +1,6 @@
import * as THREE from 'three';
import { Geometry, LineSegments, Shape, Vector2, CylinderGeometry } from 'three';
import { CylinderGeometry, Geometry, LineSegments, Mesh, Shape, Vector2 } from 'three';
import { ColorMaterial } from './ColorPalette';
import { polar } from './GeUtils';
import { boardMaterial, edgeMaterial } from './Material';
import { RotateUVs } from './RotateUV';
@@ -137,8 +138,7 @@ export function createBoard(boardData: object)
ext.applyMatrix(boardMat);
//外边.
let edges = [createEdge(ext)];
let edges: (LineSegments | Mesh)[] = [createEdge(ext)];
//差集
if (checkObjectArray(boardData, "SubBoardLocal")
@@ -161,7 +161,7 @@ export function createBoard(boardData: object)
let dris = boardData["Drillings"];
for (let dri of dris)
{
let geo = new CylinderGeometry(dri.r, dri.r, dri.h, 32);
let geo = new CylinderGeometry(dri.r, dri.r, dri.h, 8);
geo.rotateX(Math.PI * 0.5);
if (dri.f === 0) //0正
@@ -171,7 +171,11 @@ export function createBoard(boardData: object)
geo.applyMatrix(boardMat);
edges.push(createEdge(geo));
let mesh = new Mesh(geo, ColorMaterial.GetLineMaterial(1));
edges.push(mesh);
// let edge = createEdge(geo);
// edge.material = new LineBasicMaterial({ color: new Color(1, 0, 0) });
// edges.push(edge);
// let subCsg = new ThreeBSP(geo);
// thisCsg = thisCsg.subtract(subCsg);