DRW: Add DRW_STATE_WIRE_SMOOTH to draw smooth wires.

This is only useful if depth test/wire is disabled.
This commit is contained in:
2018-05-06 18:23:53 +02:00
parent c472936074
commit 2bc0c4ec59
2 changed files with 8 additions and 3 deletions

View File

@@ -272,6 +272,7 @@ typedef enum {
DRW_STATE_CLIP_PLANES = (1 << 18),
DRW_STATE_ADDITIVE_FULL = (1 << 19), /* Same as DRW_STATE_ADDITIVE but let alpha accumulate without premult. */
DRW_STATE_BLEND_PREMUL = (1 << 20), /* Use that if color is already premult by alpha. */
DRW_STATE_WIRE_SMOOTH = (1 << 21),
DRW_STATE_WRITE_STENCIL = (1 << 27),
DRW_STATE_WRITE_STENCIL_SHADOW = (1 << 28),

View File

@@ -162,12 +162,16 @@ void drw_state_set(DRWState state)
/* Wire Width */
{
if (CHANGED_ANY(DRW_STATE_WIRE)) {
if ((state & DRW_STATE_WIRE) != 0) {
if (CHANGED_ANY(DRW_STATE_WIRE | DRW_STATE_WIRE_SMOOTH)) {
if ((state & DRW_STATE_WIRE_SMOOTH) != 0) {
glLineWidth(2.0f);
glEnable(GL_LINE_SMOOTH);
}
else if ((state & DRW_STATE_WIRE) != 0) {
glLineWidth(1.0f);
}
else {
/* do nothing */
glDisable(GL_LINE_SMOOTH);
}
}
}