Overlay-Next: Light Probe

Overlay-Next version of light probe.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/125828
This commit is contained in:
Laurynas Duburas
2024-08-05 17:20:12 +02:00
committed by Clément Foucault
parent 9c622d3b2b
commit f340d7037c
12 changed files with 368 additions and 17 deletions

View File

@@ -297,6 +297,7 @@ set(SRC
engines/overlay/overlay_next_instance.hh
engines/overlay/overlay_next_lattice.hh
engines/overlay/overlay_next_light.hh
engines/overlay/overlay_next_lightprobe.hh
engines/overlay/overlay_next_metaball.hh
engines/overlay/overlay_next_prepass.hh
engines/overlay/overlay_next_private.hh

View File

@@ -78,7 +78,7 @@ class Bounds {
break;
}
case OB_BOUND_SPHERE: {
float4x4 scale = math::from_scale<float4x4>(float3{math::reduce_max(size)});
float4x4 scale = math::from_scale<float4x4>(float3(math::reduce_max(size)));
scale.location() = center;
ExtraInstanceData data(object_mat * scale, color, 1.0f);
call_buffers_.sphere.append(data, select_id);
@@ -86,7 +86,7 @@ class Bounds {
}
case OB_BOUND_CYLINDER: {
float4x4 scale = math::from_scale<float4x4>(
float3{float2{math::max(size.x, size.y)}, size.z});
float3(float2(math::max(size.x, size.y)), size.z));
scale.location() = center;
ExtraInstanceData data(object_mat * scale, color, 1.0f);
call_buffers_.cylinder.append(data, select_id);
@@ -94,7 +94,7 @@ class Bounds {
}
case OB_BOUND_CONE: {
float4x4 mat = math::from_scale<float4x4>(
float3{float2{math::max(size.x, size.y)}, size.z});
float3(float2(math::max(size.x, size.y)), size.z));
mat.location() = center;
/* Cone batch has base at 0 and is pointing towards +Y. */
std::swap(mat[1], mat[2]);
@@ -104,7 +104,7 @@ class Bounds {
break;
}
case OB_BOUND_CAPSULE: {
float4x4 mat = math::from_scale<float4x4>(float3{math::max(size.x, size.y)});
float4x4 mat = math::from_scale<float4x4>(float3(math::max(size.x, size.y)));
mat.location() = center;
mat.location().z = center.z + std::max(0.0f, size.z - size.x);
ExtraInstanceData data(object_mat * mat, color, 1.0f);

View File

@@ -91,11 +91,11 @@ class Cameras {
const View3D *v3d,
const float4 &color,
const ObjectRef &ob_ref,
const bool is_select,
Resources &res,
CallBuffers &call_buffers)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
const bool is_select = DRW_state_is_select();
Object *ob = ob_ref.object;
MovieClip *clip = BKE_object_movieclip_get((Scene *)scene, ob, false);
@@ -236,6 +236,7 @@ class Cameras {
const select::ID select_id,
const Scene *scene,
const View3D *v3d,
const bool is_select,
Resources &res,
Object *ob,
CallBuffers &call_buffers)
@@ -243,7 +244,6 @@ class Cameras {
CameraInstanceData stereodata = instdata;
const Camera *cam = static_cast<const Camera *>(ob->data);
const bool is_select = DRW_state_is_select();
const char *viewnames[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
const bool is_stereo3d_cameras = (v3d->stereo3d_flag & V3D_S3D_DISPCAMERAS) != 0;
@@ -374,7 +374,7 @@ class Cameras {
const Camera *cam = static_cast<Camera *>(ob->data);
const Object *camera_object = DEG_get_evaluated_object(state.depsgraph, v3d->camera);
const bool is_select = DRW_state_is_select();
const bool is_select = call_buffers_.selection_type_ == SelectionType::ENABLED;
const bool is_active = (ob == camera_object);
const bool is_camera_view = (is_active && (rv3d->persp == RV3D_CAMOB));
@@ -447,7 +447,7 @@ class Cameras {
else {
/* Stereo cameras, volumes, plane drawing. */
if (is_stereo3d_display_extra) {
stereoscopy_extra(data, select_id, scene, v3d, res, ob, call_buffers_);
stereoscopy_extra(data, select_id, scene, v3d, is_select, res, ob, call_buffers_);
}
else {
call_buffers_.frame_buf.append(data, select_id);
@@ -489,8 +489,14 @@ class Cameras {
/* Motion Tracking. */
if ((v3d->flag2 & V3D_SHOW_RECONSTRUCTION) != 0) {
view3d_reconstruction(
select_id, scene, v3d, res.object_wire_color(ob_ref, state), ob_ref, res, call_buffers_);
view3d_reconstruction(select_id,
scene,
v3d,
res.object_wire_color(ob_ref, state),
ob_ref,
is_select,
res,
call_buffers_);
}
// TODO: /* Background images. */

View File

@@ -84,6 +84,7 @@ void Instance::begin_sync()
layer.empties.begin_sync();
layer.lattices.begin_sync(resources, state);
layer.lights.begin_sync();
layer.light_probes.begin_sync(resources, state);
layer.metaballs.begin_sync();
layer.prepass.begin_sync(resources, state);
layer.speakers.begin_sync();
@@ -154,6 +155,9 @@ void Instance::object_sync(ObjectRef &ob_ref, Manager &manager)
case OB_LAMP:
layer.lights.object_sync(ob_ref, resources, state);
break;
case OB_LIGHTPROBE:
layer.light_probes.object_sync(ob_ref, resources, state);
break;
case OB_MBALL:
if (!in_edit_mode) {
layer.metaballs.object_sync(ob_ref, resources, state);
@@ -178,6 +182,7 @@ void Instance::end_sync()
layer.cameras.end_sync(resources, shapes, state);
layer.empties.end_sync(resources, shapes, state);
layer.lights.end_sync(resources, shapes, state);
layer.light_probes.end_sync(resources, shapes, state);
layer.metaballs.end_sync(resources, shapes, state);
layer.speakers.end_sync(resources, shapes, state);
};
@@ -252,6 +257,7 @@ void Instance::draw(Manager &manager)
layer.cameras.draw(framebuffer, manager, view);
layer.empties.draw(framebuffer, manager, view);
layer.lights.draw(framebuffer, manager, view);
layer.light_probes.draw(framebuffer, manager, view);
layer.speakers.draw(framebuffer, manager, view);
layer.lattices.draw(framebuffer, manager, view);
layer.metaballs.draw(framebuffer, manager, view);

View File

@@ -17,6 +17,7 @@
#include "overlay_next_grid.hh"
#include "overlay_next_lattice.hh"
#include "overlay_next_light.hh"
#include "overlay_next_lightprobe.hh"
#include "overlay_next_metaball.hh"
#include "overlay_next_prepass.hh"
#include "overlay_next_speaker.hh"
@@ -51,6 +52,7 @@ class Instance {
Empties empties = {selection_type_};
Lattices lattices;
Lights lights = {selection_type_};
LightProbes light_probes = {selection_type_};
Metaballs metaballs = {selection_type_};
Prepass prepass;
Speakers speakers = {selection_type_};

View File

@@ -121,7 +121,7 @@ class Lights {
/* HACK: We pack the area size in alpha color. This is decoded by the shader. */
theme_color[3] = -max_ff(la.radius, FLT_MIN);
call_buffers_.spot_buf.append(data, select_id);
if ((la.mode & LA_SHOW_CONE) && !DRW_state_is_select()) {
if ((la.mode & LA_SHOW_CONE) && selection_type_ == SelectionType::DISABLED) {
const float4 color_inside{0.0f, 0.0f, 0.0f, 0.5f};
const float4 color_outside{1.0f, 1.0f, 1.0f, 0.3f};
call_buffers_.spot_cone_front_buf.append(data.with_color(color_inside), select_id);

View File

@@ -0,0 +1,211 @@
/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup overlay
*/
#pragma once
#include "DNA_lightprobe_types.h"
#include "overlay_next_private.hh"
namespace blender::draw::overlay {
class LightProbes {
using LightProbeInstanceBuf = ShapeInstanceBuf<ExtraInstanceData>;
using GroundLineInstanceBuf = ShapeInstanceBuf<float4>;
using DotsInstanceBuf = ShapeInstanceBuf<float4x4>;
private:
const SelectionType selection_type_;
PassSimple ps_ = {"LightProbes"};
PassMain ps_dots_ = {"LightProbesDots"};
struct CallBuffers {
const SelectionType selection_type_;
GroundLineInstanceBuf ground_line_buf = {selection_type_, "ground_line_buf"};
LightProbeInstanceBuf probe_cube_buf = {selection_type_, "probe_cube_buf"};
LightProbeInstanceBuf probe_planar_buf = {selection_type_, "probe_planar_buf"};
LightProbeInstanceBuf probe_grid_buf = {selection_type_, "probe_grid_buf"};
LightProbeInstanceBuf quad_solid_buf = {selection_type_, "quad_solid_buf"};
LightProbeInstanceBuf cube_buf = {selection_type_, "cube_buf"};
LightProbeInstanceBuf sphere_buf = {selection_type_, "sphere_buf"};
LightProbeInstanceBuf single_arrow_buf = {selection_type_, "single_arrow_buf"};
} call_buffers_{selection_type_};
public:
LightProbes(const SelectionType selection_type) : selection_type_(selection_type){};
void begin_sync(Resources &res, const State &state)
{
call_buffers_.ground_line_buf.clear();
call_buffers_.probe_cube_buf.clear();
call_buffers_.probe_planar_buf.clear();
call_buffers_.probe_grid_buf.clear();
call_buffers_.quad_solid_buf.clear();
call_buffers_.cube_buf.clear();
call_buffers_.sphere_buf.clear();
call_buffers_.single_arrow_buf.clear();
ps_dots_.init();
ps_dots_.state_set(DRW_STATE_WRITE_COLOR | state.clipping_state);
ps_dots_.shader_set(res.shaders.extra_grid.get());
ps_dots_.bind_ubo("globalsBlock", &res.globals_buf);
ps_dots_.bind_texture("depthBuffer", &res.depth_tx);
ps_dots_.push_constant("isTransform", (G.moving & G_TRANSFORM_OBJ) != 0);
res.select_bind(ps_dots_);
}
void object_sync(const ObjectRef &ob_ref, Resources &res, const State &state)
{
const Object *ob = ob_ref.object;
const LightProbe *prb = static_cast<LightProbe *>(ob_ref.object->data);
const bool show_clipping = (prb->flag & LIGHTPROBE_FLAG_SHOW_CLIP_DIST) != 0;
const bool show_parallax = (prb->flag & LIGHTPROBE_FLAG_SHOW_PARALLAX) != 0;
const bool show_influence = (prb->flag & LIGHTPROBE_FLAG_SHOW_INFLUENCE) != 0;
const bool is_select = selection_type_ == SelectionType::ENABLED;
const bool show_data = (ob_ref.object->base_flag & BASE_SELECTED) || is_select;
const select::ID select_id = res.select_id(ob_ref);
const float4 color = res.object_wire_color(ob_ref, state);
ExtraInstanceData data(ob->object_to_world(), color, 1.0f);
float4x4 &matrix = data.object_to_world_;
float &clip_start = matrix[2].w;
float &clip_end = matrix[3].w;
float &draw_size = matrix[3].w;
switch (prb->type) {
case LIGHTPROBE_TYPE_SPHERE:
clip_start = show_clipping ? prb->clipsta : -1.0;
clip_end = show_clipping ? prb->clipend : -1.0;
call_buffers_.probe_cube_buf.append(data, select_id);
call_buffers_.ground_line_buf.append(float4(matrix.location()), select_id);
if (show_influence) {
LightProbeInstanceBuf &attenuation = (prb->attenuation_type == LIGHTPROBE_SHAPE_BOX) ?
call_buffers_.cube_buf :
call_buffers_.sphere_buf;
const float f = 1.0f - prb->falloff;
ExtraInstanceData data(ob->object_to_world(), color, prb->distinf);
attenuation.append(data, select_id);
data.object_to_world_[3].w = prb->distinf * f;
attenuation.append(data, select_id);
}
if (show_parallax) {
LightProbeInstanceBuf &parallax = (prb->parallax_type == LIGHTPROBE_SHAPE_BOX) ?
call_buffers_.cube_buf :
call_buffers_.sphere_buf;
const float dist = ((prb->flag & LIGHTPROBE_FLAG_CUSTOM_PARALLAX) != 0) ? prb->distpar :
prb->distinf;
parallax.append(ExtraInstanceData(ob->object_to_world(), color, dist), select_id);
}
break;
case LIGHTPROBE_TYPE_VOLUME: {
clip_start = show_clipping ? 0.0f : -1.0f;
clip_end = show_clipping ? prb->clipend : -1.0f;
call_buffers_.probe_grid_buf.append(data, select_id);
{
/* Display surfel density as a cube. */
float3 axes_len = math::to_scale(ob->object_to_world());
float max_axis_len = math::reduce_max(axes_len);
float3 local_surfel_size = (0.5f / prb->grid_surfel_density) * (max_axis_len / axes_len);
float4x4 surfel_density_mat = math::from_loc_rot_scale<float4x4>(
float3(-1.0f + local_surfel_size),
math::Quaternion::identity(),
float3(local_surfel_size));
surfel_density_mat = ob->object_to_world() * surfel_density_mat;
call_buffers_.cube_buf.append(ExtraInstanceData(surfel_density_mat, color, 1.0f),
select_id);
}
if (show_influence) {
call_buffers_.cube_buf.append(ExtraInstanceData(ob->object_to_world(), color, 1.0f),
select_id);
}
/* Data dots */
if (show_data) {
matrix[0].w = prb->grid_resolution_x;
matrix[1].w = prb->grid_resolution_y;
matrix[2].w = prb->grid_resolution_z;
/* Put theme id in matrix. */
matrix[3].w = res.object_wire_theme_id(ob_ref, state) == TH_ACTIVE ? 1.0f : 2.0f;
const uint cell_count = prb->grid_resolution_x * prb->grid_resolution_y *
prb->grid_resolution_z;
ps_dots_.push_constant("gridModelMatrix", matrix);
ps_dots_.draw_procedural(GPU_PRIM_POINTS, 1, cell_count, 0, {0}, select_id.get());
}
break;
}
case LIGHTPROBE_TYPE_PLANE:
call_buffers_.probe_planar_buf.append(data, select_id);
if (is_select && (prb->flag & LIGHTPROBE_FLAG_SHOW_DATA)) {
call_buffers_.quad_solid_buf.append(data, select_id);
}
if (show_influence) {
matrix.z_axis() = math::normalize(matrix.z_axis()) * prb->distinf;
call_buffers_.cube_buf.append(data, select_id);
matrix.z_axis() *= 1.0f - prb->falloff;
call_buffers_.cube_buf.append(data, select_id);
}
matrix.z_axis() = float3(0);
call_buffers_.cube_buf.append(data, select_id);
matrix.view<3, 3>() = math::normalize(float4x4(ob->object_to_world().ptr()).view<3, 3>());
draw_size = ob->empty_drawsize;
call_buffers_.single_arrow_buf.append(data, select_id);
break;
}
}
void end_sync(Resources &res, ShapeCache &shapes, const State &state)
{
ps_.init();
res.select_bind(ps_);
DRWState pass_state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
DRW_STATE_DEPTH_LESS_EQUAL | state.clipping_state;
{
PassSimple::Sub &sub_pass = ps_.sub("empties");
sub_pass.state_set(pass_state);
sub_pass.shader_set(res.shaders.extra_shape.get());
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
call_buffers_.probe_cube_buf.end_sync(sub_pass, shapes.lightprobe_cube.get());
call_buffers_.probe_planar_buf.end_sync(sub_pass, shapes.lightprobe_planar.get());
call_buffers_.probe_grid_buf.end_sync(sub_pass, shapes.lightprobe_grid.get());
call_buffers_.quad_solid_buf.end_sync(sub_pass, shapes.quad_solid.get());
call_buffers_.cube_buf.end_sync(sub_pass, shapes.cube.get());
call_buffers_.sphere_buf.end_sync(sub_pass, shapes.empty_sphere.get());
call_buffers_.single_arrow_buf.end_sync(sub_pass, shapes.single_arrow.get());
}
{
PassSimple::Sub &sub_pass = ps_.sub("ground_line");
sub_pass.state_set(pass_state | DRW_STATE_BLEND_ALPHA);
sub_pass.shader_set(res.shaders.extra_ground_line.get());
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
call_buffers_.ground_line_buf.end_sync(sub_pass, shapes.ground_line.get());
}
}
void draw(Framebuffer &framebuffer, Manager &manager, View &view)
{
GPU_framebuffer_bind(framebuffer);
manager.submit(ps_, view);
manager.submit(ps_dots_, view);
}
};
} // namespace blender::draw::overlay

View File

@@ -73,6 +73,7 @@ class ShapeCache {
public:
BatchPtr quad_wire;
BatchPtr quad_solid;
BatchPtr plain_axes;
BatchPtr single_arrow;
BatchPtr cube;
@@ -109,6 +110,10 @@ class ShapeCache {
BatchPtr light_area_square_lines;
BatchPtr light_spot_volume;
BatchPtr lightprobe_cube;
BatchPtr lightprobe_planar;
BatchPtr lightprobe_grid;
ShapeCache();
};
@@ -142,6 +147,7 @@ class ShaderModule {
/** Selectable Shaders */
ShaderPtr armature_sphere_outline;
ShaderPtr depth_mesh;
ShaderPtr extra_grid;
ShaderPtr extra_shape;
ShaderPtr extra_wire_object;
ShaderPtr extra_wire;

View File

@@ -118,6 +118,12 @@ ShaderModule::ShaderModule(const SelectionType selection_type, const bool clippi
"draw_view", "draw_modelmat_new", "draw_resource_handle_new", "draw_globals");
});
extra_grid = selectable_shader("overlay_extra_grid", [](gpu::shader::ShaderCreateInfo &info) {
info.additional_infos_.clear();
info.additional_info(
"draw_view", "draw_modelmat_new", "draw_resource_handle_new", "draw_globals");
});
extra_ground_line = selectable_shader(
"overlay_extra_groundline", [](gpu::shader::ShaderCreateInfo &info) {
info.storage_buf(0, Qualifier::READ, "vec4", "data_buf[]");

View File

@@ -187,17 +187,24 @@ static Vector<Vertex> sphere_axes_circles(const float radius,
return verts;
}
static void light_append_direction_line(Vector<Vertex> &verts)
static void light_append_direction_line(const char axis,
Span<float2> diamond,
Vector<Vertex> &verts)
{
const Vector<float2> diamond = ring_vertices(1.2f, diamond_nsegments);
const float zsta = light_distance_z_get('z', true);
const float zend = light_distance_z_get('z', false);
const float zsta = light_distance_z_get(axis, true);
const float zend = light_distance_z_get(axis, false);
verts.append({{0.0, 0.0, zsta}, VCLASS_LIGHT_DIST});
verts.append({{0.0, 0.0, zend}, VCLASS_LIGHT_DIST});
append_line_loop(verts, diamond, zsta, VCLASS_LIGHT_DIST | VCLASS_SCREENSPACE);
append_line_loop(verts, diamond, zend, VCLASS_LIGHT_DIST | VCLASS_SCREENSPACE);
}
static void light_append_direction_line(Vector<Vertex> &verts)
{
const Vector<float2> diamond = ring_vertices(1.2f, diamond_nsegments);
light_append_direction_line('z', diamond, verts);
}
static VertShaded sphere_lat_lon_vert(const float2 &lat_pt, const float2 &lon_pt)
{
const float x = lon_pt.y * lat_pt.x;
@@ -269,6 +276,16 @@ ShapeCache::ShapeCache()
quad_wire = BatchPtr(
GPU_batch_create_ex(GPU_PRIM_LINES, vbo_from_vector(verts), nullptr, GPU_BATCH_OWNS_VBO));
}
/* quad_solid */
{
const Array<float2> quad = {{-1.0f, 1.0f}, {1.0f, 1.0f}, {-1.0f, -1.0f}, {1.0f, -1.0f}};
Vector<Vertex> verts;
for (const float2 &point : quad) {
verts.append({{point, 0.0f}, VCLASS_EMPTY_SCALED});
}
quad_solid = BatchPtr(GPU_batch_create_ex(
GPU_PRIM_TRI_STRIP, vbo_from_vector(verts), nullptr, GPU_BATCH_OWNS_VBO));
}
/* plain_axes */
{
Vector<Vertex> verts;
@@ -531,9 +548,9 @@ ShapeCache::ShapeCache()
}
for (const float2 &point : diamond) {
Vertex vertex{float3{point, bottom_z}};
Vertex vertex{float3(point, bottom_z)};
verts.append(vertex);
vertex.pos = float3{point * 0.5f, bottom_z + step_z};
vertex.pos = float3(point * 0.5f, bottom_z + step_z);
verts.append(vertex);
verts.append(vertex);
vertex.pos.z += step_z;
@@ -761,6 +778,98 @@ ShapeCache::ShapeCache()
light_area_square_lines = BatchPtr(
GPU_batch_create_ex(GPU_PRIM_LINES, vbo_from_vector(verts), nullptr, GPU_BATCH_OWNS_VBO));
}
/* lightprobe_cube */
{
constexpr float r = 14.0f;
constexpr int flag = VCLASS_SCREENSPACE;
/* Icon */
constexpr float sin_pi_3 = 0.86602540378f;
constexpr float cos_pi_3 = 0.5f;
const Array<float2, 6> points = {
float2(0.0f, 1.0f) * r,
float2(sin_pi_3, cos_pi_3) * r,
float2(sin_pi_3, -cos_pi_3) * r,
float2(0.0f, -1.0f) * r,
float2(-sin_pi_3, -cos_pi_3) * r,
float2(-sin_pi_3, cos_pi_3) * r,
};
Vector<Vertex> verts;
append_line_loop(verts, points, 0.0f, flag);
for (const int i : IndexRange(3)) {
const float2 &point = points[i * 2 + 1];
verts.append(Vertex{{point, 0.0f}, flag});
verts.append(Vertex{{0.0f, 0.0f, 0.0f}, flag});
}
/* Direction Lines */
const Vector<float2> diamond = ring_vertices(1.2f, diamond_nsegments);
const std::string axes = "zZyYxX";
for (const char axis : axes) {
light_append_direction_line(axis, diamond, verts);
}
lightprobe_cube = BatchPtr(
GPU_batch_create_ex(GPU_PRIM_LINES, vbo_from_vector(verts), nullptr, GPU_BATCH_OWNS_VBO));
}
/* lightprobe_planar */
{
constexpr float r = 20.0f;
/* Icon */
constexpr float sin_pi_3 = 0.86602540378f;
const Array<float2, 4> points = {
float2(0.0f, 0.5f) * r,
float2(sin_pi_3, 0.0f) * r,
float2(0.0f, -0.5f) * r,
float2(-sin_pi_3, 0.0f) * r,
};
Vector<Vertex> verts;
append_line_loop(verts, points, 0.0f, VCLASS_SCREENSPACE);
lightprobe_planar = BatchPtr(
GPU_batch_create_ex(GPU_PRIM_LINES, vbo_from_vector(verts), nullptr, GPU_BATCH_OWNS_VBO));
}
/* lightprobe_grid */
{
constexpr float r = 14.0f;
constexpr int flag = VCLASS_SCREENSPACE;
/* Icon */
constexpr float sin_pi_3 = 0.86602540378f;
constexpr float cos_pi_3 = 0.5f;
const Array<float2, 6> points = {float2(0.0f, 1.0f) * r,
float2(sin_pi_3, cos_pi_3) * r,
float2(sin_pi_3, -cos_pi_3) * r,
float2(0.0f, -1.0f) * r,
float2(-sin_pi_3, -cos_pi_3) * r,
float2(-sin_pi_3, cos_pi_3) * r};
Vector<Vertex> verts;
append_line_loop(verts, points, 0.0f, flag);
/* Internal wires. */
for (const int i : IndexRange(6)) {
const float2 tr = points[(i / 2) * 2 + 1] * -0.5f;
const float2 t1 = points[i] + tr;
const float2 t2 = points[(i + 1) % 6] + tr;
verts.append({{t1, 0.0f}, flag});
verts.append({{t2, 0.0f}, flag});
}
for (const int i : IndexRange(3)) {
const float2 &point = points[i * 2 + 1];
verts.append(Vertex{{point, 0.0f}, flag});
verts.append(Vertex{{0.0f, 0.0f, 0.0f}, flag});
}
/* Direction Lines */
const Vector<float2> diamond = ring_vertices(1.2f, diamond_nsegments);
const std::string axes = "zZyYxX";
for (const char axis : axes) {
light_append_direction_line(axis, diamond, verts);
}
lightprobe_grid = BatchPtr(
GPU_batch_create_ex(GPU_PRIM_LINES, vbo_from_vector(verts), nullptr, GPU_BATCH_OWNS_VBO));
}
}
} // namespace blender::draw::overlay

View File

@@ -4,6 +4,7 @@
#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl)
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
#pragma BLENDER_REQUIRE(select_lib.glsl)
vec4 color_from_id(float color_id)
{
@@ -27,6 +28,7 @@ vec4 color_from_id(float color_id)
void main()
{
select_id_set(drw_CustomID);
mat4 model_mat = gridModelMatrix;
model_mat[0][3] = model_mat[1][3] = model_mat[2][3] = 0.0;
model_mat[3][3] = 1.0;

View File

@@ -1,6 +1,7 @@
/* SPDX-FileCopyrightText: 2016-2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma BLENDER_REQUIRE(select_lib.glsl)
void main()
{
@@ -24,4 +25,5 @@ void main()
#else
fragColor = finalColor;
#endif
select_id_output(select_id);
}