Commit: f2d25975b5e90f89744be733b81462493dc57977
Author: Campbell Barton
Date:   Sun Apr 27 00:22:07 2014 +1000
https://developer.blender.org/rBf2d25975b5e90f89744be733b81462493dc57977

Code cleanup: use 'const' for arrays (render)

===================================================================

M       source/blender/render/intern/source/bake.c
M       source/blender/render/intern/source/convertblender.c
M       source/blender/render/intern/source/imagetexture.c
M       source/blender/render/intern/source/multires_bake.c
M       source/blender/render/intern/source/occlusion.c
M       source/blender/render/intern/source/pointdensity.c
M       source/blender/render/intern/source/rayshade.c
M       source/blender/render/intern/source/render_texture.c
M       source/blender/render/intern/source/rendercore.c
M       source/blender/render/intern/source/shadbuf.c
M       source/blender/render/intern/source/shadeinput.c
M       source/blender/render/intern/source/sss.c
M       source/blender/render/intern/source/strand.c
M       source/blender/render/intern/source/volume_precache.c
M       source/blender/render/intern/source/volumetric.c
M       source/blender/render/intern/source/voxeldata.c
M       source/blender/render/intern/source/zbuf.c

===================================================================

diff --git a/source/blender/render/intern/source/bake.c 
b/source/blender/render/intern/source/bake.c
index 59a2a0d..0d165f4 100644
--- a/source/blender/render/intern/source/bake.c
+++ b/source/blender/render/intern/source/bake.c
@@ -373,7 +373,7 @@ static void bake_displacement(void *handle, ShadeInput 
*UNUSED(shi), float dist,
                        bs->vcol->b = col[2];
                }
                else {
-                       char *imcol = (char *)(bs->rect + bs->rectx * y + x);
+                       const char *imcol = (char *)(bs->rect + bs->rectx * y + 
x);
                        copy_v4_v4_char((char *)imcol, (char *)col);
                }
        }
