Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-04-19 15:13:53 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-04-19 15:13:53 +0300
commitfb2330c1e0415cc8cf6fe8c0e7dd0e2712721c71 (patch)
tree3caf00875cfa46f33ec58a9dded61c3c2add4fc8 /source/blender/editors/sculpt_paint/paint_cursor.c
parent4b376dbe84b205ef661ebf608c0322432fff1287 (diff)
Use model view matrix instead of texture matrix for texture brush overlay
It is required for our new matrix stack to only have projection and model view matrix modes. This commit ports paint cursor overlay to model view matrix.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_cursor.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 4ea85b465e7..e8e376b8a69 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -605,21 +605,20 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
glDepthMask(GL_FALSE);
glDepthFunc(GL_ALWAYS);
- glMatrixMode(GL_TEXTURE);
- glPushMatrix(); /* TEXTURE */
- glLoadIdentity(); /* TEXTURE */
-
if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) {
+ gpuPushMatrix();
+
/* brush rotation */
- glTranslatef(0.5, 0.5, 0); /* TEXTURE */
- glRotatef(RAD2DEGF(primary ? ups->brush_rotation : ups->brush_rotation_sec), 0, 0, 1); /* TEXTURE */
- glTranslatef(-0.5f, -0.5f, 0); /* TEXTURE */
+ gpuTranslate2f(x, y);
+ gpuRotate2D(-RAD2DEGF(primary ? ups->brush_rotation : ups->brush_rotation_sec));
+ gpuTranslate2f(-x, -y);
/* scale based on tablet pressure */
if (primary && ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush)) {
- glTranslatef(0.5f, 0.5f, 0); /* TEXTURE */
- glScalef(1.0f / ups->size_pressure_value, 1.0f / ups->size_pressure_value, 1.0f / ups->size_pressure_value); /* TEXTURE */
- glTranslatef(-0.5f, -0.5f, 0); /* TEXTURE */
+ const float scale = ups->size_pressure_value;
+ gpuTranslate2f(x, y);
+ gpuScale2f(scale, scale);
+ gpuTranslate2f(-x, -y);
}
if (ups->draw_anchored) {
@@ -657,14 +656,12 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
quad.xmax = brush->mask_stencil_dimension[0];
quad.ymax = brush->mask_stencil_dimension[1];
}
- glMatrixMode(GL_MODELVIEW);
gpuPushMatrix();
if (primary)
gpuTranslate2fv(brush->stencil_pos);
else
gpuTranslate2fv(brush->mask_stencil_pos);
gpuRotate2D(RAD2DEGF(mtex->rot));
- glMatrixMode(GL_TEXTURE);
}
/* set quad color. Colored overlay does not get blending */
@@ -697,10 +694,7 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
immUnbindProgram();
- glPopMatrix(); /* TEXTURE */
- glMatrixMode(GL_MODELVIEW);
-
- if (mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL) {
+ if (ELEM(mtex->brush_map_mode, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_VIEW)) {
gpuPopMatrix();
}
}