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:
authorJacques Lucke <jacques@blender.org>2020-10-20 12:00:16 +0300
committerJacques Lucke <jacques@blender.org>2020-10-20 12:00:16 +0300
commit63a9f24b55d0b5d84d625bdbb44d498fb1f2ae01 (patch)
tree217fa45ec9b0c66f856dd8b32d8ab3d5cbc18d3d /source/blender/draw/intern/draw_cache_impl_volume.c
parentf3ecb4c91e159caff2e6d335adb1ccf06423c90f (diff)
Volumes: simplify volumes in modifiers or on load
This changes how the simplify volumes setting works. Before, it only affeted viewport rendering. This was an issue, because all internal computations would still have to happen on the high resolution volumes. With this patch, the simplify setting already affects file loading and procedural generation of volumes. Rendering does not have to care about the simplify option anymore, it just gets the correct simplified version from the depsgraph. Reviewers: brecht Differential Revision: https://developer.blender.org/D9176
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_volume.c')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_volume.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_volume.c b/source/blender/draw/intern/draw_cache_impl_volume.c
index 10bacadb199..1a9e40fb03b 100644
--- a/source/blender/draw/intern/draw_cache_impl_volume.c
+++ b/source/blender/draw/intern/draw_cache_impl_volume.c
@@ -262,8 +262,6 @@ static DRWVolumeGrid *volume_grid_cache_get(Volume *volume,
VolumeGrid *grid,
VolumeBatchCache *cache)
{
- const DRWContextState *draw_ctx = DRW_context_state_get();
-
const char *name = BKE_volume_grid_name(grid);
/* Return cached grid. */
@@ -289,22 +287,12 @@ static DRWVolumeGrid *volume_grid_cache_get(Volume *volume,
return cache_grid;
}
- /* Load grid tree into memory, if not loaded already. */
+ /* Remember if grid was loaded. If it was not, we want to unload it after the GPUTexture has been
+ * created. */
const bool was_loaded = BKE_volume_grid_is_loaded(grid);
- BKE_volume_grid_load(volume, grid);
-
- float resolution_factor = 1.0f;
- if (DEG_get_mode(draw_ctx->depsgraph) != DAG_EVAL_RENDER) {
- if (draw_ctx->scene->r.mode & R_SIMPLIFY) {
- resolution_factor = draw_ctx->scene->r.simplify_volumes;
- }
- }
- if (resolution_factor == 0.0f) {
- return cache_grid;
- }
DenseFloatVolumeGrid dense_grid;
- if (BKE_volume_grid_dense_floats(volume, grid, resolution_factor, &dense_grid)) {
+ if (BKE_volume_grid_dense_floats(volume, grid, &dense_grid)) {
copy_m4_m4(cache_grid->texture_to_object, dense_grid.texture_to_object);
invert_m4_m4(cache_grid->object_to_texture, dense_grid.texture_to_object);