Blender  V3.3
Classes | Macros | Typedefs | Functions | Variables
gpencil_engine.c File Reference
#include "DRW_engine.h"
#include "DRW_render.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_shader_fx.h"
#include "BKE_camera.h"
#include "BKE_global.h"
#include "BLI_link_utils.h"
#include "BLI_listbase.h"
#include "BLI_memblock.h"
#include "DNA_camera_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "GPU_texture.h"
#include "GPU_uniform_buffer.h"
#include "gpencil_engine.h"
#include "DEG_depsgraph_query.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "UI_resources.h"

Go to the source code of this file.

Classes

struct  gpIterPopulateData
 

Macros

#define DRAW_NOW   2
 
#define DISABLE_BATCHING   0
 

Typedefs

typedef struct gpIterPopulateData gpIterPopulateData
 

Functions

void GPENCIL_engine_init (void *ved)
 
void GPENCIL_cache_init (void *ved)
 
static void gpencil_drawcall_flush (gpIterPopulateData *iter)
 
static void gpencil_drawcall_add (gpIterPopulateData *iter, struct GPUBatch *geom, bool instancing, int v_first, int v_count)
 
static void gpencil_stroke_cache_populate (bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps, void *thunk)
 
static void gpencil_sbuffer_cache_populate (gpIterPopulateData *iter)
 
static void gpencil_layer_cache_populate (bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *UNUSED(gps), void *thunk)
 
static void gpencil_sbuffer_cache_populate_fast (GPENCIL_Data *vedata, gpIterPopulateData *iter)
 
void GPENCIL_cache_populate (void *ved, Object *ob)
 
void GPENCIL_cache_finish (void *ved)
 
static void GPENCIL_draw_scene_depth_only (void *ved)
 
static void gpencil_draw_mask (GPENCIL_Data *vedata, GPENCIL_tObject *ob, GPENCIL_tLayer *layer)
 
static void GPENCIL_draw_object (GPENCIL_Data *vedata, GPENCIL_tObject *ob)
 
static void GPENCIL_fast_draw_start (GPENCIL_Data *vedata)
 
static void GPENCIL_fast_draw_end (GPENCIL_Data *vedata)
 
void GPENCIL_draw_scene (void *ved)
 
static void GPENCIL_engine_free (void)
 

Variables

static const DrawEngineDataSize GPENCIL_data_size = DRW_VIEWPORT_DATA_SIZE(GPENCIL_Data)
 
DrawEngineType draw_engine_gpencil_type
 

Macro Definition Documentation

◆ DISABLE_BATCHING

#define DISABLE_BATCHING   0

Definition at line 349 of file gpencil_engine.c.

◆ DRAW_NOW

#define DRAW_NOW   2

Definition at line 322 of file gpencil_engine.c.

Typedef Documentation

◆ gpIterPopulateData

Function Documentation

◆ GPENCIL_cache_finish()

void GPENCIL_cache_finish ( void ved)

◆ GPENCIL_cache_init()

void GPENCIL_cache_init ( void ved)

Definition at line 171 of file gpencil_engine.c.

