更新支持无pts buls的数据, 支持无z轴的pts点表
This commit is contained in:
19
dist/createBoard.js
vendored
19
dist/createBoard.js
vendored
@@ -80,11 +80,20 @@ function createBoard(boardData) {
|
|||||||
boardMat.setPosition(pBase);
|
boardMat.setPosition(pBase);
|
||||||
matInv.getInverse(boardMat, true);
|
matInv.getInverse(boardMat, true);
|
||||||
}
|
}
|
||||||
for (let i = 0; i < boardPts.length; i++) {
|
if (boardPts)
|
||||||
let pt = getVec(boardPts[i]);
|
for (let i = 0; i < boardPts.length; i++) {
|
||||||
pt.applyMatrix4(matInv);
|
let pt = getVec(boardPts[i]);
|
||||||
pts.push(new THREE.Vector2(pt.x, pt.y));
|
if (pt.z !== undefined)
|
||||||
buls.push(boardBuls[i]);
|
pt.applyMatrix4(matInv);
|
||||||
|
pts.push(new THREE.Vector2(pt.x, pt.y));
|
||||||
|
buls.push(boardBuls[i]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let length = boardData["L"];
|
||||||
|
let width = boardData["W"];
|
||||||
|
let height = boardData["H"];
|
||||||
|
pts.push(new three_1.Vector2(0, 0), new three_1.Vector2(width, 0), new three_1.Vector2(width, length), new three_1.Vector2(0, length), new three_1.Vector2(0, 0));
|
||||||
|
buls.push(0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
let sp = createPath(pts, buls);
|
let sp = createPath(pts, buls);
|
||||||
let extrudeSettings = {
|
let extrudeSettings = {
|
||||||
|
2
dist/createBoard.js.map
vendored
2
dist/createBoard.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
|||||||
import * as THREE from 'three';
|
import * as THREE from 'three';
|
||||||
import { Geometry, LineSegments } from 'three';
|
import { Geometry, LineSegments, Vector2 } from 'three';
|
||||||
import { polar } from './GeUtils';
|
import { polar } from './GeUtils';
|
||||||
import { boardMaterial, edgeMaterial } from './Material';
|
import { boardMaterial, edgeMaterial } from './Material';
|
||||||
import { RotateUVs } from './RotateUV';
|
import { RotateUVs } from './RotateUV';
|
||||||
@@ -101,12 +101,27 @@ export function createBoard(boardData: object)
|
|||||||
matInv.getInverse(boardMat, true);
|
matInv.getInverse(boardMat, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < boardPts.length; i++)
|
if (boardPts)
|
||||||
|
for (let i = 0; i < boardPts.length; i++)
|
||||||
|
{
|
||||||
|
let pt = getVec(boardPts[i]);
|
||||||
|
if (pt.z !== undefined)
|
||||||
|
pt.applyMatrix4(matInv);
|
||||||
|
pts.push(new THREE.Vector2(pt.x, pt.y));
|
||||||
|
buls.push(boardBuls[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
let pt = getVec(boardPts[i]);
|
let length = boardData["L"];
|
||||||
pt.applyMatrix4(matInv);
|
let width = boardData["W"];
|
||||||
pts.push(new THREE.Vector2(pt.x, pt.y));
|
let height = boardData["H"];
|
||||||
buls.push(boardBuls[i]);
|
pts.push(new Vector2(0, 0),
|
||||||
|
new Vector2(width, 0),
|
||||||
|
new Vector2(width, length),
|
||||||
|
new Vector2(0, length),
|
||||||
|
new Vector2(0, 0)
|
||||||
|
);
|
||||||
|
buls.push(0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
let sp = createPath(pts, buls);
|
let sp = createPath(pts, buls);
|
||||||
|
Reference in New Issue
Block a user