mirror of
https://github.com/leozide/leocad
synced 2025-01-28 19:58:12 +01:00
Removed old color names.
This commit is contained in:
parent
29c58ca1c3
commit
b75053750d
7 changed files with 23 additions and 28 deletions
|
@ -9,20 +9,6 @@
|
|||
Messenger* messenger;
|
||||
MainWnd* main_window;
|
||||
|
||||
const char* colornames[LC_MAXCOLORS] = { "Red", "Orange", "Green",
|
||||
"Light Green", "Blue", "Light Blue", "Yellow", "White",
|
||||
"Dark Gray", "Black", "Brown", "Pink", "Purple", "Gold",
|
||||
"Clear Red", "Clear Orange", "Clear Green", "Clear Light Green",
|
||||
"Clear Blue", "Clear Light Blue", "Clear Yellow", "Clear White",
|
||||
"Light Gray", "Tan", "Light Brown", "Light Pink", "Turquoise", "Silver" };
|
||||
|
||||
const char* altcolornames[LC_MAXCOLORS] = { "Red", "Orange", "Green",
|
||||
"LightGreen", "Blue", "LightBlue", "Yellow", "White",
|
||||
"DarkGray", "Black", "Brown", "Pink", "Purple", "Gold",
|
||||
"ClearRed", "ClearOrange", "ClearGreen", "ClearLightGreen",
|
||||
"ClearBlue", "ClearLightBlue", "ClearYellow", "ClearWhite",
|
||||
"LightGray", "Tan", "LightBrown", "LightPink", "Turquoise", "Silver" };
|
||||
|
||||
unsigned char FlatColorArray[31][3] = {
|
||||
{ 166, 25, 25 }, // 0 - Red
|
||||
{ 255, 127, 51 }, // 1 - Orange
|
||||
|
|
|
@ -12,7 +12,5 @@ extern MainWnd* main_window;
|
|||
|
||||
extern unsigned char FlatColorArray[31][3];
|
||||
extern unsigned char ColorArray[31][4];
|
||||
extern const char* colornames[LC_MAXCOLORS];
|
||||
extern const char* altcolornames[LC_MAXCOLORS];
|
||||
|
||||
#endif // _GLOBALS_H_
|
||||
|
|
|
@ -209,6 +209,7 @@ static void LoadColorFile(lcFile& File)
|
|||
MainColor.Edge[2] = 0.2f;
|
||||
MainColor.Edge[3] = 1.0f;
|
||||
strcpy(MainColor.Name, "Main Color");
|
||||
strcpy(MainColor.SafeName, "Main_Color");
|
||||
|
||||
EdgeColor.Code = 24;
|
||||
EdgeColor.Translucent = false;
|
||||
|
@ -221,6 +222,7 @@ static void LoadColorFile(lcFile& File)
|
|||
EdgeColor.Edge[2] = 0.2f;
|
||||
EdgeColor.Edge[3] = 1.0f;
|
||||
strcpy(EdgeColor.Name, "Edge Color");
|
||||
strcpy(EdgeColor.SafeName, "Edge_Color");
|
||||
|
||||
while (File.ReadLine(Line, sizeof(Line)))
|
||||
{
|
||||
|
@ -249,6 +251,7 @@ static void LoadColorFile(lcFile& File)
|
|||
GetToken(Ptr, Token);
|
||||
strncpy(Color.Name, Token, sizeof(Color.Name));
|
||||
Color.Name[LC_MAX_COLOR_NAME - 1] = 0;
|
||||
strncpy(Color.SafeName, Color.Name, sizeof(Color.SafeName));
|
||||
|
||||
for (char* Ptr = strchr((char*)Color.Name, '_'); Ptr; Ptr = strchr(Ptr, '_'))
|
||||
*Ptr = ' ';
|
||||
|
@ -381,7 +384,8 @@ int lcGetColorIndex(lcuint32 ColorCode)
|
|||
Color.Edge[1] = 0.2f;
|
||||
Color.Edge[2] = 0.2f;
|
||||
Color.Edge[3] = 1.0f;
|
||||
sprintf(Color.Name, "Color %06x", ColorCode & 0xffffff);
|
||||
sprintf(Color.Name, "Color %06X", ColorCode & 0xffffff);
|
||||
sprintf(Color.SafeName, "Color_%06X", ColorCode & 0xffffff);
|
||||
|
||||
gColorList.Add(Color);
|
||||
return gColorList.GetSize() - 1;
|
||||
|
|
|
@ -14,6 +14,7 @@ struct lcColor
|
|||
float Value[4];
|
||||
float Edge[4];
|
||||
char Name[LC_MAX_COLOR_NAME];
|
||||
char SafeName[LC_MAX_COLOR_NAME];
|
||||
};
|
||||
|
||||
extern ObjArray<lcColor> gColorList;
|
||||
|
|
|
@ -375,9 +375,9 @@ void lcMesh::ExportWavefrontIndices(lcFile& File, int DefaultColorIndex, int Ver
|
|||
IndexType* Indices = (IndexType*)mIndexBuffer.mData + Section->IndexOffset / sizeof(IndexType);
|
||||
|
||||
if (Section->ColorIndex == gDefaultColor)
|
||||
sprintf(Line, "usemtl %s\n", altcolornames[DefaultColorIndex]);
|
||||
sprintf(Line, "usemtl %s\n", gColorList[DefaultColorIndex].SafeName);
|
||||
else
|
||||
sprintf(Line, "usemtl %s\n", altcolornames[Section->ColorIndex]);
|
||||
sprintf(Line, "usemtl %s\n", gColorList[Section->ColorIndex].SafeName);
|
||||
File.WriteLine(Line);
|
||||
|
||||
for (int Idx = 0; Idx < Section->NumIndices; Idx += 3)
|
||||
|
|
|
@ -3190,7 +3190,7 @@ void Project::CreateHTMLPieceList(FILE* f, int nStep, bool bImages, const char*
|
|||
{
|
||||
col[c] = ID;
|
||||
ID++;
|
||||
fprintf(f, "<td><center>%s</center></td>\n", colornames[c]);
|
||||
fprintf(f, "<td><center>%s</center></td>\n", gColorList[c].Name);
|
||||
}
|
||||
ID++;
|
||||
fputs("</tr>\n",f);
|
||||
|
@ -3953,23 +3953,25 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
|
|||
POVFile.WriteLine("#include \"colors.inc\"\n\n");
|
||||
|
||||
// Add color definitions.
|
||||
for (int ColorIdx = 0; ColorIdx < LC_MAXCOLORS; ColorIdx++)
|
||||
for (int ColorIdx = 0; ColorIdx < gColorList.GetSize(); ColorIdx++)
|
||||
{
|
||||
if (ColorIdx > 13 && ColorIdx < 22)
|
||||
lcColor* Color = &gColorList[ColorIdx];
|
||||
|
||||
if (lcIsColorTranslucent(ColorIdx))
|
||||
{
|
||||
sprintf(Line, "#declare lc_%s = texture { pigment { rgb <%d/255, %d/255, %d/255> filter 0.9 } finish { ambient 0.3 diffuse 0.2 reflection 0.25 phong 0.3 phong_size 60 } }\n",
|
||||
altcolornames[ColorIdx], ColorArray[ColorIdx][0], ColorArray[ColorIdx][1], ColorArray[ColorIdx][2]);
|
||||
Color->SafeName, Color->Value[0], Color->Value[1], Color->Value[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(Line, "#declare lc_%s = texture { pigment { rgb <%d/255, %d/255, %d/255> } finish { ambient 0.1 phong 0.2 phong_size 20 } }\n",
|
||||
altcolornames[ColorIdx], ColorArray[ColorIdx][0], ColorArray[ColorIdx][1], ColorArray[ColorIdx][2]);
|
||||
Color->SafeName, Color->Value[0], Color->Value[1], Color->Value[2]);
|
||||
}
|
||||
|
||||
POVFile.WriteLine(Line);
|
||||
|
||||
if (!ColorTable[ColorIdx][0])
|
||||
sprintf(ColorTable[ColorIdx], "lc_%s", altcolornames[ColorIdx]);
|
||||
sprintf(ColorTable[ColorIdx], "lc_%s", Color->SafeName);
|
||||
}
|
||||
|
||||
POVFile.WriteLine("\n");
|
||||
|
@ -4157,8 +4159,11 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
|
|||
|
||||
FILE* mat = fopen(buf, "wt");
|
||||
fputs("# Colors used by LeoCAD\n# You need to add transparency values\n#\n\n", mat);
|
||||
for (int i = 0; i < LC_MAXCOLORS; i++)
|
||||
fprintf(mat, "newmtl %s\nKd %.2f %.2f %.2f\n\n", altcolornames[i], (float)FlatColorArray[i][0]/255, (float)FlatColorArray[i][1]/255, (float)FlatColorArray[i][2]/255);
|
||||
for (int ColorIdx = 0; ColorIdx < gColorList.GetSize(); ColorIdx++)
|
||||
{
|
||||
lcColor* Color = &gColorList[ColorIdx];
|
||||
fprintf(mat, "newmtl %s\nKd %.2f %.2f %.2f\n\n", Color->SafeName, Color->Value[0], Color->Value[1], Color->Value[2]);
|
||||
}
|
||||
fclose(mat);
|
||||
|
||||
for (pPiece = m_pPieces; pPiece; pPiece = pPiece->m_pNext)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "lc_global.h"
|
||||
#include "lc_colors.h"
|
||||
#include "propertiesgridctrl.h"
|
||||
#include "globals.h"
|
||||
|
||||
|
@ -172,7 +173,7 @@ CString CLeoCADMFCPropertyGridColorProperty::FormatProperty()
|
|||
{
|
||||
ASSERT_VALID(this);
|
||||
|
||||
return colornames[m_Color];
|
||||
return gColorList[m_Color].Name;
|
||||
}
|
||||
|
||||
void CLeoCADMFCPropertyGridColorProperty::SetColor(int color, bool original)
|
||||
|
|
Loading…
Add table
Reference in a new issue