26 PassMain ps_dots_ = {
"LightProbesDots"};
31 GroundLineInstanceBuf ground_line_buf = {selection_type_,
"ground_line_buf"};
32 LightProbeInstanceBuf probe_cube_buf = {selection_type_,
"probe_cube_buf"};
33 LightProbeInstanceBuf probe_planar_buf = {selection_type_,
"probe_planar_buf"};
34 LightProbeInstanceBuf probe_grid_buf = {selection_type_,
"probe_grid_buf"};
35 LightProbeInstanceBuf quad_solid_buf = {selection_type_,
"quad_solid_buf"};
36 LightProbeInstanceBuf cube_buf = {selection_type_,
"cube_buf"};
37 LightProbeInstanceBuf sphere_buf = {selection_type_,
"sphere_buf"};
38 LightProbeInstanceBuf single_arrow_buf = {selection_type_,
"single_arrow_buf"};
40 } call_buffers_{selection_type_};
47 call_buffers_.ground_line_buf.clear();
48 call_buffers_.probe_cube_buf.clear();
49 call_buffers_.probe_planar_buf.clear();
50 call_buffers_.probe_grid_buf.clear();
51 call_buffers_.quad_solid_buf.clear();
52 call_buffers_.cube_buf.clear();
53 call_buffers_.sphere_buf.clear();
54 call_buffers_.single_arrow_buf.clear();
59 ps_dots_.bind_ubo(
"globalsBlock", &res.
globals_buf);
60 ps_dots_.bind_texture(
"depthBuffer", &res.
depth_tx);
72 const bool is_select = selection_type_ == SelectionType::ENABLED;
79 float &clip_start = matrix[2].w;
80 float &clip_end = matrix[3].w;
81 float &draw_size = matrix[3].w;
85 clip_start = show_clipping ? prb->clipsta : -1.0;
86 clip_end = show_clipping ? prb->clipend : -1.0;
87 call_buffers_.probe_cube_buf.append(
data, select_id);
89 call_buffers_.ground_line_buf.append(
float4(matrix.
location()), select_id);
93 call_buffers_.cube_buf :
94 call_buffers_.sphere_buf;
95 const float f = 1.0f - prb->falloff;
98 data.object_to_world_[3].w = prb->distinf * f;
104 call_buffers_.cube_buf :
105 call_buffers_.sphere_buf;
112 clip_start = show_clipping ? 0.0f : -1.0f;
113 clip_end = show_clipping ? prb->clipend : -1.0f;
114 call_buffers_.probe_grid_buf.append(
data, select_id);
119 float3 local_surfel_size = (0.5f / prb->grid_surfel_density) * (max_axis_len / axes_len);
122 float3(-1.0f + local_surfel_size),
124 float3(local_surfel_size));
125 surfel_density_mat = ob->object_to_world() * surfel_density_mat;
130 if (show_influence) {
137 matrix[0].w = prb->grid_resolution_x;
138 matrix[1].w = prb->grid_resolution_y;
139 matrix[2].w = prb->grid_resolution_z;
143 const uint cell_count = prb->grid_resolution_x * prb->grid_resolution_y *
144 prb->grid_resolution_z;
145 ps_dots_.push_constant(
"gridModelMatrix", matrix);
151 call_buffers_.probe_planar_buf.append(
data, select_id);
154 call_buffers_.quad_solid_buf.append(
data, select_id);
157 if (show_influence) {
159 call_buffers_.cube_buf.append(
data, select_id);
160 matrix.
z_axis() *= 1.0f - prb->falloff;
161 call_buffers_.cube_buf.append(
data, select_id);
165 call_buffers_.cube_buf.append(
data, select_id);
169 call_buffers_.single_arrow_buf.append(
data, select_id);
186 call_buffers_.probe_cube_buf.end_sync(sub_pass, shapes.
lightprobe_cube.get());
187 call_buffers_.probe_planar_buf.end_sync(sub_pass, shapes.
lightprobe_planar.get());
188 call_buffers_.probe_grid_buf.end_sync(sub_pass, shapes.
lightprobe_grid.get());
189 call_buffers_.quad_solid_buf.end_sync(sub_pass, shapes.
quad_solid.get());
190 call_buffers_.cube_buf.end_sync(sub_pass, shapes.
cube.get());
191 call_buffers_.sphere_buf.end_sync(sub_pass, shapes.
empty_sphere.get());
192 call_buffers_.single_arrow_buf.end_sync(sub_pass, shapes.
single_arrow.get());
199 call_buffers_.ground_line_buf.end_sync(sub_pass, shapes.
ground_line.get());
@ LIGHTPROBE_FLAG_SHOW_PARALLAX
@ LIGHTPROBE_FLAG_SHOW_CLIP_DIST
@ LIGHTPROBE_FLAG_SHOW_INFLUENCE
@ LIGHTPROBE_FLAG_SHOW_DATA
@ LIGHTPROBE_FLAG_CUSTOM_PARALLAX
#define BASE_SELECTED(v3d, base)
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
void submit(PassSimple &pass, View &view)
void state_set(DRWState state, int clip_plane_count=0)
void bind_ubo(const char *name, GPUUniformBuf *buffer)
void shader_set(GPUShader *shader)
detail::PassBase< command::DrawCommandBuf > Sub
void draw(Framebuffer &framebuffer, Manager &manager, View &view)
LightProbes(const SelectionType selection_type)
void begin_sync(Resources &res, const State &state)
void end_sync(Resources &res, ShapeCache &shapes, const State &state)
void object_sync(const ObjectRef &ob_ref, Resources &res, const State &state)
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view)
ShaderPtr extra_ground_line
BatchPtr lightprobe_planar
@ DRW_STATE_DEPTH_LESS_EQUAL
select::SelectionType SelectionType
detail::Pass< command::DrawCommandBuf > PassSimple
detail::Pass< command::DrawMultiBuf > PassMain
T reduce_max(const VecBase< T, Size > &a)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
VecBase< T, 3 > to_scale(const MatBase< T, NumCol, NumRow > &mat)
MatT from_loc_rot_scale(const typename MatT::loc_type &location, const RotationT &rotation, const VecBase< typename MatT::base_type, ScaleDim > &scale)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
MatBase< float, 3, 3 > float3x3
VecBase< float, 3 > float3
struct ExtraInstanceData ExtraInstanceData
const MatView< T, ViewNumCol, ViewNumRow, NumCol, NumRow, SrcStartCol, SrcStartRow, Alignment > view() const
const float4 & object_wire_color(const ObjectRef &ob_ref, ThemeColorID theme_id) const
GPUUniformBuf * globals_buf
ThemeColorID object_wire_theme_id(const ObjectRef &ob_ref, const State &state) const
void append(const InstanceDataT &data, select::ID select_id)
void select_bind(PassSimple &pass)
const ID select_id(const ObjectRef &ob_ref, uint sub_object_id=0)
static QuaternionBase identity()