blob: 9f7ddba99c8323dd4b0b7f546d346eae14df2fdf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2018 Blender Foundation.
*/
/** \file
* \ingroup eevee
*/
#pragma once
#include "BKE_studiolight.h"
#include "DNA_world_types.h"
#include "DRW_render.h"
namespace blender::eevee {
class Instance;
/* -------------------------------------------------------------------- */
/** \name Lookdev World Nodetree
*
* \{ */
class LookDevWorldNodeTree {
private:
bNodeTree *ntree_;
bNodeSocketValueFloat *strength_socket_;
public:
LookDevWorldNodeTree();
~LookDevWorldNodeTree();
bNodeTree *nodetree_get(float strength);
};
/** \} */
/* -------------------------------------------------------------------- */
/** \name Look Dev
*
* \{ */
class LookDev {
private:
Instance &inst_;
/** Nodetree used to render the world reflection cubemap and irradiance. */
LookDevWorldNodeTree world_tree;
/** Compiled gpu material for the nodetree. Owned. */
ListBase material = {nullptr, nullptr};
/** Choosen studio light. */
StudioLight *studiolight_ = nullptr;
int studiolight_index_ = -1;
/** Draw pass to draw the viewport background. */
DRWPass *background_ps_ = nullptr;
/** Parameters. */
float instensity_ = -1.0f;
float blur_ = -1.0f;
float opacity_ = -1.0f;
float rotation_ = -9999.0f;
bool view_rotation_ = false;
/** Overlay (reference spheres). */
DRWPass *overlay_ps_ = nullptr;
/** View based on main view with orthographic projection. Without this, shading is incorrect. */
DRWView *view_ = nullptr;
/** Selected LOD of the sphere mesh. */
eDRWLevelOfDetail sphere_lod_;
/** Screen space radius in pixels. */
int sphere_size_ = 0;
/** Lower right corner of the area where we can start drawing. */
int2 anchor_;
public:
LookDev(Instance &inst) : inst_(inst){};
~LookDev()
{
GPU_material_free(&material);
};
void init(const int2 &output_res, const rcti *render_border);
void sync_background(void);
bool sync_world(void);
void sync_overlay(void);
bool render_background(void);
void render_overlay(GPUFrameBuffer *view_fb);
void rotation_get(float4x4 &r_mat);
private:
bool do_overlay(const int2 &output_res, const rcti *render_border);
};
/** \} */
} // namespace blender::eevee
|