Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_outline.c
| Show First 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | static void gpencil_layer_cache_populate(bGPDlayer *gpl, | ||||
| iterData *iter = (iterData *)thunk; | iterData *iter = (iterData *)thunk; | ||||
| bGPdata *gpd = (bGPdata *)iter->ob->data; | bGPdata *gpd = (bGPdata *)iter->ob->data; | ||||
| const bool is_screenspace = (gpd->flag & GP_DATA_STROKE_KEEPTHICKNESS) != 0; | const bool is_screenspace = (gpd->flag & GP_DATA_STROKE_KEEPTHICKNESS) != 0; | ||||
| const bool is_stroke_order_3d = (gpd->draw_mode == GP_DRAWMODE_3D); | const bool is_stroke_order_3d = (gpd->draw_mode == GP_DRAWMODE_3D); | ||||
| float object_scale = mat4_to_scale(iter->ob->obmat); | float object_scale = mat4_to_scale(iter->ob->obmat); | ||||
| /* Negate thickness sign to tag that strokes are in screen space. | /* Negate thickness sign to tag that strokes are in screen space. | ||||
| * Convert to world units (by default, 1 meter = 2000 px). */ | * Convert to world units (by default, 1 meter = 2000 pixels). */ | ||||
| float thickness_scale = (is_screenspace) ? -1.0f : (gpd->pixfactor / 2000.0f); | float thickness_scale = (is_screenspace) ? -1.0f : (gpd->pixfactor / 2000.0f); | ||||
| DRWShadingGroup *grp = iter->stroke_grp = DRW_shgroup_create_sub(iter->stroke_grp); | DRWShadingGroup *grp = iter->stroke_grp = DRW_shgroup_create_sub(iter->stroke_grp); | ||||
| DRW_shgroup_uniform_bool_copy(grp, "strokeOrder3d", is_stroke_order_3d); | DRW_shgroup_uniform_bool_copy(grp, "strokeOrder3d", is_stroke_order_3d); | ||||
| DRW_shgroup_uniform_vec2_copy(grp, "sizeViewportInv", DRW_viewport_invert_size_get()); | DRW_shgroup_uniform_vec2_copy(grp, "sizeViewportInv", DRW_viewport_invert_size_get()); | ||||
| DRW_shgroup_uniform_vec2_copy(grp, "sizeViewport", DRW_viewport_size_get()); | DRW_shgroup_uniform_vec2_copy(grp, "sizeViewport", DRW_viewport_size_get()); | ||||
| DRW_shgroup_uniform_float_copy(grp, "thicknessScale", object_scale); | DRW_shgroup_uniform_float_copy(grp, "thicknessScale", object_scale); | ||||
| DRW_shgroup_uniform_float_copy(grp, "thicknessOffset", (float)gpl->line_change); | DRW_shgroup_uniform_float_copy(grp, "thicknessOffset", (float)gpl->line_change); | ||||
| ▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | else { | ||||
| if (geom) { | if (geom) { | ||||
| shgroup = (ob->type == OB_POINTCLOUD) ? pd->outlines_ptcloud_grp : pd->outlines_grp; | shgroup = (ob->type == OB_POINTCLOUD) ? pd->outlines_ptcloud_grp : pd->outlines_grp; | ||||
| } | } | ||||
| } | } | ||||
| if (shgroup && geom) { | if (shgroup && geom) { | ||||
| if (ob->type == OB_POINTCLOUD) { | if (ob->type == OB_POINTCLOUD) { | ||||
| /* Draw range to avoid drawcall batching messing up the instance attrib. */ | /* Draw range to avoid drawcall batching messing up the instance attribute. */ | ||||
| DRW_shgroup_call_instance_range(shgroup, ob, geom, 0, 0); | DRW_shgroup_call_instance_range(shgroup, ob, geom, 0, 0); | ||||
| } | } | ||||
| else { | else { | ||||
| DRW_shgroup_call(shgroup, geom, ob); | DRW_shgroup_call(shgroup, geom, ob); | ||||
| } | } | ||||
| } | } | ||||
| if (init_dupli) { | if (init_dupli) { | ||||
| Show All 29 Lines | |||||