src/gl/compiler.cpp

changeset 376
3cef3b016330
parent 374
75efc3ba5a56
equal deleted inserted replaced
375:21a5ecbe34e4 376:3cef3b016330
234 } 234 }
235 } 235 }
236 236
237 static QColor getColorForPolygon( 237 static QColor getColorForPolygon(
238 const PolygonElement& polygon, 238 const PolygonElement& polygon,
239 const gl::RenderPreferences& preferences, 239 const gl::build_preferences* preferences,
240 const ColorTable& colorTable) 240 const ColorTable& colorTable)
241 { 241 {
242 QColor color; 242 QColor color;
243 // For normal colors, use the polygon's color. 243 // For normal colors, use the polygon's color.
244 if (polygon.color == MAIN_COLOR) 244 if (polygon.color == MAIN_COLOR)
245 { 245 {
246 color = preferences.mainColor; 246 color = preferences->mainColor;
247 } 247 }
248 else if (polygon.color == EDGE_COLOR) 248 else if (polygon.color == EDGE_COLOR)
249 { 249 {
250 // Edge color is black, unless we have a dark background, in which case lines need to be bright. 250 // Edge color is black, unless we have a dark background, in which case lines need to be bright.
251 color = luma(preferences.backgroundColor) > (40.0 / 256.0) ? Qt::black : Qt::white; 251 color = luma(preferences->backgroundColor) > (40.0 / 256.0) ? Qt::black : Qt::white;
252 } 252 }
253 else 253 else
254 { 254 {
255 // Not main or edge color, use the polygon's color as is. 255 // Not main or edge color, use the polygon's color as is.
256 color = colorFace(polygon.color, colorTable).value_or(Qt::black); 256 color = colorFace(polygon.color, colorTable).value_or(Qt::black);
279 void gl::build( 279 void gl::build(
280 gl::ModelShaders* shaders, 280 gl::ModelShaders* shaders,
281 QTextDocument* model, 281 QTextDocument* model,
282 const ColorTable& colorTable, 282 const ColorTable& colorTable,
283 DocumentManager* context, 283 DocumentManager* context,
284 const gl::RenderPreferences& preferences) 284 const gl::build_preferences* preferences)
285 { 285 {
286 for (gl::ModelShaders::ShaderObject& shader : shaders->shaderObjects) { 286 for (gl::ModelShaders::ShaderObject& shader : shaders->shaderObjects) {
287 shader.cachedData.clear(); 287 shader.cachedData.clear();
288 } 288 }
289 iterateModelPolygons(model, context, [&](const WithId<PolygonElement>& polygon) 289 iterateModelPolygons(model, context, [&](const WithId<PolygonElement>& polygon)

mercurial