Blender  V3.3
eevee_view.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2021 Blender Foundation.
3  */
4 
17 #pragma once
18 
19 #include "DRW_render.h"
20 
21 #include "eevee_camera.hh"
22 #include "eevee_pipeline.hh"
23 #include "eevee_shader.hh"
24 #include "eevee_velocity.hh"
25 
26 namespace blender::eevee {
27 
28 class Instance;
29 
30 /* -------------------------------------------------------------------- */
36 class ShadingView {
37  private:
38  Instance &inst_;
40  const char *name_;
42  const float (*face_matrix_)[4];
43 
45  // DepthOfField dof_;
46  // MotionBlur mb_;
47 
49  // RaytraceBuffer rt_buffer_opaque_;
50  // RaytraceBuffer rt_buffer_refract_;
51 
52  Framebuffer prepass_fb_;
53  Framebuffer combined_fb_;
54  TextureFromPool postfx_tx_;
55 
57  DRWView *main_view_ = nullptr;
60  DRWView *sub_view_ = nullptr;
62  DRWView *render_view_ = nullptr;
63 
65  int2 extent_ = {-1, -1};
66 
67  bool is_enabled_ = false;
68 
69  public:
70  ShadingView(Instance &inst, const char *name, const float (*face_matrix)[4])
71  : inst_(inst), name_(name), face_matrix_(face_matrix){};
72 
74 
75  void init();
76 
77  void sync();
78 
79  void render();
80 
81  GPUTexture *render_post(GPUTexture *input_tx);
82 
83  private:
84  void update_view();
85 };
86 
89 /* -------------------------------------------------------------------- */
97 class MainView {
98  private:
99  /* WORKAROUND: Defining this as an array does not seems to work on GCC < 9.4.
100  * It tries to use the copy constructor and fails because ShadingView is non-copyable and
101  * non-movable. */
102  ShadingView shading_views_0;
103  ShadingView shading_views_1;
104  ShadingView shading_views_2;
105  ShadingView shading_views_3;
106  ShadingView shading_views_4;
107  ShadingView shading_views_5;
108 #define shading_views_ (&shading_views_0)
109 
110  public:
112  : shading_views_0(inst, "posX_view", cubeface_mat[0]),
113  shading_views_1(inst, "negX_view", cubeface_mat[1]),
114  shading_views_2(inst, "posY_view", cubeface_mat[2]),
115  shading_views_3(inst, "negY_view", cubeface_mat[3]),
116  shading_views_4(inst, "posZ_view", cubeface_mat[4]),
117  shading_views_5(inst, "negZ_view", cubeface_mat[5])
118  {
119  }
120 
121  void init()
122  {
123  for (auto i : IndexRange(6)) {
124  shading_views_[i].init();
125  }
126  }
127 
128  void sync()
129  {
130  for (auto i : IndexRange(6)) {
131  shading_views_[i].sync();
132  }
133  }
134 
135  void render()
136  {
137  for (auto i : IndexRange(6)) {
138  shading_views_[i].render();
139  }
140  }
141 
142 #undef shading_views_
143 };
144 
147 } // namespace blender::eevee
typedef float(TangentPoint)[2]
struct GPUTexture GPUTexture
Definition: GPU_texture.h:17
A running instance of the engine.
MainView(Instance &inst)
Definition: eevee_view.hh:111
GPUTexture * render_post(GPUTexture *input_tx)
Definition: eevee_view.cc:151
ShadingView(Instance &inst, const char *name, const float(*face_matrix)[4])
Definition: eevee_view.hh:70
#define shading_views_
Definition: eevee_view.hh:108
static const float cubeface_mat[6][4][4]
Definition: eevee_camera.hh:16