清理代码格式
This commit is contained in:
parent
e3c565a83d
commit
2a17e619a2
4
dist/createBoard.d.ts
vendored
4
dist/createBoard.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
import * as THREE from 'three';
|
import * as THREE from 'three';
|
||||||
import { Geometry, LineSegments } from 'three';
|
import { Geometry, LineSegments, Shape, Vector2 } from 'three';
|
||||||
export declare class Arc2d {
|
export declare class Arc2d {
|
||||||
m_StartAn: number;
|
m_StartAn: number;
|
||||||
m_EndAn: number;
|
m_EndAn: number;
|
||||||
@ -9,7 +9,7 @@ export declare class Arc2d {
|
|||||||
m_Radius: number;
|
m_Radius: number;
|
||||||
constructor(p1: THREE.Vector2, p2: THREE.Vector2, bul: number);
|
constructor(p1: THREE.Vector2, p2: THREE.Vector2, bul: number);
|
||||||
}
|
}
|
||||||
export declare function createPath(pts: THREE.Vector2[], buls: number[], shapeOut?: THREE.Shape): THREE.Shape;
|
export declare function createPath(pts: Vector2[], buls: number[], shapeOut?: Shape): Shape;
|
||||||
export declare function getVec(data: object): THREE.Vector3;
|
export declare function getVec(data: object): THREE.Vector3;
|
||||||
export declare function createBoard(boardData: object): {
|
export declare function createBoard(boardData: object): {
|
||||||
mesh: THREE.Mesh;
|
mesh: THREE.Mesh;
|
||||||
|
2
dist/createBoard.js
vendored
2
dist/createBoard.js
vendored
@ -34,7 +34,7 @@ class Arc2d {
|
|||||||
exports.Arc2d = Arc2d;
|
exports.Arc2d = Arc2d;
|
||||||
//创建轮廓 通过点表和凸度
|
//创建轮廓 通过点表和凸度
|
||||||
function createPath(pts, buls, shapeOut) {
|
function createPath(pts, buls, shapeOut) {
|
||||||
let shape = shapeOut || new THREE.Shape();
|
let shape = shapeOut || new three_1.Shape();
|
||||||
if (pts.length === 0)
|
if (pts.length === 0)
|
||||||
return shape;
|
return shape;
|
||||||
let firstPt = pts[0];
|
let firstPt = pts[0];
|
||||||
|
2
dist/createBoard.js.map
vendored
2
dist/createBoard.js.map
vendored
File diff suppressed because one or more lines are too long
@ -1,14 +1,14 @@
|
|||||||
import { Matrix2 } from './Matrix2';
|
import { Matrix2 } from './Matrix2';
|
||||||
import * as THREE from 'three';
|
import { Geometry, Vector2 } from 'three';
|
||||||
|
|
||||||
|
|
||||||
export function RotateUVs(geo: THREE.Geometry)
|
export function RotateUVs(geo: Geometry)
|
||||||
{
|
{
|
||||||
let roMat = new Matrix2();
|
let roMat = new Matrix2();
|
||||||
roMat.set(0, -1,
|
roMat.set(0, -1,
|
||||||
1, 0);
|
1, 0);
|
||||||
|
|
||||||
let addV = new THREE.Vector2(1, 0);
|
let addV = new Vector2(1, 0);
|
||||||
|
|
||||||
for (let uvs of geo.faceVertexUvs)
|
for (let uvs of geo.faceVertexUvs)
|
||||||
{
|
{
|
||||||
|
15
src/Text.ts
15
src/Text.ts
@ -2,10 +2,13 @@ import { Font, FontLoader, Mesh, ShapeGeometry, Vector3 } from "three";
|
|||||||
import { ColorMaterial } from "./ColorPalette";
|
import { ColorMaterial } from "./ColorPalette";
|
||||||
import { MoveMatrix } from "./GeUtils";
|
import { MoveMatrix } from "./GeUtils";
|
||||||
|
|
||||||
class FontLoaderUtil {
|
class FontLoaderUtil
|
||||||
|
{
|
||||||
private static defFont: Font;
|
private static defFont: Font;
|
||||||
static Load(): Font {
|
static Load(): Font
|
||||||
if (!this.defFont) {
|
{
|
||||||
|
if (!this.defFont)
|
||||||
|
{
|
||||||
const f = require("../resources/fonts/helvetiker_regular.typeface.json");
|
const f = require("../resources/fonts/helvetiker_regular.typeface.json");
|
||||||
let loader = new FontLoader();
|
let loader = new FontLoader();
|
||||||
this.defFont = loader.parse(f);
|
this.defFont = loader.parse(f);
|
||||||
@ -14,7 +17,8 @@ class FontLoaderUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DbText extends Mesh {
|
export class DbText extends Mesh
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 构造一个文本对象,8位点(中心点下面)在0点
|
* 构造一个文本对象,8位点(中心点下面)在0点
|
||||||
@ -22,7 +26,8 @@ export class DbText extends Mesh {
|
|||||||
* @param {number} height 文本高度
|
* @param {number} height 文本高度
|
||||||
* @memberof DbText
|
* @memberof DbText
|
||||||
*/
|
*/
|
||||||
constructor(str: string, height: number = 5) {
|
constructor(str: string, height: number = 5)
|
||||||
|
{
|
||||||
let font = FontLoaderUtil.Load();
|
let font = FontLoaderUtil.Load();
|
||||||
|
|
||||||
let shapes: THREE.Shape[] = font.generateShapes(str, height, 0.1);
|
let shapes: THREE.Shape[] = font.generateShapes(str, height, 0.1);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as THREE from 'three';
|
import * as THREE from 'three';
|
||||||
import { Geometry, LineSegments, Vector2 } from 'three';
|
import { Geometry, LineSegments, Shape, 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';
|
||||||
@ -44,9 +44,9 @@ export class Arc2d
|
|||||||
}
|
}
|
||||||
|
|
||||||
//创建轮廓 通过点表和凸度
|
//创建轮廓 通过点表和凸度
|
||||||
export function createPath(pts: THREE.Vector2[], buls: number[], shapeOut?: THREE.Shape): THREE.Shape
|
export function createPath(pts: Vector2[], buls: number[], shapeOut?: Shape): Shape
|
||||||
{
|
{
|
||||||
let shape = shapeOut || new THREE.Shape();
|
let shape = shapeOut || new Shape();
|
||||||
if (pts.length === 0) return shape;
|
if (pts.length === 0) return shape;
|
||||||
let firstPt = pts[0];
|
let firstPt = pts[0];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user