升级到webpack4

This commit is contained in:
ChenX
2018-08-17 17:39:11 +08:00
parent 563ea73750
commit c99f7f8149
11 changed files with 1935 additions and 5684 deletions

View File

@@ -1,4 +1,5 @@
import * as THREE from 'three';
import { LineBasicMaterial, MeshBasicMaterial, Color } from 'three';
const ColorPalette = [
[255, 0, 0, 255], //----- 0 - lets make it red for an example
//[255, 255, 255, 255],//----- 0 - ByBlock - White
@@ -270,19 +271,28 @@ export class ColorMaterial
{
private constructor() { }
private static m_LineMaterialMap = new Map<number, THREE.LineBasicMaterial>();
static GetLineMaterial(index): THREE.LineBasicMaterial
static GetLineMaterial(index): LineBasicMaterial
{
if (this.m_LineMaterialMap.has(index))
return this.m_LineMaterialMap.get(index);
let mat = new THREE.LineBasicMaterial({ color: this.GetColor(index) });
let mat = new LineBasicMaterial({ color: this.GetColor(index) });
this.m_LineMaterialMap.set(index, mat);
return mat;
}
private static m_BasicMaterialMap = new Map<number, MeshBasicMaterial>();
static GetBasicMaterial(index: number): MeshBasicMaterial
{
if (this.m_BasicMaterialMap.has(index))
return this.m_BasicMaterialMap.get(index);
let mat = new MeshBasicMaterial({ color: this.GetColor(index) });
this.m_BasicMaterialMap.set(index, mat);
return mat;
}
static GetColor(index: number)
{
let rgb = ColorPalette[index];
if (rgb)
return new THREE.Color(rgb[0] / 255, rgb[1] / 255, rgb[2] / 255);
return new Color(rgb[0] / 255, rgb[1] / 255, rgb[2] / 255);
}
}