References CameraDOFSettings::aperture_fstop, BKE_camera_object_dof_distance(), BKE_camera_sensor_size(), BKE_gpencil_layer_active_get(), CAM_DOF_ENABLED, GPENCIL_PrivateData::camera, GPENCIL_PrivateData::cfra, CTX_wm_manager(), Object::data, DEG_get_ctime(), DRWContextState::depsgraph, GPENCIL_PrivateData::depth_tx, GPENCIL_PrivateData::do_fast_drawing, GPENCIL_PrivateData::do_onion, Camera::dof, GPENCIL_PrivateData::dof_params, GPENCIL_PrivateData::draw_depth_only, DRW_cache_gpencil_sbuffer_stroke_data_get(), DRW_context_state_get(), DRW_PASS_CREATE, DRW_shgroup_call_procedural_triangles(), DRW_shgroup_create(), DRW_shgroup_uniform_bool(), DRW_shgroup_uniform_texture_ref(), DRW_shgroup_uniform_vec4(), DRW_STATE_DEPTH_LESS, DRW_STATE_LOGIC_INVERT, DRW_STATE_WRITE_COLOR, DRW_STATE_WRITE_DEPTH, DRW_texture_ensure_2d(), DRW_TEXTURE_FREE_SAFE, DRW_viewport_size_get(), ED_screen_animation_playing(), DRWContextState::evil_C, fabsf, GPENCIL_PrivateData::fade_3d_object_opacity, GPENCIL_PrivateData::fade_gp_object_opacity, GPENCIL_PrivateData::fade_layer_opacity, GPENCIL_Data::fbl, GPENCIL_PrivateData::fill_batch, CameraDOFSettings::flag, View3D::flag2, View3D::gp_flag, View3DOverlay::gpencil_fade_layer, View3DOverlay::gpencil_paper_opacity, GPENCIL_shader_depth_merge_get(), GPENCIL_shader_mask_invert_get(), GPENCIL_SIMPLIFY_AA, GPENCIL_SIMPLIFY_FILL, GPENCIL_SIMPLIFY_FX, View3DOverlay::gpencil_vertex_paint_opacity, GPU_DEPTH24_STENCIL8, GPU_R11F_G11F_B10F, if(), GPENCIL_PrivateData::is_render, GPENCIL_PrivateData::is_stroke_order_3d, GPENCIL_PrivateData::is_viewport, Camera::lens, GPENCIL_PassList::mask_invert_ps, GPENCIL_PassList::merge_depth_ps, NULL, OB_CAMERA, OB_GPENCIL, OB_RENDER, GPENCIL_PrivateData::obact, DRWContextState::obact, GPENCIL_PrivateData::object_bound_mat, View3D::overlay, GPENCIL_StorageList::pd, GPENCIL_PrivateData::playing, GPENCIL_Data::psl, bGPdata::runtime, DRWContextState::rv3d, GPENCIL_PrivateData::sbuffer_gpd, GPENCIL_PrivateData::sbuffer_layer, GPENCIL_PrivateData::sbuffer_stroke, bGPdata_Runtime::sbuffer_used, scene, DRWContextState::scene, Camera::sensor_fit, Camera::sensor_x, Camera::sensor_y, sh, View3D::shading, GPENCIL_PrivateData::simplify_antialias, GPENCIL_PrivateData::simplify_fill, GPENCIL_PrivateData::simplify_fx, size(), GPENCIL_PrivateData::snapshot_buffer_dirty, GPENCIL_TextureList::snapshot_color_tx, GPENCIL_TextureList::snapshot_depth_tx, GPENCIL_FramebufferList::snapshot_fb, GPENCIL_TextureList::snapshot_reveal_tx, state, GPENCIL_Data::stl, GPENCIL_PrivateData::stroke_batch, GPENCIL_Data::txl, Object::type, View3DShading::type, GPENCIL_PrivateData::use_layer_fb, GPENCIL_PrivateData::use_mask_fb, GPENCIL_PrivateData::use_object_fb, GPENCIL_PrivateData::use_signed_fb, DRWContextState::v3d, V3D_GP_FADE_NOACTIVE_GPENCIL, V3D_GP_FADE_NOACTIVE_LAYERS, V3D_GP_FADE_OBJECTS, V3D_GP_SHOW_ONION_SKIN, V3D_HIDE_OVERLAYS, GPENCIL_PrivateData::vertex_paint_opacity, and RegionView3D::viewcamtexcofac.

Referenced by GPENCIL_render_to_image().

◆ GPENCIL_cache_populate()

void GPENCIL_cache_populate ( void ved,
Object ob 
)

Definition at line 580 of file gpencil_engine.c.

