Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/gpencil/gpencil_engine.h
| Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
| #define GP_SIMPLIFY(scene) ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ENABLE)) | #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_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_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_MODIF(scene, playing) ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_MODIFIER))) | ||||
| #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 GPencilFXPixel { | |||||
| float loc[3]; | |||||
| float size[2]; | |||||
| float rgba[4]; | |||||
| int lines; | |||||
| } GPencilFXPixel; | |||||
| typedef struct GPencilFXBlur { | |||||
| float radius[2]; | |||||
| int samples; | |||||
| } GPencilFXBlur; | |||||
| typedef struct GPencilFXFlip { | |||||
| float flipmode[2]; /* use float to pass to shader, but only will be 0 or 1 */ | |||||
| } GPencilFXFlip; | |||||
| typedef struct GPencilFXLight { | |||||
| float loc[4]; | |||||
| float energy; | |||||
| float ambient; | |||||
| float specular; | |||||
| } GPencilFXLight; | |||||
| typedef struct GPencilFXSwirl { | |||||
| float loc[3]; | |||||
| float radius; | |||||
| float angle; | |||||
| int transparent; | |||||
| } GPencilFXSwirl; | |||||
| typedef struct GPencilFXWave { | |||||
| int orientation; | |||||
| float amplitude; | |||||
| float period; | |||||
| float phase; | |||||
| } GPencilFXWave; | |||||
| /* used to save gpencil objects */ | /* used to save gpencil objects */ | ||||
| typedef struct tGPencilObjectCache { | typedef struct tGPencilObjectCache { | ||||
| struct Object *ob; | struct Object *ob; | ||||
| int init_grp, end_grp; | int init_grp, end_grp; | ||||
| int idx; /*original index, can change after sort */ | int idx; /*original index, can change after sort */ | ||||
| /* effects */ | |||||
| DRWShadingGroup *fx_wave_sh; | |||||
| DRWShadingGroup *fx_blur_sh; | |||||
| DRWShadingGroup *fx_pixel_sh; | |||||
| DRWShadingGroup *fx_swirl_sh; | |||||
| DRWShadingGroup *fx_flip_sh; | |||||
| DRWShadingGroup *fx_light_sh; | |||||
| float zdepth; /* z-depth value to sort gp object */ | float zdepth; /* z-depth value to sort gp object */ | ||||
| bool temp_ob; /* flag to tag temporary objects that must be removed after drawing loop */ | bool temp_ob; /* flag to tag temporary objects that must be removed after drawing loop */ | ||||
| } tGPencilObjectCache; | } tGPencilObjectCache; | ||||
| /* *********** LISTS *********** */ | /* *********** LISTS *********** */ | ||||
| typedef struct GPENCIL_fx { | |||||
| GPencilFXBlur fx_blur; | |||||
| GPencilFXWave fx_wave; | |||||
| GPencilFXPixel fx_pixel; | |||||
| GPencilFXSwirl fx_swirl; | |||||
| GPencilFXFlip fx_flip; | |||||
| GPencilFXLight fx_light; | |||||
| } GPENCIL_fx; | |||||
| typedef struct GPENCIL_shgroup { | typedef struct GPENCIL_shgroup { | ||||
| int s_clamp; | int s_clamp; | ||||
| int stroke_style; | int stroke_style; | ||||
| int color_type; | int color_type; | ||||
| int mode; | int mode; | ||||
| int texture_mix; | int texture_mix; | ||||
| int texture_flip; | int texture_flip; | ||||
| Show All 23 Lines | typedef struct GPENCIL_Storage { | ||||
| const float *pixsize; | const float *pixsize; | ||||
| float render_pixsize; | float render_pixsize; | ||||
| int tonemapping; | int tonemapping; | ||||
| short multisamples; | short multisamples; | ||||
| /* simplify settings*/ | /* simplify settings*/ | ||||
| bool simplify_fill; | bool simplify_fill; | ||||
| bool simplify_modif; | bool simplify_modif; | ||||
| bool simplify_vfx; | bool simplify_fx; | ||||
| /* Render Matrices and data */ | /* Render Matrices and data */ | ||||
| float persmat[4][4], persinv[4][4]; | float persmat[4][4], persinv[4][4]; | ||||
| float viewmat[4][4], viewinv[4][4]; | float viewmat[4][4], viewinv[4][4]; | ||||
| float winmat[4][4], wininv[4][4]; | float winmat[4][4], wininv[4][4]; | ||||
| float view_vecs[2][4]; /* vec4[2] */ | float view_vecs[2][4]; /* vec4[2] */ | ||||
| Object *camera; /* camera pointer for render mode */ | |||||
| } GPENCIL_Storage; | } GPENCIL_Storage; | ||||
| typedef struct GPENCIL_StorageList { | typedef struct GPENCIL_StorageList { | ||||
| struct GPENCIL_Storage *storage; | struct GPENCIL_Storage *storage; | ||||
| struct g_data *g_data; | struct g_data *g_data; | ||||
| struct GPENCIL_shgroup *shgroups; | struct GPENCIL_shgroup *shgroups; | ||||
| struct GPENCIL_fx *fx; | |||||
| } GPENCIL_StorageList; | } GPENCIL_StorageList; | ||||
| typedef struct GPENCIL_PassList { | typedef struct GPENCIL_PassList { | ||||
| struct DRWPass *stroke_pass; | struct DRWPass *stroke_pass; | ||||
| struct DRWPass *edit_pass; | struct DRWPass *edit_pass; | ||||
| struct DRWPass *drawing_pass; | struct DRWPass *drawing_pass; | ||||
| struct DRWPass *mix_pass; | struct DRWPass *mix_pass; | ||||
| struct DRWPass *mix_pass_noblend; | struct DRWPass *mix_pass_noblend; | ||||
| struct DRWPass *background_pass; | struct DRWPass *background_pass; | ||||
| struct DRWPass *paper_pass; | struct DRWPass *paper_pass; | ||||
| /* effects */ | |||||
| struct DRWPass *fx_blur_pass; | |||||
| struct DRWPass *fx_flip_pass; | |||||
| struct DRWPass *fx_light_pass; | |||||
| struct DRWPass *fx_pixel_pass; | |||||
| struct DRWPass *fx_swirl_pass; | |||||
| struct DRWPass *fx_wave_pass; | |||||
| } GPENCIL_PassList; | } GPENCIL_PassList; | ||||
| typedef struct GPENCIL_FramebufferList { | typedef struct GPENCIL_FramebufferList { | ||||
| struct GPUFrameBuffer *main; | struct GPUFrameBuffer *main; | ||||
| struct GPUFrameBuffer *temp_fb_a; | struct GPUFrameBuffer *temp_fb_a; | ||||
| struct GPUFrameBuffer *temp_fb_b; | |||||
| struct GPUFrameBuffer *background_fb; | struct GPUFrameBuffer *background_fb; | ||||
| struct GPUFrameBuffer *multisample_fb; | struct GPUFrameBuffer *multisample_fb; | ||||
| } GPENCIL_FramebufferList; | } GPENCIL_FramebufferList; | ||||
| typedef struct GPENCIL_TextureList { | typedef struct GPENCIL_TextureList { | ||||
| struct GPUTexture *texture; | struct GPUTexture *texture; | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | typedef struct GPENCIL_e_data { | ||||
| struct GPUShader *gpencil_edit_point_sh; | struct GPUShader *gpencil_edit_point_sh; | ||||
| struct GPUShader *gpencil_line_sh; | struct GPUShader *gpencil_line_sh; | ||||
| struct GPUShader *gpencil_drawing_fill_sh; | struct GPUShader *gpencil_drawing_fill_sh; | ||||
| struct GPUShader *gpencil_fullscreen_sh; | struct GPUShader *gpencil_fullscreen_sh; | ||||
| struct GPUShader *gpencil_simple_fullscreen_sh; | struct GPUShader *gpencil_simple_fullscreen_sh; | ||||
| struct GPUShader *gpencil_background_sh; | struct GPUShader *gpencil_background_sh; | ||||
| struct GPUShader *gpencil_paper_sh; | struct GPUShader *gpencil_paper_sh; | ||||
| /* effects */ | |||||
| struct GPUShader *gpencil_fx_blur_sh; | |||||
| struct GPUShader *gpencil_fx_flip_sh; | |||||
| struct GPUShader *gpencil_fx_light_sh; | |||||
| struct GPUShader *gpencil_fx_pixel_sh; | |||||
| struct GPUShader *gpencil_fx_swirl_sh; | |||||
| struct GPUShader *gpencil_fx_wave_sh; | |||||
| /* textures */ | /* textures */ | ||||
| struct GPUTexture *background_depth_tx; | struct GPUTexture *background_depth_tx; | ||||
| struct GPUTexture *background_color_tx; | struct GPUTexture *background_color_tx; | ||||
| struct GPUTexture *gpencil_blank_texture; | struct GPUTexture *gpencil_blank_texture; | ||||
| /* runtime pointers texture */ | /* runtime pointers texture */ | ||||
| struct GPUTexture *input_depth_tx; | struct GPUTexture *input_depth_tx; | ||||
| struct GPUTexture *input_color_tx; | struct GPUTexture *input_color_tx; | ||||
| /* working textures */ | /* working textures */ | ||||
| struct GPUTexture *temp_color_tx_a; | struct GPUTexture *temp_color_tx_a; | ||||
| struct GPUTexture *temp_depth_tx_a; | struct GPUTexture *temp_depth_tx_a; | ||||
| struct GPUTexture *temp_color_tx_b; | |||||
| struct GPUTexture *temp_depth_tx_b; | |||||
| } GPENCIL_e_data; /* Engine data */ | } GPENCIL_e_data; /* Engine data */ | ||||
| /* Gwn_Batch Cache */ | /* Gwn_Batch Cache */ | ||||
| typedef struct GpencilBatchCache { | typedef struct GpencilBatchCache { | ||||
| /* For normal strokes, a variable number of batch can be needed depending of number of strokes. | /* For normal strokes, a variable number of batch can be needed depending of number of strokes. | ||||
| It could use the stroke number as total size, but when activate the onion skining, the number | It could use the stroke number as total size, but when activate the onion skining, the number | ||||
| can change, so the size is changed dinamically. | can change, so the size is changed dinamically. | ||||
| Show All 39 Lines | |||||
| /* geometry batch cache functions */ | /* geometry batch cache functions */ | ||||
| void gpencil_batch_cache_check_free_slots(struct Object *ob); | void gpencil_batch_cache_check_free_slots(struct Object *ob); | ||||
| struct GpencilBatchCache *gpencil_batch_cache_get(struct Object *ob, int cfra); | struct GpencilBatchCache *gpencil_batch_cache_get(struct Object *ob, int cfra); | ||||
| /* modifier functions */ | /* modifier functions */ | ||||
| void gpencil_instance_modifiers(struct GPENCIL_StorageList *stl, struct Object *ob); | void gpencil_instance_modifiers(struct GPENCIL_StorageList *stl, struct Object *ob); | ||||
| /* effects */ | |||||
| void GPENCIL_create_fx_shaders(struct GPENCIL_e_data *e_data); | |||||
| void GPENCIL_delete_fx_shaders(struct GPENCIL_e_data *e_data); | |||||
| void GPENCIL_create_fx_passes(struct GPENCIL_PassList *psl); | |||||
| void DRW_gpencil_fx_prepare( | |||||
| struct GPENCIL_e_data *e_data, struct GPENCIL_Data *vedata, | |||||
| struct tGPencilObjectCache *cache); | |||||
| void DRW_gpencil_fx_draw( | |||||
| struct GPENCIL_e_data *e_data, struct GPENCIL_Data *vedata, | |||||
| struct tGPencilObjectCache *cache); | |||||
| /* main functions */ | /* main functions */ | ||||
| void GPENCIL_engine_init(void *vedata); | void GPENCIL_engine_init(void *vedata); | ||||
| void GPENCIL_cache_init(void *vedata); | void GPENCIL_cache_init(void *vedata); | ||||
| void GPENCIL_cache_populate(void *vedata, struct Object *ob); | void GPENCIL_cache_populate(void *vedata, struct Object *ob); | ||||
| void GPENCIL_cache_finish(void *vedata); | void GPENCIL_cache_finish(void *vedata); | ||||
| void GPENCIL_draw_scene(void *vedata); | void GPENCIL_draw_scene(void *vedata); | ||||
| /* render */ | /* render */ | ||||
| Show All 23 Lines | |||||