44 environment_node_ = environment;
60 bke::node_add_link(ntree, environment, environment_out, background, background_color_in);
65 STRNCPY(image.id.name,
"IMLookdev");
80 STRNCPY(world.id.name,
"WOLookdev");
82 world.use_nodes =
true;
83 world.nodetree = ntree;
96 if (parameters_changed) {
101 environment_node_->
id =
nullptr;
108 if (texture !=
nullptr) {
111 environment_node_->
id = &image.id;
117 return parameters_changed;
133 visible_rect_ = *visible_rect;
137 const int2 extent_dummy(1);
146float LookdevModule::calc_viewport_scale()
148 const float viewport_scale =
clamp_f(
150 return viewport_scale;
156 (
U.lookdev_sphere_size / 400.0f) * viewport_scale *
UI_SCALE_FAC, 0.1f, 1.0f);
158 if (res_scale > 0.7f) {
161 else if (res_scale > 0.25f) {
169 const int sphere_radius =
U.lookdev_sphere_size *
UI_SCALE_FAC * viewport_scale;
170 return sphere_radius * 2;
178 const float viewport_scale = calc_viewport_scale();
184 if (spheres_[index].color_tx_.ensure_2d(color_format, extent)) {
202 pixel_radius *= sphere_distance;
205 this->sphere_radius_ = (extent.x / 2) * pixel_radius;
206 this->sphere_position_ = cam.
position() -
207 cam.
forward() * (sphere_distance + this->sphere_radius_);
210 model_m4.
location() = this->sphere_position_;
221void LookdevModule::sync_pass(
PassSimple &pass,
227 pass.clear_depth(1.0f);
228 pass.clear_color(
float4(0.0, 0.0, 0.0, 1.0));
234 pass.state_set(
state);
235 pass.material_set(*inst_.
manager, gpumat);
238 pass.bind_resources(inst_.
lights);
239 pass.bind_resources(inst_.
shadows);
241 pass.bind_resources(inst_.
sampling);
245 pass.draw(geom, res_handle, 0);
248void LookdevModule::sync_display()
255 pass.state_set(
state);
259 pass.push_constant(
"anchor",
int2(visible_rect_.
xmax, visible_rect_.
ymin));
260 pass.bind_texture(
"metallic_tx", &spheres_[0].color_tx_);
261 pass.bind_texture(
"diffuse_tx", &spheres_[1].color_tx_);
271 for (Sphere &sphere : spheres_) {
272 sphere.framebuffer.bind();
302 if (v3d ==
nullptr) {
306 const ::View3DShading &shading = v3d->shading;
310 rot_z = shading.studiolight_rot_z;
312 blur = shading.studiolight_blur;
313 intensity = shading.studiolight_intensity;
320 return hdri == other.hdri &&
rot_z == other.rot_z &&
327 return !(*
this == other);
GPUTexture * BKE_image_get_gpu_texture(Image *image, ImageUser *iuser)
void BKE_libblock_free_datablock(ID *id, int flag) ATTR_NONNULL()
void BKE_libblock_init_empty(ID *id) ATTR_NONNULL(1)
#define SH_NODE_OUTPUT_WORLD
#define SH_NODE_VECTOR_ROTATE
#define SH_NODE_TEX_COORD
#define SH_NODE_TEX_ENVIRONMENT
@ STUDIOLIGHT_EQUIRECT_RADIANCE_GPUTEXTURE
struct StudioLight * BKE_studiolight_find(const char *name, int flag)
void BKE_studiolight_ensure_flag(StudioLight *sl, int flag)
#define STUDIOLIGHT_ORIENTATIONS_MATERIAL_MODE
MINLINE float clamp_f(float value, float min, float max)
MINLINE void copy_v4_fl(float r[4], float f)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
#define STRNCPY(dst, src)
@ NODE_VECTOR_ROTATE_TYPE_AXIS_Z
@ V3D_SHADING_SCENE_WORLD_RENDER
@ V3D_SHADING_SCENE_WORLD
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_NONE
void GPU_framebuffer_viewport_reset(GPUFrameBuffer *framebuffer)
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
void GPU_material_free(ListBase *gpumaterial)
void GPU_texture_ref(GPUTexture *texture)
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_SHADER_WRITE
#define GPU_TEXTURE_FREE_SAFE(texture)
struct blender::bke::bNodeTreeType * ntreeType_Shader
void ensure(GPUAttachment depth=GPU_ATTACHMENT_NONE, GPUAttachment color1=GPU_ATTACHMENT_NONE, GPUAttachment color2=GPU_ATTACHMENT_NONE, GPUAttachment color3=GPU_ATTACHMENT_NONE, GPUAttachment color4=GPU_ATTACHMENT_NONE, GPUAttachment color5=GPU_ATTACHMENT_NONE, GPUAttachment color6=GPU_ATTACHMENT_NONE, GPUAttachment color7=GPU_ATTACHMENT_NONE, GPUAttachment color8=GPU_ATTACHMENT_NONE)
void submit(PassSimple &pass, View &view)
ResourceHandle resource_handle(const ObjectRef &ref, float inflate_bounds=0.0f)
bool ensure_2d_array(eGPUTextureFormat format, int2 extent, int layers, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, const float *data=nullptr, int mip_len=1)
bool ensure_2d(eGPUTextureFormat format, int2 extent, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, const float *data=nullptr, int mip_len=1)
const float3 & forward() const
const float3 & position() const
const CameraData & data_get() const
bool is_perspective() const
int2 display_extent_get() const
struct blender::eevee::HiZBuffer::@195 front
A running instance of the engine.
VolumeProbeModule volume_probes
bool use_lookdev_overlay() const
SphereProbeModule sphere_probes
bool overlays_enabled() const
UniformDataModule uniform_data
void init(const rcti *visible_rect)
LookdevModule(Instance &inst)
bool sync(const LookdevParameters &new_parameters)
::Material * metallic_mat
UtilityTexture utility_tx
bool finished_viewport() const
GPUMaterial * material_shader_get(::Material *blender_mat, bNodeTree *nodetree, eMaterialPipeline pipeline_type, eMaterialGeometry geometry_type, bool deferred_compilation)
GPUShader * static_shader_get(eShaderType shader_type)
static float screen_pixel_radius(const float4x4 &wininv, bool is_perspective, const int2 &extent)
struct blender::eevee::VolumeModule::@196 result
additional_info("compositor_sum_float_shared") .push_constant(Type additional_info("compositor_sum_float_shared") .push_constant(Type GPU_RGBA32F
local_group_size(16, 16) .push_constant(Type texture
blender::gpu::Batch * DRW_cache_sphere_get(const eDRWLevelOfDetail level_of_detail)
Simple API to draw debug shapes and log in the viewport.
const float * DRW_viewport_invert_size_get()
DefaultFramebufferList * DRW_viewport_framebuffer_list_get()
const float * DRW_viewport_size_get()
#define RBUFS_UTILITY_TEX_SLOT
void node_set_active(bNodeTree *ntree, bNode *node)
bNode * node_add_static_node(const bContext *C, bNodeTree *ntree, int type)
bNodeLink * node_add_link(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock, bNode *tonode, bNodeSocket *tosock)
bNodeTree * node_tree_add_tree(Main *bmain, const char *name, const char *idname)
bNodeSocket * node_find_socket(bNode *node, eNodeSocketInOut in_out, StringRef identifier)
detail::Pass< command::DrawCommandBuf > PassSimple
static int calc_sphere_extent(const float viewport_scale)
static eDRWLevelOfDetail calc_level_of_detail(const float viewport_scale)
MatBase< T, NumCol, NumRow > scale(const MatBase< T, NumCol, NumRow > &mat, const VectorT &scale)
bool assign_if_different(T &old_value, T new_value)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
MatBase< float, 3, 3 > float3x3
VecBase< float, 3 > float3
GPUFrameBuffer * default_fb
struct bNodeTree * nodetree
struct GPUTexture * equirect_radiance_gputexture
bool operator==(const LookdevParameters &other) const
bool operator!=(const LookdevParameters &other) const
void * BKE_image_get_tile