Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/mesh_tangent.c
| Show First 20 Lines • Show All 654 Lines • ▼ Show 20 Lines | else { | ||||
| num_face_as_quad_map = (int)looptri_len; | num_face_as_quad_map = (int)looptri_len; | ||||
| } | } | ||||
| #endif | #endif | ||||
| /* Calculation */ | /* Calculation */ | ||||
| if (looptri_len != 0) { | if (looptri_len != 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 */ | ||||
| SGLSLMeshToTangent data_array[MAX_MTFACE]; | SGLSLMeshToTangent data_array[MAX_MTFACE]; | ||||
| 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); | ||||
| for (int n = 0; n < tangent_layer_num; n++) { | for (int n = 0; n < tangent_layer_num; n++) { | ||||
| int index = CustomData_get_layer_index_n(loopdata_out, CD_TANGENT, n); | int index = CustomData_get_layer_index_n(loopdata_out, CD_TANGENT, n); | ||||
| BLI_assert(n < MAX_MTFACE); | BLI_assert(n < MAX_MTFACE); | ||||
| Show All 30 Lines | #endif | ||||
| loopdata, CD_MLOOPUV, loopdata_out->layers[index].name); | loopdata, CD_MLOOPUV, loopdata_out->layers[index].name); | ||||
| int uv_start = CustomData_get_layer_index(loopdata, CD_MLOOPUV); | int uv_start = CustomData_get_layer_index(loopdata, CD_MLOOPUV); | ||||
| BLI_assert(uv_ind != -1 && uv_start != -1); | BLI_assert(uv_ind != -1 && uv_start != -1); | ||||
| BLI_assert(uv_ind - uv_start < MAX_MTFACE); | BLI_assert(uv_ind - uv_start < MAX_MTFACE); | ||||
| tangent_mask_curr |= (short)(1 << (uv_ind - uv_start)); | tangent_mask_curr |= (short)(1 << (uv_ind - uv_start)); | ||||
| } | } | ||||
| mesh2tangent->tangent = loopdata_out->layers[index].data; | mesh2tangent->tangent = loopdata_out->layers[index].data; | ||||
| BLI_task_pool_push( | BLI_task_pool_push(task_pool, DM_calc_loop_tangents_thread, mesh2tangent, false, NULL); | ||||
| task_pool, DM_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 20 Lines • Show All 58 Lines • Show Last 20 Lines | |||||