2012-03-24 00:24:58 +01:00
|
|
|
#ifndef _LC_COLORS_H_
|
|
|
|
#define _LC_COLORS_H_
|
|
|
|
|
2012-04-12 01:32:38 +02:00
|
|
|
#include "opengl.h"
|
2012-04-18 02:03:28 +02:00
|
|
|
#include "array.h"
|
2012-04-12 01:32:38 +02:00
|
|
|
|
2012-03-24 00:24:58 +01:00
|
|
|
#define LC_MAX_COLOR_NAME 64
|
2012-04-18 02:03:28 +02:00
|
|
|
#define LC_COLOR_DIRECT 0x80000000
|
2012-03-24 00:24:58 +01:00
|
|
|
|
|
|
|
struct lcColor
|
|
|
|
{
|
|
|
|
lcuint32 Code;
|
|
|
|
bool Translucent;
|
|
|
|
float Value[4];
|
|
|
|
float Edge[4];
|
|
|
|
char Name[LC_MAX_COLOR_NAME];
|
2012-04-19 03:11:24 +02:00
|
|
|
char SafeName[LC_MAX_COLOR_NAME];
|
2012-03-24 00:24:58 +01:00
|
|
|
};
|
|
|
|
|
2012-04-29 22:00:16 +02:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
LC_COLORGROUP_SOLID,
|
|
|
|
LC_COLORGROUP_TRANSLUCENT,
|
|
|
|
LC_COLORGROUP_SPECIAL,
|
|
|
|
LC_NUM_COLORGROUPS
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lcColorGroup
|
|
|
|
{
|
|
|
|
ObjArray<int> Colors;
|
|
|
|
char Name[LC_MAX_COLOR_NAME];
|
|
|
|
};
|
|
|
|
|
2012-04-18 02:03:28 +02:00
|
|
|
extern ObjArray<lcColor> gColorList;
|
2012-04-29 22:00:16 +02:00
|
|
|
extern lcColorGroup gColorGroups[LC_NUM_COLORGROUPS];
|
2012-04-18 02:03:28 +02:00
|
|
|
extern int gNumUserColors;
|
|
|
|
extern int gEdgeColor;
|
|
|
|
extern int gDefaultColor;
|
2012-03-24 00:24:58 +01:00
|
|
|
|
2012-04-18 02:03:28 +02:00
|
|
|
void lcLoadDefaultColors();
|
2012-10-04 00:38:33 +02:00
|
|
|
bool lcLoadColorFile(lcFile& File);
|
2012-03-28 03:07:18 +02:00
|
|
|
int lcGetColorIndex(lcuint32 ColorCode);
|
2013-01-25 00:54:10 +01:00
|
|
|
int lcGetBrickLinkColor(int ColorIndex);
|
2012-04-18 02:03:28 +02:00
|
|
|
|
2012-04-21 03:30:02 +02:00
|
|
|
inline lcuint32 lcGetColorCodeFromExtendedColor(int Color)
|
|
|
|
{
|
|
|
|
const int ConverstionTable[] = { 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 ConverstionTable[Color];
|
|
|
|
}
|
|
|
|
|
|
|
|
inline lcuint32 lcGetColorCodeFromOriginalColor(int Color)
|
|
|
|
{
|
|
|
|
const int ConverstionTable[] = { 0, 2, 4, 9, 7, 6, 22, 8, 10, 11, 14, 16, 18, 9, 21, 20, 22, 8, 10, 11 };
|
|
|
|
return lcGetColorCodeFromExtendedColor(ConverstionTable[Color]);
|
|
|
|
}
|
|
|
|
|
2012-04-18 02:03:28 +02:00
|
|
|
inline lcuint32 lcGetColorCode(int ColorIndex)
|
|
|
|
{
|
|
|
|
return gColorList[ColorIndex].Code;
|
|
|
|
}
|
2012-03-28 03:07:18 +02:00
|
|
|
|
|
|
|
inline bool lcIsColorTranslucent(int ColorIndex)
|
|
|
|
{
|
2012-04-18 02:03:28 +02:00
|
|
|
return gColorList[ColorIndex].Translucent;
|
2012-03-28 03:07:18 +02:00
|
|
|
}
|
|
|
|
|
2012-03-25 01:47:53 +01:00
|
|
|
inline void lcSetColor(int ColorIndex)
|
|
|
|
{
|
2012-04-18 02:03:28 +02:00
|
|
|
glColor4fv(gColorList[ColorIndex].Value);
|
2012-04-14 01:41:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void lcSetEdgeColor(int ColorIndex)
|
|
|
|
{
|
2012-04-18 02:03:28 +02:00
|
|
|
glColor4fv(gColorList[ColorIndex].Edge);
|
2012-03-25 01:47:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void lcSetColorFocused()
|
|
|
|
{
|
|
|
|
glColor4f(0.4000f, 0.2980f, 0.8980f, 1.0000f);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void lcSetColorSelected()
|
|
|
|
{
|
|
|
|
glColor4f(0.8980f, 0.2980f, 0.4000f, 1.0000f);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void lcSetColorCamera()
|
|
|
|
{
|
|
|
|
glColor4f(0.5f, 0.8f, 0.5f, 1.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void lcSetColorLight()
|
|
|
|
{
|
|
|
|
glColor4f(0.5f, 0.8f, 0.5f, 1.0f);
|
|
|
|
}
|
|
|
|
|
2012-03-24 00:24:58 +01:00
|
|
|
#endif // _LC_COLORS_H_
|