[Bf-blender-cvs] [8ddf68b6a78] greasepencil-object: Fix rename missing in previous commit
Antonio Vazquez
noreply at git.blender.org
Mon Jun 4 17:25:46 CEST 2018
Commit: 8ddf68b6a783979efbaa0af17cf0aa5d4669a8f0
Author: Antonio Vazquez
Date: Mon Jun 4 17:25:17 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB8ddf68b6a783979efbaa0af17cf0aa5d4669a8f0
Fix rename missing in previous commit
These fields were not renamed in previous commit.
===================================================================
M source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M source/blender/draw/engines/gpencil/gpencil_engine.h
M source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
===================================================================
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 0b2fa2e05b3..b33fcf42564 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -276,11 +276,11 @@ static DRWShadingGroup *DRW_gpencil_shgroup_fill_create(
DRW_shgroup_uniform_vec2(grp, "texture_offset", gp_style->texture_offset, 1);
DRW_shgroup_uniform_float(grp, "texture_opacity", &gp_style->texture_opacity, 1);
- stl->shgroups[id].t_mix = gp_style->flag & GP_STYLE_COLOR_TEX_MIX ? 1 : 0;
- DRW_shgroup_uniform_int(grp, "t_mix", &stl->shgroups[id].t_mix, 1);
+ stl->shgroups[id].texture_mix = gp_style->flag & GP_STYLE_COLOR_TEX_MIX ? 1 : 0;
+ DRW_shgroup_uniform_int(grp, "texture_mix", &stl->shgroups[id].texture_mix, 1);
- stl->shgroups[id].t_flip = gp_style->flag & GP_STYLE_COLOR_FLIP_FILL ? 1 : 0;
- DRW_shgroup_uniform_int(grp, "t_flip", &stl->shgroups[id].t_flip, 1);
+ stl->shgroups[id].texture_flip = gp_style->flag & GP_STYLE_COLOR_FLIP_FILL ? 1 : 0;
+ DRW_shgroup_uniform_int(grp, "texture_flip", &stl->shgroups[id].texture_flip, 1);
DRW_shgroup_uniform_int(grp, "xraymode", (const int *) &gpd->xray_mode, 1);
/* image texture */
@@ -303,8 +303,8 @@ static DRWShadingGroup *DRW_gpencil_shgroup_fill_create(
GPUTexture *texture = GPU_texture_from_blender(gp_style->ima, &iuser, GL_TEXTURE_2D, true, 0.0, 0);
DRW_shgroup_uniform_texture(grp, "myTexture", texture);
- stl->shgroups[id].t_clamp = gp_style->flag & GP_STYLE_COLOR_TEX_CLAMP ? 1 : 0;
- DRW_shgroup_uniform_int(grp, "t_clamp", &stl->shgroups[id].t_clamp, 1);
+ stl->shgroups[id].texture_clamp = gp_style->flag & GP_STYLE_COLOR_TEX_CLAMP ? 1 : 0;
+ DRW_shgroup_uniform_int(grp, "t_clamp", &stl->shgroups[id].texture_clamp, 1);
BKE_image_release_ibuf(image, ibuf, NULL);
}
@@ -312,8 +312,8 @@ static DRWShadingGroup *DRW_gpencil_shgroup_fill_create(
else {
/* if no texture defined, need a blank texture to avoid errors in draw manager */
DRW_shgroup_uniform_texture(grp, "myTexture", e_data->gpencil_blank_texture);
- stl->shgroups[id].t_clamp = 0;
- DRW_shgroup_uniform_int(grp, "t_clamp", &stl->shgroups[id].t_clamp, 1);
+ stl->shgroups[id].texture_clamp = 0;
+ DRW_shgroup_uniform_int(grp, "texture_clamp", &stl->shgroups[id].texture_clamp, 1);
}
return grp;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 998cda1ef0a..c11fdd8cc8d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -75,9 +75,9 @@ typedef struct GPENCIL_shgroup {
int stroke_style;
int color_type;
int mode;
- int t_mix;
- int t_flip;
- int t_clamp;
+ int texture_mix;
+ int texture_flip;
+ int texture_clamp;
int fill_style;
int keep_size;
float obj_scale;
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
index d97d6b2c7eb..4e52d59dc4d 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
@@ -2,22 +2,22 @@ uniform vec4 color2;
uniform int fill_type;
uniform float mix_factor;
-uniform float g_angle;
-uniform float g_radius;
-uniform float g_boxsize;
-uniform vec2 g_scale;
-uniform vec2 g_shift;
+uniform float gradient_angle;
+uniform float gradient_radius;
+uniform float gradient_boxsize;
+uniform vec2 gradient_scale;
+uniform vec2 gradient_shift;
-uniform float t_angle;
-uniform vec2 t_scale;
-uniform vec2 t_offset;
-uniform int t_mix;
-uniform int t_flip;
-uniform float t_opacity;
+uniform float texture_angle;
+uniform vec2 texture_scale;
+uniform vec2 texture_offset;
+uniform int texture_mix;
+uniform int texture_flip;
+uniform float texture_opacity;
uniform int xraymode;
uniform sampler2D myTexture;
-uniform int t_clamp;
+uniform int texture_clamp;
/* keep this list synchronized with list in DNA_brush_types.h */
#define SOLID 0
@@ -71,50 +71,50 @@ void set_color(in vec4 color, in vec4 color2, in vec4 tcolor, in float mixv, in
void main()
{
vec2 t_center = vec2(0.5, 0.5);
- mat2 matrot_tex = mat2(cos(t_angle), -sin(t_angle), sin(t_angle), cos(t_angle));
- vec2 rot_tex = (matrot_tex * (texCoord_interp - t_center)) + t_center + t_offset;
+ mat2 matrot_tex = mat2(cos(texture_angle), -sin(texture_angle), sin(texture_angle), cos(texture_angle));
+ vec2 rot_tex = (matrot_tex * (texCoord_interp - t_center)) + t_center + texture_offset;
vec4 tmp_color;
- tmp_color = (t_clamp == 0) ? texture2D(myTexture, rot_tex * t_scale) : texture2D(myTexture, clamp(rot_tex * t_scale, 0.0, 1.0));
- vec4 text_color = vec4(tmp_color[0], tmp_color[1], tmp_color[2], tmp_color[3] * t_opacity);
+ tmp_color = (texture_clamp == 0) ? texture2D(myTexture, rot_tex * texture_scale) : texture2D(myTexture, clamp(rot_tex * texture_scale, 0.0, 1.0));
+ vec4 text_color = vec4(tmp_color[0], tmp_color[1], tmp_color[2], tmp_color[3] * texture_opacity);
vec4 chesscolor;
/* solid fill */
if (fill_type == SOLID) {
- fragColor = (t_mix == 1) ? mix(finalColor, text_color, mix_factor) : finalColor;
+ fragColor = (texture_mix == 1) ? mix(finalColor, text_color, mix_factor) : finalColor;
}
else {
- vec2 center = vec2(0.5, 0.5) + g_shift;
- mat2 matrot = mat2(cos(g_angle), -sin(g_angle), sin(g_angle), cos(g_angle));
- vec2 rot = (((matrot * (texCoord_interp - center)) + center) * g_scale) + g_shift;
+ vec2 center = vec2(0.5, 0.5) + gradient_shift;
+ mat2 matrot = mat2(cos(gradient_angle), -sin(gradient_angle), sin(gradient_angle), cos(gradient_angle));
+ vec2 rot = (((matrot * (texCoord_interp - center)) + center) * gradient_scale) + gradient_shift;
/* gradient */
if (fill_type == GRADIENT) {
- set_color(finalColor, color2, text_color, mix_factor, rot.x - mix_factor + 0.5, t_mix, t_flip, fragColor);
+ set_color(finalColor, color2, text_color, mix_factor, rot.x - mix_factor + 0.5, texture_mix, texture_flip, fragColor);
}
/* radial gradient */
if (fill_type == RADIAL) {
- float in_rad = g_radius * mix_factor;
- float ex_rad = g_radius - in_rad;
+ float in_rad = gradient_radius * mix_factor;
+ float ex_rad = gradient_radius - in_rad;
float intensity = 0;
- float distance = length((center - texCoord_interp) * g_scale);
- if (distance > g_radius) {
+ float distance = length((center - texCoord_interp) * gradient_scale);
+ if (distance > gradient_radius) {
discard;
}
if (distance > in_rad) {
intensity = clamp(((distance - in_rad) / ex_rad), 0.0, 1.0);
}
- set_color(finalColor, color2, text_color, mix_factor, intensity, t_mix, t_flip, fragColor);
+ set_color(finalColor, color2, text_color, mix_factor, intensity, texture_mix, texture_flip, fragColor);
}
/* chessboard */
if (fill_type == CHESS) {
- vec2 pos = rot / g_boxsize;
+ vec2 pos = rot / gradient_boxsize;
if ((fract(pos.x) < 0.5 && fract(pos.y) < 0.5) || (fract(pos.x) > 0.5 && fract(pos.y) > 0.5)) {
- chesscolor = (t_flip == 0) ? finalColor : color2;
+ chesscolor = (texture_flip == 0) ? finalColor : color2;
}
else {
- chesscolor = (t_flip == 0) ? color2 : finalColor;
+ chesscolor = (texture_flip == 0) ? color2 : finalColor;
}
/* mix with texture */
- fragColor = (t_mix == 1) ? mix(chesscolor, text_color, mix_factor) : chesscolor;
+ fragColor = (texture_mix == 1) ? mix(chesscolor, text_color, mix_factor) : chesscolor;
}
/* texture */
if (fill_type == TEXTURE) {
More information about the Bf-blender-cvs
mailing list