src/GLCompiler.cc

changeset 702
8e3058cb9281
parent 701
25b7b4aa9916
child 703
ce2a76cebdbb
equal deleted inserted replaced
701:25b7b4aa9916 702:8e3058cb9281
44 } 44 }
45 45
46 #define DEBUG_PRINT(...) fprint (stdout, __VA_ARGS__) 46 #define DEBUG_PRINT(...) fprint (stdout, __VA_ARGS__)
47 47
48 extern_cfg (Bool, gl_blackedges); 48 extern_cfg (Bool, gl_blackedges);
49 extern_cfg (String, gl_bgcolor);
49 static QList<short> g_warnedColors; 50 static QList<short> g_warnedColors;
50 static const QColor g_BFCFrontColor (40, 192, 40); 51 static const QColor g_BFCFrontColor (40, 192, 40);
51 static const QColor g_BFCBackColor (224, 40, 40); 52 static const QColor g_BFCBackColor (224, 40, 40);
52 53
53 // ============================================================================= 54 // =============================================================================
125 QColor GLCompiler::polygonColor (LDPolygon& poly, LDObject* topobj) const 126 QColor GLCompiler::polygonColor (LDPolygon& poly, LDObject* topobj) const
126 { 127 {
127 QColor qcol; 128 QColor qcol;
128 129
129 if (poly.color == maincolor) 130 if (poly.color == maincolor)
130 qcol = GLRenderer::getMainColor(); 131 {
132 if (topobj->color() == maincolor)
133 qcol = GLRenderer::getMainColor();
134 else
135 qcol = getColor (topobj->color())->faceColor;
136 }
137 elif (poly.color == edgecolor)
138 {
139 qcol = luma (QColor (gl_bgcolor)) > 40 ? Qt::black : Qt::white;
140 }
131 else 141 else
132 { 142 {
133 LDColor* col = getColor (poly.color); 143 LDColor* col = getColor (poly.color);
134 144
135 if (col) 145 if (col)
136 qcol = col->faceColor; 146 qcol = col->faceColor;
137 }
138
139 if (poly.color == edgecolor)
140 {
141 qcol = QColor (32, 32, 32); // luma (m_bgcolor) < 40 ? QColor (64, 64, 64) : Qt::black;
142
143 /*
144 if (!gl_blackedges && poly.obj->getParent() && (col = getColor (poly.obj->getParent()->getColor())))
145 qcol = col->edgeColor;
146 */
147 } 147 }
148 148
149 if (qcol.isValid() == false) 149 if (qcol.isValid() == false)
150 { 150 {
151 // The color was unknown. Use main color to make the poly.object at least 151 // The color was unknown. Use main color to make the poly.object at least

mercurial