gldraw.cpp

changeset 67
d523a370a17a
parent 66
12aca5d5a51e
child 68
c637b172d565
equal deleted inserted replaced
66:12aca5d5a51e 67:d523a370a17a
82 ((double)col.green()) / 255.0f, 82 ((double)col.green()) / 255.0f,
83 ((double)col.blue()) / 255.0f, 83 ((double)col.blue()) / 255.0f,
84 1.0f); 84 1.0f);
85 } 85 }
86 86
87 static vector<short> g_daWarnedColors;
87 void renderer::setObjectColor (LDObject* obj, bool bBackSide) { 88 void renderer::setObjectColor (LDObject* obj, bool bBackSide) {
89 if (obj->dColor == -1)
90 return;
91
88 if (gl_colorbfc && 92 if (gl_colorbfc &&
89 obj->getType () != OBJ_Line && 93 obj->getType () != OBJ_Line &&
90 obj->getType () != OBJ_CondLine) 94 obj->getType () != OBJ_CondLine)
91 { 95 {
92 if (bBackSide) 96 if (bBackSide)
98 102
99 if (obj->dColor == dMainColor) 103 if (obj->dColor == dMainColor)
100 setColor (gl_maincolor, glColor4f); 104 setColor (gl_maincolor, glColor4f);
101 else { 105 else {
102 color* col = g_LDColors[obj->dColor]; 106 color* col = g_LDColors[obj->dColor];
107
108 if (!col) {
109 // Warn about unknown colors, but only once.
110 for (long i = 0; i < g_daWarnedColors.size(); ++i)
111 if (g_daWarnedColors[i] == obj->dColor)
112 return;
113
114 printf ("%s: Unknown color %d!\n", __func__, obj->dColor);
115 g_daWarnedColors.push_back (obj->dColor);
116
117 // Set the main color to make the object at least not appear
118 // pitch-black.
119 setColor (gl_maincolor, glColor4f);
120 return;
121 }
122
103 QColor qCol (col->zColor.chars()); 123 QColor qCol (col->zColor.chars());
104 124
105 if (qCol.isValid ()) 125 if (qCol.isValid ())
106 glColor4f ( 126 glColor4f (
107 ((double)qCol.red()) / 255.0f, 127 ((double)qCol.red()) / 255.0f,

mercurial