升级到webpack4
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user