Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/mesh_evaluate.c
| Show All 25 Lines | |||||
| /** \file blender/blenkernel/intern/mesh_evaluate.c | /** \file blender/blenkernel/intern/mesh_evaluate.c | ||||
| * \ingroup bke | * \ingroup bke | ||||
| * | * | ||||
| * Functions to evaluate mesh data. | * Functions to evaluate mesh data. | ||||
| */ | */ | ||||
| #include <limits.h> | #include <limits.h> | ||||
| #include "CLG_log.h" | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "DNA_meshdata_types.h" | #include "DNA_meshdata_types.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_memarena.h" | #include "BLI_memarena.h" | ||||
| Show All 20 Lines | |||||
| // #define DEBUG_TIME | // #define DEBUG_TIME | ||||
| #include "PIL_time.h" | #include "PIL_time.h" | ||||
| #ifdef DEBUG_TIME | #ifdef DEBUG_TIME | ||||
| # include "PIL_time_utildefines.h" | # include "PIL_time_utildefines.h" | ||||
| #endif | #endif | ||||
| static CLG_LogRef LOG = {"bke.mesh_evaluate"}; | |||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Mesh Normal Calculation | /** \name Mesh Normal Calculation | ||||
| * \{ */ | * \{ */ | ||||
| /** | /** | ||||
| * Call when there are no polygons. | * Call when there are no polygons. | ||||
| */ | */ | ||||
| static void mesh_calc_normals_vert_fallback(MVert *mverts, int numVerts) | static void mesh_calc_normals_vert_fallback(MVert *mverts, int numVerts) | ||||
| ▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | if (numPolys == 0) { | ||||
| if (only_face_normals == false) { | if (only_face_normals == false) { | ||||
| mesh_calc_normals_vert_fallback(mverts, numVerts); | mesh_calc_normals_vert_fallback(mverts, numVerts); | ||||
| } | } | ||||
| return; | return; | ||||
| } | } | ||||
| /* if we are not calculating verts and no verts were passes then we have nothing to do */ | /* if we are not calculating verts and no verts were passes then we have nothing to do */ | ||||
| if ((only_face_normals == true) && (r_polyNors == NULL) && (r_faceNors == NULL)) { | if ((only_face_normals == true) && (r_polyNors == NULL) && (r_faceNors == NULL)) { | ||||
| printf("%s: called with nothing to do\n", __func__); | CLOG_WARN(&LOG, "called with nothing to do"); | ||||
| return; | return; | ||||
| } | } | ||||
| if (!pnors) pnors = MEM_calloc_arrayN((size_t)numPolys, sizeof(float[3]), __func__); | if (!pnors) pnors = MEM_calloc_arrayN((size_t)numPolys, sizeof(float[3]), __func__); | ||||
| /* if (!fnors) fnors = MEM_calloc_arrayN(numFaces, sizeof(float[3]), "face nors mesh.c"); */ /* NO NEED TO ALLOC YET */ | /* if (!fnors) fnors = MEM_calloc_arrayN(numFaces, sizeof(float[3]), "face nors mesh.c"); */ /* NO NEED TO ALLOC YET */ | ||||
| if (only_face_normals == false) { | if (only_face_normals == false) { | ||||
| Show All 16 Lines | void BKE_mesh_calc_normals_mapping_ex( | ||||
| { | { | ||||
| mf = mfaces; | mf = mfaces; | ||||
| for (i = 0; i < numFaces; i++, mf++, origIndexFace++) { | for (i = 0; i < numFaces; i++, mf++, origIndexFace++) { | ||||
| if (*origIndexFace < numPolys) { | if (*origIndexFace < numPolys) { | ||||
| copy_v3_v3(fnors[i], pnors[*origIndexFace]); | copy_v3_v3(fnors[i], pnors[*origIndexFace]); | ||||
| } | } | ||||
| else { | else { | ||||
| /* eek, we're not corresponding to polys */ | /* eek, we're not corresponding to polys */ | ||||
| printf("error in %s: tessellation face indices are incorrect. normals may look bad.\n", __func__); | CLOG_ERROR(&LOG, "tessellation face indices are incorrect. normals may look bad."); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (pnors != r_polyNors) MEM_freeN(pnors); | if (pnors != r_polyNors) MEM_freeN(pnors); | ||||
| /* if (fnors != r_faceNors) MEM_freeN(fnors); */ /* NO NEED TO ALLOC YET */ | /* if (fnors != r_faceNors) MEM_freeN(fnors); */ /* NO NEED TO ALLOC YET */ | ||||
| fnors = pnors = NULL; | fnors = pnors = NULL; | ||||
| ▲ Show 20 Lines • Show All 3,472 Lines • Show Last 20 Lines | |||||