- Make the module global and allow usage from anywhere. - Remove the matrix API for thread safety reason - Add lifetime management - Make display linked to the overlays for easy toggling ## Notes - Lifetime is in redraw. If there is 4 viewport redrawing, the lifetime decrement by 4 for each window redraw. This allows one viewport to be producer and another one being the consumer. - Display happens at the start of overlays. Any added visuals inside of the overlays drawing functions will be displayed the next redraw. - Redraw is not given to happen. It is only given if there is some scene / render update which tags the viewport to redraw. - Persistent lines are not reset on file load. Rel #137006 Pull Request: https://projects.blender.org/blender/blender/pulls/137106
97 lines
2.4 KiB
C++
97 lines
2.4 KiB
C++
/* SPDX-FileCopyrightText: 2016 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup draw
|
|
*/
|
|
|
|
/* Private functions / structs of the draw manager */
|
|
|
|
#pragma once
|
|
|
|
#include "DRW_engine.hh"
|
|
#include "DRW_render.hh"
|
|
|
|
#include "BLI_task.h"
|
|
#include "BLI_threads.h"
|
|
|
|
#include "GPU_batch.hh"
|
|
#include "GPU_context.hh"
|
|
#include "GPU_framebuffer.hh"
|
|
#include "GPU_viewport.hh"
|
|
|
|
struct DRWDebugModule;
|
|
struct DRWUniformChunk;
|
|
struct DRWViewData;
|
|
struct DRWTextStore;
|
|
struct DupliObject;
|
|
struct Object;
|
|
struct Mesh;
|
|
namespace blender::draw {
|
|
struct CurvesModule;
|
|
struct VolumeModule;
|
|
struct PointCloudModule;
|
|
struct DRW_Attributes;
|
|
struct DRW_MeshCDMask;
|
|
class CurveRefinePass;
|
|
class View;
|
|
} // namespace blender::draw
|
|
struct GPUMaterial;
|
|
struct GSet;
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
/** \name Memory Pools
|
|
* \{ */
|
|
|
|
/** Contains memory pools information. */
|
|
struct DRWData {
|
|
/** Instance data. */
|
|
DRWInstanceDataList *idatalist;
|
|
/** List of smoke textures to free after drawing. */
|
|
ListBase smoke_textures;
|
|
/** Per stereo view data. Contains engine data and default frame-buffers. */
|
|
DRWViewData *view_data[2];
|
|
/** Module storage. */
|
|
blender::draw::CurvesModule *curves_module;
|
|
blender::draw::VolumeModule *volume_module;
|
|
blender::draw::PointCloudModule *pointcloud_module;
|
|
/** Default view that feeds every engine. */
|
|
blender::draw::View *default_view;
|
|
|
|
/* Ensure modules are created. */
|
|
void modules_init();
|
|
/* Callbacks after one draw to clear transient data. */
|
|
void modules_exit();
|
|
};
|
|
|
|
/** \} */
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
/** \name Functions
|
|
* \{ */
|
|
|
|
/* Get thread local draw context. */
|
|
DRWContext &drw_get();
|
|
|
|
void drw_batch_cache_validate(Object *ob);
|
|
void drw_batch_cache_generate_requested(Object *ob, TaskGraph &task_graph);
|
|
|
|
/**
|
|
* \warning Only evaluated mesh data is handled by this delayed generation.
|
|
*/
|
|
void drw_batch_cache_generate_requested_delayed(Object *ob);
|
|
void drw_batch_cache_generate_requested_evaluated_mesh_or_curve(Object *ob, TaskGraph &task_graph);
|
|
|
|
namespace blender::draw {
|
|
|
|
void DRW_mesh_get_attributes(const Object &object,
|
|
const Mesh &mesh,
|
|
Span<const GPUMaterial *> materials,
|
|
DRW_Attributes *r_attrs,
|
|
DRW_MeshCDMask *r_cd_needed);
|
|
|
|
} // namespace blender::draw
|
|
|
|
/** \} */
|