Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| static LineartLineChain *lineart_chain_create(LineartRenderBuffer *rb) | static LineartLineChain *lineart_chain_create(LineartRenderBuffer *rb) | ||||
| { | { | ||||
| LineartLineChain *rlc; | LineartLineChain *rlc; | ||||
| rlc = lineart_mem_aquire(&rb->render_data_pool, sizeof(LineartLineChain)); | rlc = lineart_mem_acquire(&rb->render_data_pool, sizeof(LineartLineChain)); | ||||
| BLI_addtail(&rb->chains, rlc); | BLI_addtail(&rb->chains, rlc); | ||||
| return rlc; | return rlc; | ||||
| } | } | ||||
| static bool lineart_point_overlapping(LineartLineChainItem *rlci, | static bool lineart_point_overlapping(LineartLineChainItem *rlci, | ||||
| float x, | float x, | ||||
| float y, | float y, | ||||
| double threshold) | double threshold) | ||||
| Context not available. | |||||
| /* Because the new chain point is overlapping, just replace the type and occlusion level of the | /* Because the new chain point is overlapping, just replace the type and occlusion level of the | ||||
| * current point. This makes it so that the line to the point after this one has the correct | * current point. This makes it so that the line to the point after this one has the correct | ||||
| * type and level. */ | * type and level. */ | ||||
| LineartLineChainItem *old_rlci = rlc->chain.last; | LineartLineChainItem *old_rlci = rlc->chain.last; | ||||
| old_rlci->line_type = type; | old_rlci->line_type = type; | ||||
| old_rlci->occlusion = level; | old_rlci->occlusion = level; | ||||
| old_rlci->transparency_mask = transparency_mask; | old_rlci->transparency_mask = transparency_mask; | ||||
| return old_rlci; | return old_rlci; | ||||
| } | } | ||||
| rlci = lineart_mem_aquire(&rb->render_data_pool, sizeof(LineartLineChainItem)); | rlci = lineart_mem_acquire(&rb->render_data_pool, sizeof(LineartLineChainItem)); | ||||
| copy_v2_v2(rlci->pos, fbcoord); | copy_v2_v2(rlci->pos, fbcoord); | ||||
| copy_v3_v3(rlci->gpos, gpos); | copy_v3_v3(rlci->gpos, gpos); | ||||
| rlci->index = index; | rlci->index = index; | ||||
| copy_v3_v3(rlci->normal, normal); | copy_v3_v3(rlci->normal, normal); | ||||
| rlci->line_type = type & LRT_EDGE_FLAG_ALL_TYPE; | rlci->line_type = type & LRT_EDGE_FLAG_ALL_TYPE; | ||||
| rlci->occlusion = level; | rlci->occlusion = level; | ||||
| rlci->transparency_mask = transparency_mask; | rlci->transparency_mask = transparency_mask; | ||||
| BLI_addtail(&rlc->chain, rlci); | BLI_addtail(&rlc->chain, rlci); | ||||
| Context not available. | |||||
| int level, | int level, | ||||
| unsigned char transparency_mask, | unsigned char transparency_mask, | ||||
| size_t index) | size_t index) | ||||
| { | { | ||||
| LineartLineChainItem *rlci; | LineartLineChainItem *rlci; | ||||
| if (lineart_point_overlapping(rlc->chain.first, fbcoord[0], fbcoord[1], 1e-5)) { | if (lineart_point_overlapping(rlc->chain.first, fbcoord[0], fbcoord[1], 1e-5)) { | ||||
| return rlc->chain.first; | return rlc->chain.first; | ||||
| } | } | ||||
| rlci = lineart_mem_aquire(&rb->render_data_pool, sizeof(LineartLineChainItem)); | rlci = lineart_mem_acquire(&rb->render_data_pool, sizeof(LineartLineChainItem)); | ||||
| copy_v2_v2(rlci->pos, fbcoord); | copy_v2_v2(rlci->pos, fbcoord); | ||||
| copy_v3_v3(rlci->gpos, gpos); | copy_v3_v3(rlci->gpos, gpos); | ||||
| rlci->index = index; | rlci->index = index; | ||||
| copy_v3_v3(rlci->normal, normal); | copy_v3_v3(rlci->normal, normal); | ||||
| rlci->line_type = type & LRT_EDGE_FLAG_ALL_TYPE; | rlci->line_type = type & LRT_EDGE_FLAG_ALL_TYPE; | ||||
| rlci->occlusion = level; | rlci->occlusion = level; | ||||
| rlci->transparency_mask = transparency_mask; | rlci->transparency_mask = transparency_mask; | ||||
| BLI_addhead(&rlc->chain, rlci); | BLI_addhead(&rlc->chain, rlci); | ||||
| Context not available. | |||||