Blender  V3.3
eevee_instance.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2021 Blender Foundation.
3  */
4 
11 #pragma once
12 
13 #include "BKE_object.h"
14 #include "DEG_depsgraph.h"
15 #include "DNA_lightprobe_types.h"
16 #include "DRW_render.h"
17 
18 #include "eevee_camera.hh"
19 #include "eevee_film.hh"
20 #include "eevee_material.hh"
21 #include "eevee_pipeline.hh"
22 #include "eevee_renderbuffers.hh"
23 #include "eevee_sampling.hh"
24 #include "eevee_shader.hh"
25 #include "eevee_sync.hh"
26 #include "eevee_view.hh"
27 #include "eevee_world.hh"
28 
29 namespace blender::eevee {
30 
35 class Instance {
36  friend VelocityModule;
37 
38  public:
50 
62  const DRWView *drw_view;
63  const View3D *v3d;
65 
68 
69  /* Info string displayed at the top of the render / viewport. */
70  std::string info = "";
71 
72  public:
74  : shaders(*ShaderModule::module_get()),
75  sync(*this),
76  materials(*this),
77  pipelines(*this),
78  velocity(*this),
79  sampling(*this),
80  camera(*this),
81  film(*this),
82  render_buffers(*this),
83  main_view(*this),
84  world(*this){};
85  ~Instance(){};
86 
87  void init(const int2 &output_res,
88  const rcti *output_rect,
91  const LightProbe *light_probe_ = nullptr,
92  Object *camera_object = nullptr,
93  const RenderLayer *render_layer = nullptr,
94  const DRWView *drw_view = nullptr,
95  const View3D *v3d = nullptr,
96  const RegionView3D *rv3d = nullptr);
97 
98  void begin_sync();
99  void object_sync(Object *ob);
100  void end_sync();
101 
102  void render_sync();
103  void render_frame(RenderLayer *render_layer, const char *view_name);
104 
106 
107  bool is_viewport() const
108  {
109  return render == nullptr;
110  }
111 
112  bool overlays_enabled() const
113  {
114  return v3d && ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0);
115  }
116 
117  bool use_scene_lights() const
118  {
119  return (!v3d) ||
120  ((v3d->shading.type == OB_MATERIAL) &&
122  ((v3d->shading.type == OB_RENDER) &&
124  }
125 
126  /* Light the scene using the selected HDRI in the viewport shading pop-over. */
127  bool use_studio_light() const
128  {
129  return (v3d) && (((v3d->shading.type == OB_MATERIAL) &&
130  ((v3d->shading.flag & V3D_SHADING_SCENE_WORLD) == 0)) ||
131  ((v3d->shading.type == OB_RENDER) &&
133  }
134 
135  private:
136  static void object_sync_render(void *instance_,
137  Object *ob,
138  RenderEngine *engine,
140  void render_sample();
141 
142  void mesh_sync(Object *ob, ObjectHandle &ob_handle);
143 
144  void update_eval_members();
145 
146  void set_time(float time);
147 };
148 
149 } // namespace blender::eevee
General operations, lookup, etc. for blender objects.
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
@ OB_RENDER
@ OB_MATERIAL
@ V3D_SHADING_SCENE_WORLD_RENDER
@ V3D_SHADING_SCENE_WORLD
@ V3D_SHADING_SCENE_LIGHTS
@ V3D_SHADING_SCENE_LIGHTS_RENDER
#define V3D_HIDE_OVERLAYS
A running instance of the engine.
void draw_viewport(DefaultFramebufferList *dfbl)
const DRWView * drw_view
RenderBuffers render_buffers
const RenderLayer * render_layer
void object_sync(Object *ob)
void render_frame(RenderLayer *render_layer, const char *view_name)
const RegionView3D * rv3d
void init(const int2 &output_res, const rcti *output_rect, RenderEngine *render, Depsgraph *depsgraph, const LightProbe *light_probe_=nullptr, Object *camera_object=nullptr, const RenderLayer *render_layer=nullptr, const DRWView *drw_view=nullptr, const View3D *v3d=nullptr, const RegionView3D *rv3d=nullptr)
double time
View3DShading shading