2017-07-19 14:20:32 -07:00
|
|
|
#pragma once
|
2013-08-09 04:57:18 +00:00
|
|
|
|
2015-05-04 00:51:41 +00:00
|
|
|
#include "lc_math.h"
|
2013-08-09 04:57:18 +00:00
|
|
|
|
|
|
|
#define LC_MAX_COLOR_NAME 64
|
|
|
|
#define LC_COLOR_DIRECT 0x80000000
|
2021-01-31 17:32:38 -08:00
|
|
|
#define LC_COLOR_NOCOLOR 0xffffffff
|
2023-04-17 18:37:56 +02:00
|
|
|
#define LC_STUD_CYLINDER_COLOR_CODE 4242
|
2013-08-09 04:57:18 +00:00
|
|
|
|
|
|
|
struct lcColor
|
|
|
|
{
|
2017-12-02 12:22:04 -08:00
|
|
|
quint32 Code;
|
2021-01-23 10:16:44 -08:00
|
|
|
int Group;
|
2021-02-07 10:14:54 -08:00
|
|
|
bool Translucent = false;
|
2023-08-10 06:22:52 +02:00
|
|
|
bool Chrome = false;
|
|
|
|
bool Rubber = false;
|
2021-02-07 10:14:54 -08:00
|
|
|
bool Adjusted = false;
|
2015-05-04 00:51:41 +00:00
|
|
|
lcVector4 Value;
|
|
|
|
lcVector4 Edge;
|
2013-08-09 04:57:18 +00:00
|
|
|
char Name[LC_MAX_COLOR_NAME];
|
|
|
|
char SafeName[LC_MAX_COLOR_NAME];
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
LC_COLORGROUP_SOLID,
|
|
|
|
LC_COLORGROUP_TRANSLUCENT,
|
|
|
|
LC_COLORGROUP_SPECIAL,
|
|
|
|
LC_NUM_COLORGROUPS
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lcColorGroup
|
|
|
|
{
|
2019-07-04 17:06:26 -07:00
|
|
|
std::vector<int> Colors;
|
2015-11-30 19:32:33 +00:00
|
|
|
QString Name;
|
2013-08-09 04:57:18 +00:00
|
|
|
};
|
|
|
|
|
2019-07-04 17:06:26 -07:00
|
|
|
extern std::vector<lcColor> gColorList;
|
2013-08-09 04:57:18 +00:00
|
|
|
extern lcColorGroup gColorGroups[LC_NUM_COLORGROUPS];
|
|
|
|
extern int gEdgeColor;
|
|
|
|
extern int gDefaultColor;
|
|
|
|
|
2021-01-22 14:16:28 -08:00
|
|
|
void lcLoadDefaultColors(lcStudStyle StudStyle);
|
|
|
|
bool lcLoadColorFile(lcFile& File, lcStudStyle StudStyle);
|
2017-12-02 12:22:04 -08:00
|
|
|
int lcGetColorIndex(quint32 ColorCode);
|
2013-08-09 04:57:18 +00:00
|
|
|
|
2021-11-17 19:06:18 -08:00
|
|
|
inline quint32 lcGetColorCodeFromExtendedColor(int Color)
|
2013-08-09 04:57:18 +00:00
|
|
|
{
|
2021-02-03 14:24:22 -08:00
|
|
|
const quint32 ConversionTable[] = { 4, 12, 2, 10, 1, 9, 14, 15, 8, 0, 6, 13, 13, 334, 36, 44, 34, 42, 33, 41, 46, 47, 7, 382, 6, 13, 11, 383 };
|
|
|
|
return ConversionTable[Color];
|
2013-08-09 04:57:18 +00:00
|
|
|
}
|
|
|
|
|
2021-11-17 19:06:18 -08:00
|
|
|
inline quint32 lcGetColorCodeFromOriginalColor(int Color)
|
2013-08-09 04:57:18 +00:00
|
|
|
{
|
2021-02-03 14:24:22 -08:00
|
|
|
const quint32 ConversionTable[] = { 0, 2, 4, 9, 7, 6, 22, 8, 10, 11, 14, 16, 18, 9, 21, 20, 22, 8, 10, 11 };
|
|
|
|
return lcGetColorCodeFromExtendedColor(ConversionTable[Color]);
|
2013-08-09 04:57:18 +00:00
|
|
|
}
|
|
|
|
|
2017-12-02 12:22:04 -08:00
|
|
|
inline quint32 lcGetColorCode(int ColorIndex)
|
2013-08-09 04:57:18 +00:00
|
|
|
{
|
|
|
|
return gColorList[ColorIndex].Code;
|
|
|
|
}
|
|
|
|
|
2019-07-09 08:47:15 -07:00
|
|
|
inline bool lcIsColorTranslucent(size_t ColorIndex)
|
2013-08-09 04:57:18 +00:00
|
|
|
{
|
|
|
|
return gColorList[ColorIndex].Translucent;
|
|
|
|
}
|
2023-08-10 06:22:52 +02:00
|
|
|
|
|
|
|
inline bool lcIsColorChrome(size_t ColorIndex)
|
|
|
|
{
|
|
|
|
return gColorList[ColorIndex].Chrome;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool lcIsColorRubber(size_t ColorIndex)
|
|
|
|
{
|
|
|
|
return gColorList[ColorIndex].Rubber;
|
|
|
|
}
|