diff options
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 25 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 27 |
2 files changed, 27 insertions, 25 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 94758bc8566..8b020226bca 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -867,7 +867,7 @@ static void cdDM_drawMappedFacesGLSL( const float (*nors)[3] = dm->getPolyDataArray(dm, CD_NORMAL); const float (*lnors)[3] = dm->getLoopDataArray(dm, CD_NORMAL); const int totpoly = dm->getNumPolys(dm); - const short totmat = dm->totmat; + const short dm_totmat = dm->totmat; int a, b, matnr, new_matnr; bool do_draw; int orig; @@ -1048,7 +1048,7 @@ static void cdDM_drawMappedFacesGLSL( } for (a = 0; a < totpoly; a++, mpoly++) { - const short mat_nr = ME_MAT_NR_TEST(mpoly->mat_nr, totmat); + const short mat_nr = ME_MAT_NR_TEST(mpoly->mat_nr, dm_totmat); int j; int i = mat_orig_to_new[mat_nr]; offset = tot_loops * max_element_size; @@ -1260,14 +1260,15 @@ static void cdDM_buffer_copy_triangles( GPUBufferMaterial *gpumat, *gpumaterials = dm->drawObject->materials; int i, j, start; - const short totmat = dm->drawObject->totmaterial; + const int gpu_totmat = dm->drawObject->totmaterial; + const short dm_totmat = dm->totmat; const MPoly *mpoly = dm->getPolyArray(dm); const MLoopTri *lt = dm->getLoopTriArray(dm); const int totpoly = dm->getNumPolys(dm); - FaceCount *fc = MEM_mallocN(sizeof(*fc) * totmat, "gpumaterial.facecount"); + FaceCount *fc = MEM_mallocN(sizeof(*fc) * gpu_totmat, "gpumaterial.facecount"); - for (i = 0; i < totmat; i++) { + for (i = 0; i < gpu_totmat; i++) { fc[i].i_visible = 0; fc[i].i_tri_visible = 0; fc[i].i_hidden = gpumaterials[i].totpolys - 1; @@ -1275,7 +1276,7 @@ static void cdDM_buffer_copy_triangles( } for (i = 0; i < totpoly; i++) { - const short mat_nr = ME_MAT_NR_TEST(mpoly[i].mat_nr, totmat); + const short mat_nr = ME_MAT_NR_TEST(mpoly[i].mat_nr, dm_totmat); int tottri = ME_POLY_TRI_TOT(&mpoly[i]); int mati = mat_orig_to_new[mat_nr]; gpumat = gpumaterials + mati; @@ -1305,7 +1306,7 @@ static void cdDM_buffer_copy_triangles( } /* set the visible polygons */ - for (i = 0; i < totmat; i++) { + for (i = 0; i < gpu_totmat; i++) { gpumaterials[i].totvisiblepolys = fc[i].i_visible; } @@ -1698,12 +1699,12 @@ static GPUDrawObject *cdDM_GPUobject_new(DerivedMesh *dm) GPUDrawObject *gdo; const MPoly *mpoly; const MLoop *mloop; - const short totmat = dm->totmat; + const short dm_totmat = dm->totmat; GPUBufferMaterial *mat_info; int i, totloops, totpolys; /* object contains at least one material (default included) so zero means uninitialized dm */ - BLI_assert(totmat != 0); + BLI_assert(dm_totmat != 0); mpoly = dm->getPolyArray(dm); mloop = dm->getLoopArray(dm); @@ -1713,10 +1714,10 @@ static GPUDrawObject *cdDM_GPUobject_new(DerivedMesh *dm) /* get the number of points used by each material, treating * each quad as two triangles */ - mat_info = MEM_callocN(sizeof(*mat_info) * totmat, "GPU_drawobject_new.mat_orig_to_new"); + mat_info = MEM_callocN(sizeof(*mat_info) * dm_totmat, "GPU_drawobject_new.mat_orig_to_new"); for (i = 0; i < totpolys; i++) { - const short mat_nr = ME_MAT_NR_TEST(mpoly[i].mat_nr, totmat); + const short mat_nr = ME_MAT_NR_TEST(mpoly[i].mat_nr, dm_totmat); mat_info[mat_nr].totpolys++; mat_info[mat_nr].totelements += 3 * ME_POLY_TRI_TOT(&mpoly[i]); mat_info[mat_nr].totloops += mpoly[i].totloop; @@ -1726,7 +1727,7 @@ static GPUDrawObject *cdDM_GPUobject_new(DerivedMesh *dm) gdo->totvert = dm->getNumVerts(dm); gdo->totedge = dm->getNumEdges(dm); - GPU_buffer_material_finalize(gdo, mat_info, totmat); + GPU_buffer_material_finalize(gdo, mat_info, dm_totmat); gdo->tot_loop_verts = totloops; diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 5e333c28fd9..509ca9cdd19 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -2007,7 +2007,8 @@ static void ccgDM_buffer_copy_triangles( const int *mat_orig_to_new) { GPUBufferMaterial *gpumat, *gpumaterials = dm->drawObject->materials; - const short totmat = dm->drawObject->totmaterial; + const int gpu_totmat = dm->drawObject->totmaterial; + const short dm_totmat = dm->totmat; CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm; CCGSubSurf *ss = ccgdm->ss; CCGKey key; @@ -2018,11 +2019,11 @@ static void ccgDM_buffer_copy_triangles( short mat_nr = -1; int start; int totloops = 0; - FaceCount *fc = MEM_mallocN(sizeof(*fc) * totmat, "gpumaterial.facecount"); + FaceCount *fc = MEM_mallocN(sizeof(*fc) * gpu_totmat, "gpumaterial.facecount"); CCG_key_top_level(&key, ss); - for (i = 0; i < totmat; i++) { + for (i = 0; i < gpu_totmat; i++) { fc[i].i_visible = 0; fc[i].i_tri_visible = 0; fc[i].i_hidden = gpumaterials[i].totpolys - 1; @@ -2037,7 +2038,7 @@ static void ccgDM_buffer_copy_triangles( int mati; if (faceFlags) { - mat_nr = ME_MAT_NR_TEST(faceFlags[index].mat_nr, totmat); + mat_nr = ME_MAT_NR_TEST(faceFlags[index].mat_nr, dm_totmat); is_hidden = (faceFlags[index].flag & ME_HIDE) != 0; } else { @@ -2094,7 +2095,7 @@ static void ccgDM_buffer_copy_triangles( } /* set the visible polygons */ - for (i = 0; i < totmat; i++) { + for (i = 0; i < gpu_totmat; i++) { gpumaterials[i].totvisiblepolys = fc[i].i_visible; } @@ -2242,7 +2243,7 @@ static void ccgDM_buffer_copy_uv_texpaint( int i, totface = ccgSubSurf_getNumFaces(ss); int start = 0; DMFlagMat *faceFlags = ccgdm->faceFlags; - int totmaterial = dm->totmat; + int dm_totmat = dm->totmat; MLoopUV **mloopuv_base; MLoopUV *stencil_base; int stencil; @@ -2251,9 +2252,9 @@ static void ccgDM_buffer_copy_uv_texpaint( /* should have been checked for before, reassert */ BLI_assert(DM_get_loop_data_layer(dm, CD_MLOOPUV)); - mloopuv_base = MEM_mallocN(totmaterial * sizeof(*mloopuv_base), "texslots"); + mloopuv_base = MEM_mallocN(dm_totmat * sizeof(*mloopuv_base), "texslots"); - for (i = 0; i < totmaterial; i++) { + for (i = 0; i < dm_totmat; i++) { mloopuv_base[i] = DM_paint_uvlayer_active_get(dm, i); } @@ -2540,7 +2541,7 @@ static GPUDrawObject *ccgDM_GPUObjectNew(DerivedMesh *dm) GPUDrawObject *gdo; DMFlagMat *faceFlags = ccgdm->faceFlags; int gridFaces = ccgSubSurf_getGridSize(ss) - 1; - const short totmat = (faceFlags) ? dm->totmat : 1; + const short dm_totmat = (faceFlags) ? dm->totmat : 1; GPUBufferMaterial *matinfo; int i; unsigned int tot_internal_edges = 0; @@ -2551,16 +2552,16 @@ static GPUDrawObject *ccgDM_GPUObjectNew(DerivedMesh *dm) int totface = ccgSubSurf_getNumFaces(ss); /* object contains at least one material (default included) so zero means uninitialized dm */ - BLI_assert(totmat != 0); + BLI_assert(dm_totmat != 0); - matinfo = MEM_callocN(sizeof(*matinfo) * totmat, "GPU_drawobject_new.mat_orig_to_new"); + matinfo = MEM_callocN(sizeof(*matinfo) * dm_totmat, "GPU_drawobject_new.mat_orig_to_new"); if (faceFlags) { for (i = 0; i < totface; i++) { CCGFace *f = ccgdm->faceMap[i].face; int numVerts = ccgSubSurf_getFaceNumVerts(f); int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f)); - const short new_matnr = ME_MAT_NR_TEST(faceFlags[index].mat_nr, totmat); + const short new_matnr = ME_MAT_NR_TEST(faceFlags[index].mat_nr, dm_totmat); matinfo[new_matnr].totelements += numVerts * gridFaces * gridFaces * 6; matinfo[new_matnr].totloops += numVerts * gridFaces * gridFaces * 4; matinfo[new_matnr].totpolys++; @@ -2583,7 +2584,7 @@ static GPUDrawObject *ccgDM_GPUObjectNew(DerivedMesh *dm) gdo->totvert = 0; /* used to count indices, doesn't really matter for ccgsubsurf */ gdo->totedge = (totedge * edgeSize + tot_internal_edges); - GPU_buffer_material_finalize(gdo, matinfo, totmat); + GPU_buffer_material_finalize(gdo, matinfo, dm_totmat); /* store total number of points used for triangles */ gdo->tot_triangle_point = ccgSubSurf_getNumFinalFaces(ss) * 6; |