Fix #32522: Object's diffuse color not showing in Sculpt Mode

It was missing since sculpting mask implementation.

Now object's color would be multiplied by sculpt mask value.

For VBOs it's done by storing final color in VertexBufferFormat and
mimic behavior of setMaterial callback for getting current diffuse
color.

For non-VBOs diffuse color is getting from current OpenGL context.
This commit is contained in:
2012-09-23 14:16:52 +00:00
parent fa2daf0dbd
commit 2637efa2a3
5 changed files with 102 additions and 33 deletions

View File

@@ -1440,6 +1440,21 @@ void GPU_disable_material(void)
GPU_set_material_alpha_blend(GPU_BLEND_SOLID);
}
void GPU_material_diffuse_get(int nr, float diff[4])
{
/* prevent index to use un-initialized array items */
if (nr >= GMS.totmat)
nr = 0;
/* no GPU_begin_object_materials, use default material */
if (!GMS.matbuf) {
mul_v3_v3fl(diff, &defmaterial.r, defmaterial.ref + defmaterial.emit);
}
else {
copy_v4_v4(diff, GMS.matbuf[nr].diff);
}
}
void GPU_end_object_materials(void)
{
GPU_disable_material();