References bGPDlayer::actframe, BKE_gpencil_frame_retime_get(), BKE_gpencil_has_time_modifiers(), BKE_gpencil_layer_frame_get(), BKE_gpencil_visible_stroke_advanced_iter(), GPENCIL_PrivateData::cfra, Object::data, DRWContextState::depsgraph, GPENCIL_PrivateData::do_fast_drawing, GPENCIL_PrivateData::do_onion, gpIterPopulateData::do_sbuffer_call, DRW_context_state_get(), DRW_object_visibility_in_active_context(), DRW_state_is_image_render(), Object::dt, GPENCIL_TextureList::dummy_texture, GPENCIL_PrivateData::global_light_pool, GP_GETFRAME_USE_PREV, GP_ONION_GHOST_ALWAYS, gpencil_drawcall_flush(), gpencil_layer_cache_populate(), gpencil_light_pool_populate(), gpencil_material_pool_create(), gpencil_object_cache_add(), gpencil_sbuffer_cache_populate(), gpencil_sbuffer_cache_populate_fast(), gpencil_stroke_cache_populate(), gpencil_vfx_cache_populate(), if(), GPENCIL_PrivateData::is_render, bGPdata::layers, LISTBASE_FOREACH, gpIterPopulateData::mat_ofs, gpIterPopulateData::matpool, NULL, gpIterPopulateData::ob, OB_GPENCIL, OB_LAMP, OB_SOLID, OB_VISIBLE_SELF, bGPdata::onion_flag, gpIterPopulateData::pd, GPENCIL_StorageList::pd, GPENCIL_PrivateData::playing, bGPdata_Runtime::playing, GPENCIL_TextureList::render_depth_tx, bGPdata::runtime, GPENCIL_PrivateData::scene, GPENCIL_Data::stl, gpIterPopulateData::tex_fill, gpIterPopulateData::tex_stroke, gpIterPopulateData::tgp_ob, GPENCIL_Data::txl, Object::type, GPENCIL_PrivateData::use_lights, and GPENCIL_PrivateData::view_layer.

Referenced by GPENCIL_render_cache().

◆ gpencil_draw_mask()

static void gpencil_draw_mask ( GPENCIL_Data vedata,
GPENCIL_tObject ob,
GPENCIL_tLayer layer 
)
static

◆ GPENCIL_draw_object()

static void GPENCIL_draw_object ( GPENCIL_Data vedata,
GPENCIL_tObject ob 
)
static

◆ GPENCIL_draw_scene()

void GPENCIL_draw_scene ( void ved)

◆ GPENCIL_draw_scene_depth_only()

static void GPENCIL_draw_scene_depth_only ( void ved)
static

◆ gpencil_drawcall_add()

static void gpencil_drawcall_add ( gpIterPopulateData iter,
struct GPUBatch geom,
bool  instancing,
int  v_first,
int  v_count 
)
static

◆ gpencil_drawcall_flush()

static void gpencil_drawcall_flush ( gpIterPopulateData iter)
static

◆ GPENCIL_engine_free()

static void GPENCIL_engine_free ( void  )
static

Definition at line 964 of file gpencil_engine.c.

References GPENCIL_shader_free().

◆ GPENCIL_engine_init()

void GPENCIL_engine_init ( void ved)

Definition at line 44 of file gpencil_engine.c.

