清理代码格式

This commit is contained in:
ChenX 2018-05-30 18:32:42 +08:00
parent e3c565a83d
commit 2a17e619a2
6 changed files with 20 additions and 15 deletions

View File

@ -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
View File

@ -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];

File diff suppressed because one or more lines are too long

View File

@ -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)
{ {

View File

@ -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);

View File

@ -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];