Blender V4.3
gpencil_engine_c.cc File Reference
#include "DRW_engine.hh"
#include "DRW_render.hh"
#include "BKE_curves.hh"
#include "BKE_gpencil_geom_legacy.h"
#include "BKE_gpencil_legacy.h"
#include "BKE_grease_pencil.h"
#include "BKE_grease_pencil.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_object.hh"
#include "BKE_paint.hh"
#include "BKE_shader_fx.h"
#include "BKE_camera.h"
#include "BKE_global.hh"
#include "BLI_link_utils.h"
#include "BLI_listbase.h"
#include "BLI_memblock.h"
#include "BLI_virtual_array.hh"
#include "DNA_camera_types.h"
#include "DNA_gpencil_legacy_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "GPU_texture.hh"
#include "GPU_uniform_buffer.hh"
#include "gpencil_engine.h"
#include "DEG_depsgraph_query.hh"
#include "ED_grease_pencil.hh"
#include "ED_screen.hh"
#include "ED_view3d.hh"
#include "UI_resources.hh"

Go to the source code of this file.

Macros

#define DISABLE_BATCHING   0
 

Functions

void GPENCIL_engine_init (void *ved)
 
void GPENCIL_cache_init (void *ved)
 
static bool is_used_as_layer_mask_in_viewlayer (const GreasePencil &grease_pencil, const blender::bke::greasepencil::Layer &mask_layer, const ViewLayer &view_layer)
 
static bool use_layer_in_render (const GreasePencil &grease_pencil, const blender::bke::greasepencil::Layer &layer, const ViewLayer &view_layer, bool &r_is_used_as_mask)
 
static GPENCIL_tObjectgrease_pencil_object_cache_populate (GPENCIL_PrivateData *pd, GPENCIL_TextureList *txl, Object *ob)
 
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 ()
 

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 325 of file gpencil_engine_c.cc.

Function Documentation

◆ GPENCIL_cache_finish()

◆ GPENCIL_cache_init()

void GPENCIL_cache_init ( void * ved)

Definition at line 179 of file gpencil_engine_c.cc.

References CameraDOFSettings::aperture_fstop, BKE_camera_object_dof_distance(), BKE_camera_sensor_size(), 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, 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_framebuffer_ensure_config, GPU_FRAMEBUFFER_FREE_SAFE, GPU_R11F_G11F_B10F, int, 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, OB_CAMERA, OB_RENDER, DRWContextState::obact, GPENCIL_PrivateData::obact, GPENCIL_PrivateData::object_bound_mat, View3D::overlay, GPENCIL_StorageList::pd, GPENCIL_PrivateData::playing, GPENCIL_Data::psl, DRWContextState::rv3d, GPENCIL_PrivateData::sbuffer_gpd, GPENCIL_PrivateData::sbuffer_layer, GPENCIL_PrivateData::sbuffer_stroke, DRWContextState::scene, Camera::sensor_fit, Camera::sensor_x, Camera::sensor_y, View3D::shading, GPENCIL_PrivateData::simplify_antialias, GPENCIL_PrivateData::simplify_fill, GPENCIL_PrivateData::simplify_fx, 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()

◆ gpencil_draw_mask()

◆ GPENCIL_draw_object()

◆ GPENCIL_draw_scene()

◆ GPENCIL_draw_scene_depth_only()

◆ GPENCIL_engine_free()

static void GPENCIL_engine_free ( )
static

Definition at line 944 of file gpencil_engine_c.cc.

References GPENCIL_shader_free().

◆ GPENCIL_engine_init()

void GPENCIL_engine_init ( void * ved)

Definition at line 50 of file gpencil_engine_c.cc.

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_PrivateData::gp_layer_pool, GPENCIL_ViewLayerData::gp_layer_pool, GPENCIL_PrivateData::gp_light_pool, GPENCIL_ViewLayerData::gp_light_pool, GPENCIL_PrivateData::gp_maskbit_pool, GPENCIL_ViewLayerData::gp_maskbit_pool, GPENCIL_PrivateData::gp_material_pool, GPENCIL_ViewLayerData::gp_material_pool, GPENCIL_PrivateData::gp_object_pool, GPENCIL_ViewLayerData::gp_object_pool, GPENCIL_PrivateData::gp_vfx_pool, GPENCIL_ViewLayerData::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, 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, OB_MODE_VERTEX_GREASE_PENCIL, 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, DRWContextState::scene, GPENCIL_PrivateData::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, View3DShading::type, GPENCIL_PrivateData::use_lighting, GPENCIL_PrivateData::use_lights, GPENCIL_PrivateData::use_multiedit_lines_only, DRWContextState::v3d, GPENCIL_PrivateData::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, DRWContextState::view_layer, GPENCIL_PrivateData::view_layer, Scene::world, XRAY_ALPHA, GPENCIL_PrivateData::xray_alpha, and XRAY_ENABLED.

