Smoke: fix for missing viewport color update.

Active color wasn't copied over if it differs from what the user plugged
in in the UI. Also use a darker color for the default color so smoke
doesn't doen't appear too bright.

Reported in IRC by mib2berlin.
This commit is contained in:
Kévin Dietrich 2016-01-10 11:37:34 +01:00
parent e9c8e0316f
commit f1e8204f5a
Notes: blender-bot 2023-02-14 08:42:54 +01:00
Referenced by issue #47697, Smoke simulation doesn't work in viewport
Referenced by issue #47164, [Scene.raycast] - True result when it should be False.
2 changed files with 4 additions and 2 deletions

View File

@ -2155,6 +2155,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sd
active_fields |= SM_ACTIVE_COLOR_SET;
}
else if (!equals_v3v3(sds->active_color, sfs->color)) {
copy_v3_v3(sds->active_color, sfs->color);
active_fields |= SM_ACTIVE_COLORS;
}
}
@ -2173,6 +2174,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sd
active_fields |= SM_ACTIVE_COLOR_SET;
}
else if (!equals_v3v3(sds->active_color, sds->flame_smoke_color)) {
copy_v3_v3(sds->active_color, sds->flame_smoke_color);
active_fields |= SM_ACTIVE_COLORS;
}
}

View File

@ -351,8 +351,8 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
GPU_shader_uniform_texture(shader, spec_location, tex_spec);
}
float active_color[4] = { 1.0, 1.0, 1.0, 10.0 };
if ((sds->active_fields & SM_ACTIVE_COLORS) == 0)
float active_color[4] = { 0.7, 0.7, 0.7, 10.0 };
if ((sds->active_fields & SM_ACTIVE_COLORS) != 0)
copy_v3_v3(active_color, sds->active_color);
GPU_shader_uniform_vector(shader, actcol_location, 4, 1, active_color);