33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
![]() |
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
const THREE = require("three");
|
||
|
const ColorPalette = [
|
||
|
[255, 0, 0, 255],
|
||
|
//[255, 255, 255, 255],//----- 0 - ByBlock - White
|
||
|
[255, 0, 0, 255],
|
||
|
// [255, 0, 0, 255], //----- 1 - Red
|
||
|
[255, 255, 0, 255],
|
||
|
[0, 255, 0, 255],
|
||
|
[0, 255, 255, 255],
|
||
|
[0, 0, 255, 255],
|
||
|
[255, 0, 255, 255],
|
||
|
];
|
||
|
//颜色材质,对于二维图像来说可能有用,应该不对三维对象使用该材质
|
||
|
class ColorMaterial {
|
||
|
constructor() { }
|
||
|
static GetLineMaterial(index) {
|
||
|
if (this.m_LineMaterialMap.has(index))
|
||
|
return this.m_LineMaterialMap.get(index);
|
||
|
let mat = new THREE.LineBasicMaterial({ color: this.GetColor(index) });
|
||
|
this.m_LineMaterialMap.set(index, mat);
|
||
|
return mat;
|
||
|
}
|
||
|
static GetColor(index) {
|
||
|
let rgb = ColorPalette[index];
|
||
|
if (rgb)
|
||
|
return new THREE.Color(rgb[0] / 255, rgb[1] / 255, rgb[2] / 255);
|
||
|
}
|
||
|
}
|
||
|
ColorMaterial.m_LineMaterialMap = new Map();
|
||
|
exports.ColorMaterial = ColorMaterial;
|
||
|
//# sourceMappingURL=ColorPalette.js.map
|