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:
-rw-r--r--source/blender/draw/intern/draw_common.c7
-rw-r--r--source/blender/draw/intern/draw_common.h2
-rw-r--r--source/blender/draw/modes/object_mode.c14
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl5
4 files changed, 12 insertions, 16 deletions
diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c
index 9b969c23ba6..15a8675f55d 100644
--- a/source/blender/draw/intern/draw_common.c
+++ b/source/blender/draw/intern/draw_common.c
@@ -444,18 +444,18 @@ DRWShadingGroup *shgroup_instance(DRWPass *pass, struct GPUBatch *geom)
GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE);
DRW_shgroup_instance_format(g_formats.instance_sized, {
- {"color", DRW_ATTRIB_FLOAT, 3},
+ {"color", DRW_ATTRIB_FLOAT, 4},
{"size", DRW_ATTRIB_FLOAT, 1},
{"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16}
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_sized);
- DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f);
+ DRW_shgroup_state_disable(grp, DRW_STATE_BLEND);
return grp;
}
-DRWShadingGroup *shgroup_instance_alpha(DRWPass *pass, struct GPUBatch *geom, float alpha)
+DRWShadingGroup *shgroup_instance_alpha(DRWPass *pass, struct GPUBatch *geom)
{
GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE);
@@ -466,7 +466,6 @@ DRWShadingGroup *shgroup_instance_alpha(DRWPass *pass, struct GPUBatch *geom, fl
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_sized);
- DRW_shgroup_uniform_float_copy(grp, "alpha", alpha);
return grp;
}
diff --git a/source/blender/draw/intern/draw_common.h b/source/blender/draw/intern/draw_common.h
index ca4bf967236..b79902bf4e3 100644
--- a/source/blender/draw/intern/draw_common.h
+++ b/source/blender/draw/intern/draw_common.h
@@ -137,7 +137,7 @@ struct DRWShadingGroup *shgroup_instance_screen_aligned(struct DRWPass *pass, st
struct DRWShadingGroup *shgroup_instance_empty_axes(struct DRWPass *pass, struct GPUBatch *geom);
struct DRWShadingGroup *shgroup_instance_scaled(struct DRWPass *pass, struct GPUBatch *geom);
struct DRWShadingGroup *shgroup_instance(struct DRWPass *pass, struct GPUBatch *geom);
-struct DRWShadingGroup *shgroup_instance_alpha(struct DRWPass *pass, struct GPUBatch *geom, float alpha);
+struct DRWShadingGroup *shgroup_instance_alpha(struct DRWPass *pass, struct GPUBatch *geom);
struct DRWShadingGroup *shgroup_instance_outline(struct DRWPass *pass, struct GPUBatch *geom, int *baseid);
struct DRWShadingGroup *shgroup_camera_instance(struct DRWPass *pass, struct GPUBatch *geom);
struct DRWShadingGroup *shgroup_distance_lines_instance(struct DRWPass *pass, struct GPUBatch *geom);
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 69de0d72fb9..90468658764 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -1368,22 +1368,20 @@ static void OBJECT_cache_init(void *vedata)
/* Spot shapes */
state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND | DRW_STATE_CULL_FRONT;
sgl->spot_shapes = psl->spot_shapes[i] = DRW_pass_create("Spot Shape Pass", state);
- float cone_spot_alpha = 0.5f;
geom = DRW_cache_lamp_spot_volume_get();
- sgl->lamp_spot_volume = shgroup_instance_alpha(sgl->spot_shapes, geom, cone_spot_alpha);
+ sgl->lamp_spot_volume = shgroup_instance_alpha(sgl->spot_shapes, geom);
geom = DRW_cache_lamp_spot_square_volume_get();
- sgl->lamp_spot_volume_rect = shgroup_instance_alpha(sgl->spot_shapes, geom, cone_spot_alpha);
+ sgl->lamp_spot_volume_rect = shgroup_instance_alpha(sgl->spot_shapes, geom);
- cone_spot_alpha = 0.3f;
geom = DRW_cache_lamp_spot_volume_get();
- sgl->lamp_spot_volume_outside = shgroup_instance_alpha(sgl->spot_shapes, geom, cone_spot_alpha);
+ sgl->lamp_spot_volume_outside = shgroup_instance_alpha(sgl->spot_shapes, geom);
DRW_shgroup_state_disable(sgl->lamp_spot_volume_outside, DRW_STATE_CULL_FRONT);
DRW_shgroup_state_enable(sgl->lamp_spot_volume_outside, DRW_STATE_CULL_BACK);
geom = DRW_cache_lamp_spot_square_volume_get();
- sgl->lamp_spot_volume_rect_outside = shgroup_instance_alpha(sgl->spot_shapes, geom, cone_spot_alpha);
+ sgl->lamp_spot_volume_rect_outside = shgroup_instance_alpha(sgl->spot_shapes, geom);
DRW_shgroup_state_disable(sgl->lamp_spot_volume_rect_outside, DRW_STATE_CULL_FRONT);
DRW_shgroup_state_enable(sgl->lamp_spot_volume_rect_outside, DRW_STATE_CULL_BACK);
}
@@ -1524,8 +1522,8 @@ static void DRW_shgroup_lamp(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLayer
else if (la->type == LA_SPOT) {
float size[3], sizemat[4][4];
static float one = 1.0f;
- float cone_inside[3] = {0.0f, 0.0f, 0.0f};
- float cone_outside[3] = {1.0f, 1.0f, 1.0f};
+ float cone_inside[4] = {0.0f, 0.0f, 0.0f, 0.5f};
+ float cone_outside[4] = {1.0f, 1.0f, 1.0f, 0.3f};
float blend = 1.0f - pow2f(la->spotblend);
size[0] = size[1] = sinf(la->spotsize * 0.5f) * la->dist;
size[2] = cosf(la->spotsize * 0.5f) * la->dist;
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl
index 1ec158ae15c..0d0413fef94 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl
@@ -1,13 +1,12 @@
uniform mat4 ViewProjectionMatrix;
-uniform float alpha;
/* ---- Instantiated Attribs ---- */
in vec3 pos;
/* ---- Per instance Attribs ---- */
in mat4 InstanceModelMatrix;
-in vec3 color;
+in vec4 color;
#ifdef UNIFORM_SCALE
in float size;
#else
@@ -19,5 +18,5 @@ flat out vec4 finalColor;
void main()
{
gl_Position = ViewProjectionMatrix * InstanceModelMatrix * vec4(pos * size, 1.0);
- finalColor = vec4(color, alpha);
+ finalColor = color;
}