Referenced by GPENCIL_render_to_image().

◆ GPENCIL_fast_draw_end()

◆ GPENCIL_fast_draw_start()

◆ grease_pencil_object_cache_populate()

static GPENCIL_tObject * grease_pencil_object_cache_populate ( GPENCIL_PrivateData * pd,
GPENCIL_TextureList * txl,
Object * ob )
static

Definition at line 374 of file gpencil_engine_c.cc.

References GPENCIL_tLayer::base_shgrp, BKE_gpencil_material_settings(), bounds(), GPENCIL_PrivateData::cfra, color_tx, Object::data, GPENCIL_PrivateData::do_onion, DRW_shgroup_buffer_texture(), DRW_shgroup_call_range(), DRW_shgroup_create_sub(), DRW_shgroup_uniform_block, DRW_shgroup_uniform_float_copy(), DRW_shgroup_uniform_int_copy(), DRW_shgroup_uniform_texture(), DRW_shgroup_uniform_vec2_copy(), DRW_viewport_size_get(), Object::dtx, GPENCIL_TextureList::dummy_texture, ELEM, blender::bke::CurvesGeometry::evaluated_points_by_curve(), GreasePencil::flag, MaterialGPencilStyle::flag, GPENCIL_PrivateData::global_light_pool, GP_LAYER_TREE_NODE_USE_LIGHTS, GP_MATERIAL_FILL_SHOW, GP_MATERIAL_HIDE, GP_MATERIAL_HIDE_ONIONSKIN, GP_MATERIAL_STROKE_SHOW, GP_USE_MULTI_FRAME_EDITING, ToolSettings::gpencil_flags, gpencil_material_pool_create(), gpencil_material_resources_get(), gpencil_object_cache_add(), grease_pencil_layer_cache_add(), GREASE_PENCIL_STROKE_ORDER_3D, int, GPENCIL_PrivateData::is_render, Object::mode, OB_MODE_PAINT_GREASE_PENCIL, OB_MODE_VERTEX_GREASE_PENCIL, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_GREASE_PENCIL, OB_USE_GPENCIL_LIGHTS, pos, GPENCIL_PrivateData::scene, GPENCIL_PrivateData::shadeless_light_pool, GPENCIL_PrivateData::simplify_fill, Scene::toolsettings, GPENCIL_LightPool::ubo, use_layer_in_render(), GPENCIL_PrivateData::use_lighting, GPENCIL_PrivateData::use_multiedit_lines_only, and GPENCIL_PrivateData::view_layer.

Referenced by GPENCIL_cache_populate().

◆ is_used_as_layer_mask_in_viewlayer()

static bool is_used_as_layer_mask_in_viewlayer ( const GreasePencil & grease_pencil,
const blender::bke::greasepencil::Layer & mask_layer,
const ViewLayer & view_layer )
static

◆ use_layer_in_render()

static bool use_layer_in_render ( const GreasePencil & grease_pencil,
const blender::bke::greasepencil::Layer & layer,
const ViewLayer & view_layer,
bool & r_is_used_as_mask )
static

Variable Documentation

◆ draw_engine_gpencil_type

DrawEngineType draw_engine_gpencil_type
Initial value:
= {
nullptr,
nullptr,
N_("GpencilMode"),
nullptr,
nullptr,
nullptr,
nullptr,
}
void GPENCIL_render_to_image(void *vedata, struct RenderEngine *engine, struct RenderLayer *render_layer, const rcti *rect)
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 GPENCIL_cache_init(void *ved)
void GPENCIL_cache_finish(void *ved)
void GPENCIL_engine_init(void *ved)
#define N_(msgid)

Definition at line 951 of file gpencil_engine_c.cc.

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 949 of file gpencil_engine_c.cc.