Cleanup: remove redundant doxygen \file argument
[blender.git] / source / blender / draw / engines / workbench / solid_mode.c
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2016, Blender Foundation.
17  */
18
19 /** \file \ingroup draw_engine
20  *
21  * Simple engine for drawing color and/or depth.
22  * When we only need simple studio shaders.
23  */
24
25 #include "DRW_render.h"
26
27 #include "GPU_shader.h"
28
29 #include "RE_pipeline.h"
30
31 #include "workbench_private.h"
32
33 /* Functions */
34
35 static void workbench_solid_engine_init(void *vedata)
36 {
37         WORKBENCH_Data *data = vedata;
38         workbench_deferred_engine_init(data);
39 }
40
41 static void workbench_solid_cache_init(void *vedata)
42 {
43
44         WORKBENCH_Data *data = vedata;
45         workbench_deferred_cache_init(data);
46 }
47
48 static void workbench_solid_cache_populate(void *vedata, Object *ob)
49 {
50         WORKBENCH_Data *data = vedata;
51         workbench_deferred_solid_cache_populate(data, ob);
52 }
53
54 static void workbench_solid_cache_finish(void *vedata)
55 {
56         WORKBENCH_Data *data = vedata;
57         workbench_deferred_cache_finish(data);
58 }
59
60 static void workbench_solid_draw_background(void *vedata)
61 {
62         WORKBENCH_Data *data = vedata;
63         workbench_deferred_draw_background(data);
64         workbench_deferred_draw_scene(data);
65         workbench_deferred_draw_finish(data);
66 }
67
68 static void workbench_solid_engine_free(void)
69 {
70         workbench_deferred_engine_free();
71 }
72
73 static void workbench_solid_view_update(void *vedata)
74 {
75         WORKBENCH_Data *data = vedata;
76         workbench_taa_view_updated(data);
77 }
78
79 static void workbench_solid_id_update(void *UNUSED(vedata), struct ID *id)
80 {
81         if (GS(id->name) == ID_OB) {
82                 WORKBENCH_ObjectData *oed = (WORKBENCH_ObjectData *)DRW_drawdata_get(id, &draw_engine_workbench_solid);
83                 if (oed != NULL && oed->dd.recalc != 0) {
84                         oed->shadow_bbox_dirty = (oed->dd.recalc & ID_RECALC_ALL) != 0;
85                         oed->dd.recalc = 0;
86                 }
87         }
88 }
89
90 static void workbench_render_to_image(void *vedata, RenderEngine *engine, RenderLayer *render_layer, const rcti *rect)
91 {
92         workbench_render(vedata, engine, render_layer, rect);
93 }
94
95 static const DrawEngineDataSize workbench_data_size = DRW_VIEWPORT_DATA_SIZE(WORKBENCH_Data);
96
97 DrawEngineType draw_engine_workbench_solid = {
98         NULL, NULL,
99         N_("Workbench"),
100         &workbench_data_size,
101         &workbench_solid_engine_init,
102         &workbench_solid_engine_free,
103         &workbench_solid_cache_init,
104         &workbench_solid_cache_populate,
105         &workbench_solid_cache_finish,
106         &workbench_solid_draw_background,
107         NULL,
108         &workbench_solid_view_update,
109         &workbench_solid_id_update,
110         &workbench_render_to_image,
111 };