Overlay-Next: Add base class for documentation
Add the base `Overlay` class for documenting the methods. This cleans up the inconsistency in the method implementation and add TODOs for method not complying with the interface. Pull Request: https://projects.blender.org/blender/blender/pulls/130790
This commit is contained in:
committed by
Clément Foucault
parent
79b7bce125
commit
7c97978eca
@@ -11,6 +11,7 @@
|
||||
|
||||
struct CharInfo;
|
||||
struct Curve;
|
||||
struct ListBase;
|
||||
struct Main;
|
||||
struct Object;
|
||||
struct VFont;
|
||||
|
||||
@@ -42,18 +42,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class AntiAliasing {
|
||||
class AntiAliasing : Overlay {
|
||||
private:
|
||||
PassSimple anti_aliasing_ps_ = {"AntiAliasing"};
|
||||
|
||||
GPUFrameBuffer *framebuffer_ref_ = nullptr;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res)
|
||||
void begin_sync(Resources &res, const State & /*state*/) final
|
||||
{
|
||||
if (res.is_selection()) {
|
||||
anti_aliasing_ps_.init();
|
||||
@@ -77,7 +77,7 @@ class AntiAliasing {
|
||||
}
|
||||
}
|
||||
|
||||
void draw_output(Framebuffer &framebuffer, Manager &manager, View & /*view*/)
|
||||
void draw_output(Framebuffer &framebuffer, Manager &manager, View & /*view*/) final
|
||||
{
|
||||
framebuffer_ref_ = framebuffer;
|
||||
manager.submit(anti_aliasing_ps_);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "ED_view3d.hh"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
#include "overlay_shader_shared.h"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
@@ -22,7 +22,7 @@ enum eArmatureDrawMode {
|
||||
ARM_DRAW_MODE_EDIT,
|
||||
};
|
||||
|
||||
class Armatures {
|
||||
class Armatures : Overlay {
|
||||
using EmptyInstanceBuf = ShapeInstanceBuf<ExtraInstanceData>;
|
||||
using BoneInstanceBuf = ShapeInstanceBuf<BoneInstanceData>;
|
||||
using BoneEnvelopeBuf = ShapeInstanceBuf<BoneEnvelopeData>;
|
||||
@@ -126,14 +126,13 @@ class Armatures {
|
||||
BoneBuffers opaque_ = {selection_type_};
|
||||
BoneBuffers transparent_ = {selection_type_};
|
||||
|
||||
bool enabled_ = false;
|
||||
const ShapeCache &shapes_;
|
||||
|
||||
public:
|
||||
Armatures(const SelectionType selection_type, const ShapeCache &shapes)
|
||||
: selection_type_(selection_type), shapes_(shapes){};
|
||||
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && state.show_bones();
|
||||
|
||||
@@ -542,8 +541,8 @@ class Armatures {
|
||||
|
||||
void edit_object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
const State &state,
|
||||
Resources &res)
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -555,8 +554,8 @@ class Armatures {
|
||||
|
||||
void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
const State &state,
|
||||
Resources &res)
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_ || ob_ref.object->dt == OB_BOUNDBOX) {
|
||||
return;
|
||||
@@ -569,7 +568,7 @@ class Armatures {
|
||||
draw_armature_pose(&ctx);
|
||||
}
|
||||
|
||||
void end_sync(Resources & /*res*/, const ShapeCache &shapes, const State & /*state*/)
|
||||
void end_sync(Resources & /*res*/, const ShapeCache &shapes, const State & /*state*/) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -621,7 +620,7 @@ class Armatures {
|
||||
end_sync(opaque_);
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
#include "DNA_pointcloud_types.h"
|
||||
|
||||
#include "draw_cache_impl.hh"
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
class AttributeViewer {
|
||||
class AttributeViewer : Overlay {
|
||||
private:
|
||||
PassMain ps_ = {"attribute_viewer_ps_"};
|
||||
|
||||
@@ -28,10 +28,8 @@ class AttributeViewer {
|
||||
PassMain::Sub *curves_sub_ = nullptr;
|
||||
PassMain::Sub *instance_sub_ = nullptr;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
ps_.init();
|
||||
enabled_ = state.is_space_v3d() && !res.is_selection() && state.show_attribute_viewer();
|
||||
@@ -54,7 +52,10 @@ class AttributeViewer {
|
||||
instance_sub_ = create_sub("instance", res.shaders.uniform_color.get());
|
||||
}
|
||||
|
||||
void object_sync(const ObjectRef &ob_ref, const State &state, Manager &manager)
|
||||
void object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources & /*res*/,
|
||||
const State &state) final
|
||||
{
|
||||
const DupliObject *dupli_object = DRW_object_get_dupli(ob_ref.object);
|
||||
const bool is_preview = dupli_object != nullptr &&
|
||||
@@ -78,7 +79,7 @@ class AttributeViewer {
|
||||
populate_for_geometry(ob_ref, state, manager);
|
||||
}
|
||||
|
||||
void pre_draw(Manager &manager, View &view)
|
||||
void pre_draw(Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -87,7 +88,7 @@ class AttributeViewer {
|
||||
manager.generate_commands(ps_, view);
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Axes {
|
||||
class Axes : Overlay {
|
||||
using EmptyInstanceBuf = ShapeInstanceBuf<ExtraInstanceData>;
|
||||
|
||||
private:
|
||||
@@ -24,12 +24,10 @@ class Axes {
|
||||
|
||||
EmptyInstanceBuf axes_buf = {selection_type_, "object_axes"};
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
Axes(const SelectionType selection_type) : selection_type_{selection_type} {};
|
||||
|
||||
void begin_sync(Resources & /*res*/, const State &state)
|
||||
void begin_sync(Resources & /*res*/, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d();
|
||||
|
||||
@@ -37,7 +35,10 @@ class Axes {
|
||||
axes_buf.clear();
|
||||
}
|
||||
|
||||
void object_sync(const ObjectRef &ob_ref, Resources &res, const State &state)
|
||||
void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -56,7 +57,7 @@ class Axes {
|
||||
axes_buf.append(data, res.select_id(ob_ref));
|
||||
}
|
||||
|
||||
void end_sync(Resources &res, ShapeCache &shapes, const State &state)
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -69,7 +70,7 @@ class Axes {
|
||||
axes_buf.end_sync(ps_, shapes.arrows.get());
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -8,18 +8,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Background {
|
||||
class Background : Overlay {
|
||||
private:
|
||||
PassSimple bg_ps_ = {"Background"};
|
||||
|
||||
GPUFrameBuffer *framebuffer_ref_ = nullptr;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
DRWState pass_state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_BACKGROUND;
|
||||
float4 color_override(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
@@ -89,7 +89,7 @@ class Background {
|
||||
bg_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
void draw_output(Framebuffer &framebuffer, Manager &manager, View & /*view*/)
|
||||
void draw_output(Framebuffer &framebuffer, Manager &manager, View & /*view*/) final
|
||||
{
|
||||
framebuffer_ref_ = framebuffer;
|
||||
manager.submit(bg_ps_);
|
||||
|
||||
110
source/blender/draw/engines/overlay/overlay_next_base.hh
Normal file
110
source/blender/draw/engines/overlay/overlay_next_base.hh
Normal file
@@ -0,0 +1,110 @@
|
||||
/* SPDX-FileCopyrightText: 2024 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/** \file
|
||||
* \ingroup overlay
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
/**
|
||||
* Base overlay class used for documentation.
|
||||
*
|
||||
* This is not actually used as all methods should always be called from the derived class.
|
||||
* There is still some external conditional logic and draw ordering that needs to be adjusted on a
|
||||
* per overlay basis inside the `overlay::Instance`.
|
||||
*/
|
||||
struct Overlay {
|
||||
/**
|
||||
* IMPORTANT: Overlays are used for every area using GPUViewport (i.e. View3D, UV Editor,
|
||||
* Compositor ...). They are also used for depth picking and selection. This means each overlays
|
||||
* must decide when they are active. The begin_sync method must initialize the `enabled_`
|
||||
* member depending on the context state, and every method should implement an early out cases.
|
||||
*/
|
||||
bool enabled_ = false;
|
||||
|
||||
/**
|
||||
* Synchronization creates and fill render passes based on context state and scene state.
|
||||
*
|
||||
* It runs for every scene update, so keep computation overhead low.
|
||||
* If it is triggered, everything in the scene is considered updated.
|
||||
* Note that this only concerns the render passes, the mesh batch caches are updated
|
||||
* on a per object-data basis.
|
||||
*
|
||||
* IMPORTANT: Synchronization must be view agnostic. That is, not rely on view position,
|
||||
* projection matrix or framebuffer size to do conditional pass creation. This is because, by
|
||||
* design, syncing can happen once and rendered multiple time (multi view rendering, stereo
|
||||
* rendering, orbiting view ...). Conditional pass creation, must be done in the drawing
|
||||
* callbacks, but they should remain the exception. Also there will be no access to object data
|
||||
* at this point.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates passes used for object sync and enabling / disabling internal overlay types
|
||||
* (e.g. vertices, edges, faces in edit mode).
|
||||
* Runs once at the start of the sync cycle.
|
||||
* Should also contain passes setup for overlays that are not per object overlays (e.g. Grid).
|
||||
*
|
||||
* This method must be implemented.
|
||||
*/
|
||||
/* TODO(fclem): Make it pure virtual. */
|
||||
virtual void begin_sync(Resources & /*res*/, const State & /*state*/){};
|
||||
|
||||
/**
|
||||
* Fills passes or buffers for each object.
|
||||
* Runs for each individual object state.
|
||||
* IMPORTANT: Can run only once for instances using the same state (#ObjectRef might contains
|
||||
* instancing data).
|
||||
*/
|
||||
virtual void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef & /*ob_ref*/,
|
||||
Resources & /*res*/,
|
||||
const State & /*state*/){};
|
||||
|
||||
/**
|
||||
* Fills passes or buffers for each object in edit mode.
|
||||
* Runs for each individual object state for a specific mode.
|
||||
* IMPORTANT: Can run only once for instances using the same state (#ObjectRef might contains
|
||||
* instancing data).
|
||||
*/
|
||||
virtual void edit_object_sync(Manager & /*manager*/,
|
||||
const ObjectRef & /*ob_ref*/,
|
||||
Resources & /*res*/,
|
||||
const State & /*state*/){};
|
||||
|
||||
/**
|
||||
* Finalize passes or buffers used for object sync.
|
||||
* Runs once at the start of the sync cycle.
|
||||
*/
|
||||
virtual void end_sync(Resources & /*res*/,
|
||||
const ShapeCache & /*shapes*/,
|
||||
const State & /*state*/){};
|
||||
|
||||
/**
|
||||
* Warms #PassMain and #PassSortable to avoid overhead of pipeline switching.
|
||||
* Should only contains calls to `generate_commands`.
|
||||
* NOTE: `view` is guaranteed to be the same view that will be passed to the draw functions.
|
||||
*/
|
||||
virtual void pre_draw(Manager & /*manager*/, View & /*view*/){};
|
||||
|
||||
/**
|
||||
* Drawing can be split into multiple passes. Each callback draws onto a specific framebuffer.
|
||||
* The order between each draw function is guaranteed. But it is not guaranteed that no other
|
||||
* overlay will render in between. The overlay can render to a temporary framebuffer before
|
||||
* resolving to the given framebuffer.
|
||||
*/
|
||||
|
||||
virtual void draw_on_render(GPUFrameBuffer * /*fb*/, Manager & /*manager*/, View & /*view*/){};
|
||||
virtual void draw(Framebuffer & /*fb*/, Manager & /*manager*/, View & /*view*/){};
|
||||
virtual void draw_line(Framebuffer & /*fb*/, Manager & /*manager*/, View & /*view*/){};
|
||||
virtual void draw_line_only(Framebuffer & /*fb*/, Manager & /*manager*/, View & /*view*/){};
|
||||
virtual void draw_color_only(Framebuffer & /*fb*/, Manager & /*manager*/, View & /*view*/){};
|
||||
virtual void draw_output(Framebuffer & /*fb*/, Manager & /*manager*/, View & /*view*/){};
|
||||
};
|
||||
|
||||
} // namespace blender::draw::overlay
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
#include "DNA_rigidbody_types.h"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
class Bounds {
|
||||
class Bounds : Overlay {
|
||||
using BoundsInstanceBuf = ShapeInstanceBuf<ExtraInstanceData>;
|
||||
|
||||
private:
|
||||
@@ -38,7 +38,7 @@ class Bounds {
|
||||
public:
|
||||
Bounds(const SelectionType selection_type) : call_buffers_{selection_type} {}
|
||||
|
||||
void begin_sync()
|
||||
void begin_sync(Resources & /*res*/, const State & /*state*/) final
|
||||
{
|
||||
call_buffers_.box.clear();
|
||||
call_buffers_.sphere.clear();
|
||||
@@ -48,7 +48,10 @@ class Bounds {
|
||||
call_buffers_.capsule_cap.clear();
|
||||
}
|
||||
|
||||
void object_sync(const ObjectRef &ob_ref, Resources &res, const State &state)
|
||||
void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
const Object *ob = ob_ref.object;
|
||||
const bool from_dupli = is_from_dupli_or_set(ob);
|
||||
@@ -181,7 +184,7 @@ class Bounds {
|
||||
}
|
||||
}
|
||||
|
||||
void end_sync(Resources &res, ShapeCache &shapes, const State &state)
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State &state) final
|
||||
{
|
||||
ps_.init();
|
||||
ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
@@ -198,7 +201,7 @@ class Bounds {
|
||||
call_buffers_.capsule_cap.end_sync(ps_, shapes.capsule_cap.get());
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
GPU_framebuffer_bind(framebuffer);
|
||||
manager.submit(ps_, view);
|
||||
|
||||
@@ -9,20 +9,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "BKE_camera.h"
|
||||
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
|
||||
#include "BKE_tracking.h"
|
||||
|
||||
#include "BLI_math_rotation.h"
|
||||
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
#include "DNA_camera_types.h"
|
||||
|
||||
#include "ED_view3d.hh"
|
||||
|
||||
#include "draw_manager_text.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
#include "overlay_next_empty.hh"
|
||||
#include "overlay_next_private.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
struct CameraInstanceData : public ExtraInstanceData {
|
||||
@@ -51,7 +46,7 @@ struct CameraInstanceData : public ExtraInstanceData {
|
||||
: ExtraInstanceData(p_matrix, color, 1.0f){};
|
||||
};
|
||||
|
||||
class Cameras {
|
||||
class Cameras : Overlay {
|
||||
using CameraInstanceBuf = ShapeInstanceBuf<ExtraInstanceData>;
|
||||
|
||||
private:
|
||||
@@ -83,7 +78,6 @@ class Cameras {
|
||||
Empties::CallBuffers empties{selection_type_};
|
||||
} call_buffers_;
|
||||
|
||||
bool enabled_ = false;
|
||||
bool images_enabled_ = false;
|
||||
bool extras_enabled_ = false;
|
||||
bool motion_tracking_enabled_ = false;
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
|
||||
#include "draw_cache_impl.hh"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Curves {
|
||||
class Curves : Overlay {
|
||||
private:
|
||||
PassSimple edit_curves_ps_ = {"Curve Edit"};
|
||||
PassSimple::Sub *edit_curves_points_ = nullptr;
|
||||
@@ -44,9 +44,8 @@ class Curves {
|
||||
View view_edit_cage = {"view_edit_cage"};
|
||||
float view_dist = 0.0f;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
/* TODO(fclem): Remove dependency on view. */
|
||||
void begin_sync(Resources &res, const State &state, const View &view)
|
||||
{
|
||||
enabled_ = state.is_space_v3d();
|
||||
@@ -174,7 +173,10 @@ class Curves {
|
||||
}
|
||||
}
|
||||
|
||||
void edit_object_sync(Manager &manager, const ObjectRef &ob_ref, Resources & /*res*/)
|
||||
void edit_object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources & /*res*/,
|
||||
const State & /*state*/) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -234,7 +236,7 @@ class Curves {
|
||||
}
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -246,7 +248,7 @@ class Curves {
|
||||
manager.submit(edit_legacy_surface_handles_ps, view);
|
||||
}
|
||||
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
#include "BKE_vfont.hh"
|
||||
#include "BLI_math_matrix.hh"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class EditText {
|
||||
class EditText : Overlay {
|
||||
|
||||
private:
|
||||
PassSimple ps_ = {"Selection&Cursor"};
|
||||
@@ -27,12 +27,10 @@ class EditText {
|
||||
StorageVectorBuffer<ObjectMatrices> text_cursor_buf;
|
||||
LinePrimitiveBuf box_line_buf_;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
EditText(SelectionType selection_type) : box_line_buf_(selection_type, "box_line_buf_") {}
|
||||
|
||||
void begin_sync(const State &state)
|
||||
void begin_sync(Resources & /*res*/, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d();
|
||||
text_selection_buf.clear();
|
||||
@@ -40,7 +38,10 @@ class EditText {
|
||||
box_line_buf_.clear();
|
||||
}
|
||||
|
||||
void edit_object_sync(const ObjectRef &ob_ref, const Resources &res)
|
||||
void edit_object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State & /*state*/) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -52,7 +53,7 @@ class EditText {
|
||||
add_boxes(res, cu, ob_ref.object->object_to_world());
|
||||
}
|
||||
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State &state)
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State &state) final
|
||||
{
|
||||
ps_.init();
|
||||
res.select_bind(ps_);
|
||||
@@ -121,7 +122,7 @@ class EditText {
|
||||
}
|
||||
}
|
||||
|
||||
void draw(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "overlay_next_base.hh"
|
||||
#include "overlay_next_image.hh"
|
||||
#include "overlay_next_private.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Empties {
|
||||
class Empties : Overlay {
|
||||
friend class Cameras;
|
||||
using EmptyInstanceBuf = ShapeInstanceBuf<ExtraInstanceData>;
|
||||
|
||||
@@ -46,13 +46,12 @@ class Empties {
|
||||
EmptyInstanceBuf image_buf = {selection_type_, "image_buf"};
|
||||
} call_buffers_;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
float4x4 depth_bias_winmat_;
|
||||
|
||||
public:
|
||||
Empties(const SelectionType selection_type) : call_buffers_{selection_type} {};
|
||||
|
||||
/* TODO(fclem): Remove dependency on view. */
|
||||
void begin_sync(Resources &res, const State &state, View &view)
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && state.show_extras();
|
||||
@@ -107,6 +106,7 @@ class Empties {
|
||||
call_buffers.image_buf.clear();
|
||||
}
|
||||
|
||||
/* TODO(fclem): Remove dependency on shapes. Pass it to the constructor. */
|
||||
void object_sync(const ObjectRef &ob_ref,
|
||||
ShapeCache &shapes,
|
||||
Manager &manager,
|
||||
@@ -165,7 +165,7 @@ class Empties {
|
||||
}
|
||||
}
|
||||
|
||||
void end_sync(Resources &res, ShapeCache &shapes, const State &state)
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -177,7 +177,7 @@ class Empties {
|
||||
}
|
||||
|
||||
static void end_sync(Resources &res,
|
||||
ShapeCache &shapes,
|
||||
const ShapeCache &shapes,
|
||||
const State &state,
|
||||
PassSimple::Sub &ps,
|
||||
CallBuffers &call_buffers)
|
||||
@@ -197,7 +197,7 @@ class Empties {
|
||||
call_buffers.image_buf.end_sync(ps, shapes.quad_wire.get());
|
||||
}
|
||||
|
||||
void pre_draw(Manager &manager, View &view)
|
||||
void pre_draw(Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -209,7 +209,7 @@ class Empties {
|
||||
manager.generate_commands(images_front_ps_, view);
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -10,19 +10,17 @@
|
||||
|
||||
#include "BKE_paint.hh"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Facing {
|
||||
class Facing : Overlay {
|
||||
|
||||
private:
|
||||
PassMain ps_ = {"Facing"};
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.v3d && state.show_face_orientation() && !state.xray_enabled &&
|
||||
!res.is_selection();
|
||||
@@ -51,7 +49,10 @@ class Facing {
|
||||
ps_.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
}
|
||||
|
||||
void object_sync(Manager &manager, const ObjectRef &ob_ref, const State &state)
|
||||
void object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources & /*res*/,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -81,7 +82,7 @@ class Facing {
|
||||
}
|
||||
}
|
||||
|
||||
void pre_draw(Manager &manager, View &view)
|
||||
void pre_draw(Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -90,7 +91,7 @@ class Facing {
|
||||
manager.generate_commands(ps_, view);
|
||||
}
|
||||
|
||||
void draw(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
#include "BKE_paint.hh"
|
||||
|
||||
#include "overlay_next_armature.hh"
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
class Fade {
|
||||
class Fade : Overlay {
|
||||
private:
|
||||
PassMain ps_ = {"FadeGeometry"};
|
||||
|
||||
@@ -24,10 +24,8 @@ class Fade {
|
||||
PassMain::Sub *armature_fade_geometry_active_ps_;
|
||||
PassMain::Sub *armature_fade_geometry_other_ps_;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
const bool do_edit_mesh_fade_geom = !state.xray_enabled && state.show_fade_inactive();
|
||||
enabled_ = state.is_space_v3d() && (do_edit_mesh_fade_geom || state.do_pose_fade_geom) &&
|
||||
@@ -72,7 +70,10 @@ class Fade {
|
||||
}
|
||||
}
|
||||
|
||||
void object_sync(Manager &manager, const ObjectRef &ob_ref, const State &state)
|
||||
void object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources & /*res*/,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -118,7 +119,7 @@ class Fade {
|
||||
}
|
||||
}
|
||||
|
||||
void pre_draw(Manager &manager, View &view)
|
||||
void pre_draw(Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -127,7 +128,7 @@ class Fade {
|
||||
manager.generate_commands(ps_, view);
|
||||
}
|
||||
|
||||
void draw(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
|
||||
#include "BKE_modifier.hh"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Fluids {
|
||||
class Fluids : Overlay {
|
||||
private:
|
||||
const SelectionType selection_type_;
|
||||
|
||||
@@ -36,7 +36,7 @@ class Fluids {
|
||||
public:
|
||||
Fluids(const SelectionType selection_type) : selection_type_(selection_type){};
|
||||
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
/* Against design. Should not sync depending on view. */
|
||||
float3 camera_direction = View("WorkaroundView", DRW_view_default_get()).viewinv().z_axis();
|
||||
@@ -73,7 +73,10 @@ class Fluids {
|
||||
cube_buf_.clear();
|
||||
}
|
||||
|
||||
void object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state)
|
||||
void object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
Object *ob = ob_ref.object;
|
||||
|
||||
@@ -227,7 +230,7 @@ class Fluids {
|
||||
}
|
||||
}
|
||||
|
||||
void end_sync(Resources &res, ShapeCache &shapes, const State & /*state*/)
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State & /*state*/) final
|
||||
{
|
||||
fluid_ps_.shader_set(res.shaders.extra_shape.get());
|
||||
fluid_ps_.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
@@ -235,7 +238,7 @@ class Fluids {
|
||||
cube_buf_.end_sync(fluid_ps_, shapes.cube.get());
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
GPU_framebuffer_bind(framebuffer);
|
||||
manager.submit(fluid_ps_, view);
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
|
||||
#include "DNA_object_force_types.h"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class ForceFields {
|
||||
class ForceFields : Overlay {
|
||||
using ForceFieldsInstanceBuf = ShapeInstanceBuf<ExtraInstanceData>;
|
||||
|
||||
private:
|
||||
@@ -39,7 +39,7 @@ class ForceFields {
|
||||
public:
|
||||
ForceFields(const SelectionType selection_type) : call_buffers_{selection_type} {}
|
||||
|
||||
void begin_sync()
|
||||
void begin_sync(Resources & /*res*/, const State & /*state*/) final
|
||||
{
|
||||
call_buffers_.field_force_buf.clear();
|
||||
call_buffers_.field_wind_buf.clear();
|
||||
@@ -50,7 +50,10 @@ class ForceFields {
|
||||
call_buffers_.field_cone_limit_buf.clear();
|
||||
}
|
||||
|
||||
void object_sync(const ObjectRef &ob_ref, Resources &res, const State &state)
|
||||
void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!ob_ref.object->pd || !ob_ref.object->pd->forcefield) {
|
||||
return;
|
||||
@@ -144,7 +147,7 @@ class ForceFields {
|
||||
}
|
||||
}
|
||||
|
||||
void end_sync(Resources &res, ShapeCache &shapes, const State &state)
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State &state) final
|
||||
{
|
||||
ps_.init();
|
||||
res.select_bind(ps_);
|
||||
@@ -162,7 +165,7 @@ class ForceFields {
|
||||
call_buffers_.field_cone_limit_buf.end_sync(ps_, shapes.field_cone_limit.get());
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
GPU_framebuffer_bind(framebuffer);
|
||||
manager.submit(ps_, view);
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
|
||||
#include "draw_manager_text.hh"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class GreasePencil {
|
||||
class GreasePencil : Overlay {
|
||||
private:
|
||||
PassSimple edit_grease_pencil_ps_ = {"GPencil Edit"};
|
||||
PassSimple::Sub *edit_points_ = nullptr;
|
||||
@@ -42,9 +42,8 @@ class GreasePencil {
|
||||
View view_edit_cage = {"view_edit_cage"};
|
||||
float view_dist = 0.0f;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
/* TODO(fclem): Remove dependency on view. */
|
||||
void begin_sync(Resources &res, const State &state, const View &view)
|
||||
{
|
||||
enabled_ = state.is_space_v3d();
|
||||
@@ -149,8 +148,8 @@ class GreasePencil {
|
||||
|
||||
void edit_object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
const State &state,
|
||||
Resources &res)
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -181,23 +180,26 @@ class GreasePencil {
|
||||
|
||||
void paint_object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
const State &state,
|
||||
Resources &res)
|
||||
Resources &res,
|
||||
const State &state)
|
||||
{
|
||||
/* Reuse same logic as edit mode. */
|
||||
edit_object_sync(manager, ob_ref, state, res);
|
||||
edit_object_sync(manager, ob_ref, res, state);
|
||||
}
|
||||
|
||||
void sculpt_object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
const State &state,
|
||||
Resources &res)
|
||||
Resources &res,
|
||||
const State &state)
|
||||
{
|
||||
/* Reuse same logic as edit mode. */
|
||||
edit_object_sync(manager, ob_ref, state, res);
|
||||
edit_object_sync(manager, ob_ref, res, state);
|
||||
}
|
||||
|
||||
void object_sync(const ObjectRef &ob_ref, Resources & /*res*/, State &state)
|
||||
void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources & /*res*/,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -221,7 +223,7 @@ class GreasePencil {
|
||||
}
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -231,7 +233,7 @@ class GreasePencil {
|
||||
manager.submit(grid_ps_, view);
|
||||
}
|
||||
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
#include "GPU_texture.hh"
|
||||
|
||||
#include "draw_shader_shared.hh"
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Grid {
|
||||
class Grid : Overlay {
|
||||
private:
|
||||
UniformBuffer<OVERLAY_GridData> data_;
|
||||
StorageVectorBuffer<float4> tile_pos_buf_;
|
||||
@@ -36,9 +36,8 @@ class Grid {
|
||||
OVERLAY_GridBits zneg_flag_ = OVERLAY_GridBits(0);
|
||||
OVERLAY_GridBits zpos_flag_ = OVERLAY_GridBits(0);
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
/* TODO(fclem): Remove dependency on view. */
|
||||
void begin_sync(Resources &res, ShapeCache &shapes, const State &state, const View &view)
|
||||
{
|
||||
enabled_ = init(state, view);
|
||||
@@ -109,7 +108,7 @@ class Grid {
|
||||
}
|
||||
}
|
||||
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -122,27 +122,27 @@ void Instance::begin_sync()
|
||||
|
||||
background.begin_sync(resources, state);
|
||||
motion_paths.begin_sync(resources, state);
|
||||
origins.begin_sync(state);
|
||||
origins.begin_sync(resources, state);
|
||||
outline.begin_sync(resources, state);
|
||||
|
||||
auto begin_sync_layer = [&](OverlayLayer &layer) {
|
||||
layer.armatures.begin_sync(resources, state);
|
||||
layer.attribute_viewer.begin_sync(resources, state);
|
||||
layer.axes.begin_sync(resources, state);
|
||||
layer.bounds.begin_sync();
|
||||
layer.bounds.begin_sync(resources, state);
|
||||
layer.cameras.begin_sync(resources, state, view);
|
||||
layer.curves.begin_sync(resources, state, view);
|
||||
layer.edit_text.begin_sync(state);
|
||||
layer.edit_text.begin_sync(resources, state);
|
||||
layer.empties.begin_sync(resources, state, view);
|
||||
layer.facing.begin_sync(resources, state);
|
||||
layer.fade.begin_sync(resources, state);
|
||||
layer.force_fields.begin_sync();
|
||||
layer.force_fields.begin_sync(resources, state);
|
||||
layer.fluids.begin_sync(resources, state);
|
||||
layer.grease_pencil.begin_sync(resources, state, view);
|
||||
layer.lattices.begin_sync(resources, state);
|
||||
layer.lights.begin_sync(state);
|
||||
layer.lights.begin_sync(resources, state);
|
||||
layer.light_probes.begin_sync(resources, state);
|
||||
layer.metaballs.begin_sync();
|
||||
layer.metaballs.begin_sync(resources, state);
|
||||
layer.meshes.begin_sync(resources, state, view);
|
||||
layer.mesh_uvs.begin_sync(resources, state);
|
||||
layer.mode_transfer.begin_sync(resources, state);
|
||||
@@ -151,7 +151,7 @@ void Instance::begin_sync()
|
||||
layer.particles.begin_sync(resources, state);
|
||||
layer.prepass.begin_sync(resources, state);
|
||||
layer.relations.begin_sync(resources, state);
|
||||
layer.speakers.begin_sync(state);
|
||||
layer.speakers.begin_sync(resources, state);
|
||||
layer.sculpts.begin_sync(resources, state);
|
||||
layer.wireframe.begin_sync(resources, state);
|
||||
};
|
||||
@@ -160,7 +160,7 @@ void Instance::begin_sync()
|
||||
|
||||
grid.begin_sync(resources, shapes, state, view);
|
||||
|
||||
anti_aliasing.begin_sync(resources);
|
||||
anti_aliasing.begin_sync(resources, state);
|
||||
xray_fade.begin_sync(resources, state);
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ void Instance::object_sync(ObjectRef &ob_ref, Manager &manager)
|
||||
|
||||
OverlayLayer &layer = object_is_in_front(ob_ref.object, state) ? infront : regular;
|
||||
|
||||
layer.mode_transfer.object_sync(manager, ob_ref, state);
|
||||
layer.mode_transfer.object_sync(manager, ob_ref, resources, state);
|
||||
|
||||
if (needs_prepass) {
|
||||
layer.prepass.object_sync(manager, ob_ref, resources, state);
|
||||
@@ -190,12 +190,12 @@ void Instance::object_sync(ObjectRef &ob_ref, Manager &manager)
|
||||
switch (ob_ref.object->type) {
|
||||
case OB_MESH:
|
||||
/* TODO(fclem): Make it part of a #Meshes. */
|
||||
layer.paints.object_sync(manager, ob_ref, state);
|
||||
layer.paints.object_sync(manager, ob_ref, resources, state);
|
||||
/* For wireframes. */
|
||||
layer.mesh_uvs.edit_object_sync(manager, ob_ref, state);
|
||||
layer.mesh_uvs.edit_object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
case OB_GREASE_PENCIL:
|
||||
layer.grease_pencil.paint_object_sync(manager, ob_ref, state, resources);
|
||||
layer.grease_pencil.paint_object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -206,10 +206,10 @@ void Instance::object_sync(ObjectRef &ob_ref, Manager &manager)
|
||||
switch (ob_ref.object->type) {
|
||||
case OB_MESH:
|
||||
/* TODO(fclem): Make it part of a #Meshes. */
|
||||
layer.sculpts.object_sync(manager, ob_ref, state);
|
||||
layer.sculpts.object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
case OB_GREASE_PENCIL:
|
||||
layer.grease_pencil.sculpt_object_sync(manager, ob_ref, state, resources);
|
||||
layer.grease_pencil.sculpt_object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -219,37 +219,37 @@ void Instance::object_sync(ObjectRef &ob_ref, Manager &manager)
|
||||
if (in_edit_mode && !state.hide_overlays) {
|
||||
switch (ob_ref.object->type) {
|
||||
case OB_MESH:
|
||||
layer.meshes.edit_object_sync(manager, ob_ref, state, resources);
|
||||
layer.meshes.edit_object_sync(manager, ob_ref, resources, state);
|
||||
/* TODO(fclem): Find a better place / condition. */
|
||||
layer.mesh_uvs.edit_object_sync(manager, ob_ref, state);
|
||||
layer.mesh_uvs.edit_object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
case OB_ARMATURE:
|
||||
layer.armatures.edit_object_sync(manager, ob_ref, state, resources);
|
||||
layer.armatures.edit_object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
case OB_SURF:
|
||||
case OB_CURVES_LEGACY:
|
||||
layer.curves.edit_object_sync_legacy(manager, ob_ref, resources);
|
||||
break;
|
||||
case OB_CURVES:
|
||||
layer.curves.edit_object_sync(manager, ob_ref, resources);
|
||||
layer.curves.edit_object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
case OB_LATTICE:
|
||||
layer.lattices.edit_object_sync(manager, ob_ref, resources);
|
||||
layer.lattices.edit_object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
case OB_MBALL:
|
||||
layer.metaballs.edit_object_sync(ob_ref, resources);
|
||||
layer.metaballs.edit_object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
case OB_FONT:
|
||||
layer.edit_text.edit_object_sync(ob_ref, resources);
|
||||
layer.edit_text.edit_object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
case OB_GREASE_PENCIL:
|
||||
layer.grease_pencil.edit_object_sync(manager, ob_ref, state, resources);
|
||||
layer.grease_pencil.edit_object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (state.is_wireframe_mode || !state.hide_overlays) {
|
||||
layer.wireframe.object_sync(manager, ob_ref, state, resources, in_edit_paint_mode);
|
||||
layer.wireframe.object_sync(manager, ob_ref, resources, state, in_edit_paint_mode);
|
||||
}
|
||||
|
||||
if (!state.hide_overlays) {
|
||||
@@ -262,7 +262,7 @@ void Instance::object_sync(ObjectRef &ob_ref, Manager &manager)
|
||||
break;
|
||||
case OB_ARMATURE:
|
||||
if (!in_edit_mode) {
|
||||
layer.armatures.object_sync(manager, ob_ref, state, resources);
|
||||
layer.armatures.object_sync(manager, ob_ref, resources, state);
|
||||
}
|
||||
break;
|
||||
case OB_LATTICE:
|
||||
@@ -271,46 +271,46 @@ void Instance::object_sync(ObjectRef &ob_ref, Manager &manager)
|
||||
}
|
||||
break;
|
||||
case OB_LAMP:
|
||||
layer.lights.object_sync(ob_ref, resources, state);
|
||||
layer.lights.object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
case OB_LIGHTPROBE:
|
||||
layer.light_probes.object_sync(ob_ref, resources, state);
|
||||
layer.light_probes.object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
case OB_MBALL:
|
||||
if (!in_edit_mode) {
|
||||
layer.metaballs.object_sync(ob_ref, resources, state);
|
||||
layer.metaballs.object_sync(manager, ob_ref, resources, state);
|
||||
}
|
||||
break;
|
||||
case OB_GREASE_PENCIL:
|
||||
layer.grease_pencil.object_sync(ob_ref, resources, state);
|
||||
layer.grease_pencil.object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
case OB_SPEAKER:
|
||||
layer.speakers.object_sync(ob_ref, resources, state);
|
||||
layer.speakers.object_sync(manager, ob_ref, resources, state);
|
||||
break;
|
||||
}
|
||||
layer.attribute_viewer.object_sync(ob_ref, state, manager);
|
||||
layer.bounds.object_sync(ob_ref, resources, state);
|
||||
layer.facing.object_sync(manager, ob_ref, state);
|
||||
layer.fade.object_sync(manager, ob_ref, state);
|
||||
layer.force_fields.object_sync(ob_ref, resources, state);
|
||||
layer.attribute_viewer.object_sync(manager, ob_ref, resources, state);
|
||||
layer.bounds.object_sync(manager, ob_ref, resources, state);
|
||||
layer.facing.object_sync(manager, ob_ref, resources, state);
|
||||
layer.fade.object_sync(manager, ob_ref, resources, state);
|
||||
layer.force_fields.object_sync(manager, ob_ref, resources, state);
|
||||
layer.fluids.object_sync(manager, ob_ref, resources, state);
|
||||
layer.particles.object_sync(manager, ob_ref, resources, state);
|
||||
layer.relations.object_sync(ob_ref, resources, state);
|
||||
layer.axes.object_sync(ob_ref, resources, state);
|
||||
layer.names.object_sync(ob_ref, resources, state);
|
||||
layer.relations.object_sync(manager, ob_ref, resources, state);
|
||||
layer.axes.object_sync(manager, ob_ref, resources, state);
|
||||
layer.names.object_sync(manager, ob_ref, resources, state);
|
||||
|
||||
motion_paths.object_sync(ob_ref, resources, state);
|
||||
origins.object_sync(ob_ref, resources, state);
|
||||
motion_paths.object_sync(manager, ob_ref, resources, state);
|
||||
origins.object_sync(manager, ob_ref, resources, state);
|
||||
|
||||
if (object_is_selected(ob_ref) && !in_edit_paint_mode) {
|
||||
outline.object_sync(manager, ob_ref, state);
|
||||
outline.object_sync(manager, ob_ref, resources, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Instance::end_sync()
|
||||
{
|
||||
origins.end_sync(resources, state);
|
||||
origins.end_sync(resources, shapes, state);
|
||||
resources.end_sync();
|
||||
|
||||
auto end_sync_layer = [&](OverlayLayer &layer) {
|
||||
@@ -325,7 +325,7 @@ void Instance::end_sync()
|
||||
layer.light_probes.end_sync(resources, shapes, state);
|
||||
layer.mesh_uvs.end_sync(resources, shapes, state);
|
||||
layer.metaballs.end_sync(resources, shapes, state);
|
||||
layer.relations.end_sync(resources, state);
|
||||
layer.relations.end_sync(resources, shapes, state);
|
||||
layer.fluids.end_sync(resources, shapes, state);
|
||||
layer.speakers.end_sync(resources, shapes, state);
|
||||
};
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ED_lattice.hh"
|
||||
|
||||
#include "draw_cache_impl.hh"
|
||||
#include "draw_common_c.hh"
|
||||
#include "overlay_next_private.hh"
|
||||
|
||||
#include "ED_lattice.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Lattices {
|
||||
class Lattices : Overlay {
|
||||
private:
|
||||
PassMain ps_ = {"Lattice"};
|
||||
|
||||
@@ -24,10 +24,8 @@ class Lattices {
|
||||
PassMain::Sub *edit_lattice_wire_ps_;
|
||||
PassMain::Sub *edit_lattice_point_ps_;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d();
|
||||
enabled_ &= state.show_extras();
|
||||
@@ -58,7 +56,10 @@ class Lattices {
|
||||
res.select_bind(ps_);
|
||||
}
|
||||
|
||||
void edit_object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res)
|
||||
void edit_object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State & /*state*/) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -75,7 +76,10 @@ class Lattices {
|
||||
}
|
||||
}
|
||||
|
||||
void object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state)
|
||||
void object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -94,7 +98,7 @@ class Lattices {
|
||||
}
|
||||
}
|
||||
|
||||
void pre_draw(Manager &manager, View &view)
|
||||
void pre_draw(Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -103,7 +107,7 @@ class Lattices {
|
||||
manager.generate_commands(ps_, view);
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Lights {
|
||||
class Lights : Overlay {
|
||||
using LightInstanceBuf = ShapeInstanceBuf<ExtraInstanceData>;
|
||||
using GroundLineInstanceBuf = ShapeInstanceBuf<float4>;
|
||||
|
||||
@@ -36,12 +36,10 @@ class Lights {
|
||||
LightInstanceBuf area_square_buf = {selection_type_, "area_square_buf"};
|
||||
} call_buffers_{selection_type_};
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
Lights(const SelectionType selection_type) : selection_type_(selection_type){};
|
||||
|
||||
void begin_sync(const State &state)
|
||||
void begin_sync(Resources & /*res*/, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && state.show_extras();
|
||||
if (!enabled_) {
|
||||
@@ -61,7 +59,10 @@ class Lights {
|
||||
call_buffers_.area_square_buf.clear();
|
||||
}
|
||||
|
||||
void object_sync(const ObjectRef &ob_ref, Resources &res, const State &state)
|
||||
void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -152,7 +153,7 @@ class Lights {
|
||||
}
|
||||
}
|
||||
|
||||
void end_sync(Resources &res, ShapeCache &shapes, const State &state)
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -204,7 +205,7 @@ class Lights {
|
||||
}
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
#include "DNA_lightprobe_types.h"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class LightProbes {
|
||||
class LightProbes : Overlay {
|
||||
using LightProbeInstanceBuf = ShapeInstanceBuf<ExtraInstanceData>;
|
||||
using GroundLineInstanceBuf = ShapeInstanceBuf<float4>;
|
||||
using DotsInstanceBuf = ShapeInstanceBuf<float4x4>;
|
||||
@@ -39,12 +39,10 @@ class LightProbes {
|
||||
|
||||
} call_buffers_{selection_type_};
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
LightProbes(const SelectionType selection_type) : selection_type_(selection_type){};
|
||||
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && state.show_extras();
|
||||
if (!enabled_) {
|
||||
@@ -69,7 +67,10 @@ class LightProbes {
|
||||
res.select_bind(ps_dots_);
|
||||
}
|
||||
|
||||
void object_sync(const ObjectRef &ob_ref, Resources &res, const State &state)
|
||||
void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -181,7 +182,7 @@ class LightProbes {
|
||||
}
|
||||
}
|
||||
|
||||
void end_sync(Resources &res, ShapeCache &shapes, const State &state)
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -214,7 +215,7 @@ class LightProbes {
|
||||
}
|
||||
}
|
||||
|
||||
void pre_draw(Manager &manager, View &view)
|
||||
void pre_draw(Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -223,7 +224,7 @@ class LightProbes {
|
||||
manager.generate_commands(ps_dots_, view);
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -233,7 +234,7 @@ class LightProbes {
|
||||
manager.submit(ps_, view);
|
||||
}
|
||||
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -10,23 +10,23 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
|
||||
#include "BKE_customdata.hh"
|
||||
#include "BKE_editmesh.hh"
|
||||
#include "BKE_global.hh"
|
||||
#include "BKE_mask.h"
|
||||
#include "BKE_mesh_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_subdiv_modifier.hh"
|
||||
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "ED_image.hh"
|
||||
|
||||
#include "ED_view3d.hh"
|
||||
#include "GPU_capabilities.hh"
|
||||
|
||||
#include "draw_cache_impl.hh"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "draw_manager_text.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
@@ -34,7 +34,7 @@ constexpr int overlay_edit_text = V3D_OVERLAY_EDIT_EDGE_LEN | V3D_OVERLAY_EDIT_F
|
||||
V3D_OVERLAY_EDIT_FACE_ANG | V3D_OVERLAY_EDIT_EDGE_ANG |
|
||||
V3D_OVERLAY_EDIT_INDICES;
|
||||
|
||||
class Meshes {
|
||||
class Meshes : Overlay {
|
||||
private:
|
||||
PassSimple edit_mesh_normals_ps_ = {"Normals"};
|
||||
PassSimple::Sub *face_normals_ = nullptr;
|
||||
@@ -75,9 +75,8 @@ class Meshes {
|
||||
View view_edit_vert_ = {"view_edit_vert"};
|
||||
float view_dist_ = 0.0f;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
/* TODO(fclem): Remove dependency on view. */
|
||||
void begin_sync(Resources &res, const State &state, const View &view)
|
||||
{
|
||||
enabled_ = state.is_space_v3d();
|
||||
@@ -274,8 +273,8 @@ class Meshes {
|
||||
|
||||
void edit_object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
const State &state,
|
||||
Resources & /*res*/)
|
||||
Resources & /*res*/,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -351,7 +350,7 @@ class Meshes {
|
||||
}
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -384,7 +383,7 @@ class Meshes {
|
||||
GPU_debug_group_end();
|
||||
}
|
||||
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -415,7 +414,7 @@ class Meshes {
|
||||
static bool mesh_has_edit_cage(const Object *ob)
|
||||
{
|
||||
const Mesh &mesh = *static_cast<const Mesh *>(ob->data);
|
||||
if (mesh.runtime->edit_mesh.get() != nullptr) {
|
||||
if (mesh.runtime->edit_mesh != nullptr) {
|
||||
const Mesh *editmesh_eval_final = BKE_object_get_editmesh_eval_final(ob);
|
||||
const Mesh *editmesh_eval_cage = BKE_object_get_editmesh_eval_cage(ob);
|
||||
|
||||
@@ -448,7 +447,7 @@ class Meshes {
|
||||
}
|
||||
};
|
||||
|
||||
class MeshUVs {
|
||||
class MeshUVs : Overlay {
|
||||
private:
|
||||
PassSimple analysis_ps_ = {"Mesh Analysis"};
|
||||
|
||||
@@ -510,10 +509,8 @@ class MeshUVs {
|
||||
/* Set of original objects that have been drawn. */
|
||||
Set<const Object *> drawn_object_set_;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_image();
|
||||
|
||||
@@ -708,7 +705,10 @@ class MeshUVs {
|
||||
drawn_object_set_.clear();
|
||||
}
|
||||
|
||||
void edit_object_sync(Manager &manager, const ObjectRef &ob_ref, const State &state)
|
||||
void edit_object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources & /*res*/,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_ || ob_ref.object->type != OB_MESH) {
|
||||
return;
|
||||
@@ -781,7 +781,7 @@ class MeshUVs {
|
||||
}
|
||||
}
|
||||
|
||||
void end_sync(Resources &res, ShapeCache &shapes, const State &state)
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -899,7 +899,7 @@ class MeshUVs {
|
||||
}
|
||||
}
|
||||
|
||||
void draw(GPUFrameBuffer *framebuffer, Manager &manager, View &view)
|
||||
void draw(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -939,7 +939,7 @@ class MeshUVs {
|
||||
GPU_debug_group_end();
|
||||
}
|
||||
|
||||
void draw_on_render(GPUFrameBuffer *framebuffer, Manager &manager, View &view)
|
||||
void draw_on_render(GPUFrameBuffer *framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_shader_shared.h"
|
||||
|
||||
#include "ED_mball.hh"
|
||||
|
||||
#include "overlay_next_base.hh"
|
||||
#include "overlay_shader_shared.h"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Metaballs {
|
||||
class Metaballs : Overlay {
|
||||
using SphereOutlineInstanceBuf = ShapeInstanceBuf<BoneInstanceData>;
|
||||
|
||||
private:
|
||||
@@ -28,12 +28,15 @@ class Metaballs {
|
||||
public:
|
||||
Metaballs(const SelectionType selection_type) : selection_type_(selection_type){};
|
||||
|
||||
void begin_sync()
|
||||
void begin_sync(Resources & /*res*/, const State & /*state*/) final
|
||||
{
|
||||
circle_buf_.clear();
|
||||
}
|
||||
|
||||
void edit_object_sync(const ObjectRef &ob_ref, Resources &res)
|
||||
void edit_object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State & /*state*/) final
|
||||
{
|
||||
const Object *ob = ob_ref.object;
|
||||
const MetaBall *mb = static_cast<MetaBall *>(ob->data);
|
||||
@@ -62,7 +65,10 @@ class Metaballs {
|
||||
}
|
||||
}
|
||||
|
||||
void object_sync(const ObjectRef &ob_ref, Resources &res, const State &state)
|
||||
void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
const Object *ob = ob_ref.object;
|
||||
const MetaBall *mb = static_cast<MetaBall *>(ob->data);
|
||||
@@ -77,7 +83,7 @@ class Metaballs {
|
||||
}
|
||||
}
|
||||
|
||||
void end_sync(Resources &res, ShapeCache &shapes, const State &state)
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State &state) final
|
||||
{
|
||||
ps_.init();
|
||||
ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
@@ -91,7 +97,7 @@ class Metaballs {
|
||||
circle_buf_.end_sync(ps_, shapes.metaball_wire_circle.get());
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
GPU_framebuffer_bind(framebuffer);
|
||||
manager.submit(ps_, view);
|
||||
|
||||
@@ -8,11 +8,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "BKE_paint.hh"
|
||||
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class ModeTransfer {
|
||||
class ModeTransfer : Overlay {
|
||||
private:
|
||||
PassSimple ps_ = {"ModeTransfer"};
|
||||
|
||||
@@ -20,13 +22,11 @@ class ModeTransfer {
|
||||
|
||||
double current_time_ = 0.0;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
/* True if any object used was synced using this overlay. */
|
||||
bool any_animated_ = false;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && !res.is_selection();
|
||||
|
||||
@@ -50,7 +50,10 @@ class ModeTransfer {
|
||||
any_animated_ = false;
|
||||
}
|
||||
|
||||
void object_sync(Manager &manager, const ObjectRef &ob_ref, const State &state)
|
||||
void object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources & /*res*/,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -90,7 +93,7 @@ class ModeTransfer {
|
||||
any_animated_ = true;
|
||||
}
|
||||
|
||||
void draw(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
#include "draw_manager_text.hh"
|
||||
|
||||
#include "overlay_next_armature.hh"
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class MotionPath {
|
||||
class MotionPath : Overlay {
|
||||
|
||||
private:
|
||||
PassSimple motion_path_ps_ = {"motion_path_ps_"};
|
||||
@@ -27,10 +27,8 @@ class MotionPath {
|
||||
PassSimple::Sub *line_ps_ = nullptr;
|
||||
PassSimple::Sub *vert_ps_ = nullptr;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.v3d && state.show_motion_paths() && !res.is_selection();
|
||||
if (!enabled_) {
|
||||
@@ -58,7 +56,10 @@ class MotionPath {
|
||||
}
|
||||
}
|
||||
|
||||
void object_sync(const ObjectRef &ob_ref, Resources & /*res*/, const State &state)
|
||||
void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources & /*res*/,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -81,7 +82,7 @@ class MotionPath {
|
||||
}
|
||||
}
|
||||
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -10,16 +10,13 @@
|
||||
|
||||
#include "draw_manager_text.hh"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Names {
|
||||
private:
|
||||
bool enabled_ = false;
|
||||
|
||||
class Names : Overlay {
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && !res.is_selection();
|
||||
enabled_ &= state.show_text;
|
||||
@@ -29,7 +26,10 @@ class Names {
|
||||
}
|
||||
}
|
||||
|
||||
void object_sync(const ObjectRef &ob_ref, Resources &res, const State &state)
|
||||
void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -8,22 +8,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
class Origins {
|
||||
class Origins : Overlay {
|
||||
private:
|
||||
StorageVectorBuffer<VertexData> point_buf_;
|
||||
select::SelectBuf select_buf_;
|
||||
|
||||
PassSimple ps_ = {"Origins"};
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
Origins(SelectionType selection_type) : select_buf_(selection_type) {}
|
||||
|
||||
void begin_sync(const State &state)
|
||||
void begin_sync(Resources & /*res*/, const State &state) final
|
||||
{
|
||||
const bool is_paint_mode = (state.object_mode &
|
||||
(OB_MODE_ALL_PAINT | OB_MODE_ALL_PAINT_GPENCIL |
|
||||
@@ -32,7 +30,10 @@ class Origins {
|
||||
point_buf_.clear();
|
||||
}
|
||||
|
||||
void object_sync(const ObjectRef &ob_ref, Resources &res, State &state)
|
||||
void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -66,7 +67,7 @@ class Origins {
|
||||
}
|
||||
}
|
||||
|
||||
void end_sync(Resources &res, const State &state)
|
||||
void end_sync(Resources &res, const ShapeCache & /*shapes*/, const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -81,7 +82,7 @@ class Origins {
|
||||
ps_.draw_procedural(GPU_PRIM_POINTS, 1, point_buf_.size());
|
||||
}
|
||||
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "overlay_next_base.hh"
|
||||
#include "overlay_next_grease_pencil.hh"
|
||||
#include "overlay_next_private.hh"
|
||||
|
||||
#include "draw_common.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Outline {
|
||||
class Outline : Overlay {
|
||||
private:
|
||||
/* Simple render pass that renders an object ID pass. */
|
||||
PassMain outline_prepass_ps_ = {"Prepass"};
|
||||
@@ -33,12 +33,10 @@ class Outline {
|
||||
|
||||
Framebuffer prepass_fb_ = {"outline.prepass_fb"};
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
overlay::GreasePencil::ViewParameters grease_pencil_view;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = !res.is_selection();
|
||||
enabled_ &= state.v3d && (state.v3d_flag & V3D_SELECT_OUTLINE);
|
||||
@@ -127,7 +125,10 @@ class Outline {
|
||||
}
|
||||
}
|
||||
|
||||
void object_sync(Manager &manager, const ObjectRef &ob_ref, const State &state)
|
||||
void object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources & /*res*/,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -194,7 +195,7 @@ class Outline {
|
||||
}
|
||||
}
|
||||
|
||||
void pre_draw(Manager &manager, View &view)
|
||||
void pre_draw(Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -203,6 +204,7 @@ class Outline {
|
||||
manager.generate_commands(outline_prepass_ps_, view);
|
||||
}
|
||||
|
||||
/* TODO(fclem): Remove dependency on Resources. */
|
||||
void draw_line_only(Framebuffer &framebuffer, Resources &res, Manager &manager, View &view)
|
||||
{
|
||||
if (!enabled_) {
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
|
||||
#include "draw_cache_impl.hh"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Paints {
|
||||
class Paints : Overlay {
|
||||
|
||||
private:
|
||||
/* Draw selection state on top of the mesh to communicate which areas can be painted on. */
|
||||
@@ -36,10 +36,8 @@ class Paints {
|
||||
bool show_wires_ = false;
|
||||
bool show_paint_mask_ = false;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ =
|
||||
state.is_space_v3d() && !res.is_selection() &&
|
||||
@@ -139,7 +137,10 @@ class Paints {
|
||||
}
|
||||
}
|
||||
|
||||
void object_sync(Manager &manager, const ObjectRef &ob_ref, const State &state)
|
||||
void object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources & /*res*/,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -222,7 +223,7 @@ class Paints {
|
||||
}
|
||||
}
|
||||
|
||||
void draw(GPUFrameBuffer *framebuffer, Manager &manager, View &view)
|
||||
void draw(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -8,18 +8,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BKE_pointcache.h"
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
#include "DNA_collection_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
|
||||
#include "BKE_pointcache.h"
|
||||
|
||||
#include "ED_particle.hh"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Particles {
|
||||
class Particles : Overlay {
|
||||
private:
|
||||
PassMain particle_ps_ = {"particle_ps_"};
|
||||
PassMain::Sub *dot_ps_ = nullptr;
|
||||
@@ -34,10 +33,8 @@ class Particles {
|
||||
bool show_point_inner_ = false;
|
||||
bool show_point_tip_ = false;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d();
|
||||
|
||||
@@ -136,7 +133,7 @@ class Particles {
|
||||
void edit_object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources & /*res*/,
|
||||
const State &state)
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -198,7 +195,10 @@ class Particles {
|
||||
}
|
||||
}
|
||||
|
||||
void object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state)
|
||||
void object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -280,7 +280,7 @@ class Particles {
|
||||
}
|
||||
}
|
||||
|
||||
void pre_draw(Manager &manager, View &view)
|
||||
void pre_draw(Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -289,7 +289,7 @@ class Particles {
|
||||
manager.generate_commands(particle_ps_, view);
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -299,7 +299,7 @@ class Particles {
|
||||
manager.submit_only(particle_ps_, view);
|
||||
}
|
||||
|
||||
void draw(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -11,14 +11,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BKE_paint.hh"
|
||||
|
||||
#include "DNA_particle_types.h"
|
||||
|
||||
#include "draw_sculpt.hh"
|
||||
|
||||
#include "overlay_next_base.hh"
|
||||
#include "overlay_next_grease_pencil.hh"
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_particle.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Prepass {
|
||||
class Prepass : Overlay {
|
||||
private:
|
||||
PassMain ps_ = {"prepass"};
|
||||
PassMain::Sub *mesh_ps_ = nullptr;
|
||||
@@ -27,13 +32,12 @@ class Prepass {
|
||||
PassMain::Sub *point_cloud_ps_ = nullptr;
|
||||
PassMain::Sub *grease_pencil_ps_ = nullptr;
|
||||
|
||||
bool enabled_ = false;
|
||||
bool use_material_slot_selection_ = false;
|
||||
|
||||
overlay::GreasePencil::ViewParameters grease_pencil_view;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d();
|
||||
|
||||
@@ -116,8 +120,8 @@ class Prepass {
|
||||
/* Case where the render engine should have rendered it, but we need to draw it for
|
||||
* selection purpose. */
|
||||
if (handle.raw == 0u) {
|
||||
handle = manager.resource_handle_for_psys(ob_ref,
|
||||
Particles::dupli_matrix_get(ob_ref));
|
||||
handle = manager.resource_handle_for_psys(
|
||||
ob_ref, overlay::Particles::dupli_matrix_get(ob_ref));
|
||||
}
|
||||
|
||||
select::ID select_id = use_material_slot_selection_ ?
|
||||
@@ -146,7 +150,10 @@ class Prepass {
|
||||
}
|
||||
}
|
||||
|
||||
void object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state)
|
||||
void object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -240,7 +247,7 @@ class Prepass {
|
||||
}
|
||||
}
|
||||
|
||||
void pre_draw(Manager &manager, View &view)
|
||||
void pre_draw(Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -249,7 +256,7 @@ class Prepass {
|
||||
manager.generate_commands(ps_, view);
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -9,16 +9,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "BKE_constraint.h"
|
||||
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_rigidbody_types.h"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Relations {
|
||||
class Relations : Overlay {
|
||||
|
||||
private:
|
||||
PassSimple ps_ = {"Relations"};
|
||||
@@ -26,8 +27,6 @@ class Relations {
|
||||
LinePrimitiveBuf relations_buf_;
|
||||
PointPrimitiveBuf points_buf_;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
Relations(SelectionType selection_type)
|
||||
: relations_buf_(selection_type, "relations_buf_"),
|
||||
@@ -35,7 +34,7 @@ class Relations {
|
||||
{
|
||||
}
|
||||
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d();
|
||||
enabled_ &= (state.v3d_flag & V3D_HIDE_HELPLINES) == 0;
|
||||
@@ -45,7 +44,10 @@ class Relations {
|
||||
relations_buf_.clear();
|
||||
}
|
||||
|
||||
void object_sync(const ObjectRef &ob_ref, Resources &res, const State &state)
|
||||
void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -169,7 +171,7 @@ class Relations {
|
||||
}
|
||||
}
|
||||
|
||||
void end_sync(Resources &res, const State &state)
|
||||
void end_sync(Resources &res, const ShapeCache & /*shapes*/, const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -197,7 +199,7 @@ class Relations {
|
||||
}
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -9,18 +9,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "BKE_attribute.hh"
|
||||
#include "BKE_curves.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_paint_bvh.hh"
|
||||
#include "BKE_subdiv_ccg.hh"
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
|
||||
#include "bmesh.hh"
|
||||
|
||||
#include "draw_cache_impl.hh"
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Sculpts {
|
||||
class Sculpts : Overlay {
|
||||
|
||||
private:
|
||||
PassSimple sculpt_mask_ = {"SculptMaskAndFaceSet"};
|
||||
@@ -33,10 +37,8 @@ class Sculpts {
|
||||
bool show_face_set_ = false;
|
||||
bool show_mask_ = false;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
show_curves_cage_ = state.show_sculpt_curves_cage();
|
||||
show_face_set_ = state.show_sculpt_face_sets();
|
||||
@@ -89,7 +91,10 @@ class Sculpts {
|
||||
}
|
||||
}
|
||||
|
||||
void object_sync(Manager &manager, const ObjectRef &ob_ref, const State &state)
|
||||
void object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources & /*res*/,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -217,7 +222,7 @@ class Sculpts {
|
||||
}
|
||||
}
|
||||
|
||||
void draw_line(GPUFrameBuffer *framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -226,7 +231,7 @@ class Sculpts {
|
||||
manager.submit(sculpt_curve_cage_, view);
|
||||
}
|
||||
|
||||
void draw_on_render(GPUFrameBuffer *framebuffer, Manager &manager, View &view)
|
||||
void draw_on_render(GPUFrameBuffer *framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
|
||||
#include "DNA_speaker_types.h"
|
||||
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Speakers {
|
||||
class Speakers : Overlay {
|
||||
using SpeakerInstanceBuf = ShapeInstanceBuf<ExtraInstanceData>;
|
||||
|
||||
private:
|
||||
@@ -24,12 +24,10 @@ class Speakers {
|
||||
|
||||
SpeakerInstanceBuf speaker_buf_ = {selection_type_, "speaker_data_buf"};
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
Speakers(const SelectionType selection_type) : selection_type_(selection_type){};
|
||||
|
||||
void begin_sync(const State &state)
|
||||
void begin_sync(Resources & /*res*/, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && state.show_extras();
|
||||
|
||||
@@ -40,7 +38,10 @@ class Speakers {
|
||||
speaker_buf_.clear();
|
||||
}
|
||||
|
||||
void object_sync(const ObjectRef &ob_ref, Resources &res, const State &state)
|
||||
void object_sync(Manager & /*manager*/,
|
||||
const ObjectRef &ob_ref,
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -52,7 +53,7 @@ class Speakers {
|
||||
speaker_buf_.append({ob_ref.object->object_to_world(), color, 1.0f}, select_id);
|
||||
}
|
||||
|
||||
void end_sync(Resources &res, ShapeCache &shapes, const State &state)
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -68,7 +69,7 @@ class Speakers {
|
||||
speaker_buf_.end_sync(ps_, shapes.speaker.get());
|
||||
}
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view)
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
|
||||
#include "draw_common.hh"
|
||||
|
||||
#include "overlay_next_base.hh"
|
||||
#include "overlay_next_mesh.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class Wireframe {
|
||||
class Wireframe : Overlay {
|
||||
private:
|
||||
PassMain wireframe_ps_ = {"Wireframe"};
|
||||
struct ColoringPass {
|
||||
@@ -35,10 +36,8 @@ class Wireframe {
|
||||
/* Force display of wireframe on surface objects, regardless of the object display settings. */
|
||||
bool show_wire_ = false;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && (state.is_wireframe_mode || !state.hide_overlays);
|
||||
if (!enabled_) {
|
||||
@@ -101,8 +100,8 @@ class Wireframe {
|
||||
|
||||
void object_sync(Manager &manager,
|
||||
const ObjectRef &ob_ref,
|
||||
const State &state,
|
||||
Resources &res,
|
||||
const State &state,
|
||||
const bool in_edit_paint_mode)
|
||||
{
|
||||
if (!enabled_) {
|
||||
@@ -209,7 +208,7 @@ class Wireframe {
|
||||
}
|
||||
}
|
||||
|
||||
void pre_draw(Manager &manager, View &view)
|
||||
void pre_draw(Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
@@ -218,6 +217,7 @@ class Wireframe {
|
||||
manager.generate_commands(wireframe_ps_, view);
|
||||
}
|
||||
|
||||
/* TODO(fclem): Remove dependency on Resources. */
|
||||
void draw_line(Framebuffer &framebuffer, Resources &res, Manager &manager, View &view)
|
||||
{
|
||||
if (!enabled_) {
|
||||
|
||||
@@ -14,18 +14,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "overlay_next_private.hh"
|
||||
#include "overlay_next_base.hh"
|
||||
|
||||
namespace blender::draw::overlay {
|
||||
|
||||
class XrayFade {
|
||||
class XrayFade : Overlay {
|
||||
private:
|
||||
PassSimple xray_fade_ps_ = {"XrayFade"};
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
void begin_sync(Resources &res, State &state)
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.xray_enabled && (state.xray_opacity > 0.0f) && !res.is_selection();
|
||||
|
||||
@@ -50,7 +48,7 @@ class XrayFade {
|
||||
}
|
||||
}
|
||||
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View & /*view*/)
|
||||
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View & /*view*/) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
struct bContext;
|
||||
struct KeyBlock;
|
||||
struct Lattice;
|
||||
struct Object;
|
||||
|
||||
Reference in New Issue
Block a user