CADViewComponent/dist/ColorPalette.js

43 lines
1.6 KiB
JavaScript
Raw Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var three_1 = require("three");
var 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],
];
//颜色材质,对于二维图像来说可能有用,应该不对三维对象使用该材质
var ColorMaterial = /** @class */ (function () {
function ColorMaterial() {
}
ColorMaterial.GetLineMaterial = function (index) {
if (this.m_LineMaterialMap.has(index))
return this.m_LineMaterialMap.get(index);
var mat = new three_1.LineBasicMaterial({ color: this.GetColor(index) });
this.m_LineMaterialMap.set(index, mat);
return mat;
};
ColorMaterial.GetBasicMaterial = function (index) {
if (this.m_BasicMaterialMap.has(index))
return this.m_BasicMaterialMap.get(index);
var mat = new three_1.MeshBasicMaterial({ color: this.GetColor(index) });
this.m_BasicMaterialMap.set(index, mat);
return mat;
};
ColorMaterial.GetColor = function (index) {
var rgb = ColorPalette[index];
if (rgb)
return new three_1.Color(rgb[0] / 255, rgb[1] / 255, rgb[2] / 255);
};
ColorMaterial.m_LineMaterialMap = new Map();
ColorMaterial.m_BasicMaterialMap = new Map();
return ColorMaterial;
}());
exports.ColorMaterial = ColorMaterial;
//# sourceMappingURL=ColorPalette.js.map