@@ -936,8 +936,8 @@ void RE_bake_ibuf_filter(ImBuf *ibuf, char *mask, const int 
filter)
 void RE_bake_ibuf_normalize_displacement(ImBuf *ibuf, float *displacement, 
char *mask, float displacement_min, float displacement_max)
 {
        int i;
-       float *current_displacement = displacement;
-       char *current_mask = mask;
+       const float *current_displacement = displacement;
+       const char *current_mask = mask;
        float max_distance;
 
        max_distance = max_ff(fabsf(displacement_min), fabsf(displacement_max));
diff --git a/source/blender/render/intern/source/convertblender.c 
b/source/blender/render/intern/source/convertblender.c
index 908215f..7c8a6e0 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -416,7 +416,7 @@ static void calc_vertexnormals(Render *UNUSED(re), 
ObjectRen *obr, bool do_verte
                VlakRen *vlr= RE_findOrAddVlak(obr, a);
                if (do_vertex_normal && vlr->flag & ME_SMOOTH) {
                        float *n4= (vlr->v4)? vlr->v4->n: NULL;
-                       float *c4= (vlr->v4)? vlr->v4->co: NULL;
+                       const float *c4= (vlr->v4)? vlr->v4->co: NULL;
 
                        accumulate_vertex_normals(vlr->v1->n, vlr->v2->n, 
vlr->v3->n, n4,
                                vlr->n, vlr->v1->co, vlr->v2->co, vlr->v3->co, 
c4);
@@ -1325,7 +1325,7 @@ static int render_new_particle_system(Render *re, 
ObjectRen *obr, ParticleSystem
        int totchild=0, step_nbr;
        int seed, path_nbr=0, orco1=0, num;
        int totface;
-       char **uv_name = NULL;
+       const char **uv_name = NULL;
 
        const int *index_mf_to_mpoly = NULL;
        const int *index_mp_to_orig = NULL;
@@ -2045,7 +2045,7 @@ static void displace_render_vert(Render *re, ObjectRen 
*obr, ShadeInput *shi, Ve
                /* not (yet?) */
        }
        if (texco & TEXCO_STRESS) {
-               float *s= RE_vertren_get_stress(obr, vr, 0);
+               const float *s= RE_vertren_get_stress(obr, vr, 0);
 
                if (s) {
                        shi->stress= *s;
@@ -2714,7 +2714,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, 
int timeoffset)
                                /* pass */
                        }
                        else if (dl->type==DL_INDEX3) {
-                               int *index;
+                               const int *index;
 
                                startvert= obr->totvert;
                                data= dl->verts;
@@ -3085,7 +3085,7 @@ static EdgeHash *make_freestyle_edge_mark_hash(Mesh *me, 
DerivedMesh *dm)
        FreestyleEdge *fed;
        MEdge *medge;
        int totedge, a;
-       int *index;
+       const int *index;
 
        medge = dm->getEdgeArray(dm);
        totedge = dm->getNumEdges(dm);
diff --git a/source/blender/render/intern/source/imagetexture.c 
b/source/blender/render/intern/source/imagetexture.c
index 3174854..7733e5a 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -82,21 +82,21 @@ static void ibuf_get_color(float col[4], struct ImBuf 
*ibuf, int x, int y)
        
        if (ibuf->rect_float) {
                if (ibuf->channels==4) {
-                       float *fp= ibuf->rect_float + 4*ofs;
+                       const float *fp= ibuf->rect_float + 4*ofs;
                        copy_v4_v4(col, fp);
                }
                else if (ibuf->channels==3) {
-                       float *fp= ibuf->rect_float + 3*ofs;
+                       const float *fp= ibuf->rect_float + 3*ofs;
                        copy_v3_v3(col, fp);
                        col[3]= 1.0f;
                }
                else {
-                       float *fp= ibuf->rect_float + ofs;
+                       const float *fp= ibuf->rect_float + ofs;
                        col[0]= col[1]= col[2]= col[3]= *fp;
                }
        }
        else {
-               char *rect = (char *)( ibuf->rect+ ofs);
+               const char *rect = (char *)( ibuf->rect+ ofs);
 
                col[0] = ((float)rect[0])*(1.0f/255.0f);
                col[1] = ((float)rect[1])*(1.0f/255.0f);
@@ -727,7 +727,7 @@ static int ibuf_get_color_clip(float col[4], ImBuf *ibuf, 
int x, int y, int extf
                }
        }
        else {
-               char *rect = (char *)(ibuf->rect + x + y*ibuf->x);
+               const char *rect = (char *)(ibuf->rect + x + y*ibuf->x);
                float inv_alpha_fac = (1.0f / 255.0f) * rect[3] * (1.0f / 
255.0f);
                col[0] = rect[0] * inv_alpha_fac;
                col[1] = rect[1] * inv_alpha_fac;
diff --git a/source/blender/render/intern/source/multires_bake.c 
b/source/blender/render/intern/source/multires_bake.c
index b0416c5..7e07054 100644
--- a/source/blender/render/intern/source/multires_bake.c
+++ b/source/blender/render/intern/source/multires_bake.c
@@ -76,7 +76,7 @@ typedef struct {
        MFace *mface;
        MTFace *mtface;
        float *pvtangent;
-       float *precomputed_normals;
+       const float *precomputed_normals;
        int w, h;
        int face_index;
        int i0, i1, i2;
@@ -137,7 +137,7 @@ static void multiresbake_get_normal(const MResolvePixelData 
*data, float norm[],
                }
                else {
                        float nor[3];
-                       float *p0, *p1, *p2;
+                       const float *p0, *p1, *p2;
                        const int iGetNrVerts = data->mface[face_num].v4 != 0 ? 
4 : 3;
 
                        p0 = data->mvert[indices[0]].co;
@@ -145,7 +145,7 @@ static void multiresbake_get_normal(const MResolvePixelData 
*data, float norm[],
                        p2 = data->mvert[indices[2]].co;
 
                        if (iGetNrVerts == 4) {
-                               float *p3 = data->mvert[indices[3]].co;
+                               const float *p3 = data->mvert[indices[3]].co;
                                normal_quad_v3(nor, p0, p1, p2, p3);
                        }
                        else {
@@ -156,7 +156,7 @@ static void multiresbake_get_normal(const MResolvePixelData 
*data, float norm[],
                }
        }
        else {
-               short *no = data->mvert[indices[vert_index]].no;
+               const short *no = data->mvert[indices[vert_index]].no;
 
                normal_short_to_float_v3(norm, no);
                normalize_v3(norm);
@@ -181,8 +181,8 @@ static void init_bake_rast(MBakeRast *bake_rast, const 
ImBuf *ibuf, const MResol
 static void flush_pixel(const MResolvePixelData *data, const int x, const int 
y)
 {
        float st[2] = {(x + 0.5f) / data->w, (y + 0.5f) / data->h};
-       float *st0, *st1, *st2;
-       float *tang0, *tang1, *tang2;
+       const float *st0, *st1, *st2;
+       const float *tang0, *tang1, *tang2;
        float no0[3], no1[3], no2[3];
        float fUV[2], from_tang[3][3], to_tang[3][3];
        float u, v, w, sign;
@@ -451,7 +451,7 @@ static void init_ccgdm_arrays(DerivedMesh *dm)
        CCGElem **grid_data;
        CCGKey key;
        int grid_size;
-       int *grid_offset;
+       const int *grid_offset;
 
        grid_size = dm->getGridSize(dm);
        grid_data = dm->getGridData(dm);
@@ -478,7 +478,7 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image 
*ima, bool require_t
                MVert *mvert = dm->getVertArray(dm);
                MFace *mface = dm->getTessFaceArray(dm);
                MTFace *mtface = dm->getTessFaceDataArray(dm, CD_MTFACE);
-               float *precomputed_normals = dm->getTessFaceDataArray(dm, 
CD_NORMAL);
+               const float *precomputed_normals = dm->getTessFaceDataArray(dm, 
CD_NORMAL);
                float *pvtangent = NULL;
 
                ListBase threads;
diff --git a/source/blender/render/intern/source/occlusion.c 
b/source/blender/render/intern/source/occlusion.c
index 91c9143..3fafc61 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -1176,7 +1176,7 @@ static void sample_occ_surface(ShadeInput *shi)
 {
        StrandRen *strand = shi->strand;
        StrandSurface *mesh = strand->buffer->surface;
-       int *face, *index = RE_strandren_get_face(shi->obr, strand, 0);
+       const int *face, *index = RE_strandren_get_face(shi->obr, strand, 0);
        float w[4], *co1, *co2, *co3, *co4;
 
        if (mesh && mesh->face && mesh->co && mesh->ao && index) {
diff --git a/source/blender/render/intern/source/pointdensity.c 
b/source/blender/render/intern/source/pointdensity.c
index b085ac5..51fe489 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -350,7 +350,7 @@ void free_pointdensities(Render *re)
 typedef struct PointDensityRangeData {
        float *density;
        float squared_radius;
-       float *point_data;
+       const float *point_data;
        float *vec;
        float softness;
        short falloff_type;
diff --git a/source/blender/render/intern/source/rayshade.c 
b/source/blender/render/intern/source/rayshade.c
index 61e8eb2..e39a110 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -476,9 +476,9 @@ static void shade_ray_set_derivative(ShadeInput *shi)
                t10= v3[axis1]-v2[axis1]; t11= v3[axis2]-v2[axis2];
        }
        else {
-               float *v1= shi->v1->co;
-               float *v2= shi->v2->co;
-               float *v3= shi->v3->co;
+               const float *v1= shi->v1->co;
+               const float *v2= shi->v2->co;
+               const float *v3= shi->v3->co;
 
                /* same as above */
                t00= v3[axis1]-v1[axis1]; t01= v3[axis2]-v1[axis2];
@@ -2327,7 +2327,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, 
const float lampco[3],
 static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float 
lampco[3], float shadfac[4], Isect *isec)
 {
        /* area soft shadow */
-       float *jitlamp;
+       const float *jitlamp;
        float fac=0.0f, div=0.0f, vec[3];
        int a, j= -1, mask;
        RayHint point_hint;
diff --git a/source/blender/render/intern/source/render_texture.c 
b/source/blender/render/intern/source/render_texture.c
index adc824f..9c7c673 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -1683,7 +1683,7 @@ static void compatible_bump_uv_derivs(CompatibleBump 
*compat_bump, ShadeInput *s
                        }
 
                        if (tf) {
-                               float *uv1 = tf->uv[j1], *uv2 = tf->uv[j2], 
*uv3 = tf->uv[j3];
+                               const float *uv1 = tf->uv[j1], *uv2 = 
tf->uv[j2], *uv3 = tf->uv[j3];
                                const float an[3] = {fabsf(compat_bump->nn[0]), 
fabsf(compat_bump->nn[1]), fabsf(compat_bump->nn[2])};
                                const int a1 = (an[0] > an[1] && an[0] > an[2]) 
? 1 : 0;
                                const int a2 = (an[2] > an[0] && an[2] > an[1]) 
? 1 : 2;
@@ -3713,7 +3713,7 @@ void RE_sample_material_color(Material *mat, float 
color[3], float *alpha, const
                        /* for every uv map set coords and name */
                        for (i=0; i<layers; i++) {
                                if (layer_index >= 0) {
-                                       float *uv1, *uv2, *uv3;
+                                       const float *uv1, *uv2, *uv3;
                                        float l;
                                        CustomData *data = &orcoDm->faceData;
                                        MTFace *tface = (MTFace *) 
data->layers[layer_index+i].data;
diff --git a/source/blender/render/intern/source/r

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to