Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
| Show First 20 Lines • Show All 1,498 Lines • ▼ Show 20 Lines | if (ob->type != OB_MESH) { \ | ||||
| BKE_mesh_free(use_mesh); \ | BKE_mesh_free(use_mesh); \ | ||||
| MEM_freeN(use_mesh); \ | MEM_freeN(use_mesh); \ | ||||
| } | } | ||||
| if (usage == OBJECT_LRT_EXCLUDE) { | if (usage == OBJECT_LRT_EXCLUDE) { | ||||
| return; | return; | ||||
| } | } | ||||
| if (ob->type == OB_MESH || ob->type == OB_MBALL || ob->type == OB_CURVE || ob->type == OB_SURF || | if (ELEM(ob->type, OB_MESH, OB_MBALL, OB_CURVE, OB_SURF, OB_FONT)) { | ||||
| ob->type == OB_FONT) { | |||||
| if (ob->type == OB_MESH) { | if (ob->type == OB_MESH) { | ||||
| use_mesh = DEG_get_evaluated_object(dg, ob)->data; | use_mesh = DEG_get_evaluated_object(dg, ob)->data; | ||||
| } | } | ||||
| else { | else { | ||||
| use_mesh = BKE_mesh_new_from_object(NULL, ob, false); | use_mesh = BKE_mesh_new_from_object(NULL, ob, false); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | for (i = 0; i < bm->totface; i++) { | ||||
| double gn[3]; | double gn[3]; | ||||
| copy_v3db_v3fl(gn, f->no); | copy_v3db_v3fl(gn, f->no); | ||||
| mul_v3_mat3_m4v3_db(rt->gn, normal, gn); | mul_v3_mat3_m4v3_db(rt->gn, normal, gn); | ||||
| normalize_v3_db(rt->gn); | normalize_v3_db(rt->gn); | ||||
| if (usage == OBJECT_LRT_INTERSECTION_ONLY) { | if (usage == OBJECT_LRT_INTERSECTION_ONLY) { | ||||
| rt->flags |= LRT_TRIANGLE_INTERSECTION_ONLY; | rt->flags |= LRT_TRIANGLE_INTERSECTION_ONLY; | ||||
| } | } | ||||
| else if (usage == OBJECT_LRT_NO_INTERSECTION || usage == OBJECT_LRT_OCCLUSION_ONLY) { | else if (ELEM(usage, OBJECT_LRT_NO_INTERSECTION, OBJECT_LRT_OCCLUSION_ONLY)) { | ||||
| rt->flags |= LRT_TRIANGLE_NO_INTERSECTION; | rt->flags |= LRT_TRIANGLE_NO_INTERSECTION; | ||||
| } | } | ||||
| /* Re-use this field to refer to adjacent info, will be cleared after culling stage. */ | /* Re-use this field to refer to adjacent info, will be cleared after culling stage. */ | ||||
| rt->intersecting_verts = (void *)&orta[i]; | rt->intersecting_verts = (void *)&orta[i]; | ||||
| rt = (LineartTriangle *)(((uchar *)rt) + rb->triangle_size); | rt = (LineartTriangle *)(((uchar *)rt) + rb->triangle_size); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | for (i = 0; i < bm->totedge; i++) { | ||||
| } | } | ||||
| } | } | ||||
| la_e->flags = e->head.hflag; | la_e->flags = e->head.hflag; | ||||
| la_e->object_ref = orig_ob; | la_e->object_ref = orig_ob; | ||||
| LineartLineSegment *rls = lineart_mem_aquire(&rb->render_data_pool, | LineartLineSegment *rls = lineart_mem_aquire(&rb->render_data_pool, | ||||
| sizeof(LineartLineSegment)); | sizeof(LineartLineSegment)); | ||||
| BLI_addtail(&la_e->segments, rls); | BLI_addtail(&la_e->segments, rls); | ||||
| if (usage == OBJECT_LRT_INHERIT || usage == OBJECT_LRT_INCLUDE || | if (ELEM(usage, OBJECT_LRT_INHERIT, OBJECT_LRT_INCLUDE, OBJECT_LRT_NO_INTERSECTION)) { | ||||
| usage == OBJECT_LRT_NO_INTERSECTION) { | |||||
| lineart_add_edge_to_list(rb, la_e); | lineart_add_edge_to_list(rb, la_e); | ||||
| } | } | ||||
| la_e++; | la_e++; | ||||
| } | } | ||||
| LRT_MESH_FINISH | LRT_MESH_FINISH | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 2,263 Lines • Show Last 20 Lines | |||||