References BLI_memblock_clear(), GPENCIL_PrivateData::camera, View3D::camera, GPENCIL_PrivateData::camera_pos, GPENCIL_PrivateData::camera_z_axis, GPENCIL_PrivateData::camera_z_offset, View3DShading::color_type, copy_v3_fl(), copy_v3_v3(), DefaultFramebufferList::default_fb, DefaultTextureList::depth, dot_v3v3(), GPENCIL_PrivateData::draw_depth_only, GPENCIL_PrivateData::draw_wireframe, DRW_context_state_get(), DRW_state_is_fbo(), DRW_TEX_WRAP, DRW_texture_create_2d(), DRW_view_viewmat_get(), DRW_viewport_framebuffer_list_get(), DRW_viewport_texture_list_get(), GPENCIL_TextureList::dummy_texture, GPENCIL_PrivateData::dummy_tx, GPENCIL_Data::fbl, GPENCIL_PrivateData::first, View3D::flag2, GPENCIL_PrivateData::global_light_pool, View3D::gp_flag, GPENCIL_ViewLayerData::gp_layer_pool, GPENCIL_PrivateData::gp_layer_pool, GPENCIL_ViewLayerData::gp_light_pool, GPENCIL_PrivateData::gp_light_pool, GPENCIL_ViewLayerData::gp_maskbit_pool, GPENCIL_PrivateData::gp_maskbit_pool, GPENCIL_ViewLayerData::gp_material_pool, GPENCIL_PrivateData::gp_material_pool, GPENCIL_ViewLayerData::gp_object_pool, GPENCIL_PrivateData::gp_object_pool, GPENCIL_ViewLayerData::gp_vfx_pool, GPENCIL_PrivateData::gp_vfx_pool, gpencil_light_ambient_add(), gpencil_light_pool_add(), gpencil_light_pool_free(), gpencil_material_pool_free(), GPENCIL_view_layer_data_ensure(), GPU_RGBA8, World::horr, if(), GPENCIL_PrivateData::is_render, GPENCIL_PrivateData::is_viewport, GPENCIL_PrivateData::last, GPENCIL_PrivateData::last_light_pool, GPENCIL_PrivateData::last_material_pool, MEM_callocN, Object::mode, NULL, OB_GPENCIL, OB_MODE_VERTEX_GPENCIL, OB_RENDER, OB_SOLID, OB_WIRE, DRWContextState::obact, GPENCIL_StorageList::pd, RegionView3D::persp, GPENCIL_TextureList::render_depth_tx, GPENCIL_FramebufferList::render_fb, DRWContextState::rv3d, RV3D_CAMOB, GPENCIL_PrivateData::sbuffer_tobjects, GPENCIL_PrivateData::scene, DRWContextState::scene, GPENCIL_PrivateData::scene_depth_tx, GPENCIL_PrivateData::scene_fb, GPENCIL_PrivateData::shadeless_light_pool, View3D::shading, View3DShading::single_color, GPENCIL_Data::stl, View3DShading::studiolight_intensity, GPENCIL_PrivateData::tobjects, GPENCIL_PrivateData::tobjects_infront, GPENCIL_Data::txl, Object::type, View3DShading::type, GPENCIL_PrivateData::use_lighting, GPENCIL_PrivateData::use_lights, GPENCIL_PrivateData::use_multiedit_lines_only, GPENCIL_PrivateData::v3d, DRWContextState::v3d, GPENCIL_PrivateData::v3d_color_type, V3D_GP_SHOW_MULTIEDIT_LINES, V3D_HIDE_OVERLAYS, V3D_SHADING_VERTEX_COLOR, GPENCIL_PrivateData::v3d_single_color, V3D_USES_SCENE_LIGHTS, V3D_USES_SCENE_WORLD, GPENCIL_PrivateData::view_layer, DRWContextState::view_layer, world, Scene::world, GPENCIL_PrivateData::xray_alpha, XRAY_ALPHA, and XRAY_ENABLED.

Referenced by GPENCIL_render_to_image().

◆ GPENCIL_fast_draw_end()

static void GPENCIL_fast_draw_end ( GPENCIL_Data vedata)
static

◆ GPENCIL_fast_draw_start()

static void GPENCIL_fast_draw_start ( GPENCIL_Data vedata)
static

◆ gpencil_layer_cache_populate()

static void gpencil_layer_cache_populate ( bGPDlayer gpl,
bGPDframe gpf,
bGPDstroke UNUSEDgps,
void thunk 
)
static

◆ gpencil_sbuffer_cache_populate()

static void gpencil_sbuffer_cache_populate ( gpIterPopulateData iter)
static

◆ gpencil_sbuffer_cache_populate_fast()

static void gpencil_sbuffer_cache_populate_fast ( GPENCIL_Data vedata,
gpIterPopulateData iter 
)
static

◆ gpencil_stroke_cache_populate()

static void gpencil_stroke_cache_populate ( bGPDlayer gpl,
bGPDframe gpf,
bGPDstroke gps,
void thunk 
)
static

Variable Documentation

◆ draw_engine_gpencil_type

DrawEngineType draw_engine_gpencil_type
Initial value:
= {
N_("GpencilMode"),
NULL,
}
static const DrawEngineDataSize GPENCIL_data_size
void GPENCIL_cache_populate(void *ved, Object *ob)
void GPENCIL_draw_scene(void *ved)
static void GPENCIL_engine_free(void)
void GPENCIL_cache_init(void *ved)
void GPENCIL_cache_finish(void *ved)
void GPENCIL_engine_init(void *ved)
void GPENCIL_render_to_image(void *vedata, struct RenderEngine *engine, struct RenderLayer *render_layer, const rcti *rect)
#define N_(msgid)

Definition at line 971 of file gpencil_engine.c.

Referenced by DRW_draw_depth_loop(), DRW_draw_select_loop(), drw_engines_enable(), DRW_engines_register(), DRW_render_gpencil_to_image(), GPENCIL_antialiasing_init(), GPENCIL_cache_finish(), and GPENCIL_view_layer_data_ensure().

◆ GPENCIL_data_size

const DrawEngineDataSize GPENCIL_data_size = DRW_VIEWPORT_DATA_SIZE(GPENCIL_Data)
static

Definition at line 969 of file gpencil_engine.c.