Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/gpencil/gpencil_engine.h
| Show All 29 Lines | |||||
| struct MaterialGPencilStyle; | struct MaterialGPencilStyle; | ||||
| struct ModifierData; | struct ModifierData; | ||||
| struct Object; | struct Object; | ||||
| struct RenderEngine; | struct RenderEngine; | ||||
| struct RenderLayer; | struct RenderLayer; | ||||
| struct bGPDstroke; | struct bGPDstroke; | ||||
| struct tGPspoint; | struct tGPspoint; | ||||
| struct GPUBatch; | |||||
| struct GPUVertBuf; | |||||
| struct GPUVertFormat; | |||||
| #define GPENCIL_CACHE_BLOCK_SIZE 8 | #define GPENCIL_CACHE_BLOCK_SIZE 8 | ||||
| #define GPENCIL_MAX_SHGROUPS 65536 | #define GPENCIL_MAX_SHGROUPS 65536 | ||||
| #define GPENCIL_GROUPS_BLOCK_SIZE 1024 | #define GPENCIL_GROUPS_BLOCK_SIZE 1024 | ||||
| /* used to expand VBOs. Size has a big impact in the speed */ | /* used to expand VBOs. Size has a big impact in the speed */ | ||||
| #define GPENCIL_VBO_BLOCK_SIZE 128 | #define GPENCIL_VBO_BLOCK_SIZE 128 | ||||
| #define GPENCIL_COLOR_SOLID 0 | #define GPENCIL_COLOR_SOLID 0 | ||||
| #define GPENCIL_COLOR_TEXTURE 1 | #define GPENCIL_COLOR_TEXTURE 1 | ||||
| #define GPENCIL_COLOR_PATTERN 2 | #define GPENCIL_COLOR_PATTERN 2 | ||||
| #define GP_SIMPLIFY(scene) ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ENABLE)) | |||||
| #define GP_SIMPLIFY_ONPLAY(playing) \ | |||||
| (((playing == true) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY)) || \ | |||||
| ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY) == 0)) | |||||
| #define GP_SIMPLIFY_FILL(scene, playing) \ | |||||
| ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && \ | |||||
| (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FILL))) | |||||
| #define GP_SIMPLIFY_MODIF(scene, playing) \ | |||||
| ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && \ | |||||
| (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_MODIFIER))) | |||||
| #define GP_SIMPLIFY_FX(scene, playing) \ | |||||
| ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && \ | |||||
| (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FX))) | |||||
| #define GP_SIMPLIFY_BLEND(scene, playing) \ | |||||
| ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && \ | |||||
| (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_BLEND))) | |||||
| #define GP_IS_CAMERAVIEW ((rv3d != NULL) && (rv3d->persp == RV3D_CAMOB && v3d->camera)) | #define GP_IS_CAMERAVIEW ((rv3d != NULL) && (rv3d->persp == RV3D_CAMOB && v3d->camera)) | ||||
| /* *********** OBJECTS CACHE *********** */ | /* *********** OBJECTS CACHE *********** */ | ||||
| typedef struct tGPencilObjectCache_shgrp { | typedef struct tGPencilObjectCache_shgrp { | ||||
| /** type of blend (regular, add, mult, etc...) */ | /** type of blend (regular, add, mult, etc...) */ | ||||
| int mode; | int mode; | ||||
| /** flag to enable the layer clamping */ | /** flag to enable the layer clamping */ | ||||
| bool mask_layer; | bool mask_layer; | ||||
| ▲ Show 20 Lines • Show All 262 Lines • ▼ Show 20 Lines | typedef struct GPENCIL_e_data { | ||||
| struct GPUShader *gpencil_fx_rim_resolve_sh; | struct GPUShader *gpencil_fx_rim_resolve_sh; | ||||
| struct GPUShader *gpencil_fx_shadow_prepare_sh; | struct GPUShader *gpencil_fx_shadow_prepare_sh; | ||||
| struct GPUShader *gpencil_fx_shadow_resolve_sh; | struct GPUShader *gpencil_fx_shadow_resolve_sh; | ||||
| struct GPUShader *gpencil_fx_swirl_sh; | struct GPUShader *gpencil_fx_swirl_sh; | ||||
| struct GPUShader *gpencil_fx_wave_sh; | struct GPUShader *gpencil_fx_wave_sh; | ||||
| } GPENCIL_e_data; /* Engine data */ | } GPENCIL_e_data; /* Engine data */ | ||||
| /* GPUBatch Cache */ | /* GPUBatch Cache Element */ | ||||
| typedef struct GpencilBatchCacheElem { | typedef struct GpencilBatchCacheElem { | ||||
| GPUBatch *batch; | GPUBatch *batch; | ||||
| GPUVertBuf *vbo; | GPUVertBuf *vbo; | ||||
| int vbo_len; | int vbo_len; | ||||
| /* attr ids */ | /* attr ids */ | ||||
| GPUVertFormat format; | GPUVertFormat *format; | ||||
| uint pos_id; | uint pos_id; | ||||
| uint color_id; | uint color_id; | ||||
| uint thickness_id; | uint thickness_id; | ||||
| uint uvdata_id; | uint uvdata_id; | ||||
| uint prev_pos_id; | uint prev_pos_id; | ||||
| /* size for VBO alloc */ | /* size for VBO alloc */ | ||||
| int tot_vertex; | int tot_vertex; | ||||
| } GpencilBatchCacheElem; | } GpencilBatchCacheElem; | ||||
| /* Defines each batch group to define later the shgroup */ | |||||
| typedef struct GpencilBatchGroup { | typedef struct GpencilBatchGroup { | ||||
| struct bGPDlayer *gpl; /* reference to original layer */ | struct bGPDlayer *gpl; /* reference to original layer */ | ||||
| struct bGPDframe *gpf; /* reference to original frame */ | struct bGPDframe *gpf; /* reference to original frame */ | ||||
| struct bGPDstroke *gps; /* reference to original stroke */ | struct bGPDstroke *gps; /* reference to original stroke */ | ||||
| short type; /* type of element */ | short type; /* type of element */ | ||||
| bool onion; /* the group is part of onion skin */ | bool onion; /* the group is part of onion skin */ | ||||
| int vertex_idx; /* index of vertex data */ | int vertex_idx; /* index of vertex data */ | ||||
| } GpencilBatchGroup; | } GpencilBatchGroup; | ||||
| typedef enum GpencilBatchGroup_Type { | typedef enum GpencilBatchGroup_Type { | ||||
| eGpencilBatchGroupType_Stroke = 1, | eGpencilBatchGroupType_Stroke = 1, | ||||
| eGpencilBatchGroupType_Point = 2, | eGpencilBatchGroupType_Point = 2, | ||||
| eGpencilBatchGroupType_Fill = 3, | eGpencilBatchGroupType_Fill = 3, | ||||
| eGpencilBatchGroupType_Edit = 4, | eGpencilBatchGroupType_Edit = 4, | ||||
| eGpencilBatchGroupType_Edlin = 5, | eGpencilBatchGroupType_Edlin = 5, | ||||
| } GpencilBatchGroup_Type; | } GpencilBatchGroup_Type; | ||||
| /* Runtime data for GPU and evaluated frames after applying modifiers */ | |||||
| typedef struct GpencilBatchCache { | typedef struct GpencilBatchCache { | ||||
| GpencilBatchCacheElem b_stroke; | GpencilBatchCacheElem b_stroke; | ||||
| GpencilBatchCacheElem b_point; | GpencilBatchCacheElem b_point; | ||||
| GpencilBatchCacheElem b_fill; | GpencilBatchCacheElem b_fill; | ||||
| GpencilBatchCacheElem b_edit; | GpencilBatchCacheElem b_edit; | ||||
| GpencilBatchCacheElem b_edlin; | GpencilBatchCacheElem b_edlin; | ||||
| /* settings to determine if cache is invalid */ | /** Cache is dirty */ | ||||
| bool is_dirty; | bool is_dirty; | ||||
| /** Edit mode flag */ | |||||
| bool is_editmode; | bool is_editmode; | ||||
| /** Last cache frame */ | |||||
| int cache_frame; | int cache_frame; | ||||
| /* data with the shading groups */ | /** Total groups in arrays */ | ||||
| int grp_used; /* total groups in arrays */ | int grp_used; | ||||
| int grp_size; /* max size of the array */ | /** Max size of the array */ | ||||
| struct GpencilBatchGroup *grp_cache; /* array of elements */ | int grp_size; | ||||
| /** Array of cache elements */ | |||||
| int tot_layers; | struct GpencilBatchGroup *grp_cache; | ||||
| struct bGPDframe *derived_array; /* runtime data created by modifiers */ | |||||
| } GpencilBatchCache; | } GpencilBatchCache; | ||||
| /* general drawing functions */ | /* general drawing functions */ | ||||
| struct DRWShadingGroup *gpencil_shgroup_stroke_create(struct GPENCIL_Data *vedata, | struct DRWShadingGroup *gpencil_shgroup_stroke_create(struct GPENCIL_Data *vedata, | ||||
| struct DRWPass *pass, | struct DRWPass *pass, | ||||
| struct GPUShader *shader, | struct GPUShader *shader, | ||||
| struct Object *ob, | struct Object *ob, | ||||
| struct bGPdata *gpd, | struct bGPdata *gpd, | ||||
| ▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines | |||||