Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/editmesh_tangent.c
| Show First 20 Lines • Show All 358 Lines • ▼ Show 20 Lines | #ifdef USE_LOOPTRI_DETECT_QUADS | ||||
| else { | else { | ||||
| num_face_as_quad_map = totface; | num_face_as_quad_map = totface; | ||||
| } | } | ||||
| #endif | #endif | ||||
| /* Calculation */ | /* Calculation */ | ||||
| if (em->tottri != 0) { | if (em->tottri != 0) { | ||||
| TaskScheduler *scheduler = BLI_task_scheduler_get(); | TaskScheduler *scheduler = BLI_task_scheduler_get(); | ||||
| TaskPool *task_pool; | TaskPool *task_pool; | ||||
| task_pool = BLI_task_pool_create(scheduler, NULL); | task_pool = BLI_task_pool_create(scheduler, NULL, TASK_PRIORITY_LOW); | ||||
| tangent_mask_curr = 0; | tangent_mask_curr = 0; | ||||
| /* Calculate tangent layers */ | /* Calculate tangent layers */ | ||||
| SGLSLEditMeshToTangent data_array[MAX_MTFACE]; | SGLSLEditMeshToTangent data_array[MAX_MTFACE]; | ||||
| int index = 0; | int index = 0; | ||||
| int n = 0; | int n = 0; | ||||
| CustomData_update_typemap(loopdata_out); | CustomData_update_typemap(loopdata_out); | ||||
| const int tangent_layer_num = CustomData_number_of_layers(loopdata_out, CD_TANGENT); | const int tangent_layer_num = CustomData_number_of_layers(loopdata_out, CD_TANGENT); | ||||
| Show All 36 Lines | #endif | ||||
| /* needed for face normal lookups */ | /* needed for face normal lookups */ | ||||
| htype_index |= BM_FACE; | htype_index |= BM_FACE; | ||||
| } | } | ||||
| BM_mesh_elem_index_ensure(bm, htype_index); | BM_mesh_elem_index_ensure(bm, htype_index); | ||||
| mesh2tangent->looptris = (const BMLoop *(*)[3])em->looptris; | mesh2tangent->looptris = (const BMLoop *(*)[3])em->looptris; | ||||
| mesh2tangent->tangent = loopdata_out->layers[index].data; | mesh2tangent->tangent = loopdata_out->layers[index].data; | ||||
| BLI_task_pool_push( | BLI_task_pool_push(task_pool, emDM_calc_loop_tangents_thread, mesh2tangent, false, NULL); | ||||
| task_pool, emDM_calc_loop_tangents_thread, mesh2tangent, false, TASK_PRIORITY_LOW); | |||||
| } | } | ||||
| BLI_assert(tangent_mask_curr == tangent_mask); | BLI_assert(tangent_mask_curr == tangent_mask); | ||||
| BLI_task_pool_work_and_wait(task_pool); | BLI_task_pool_work_and_wait(task_pool); | ||||
| BLI_task_pool_free(task_pool); | BLI_task_pool_free(task_pool); | ||||
| } | } | ||||
| else { | else { | ||||
| tangent_mask_curr = tangent_mask; | tangent_mask_curr = tangent_mask; | ||||
| Show All 28 Lines | |||||