Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-05-27 02:21:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-27 02:21:56 +0400
commit54b64cfd612922054f014460f1c08ec4b0374a3d (patch)
tree2df8a029ef6deff92da8e67fee92c55a29c11234 /source/blender/render
parenteda0f3b1863e2e41b9913e16af82407b63e145bf (diff)
code cleanup: use const float and define array size
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/intern/include/renderdatabase.h9
-rw-r--r--source/blender/render/intern/include/zbuf.h15
-rw-r--r--source/blender/render/intern/source/convertblender.c5
-rw-r--r--source/blender/render/intern/source/envmap.c2
-rw-r--r--source/blender/render/intern/source/renderdatabase.c18
-rw-r--r--source/blender/render/intern/source/shadbuf.c8
-rw-r--r--source/blender/render/intern/source/zbuf.c26
7 files changed, 51 insertions, 32 deletions
diff --git a/source/blender/render/intern/include/renderdatabase.h b/source/blender/render/intern/include/renderdatabase.h
index 298fc3b49ac..584e56836fa 100644
--- a/source/blender/render/intern/include/renderdatabase.h
+++ b/source/blender/render/intern/include/renderdatabase.h
@@ -97,8 +97,13 @@ struct VlakRen *RE_findOrAddVlak(struct ObjectRen *obr, int nr);
struct VertRen *RE_findOrAddVert(struct ObjectRen *obr, int nr);
struct StrandRen *RE_findOrAddStrand(struct ObjectRen *obr, int nr);
struct HaloRen *RE_findOrAddHalo(struct ObjectRen *obr, int nr);
-struct HaloRen *RE_inithalo(struct Render *re, struct ObjectRen *obr, struct Material *ma, float *vec, float *vec1, float *orco, float hasize, float vectsize, int seed);
-struct HaloRen *RE_inithalo_particle(struct Render *re, struct ObjectRen *obr, struct DerivedMesh *dm, struct Material *ma, float *vec, float *vec1, float *orco, float *uvco, float hasize, float vectsize, int seed, float *pa_co);
+struct HaloRen *RE_inithalo(struct Render *re, struct ObjectRen *obr, struct Material *ma,
+ const float vec[3], const float vec1[3],
+ const float *orco, float hasize, float vectsize, int seed);
+struct HaloRen *RE_inithalo_particle(struct Render *re, struct ObjectRen *obr, struct DerivedMesh *dm, struct Material *ma,
+ const float vec[3], const float vec1[3],
+ const float *orco, const float *uvco, float hasize, float vectsize, int seed,
+ const float pa_co[3]);
struct StrandBuffer *RE_addStrandBuffer(struct ObjectRen *obr, int totvert);
struct ObjectRen *RE_addRenderObject(struct Render *re, struct Object *ob, struct Object *par, int index, int psysindex, int lay);
diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h
index 518b2f846d3..77cee59a83a 100644
--- a/source/blender/render/intern/include/zbuf.h
+++ b/source/blender/render/intern/include/zbuf.h
@@ -91,7 +91,7 @@ typedef struct ZSpan {
int rectx, recty; /* range for clipping */
int miny1, maxy1, miny2, maxy2; /* actual filled in range */
- float *minp1, *maxp1, *minp2, *maxp2; /* vertex pointers detect min/max range in */
+ const float *minp1, *maxp1, *minp2, *maxp2; /* vertex pointers detect min/max range in */
float *span1, *span2;
float zmulx, zmuly, zofsx, zofsy; /* transform from hoco to zbuf co */
@@ -115,23 +115,26 @@ typedef struct ZSpan {
void *sss_handle; /* used by sss */
void (*sss_func)(void *, int, int, int, int, int);
- void (*zbuffunc)(struct ZSpan *, int, int, float *, float *, float *, float *);
- void (*zbuflinefunc)(struct ZSpan *, int, int, float *, float *);
+ void (*zbuffunc)(struct ZSpan *, int, int, const float *, const float *, const float *, const float *);
+ void (*zbuflinefunc)(struct ZSpan *, int, int, const float *, const float *);
} ZSpan;
/* exported to shadbuf.c */
-void zbufclip4(struct ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, float *f4, int c1, int c2, int c3, int c4);
+void zbufclip4(struct ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, float *f4,
+ int c1, int c2, int c3, int c4);
void zbuf_free_span(struct ZSpan *zspan);
void freepsA(struct ListBase *lb);
/* to rendercore.c */
-void zspan_scanconvert(struct ZSpan *zpan, void *handle, float *v1, float *v2, float *v3, void (*func)(void *, int, int, float, float) );
+void zspan_scanconvert(struct ZSpan *zpan, void *handle, float *v1, float *v2, float *v3,
+ void (*func)(void *, int, int, float, float) );
/* exported to edge render... */
void zbufclip(struct ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, int c1, int c2, int c3);
void zbuf_alloc_span(struct ZSpan *zspan, int rectx, int recty, float clipcrop);
-void zbufclipwire(struct ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *ho2, float *ho3, float *ho4, int c1, int c2, int c3, int c4);
+void zbufclipwire(struct ZSpan *zspan, int obi, int zvlnr, int ec,
+ float *ho1, float *ho2, float *ho3, float *ho4, int c1, int c2, int c3, int c4);
/* exported to shadeinput.c */
void zbuf_make_winmat(Render *re, float winmat[][4]);
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index bda8baa5e30..a2e99300be7 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -130,7 +130,7 @@
/* ------------------------------------------------------------------------- */
/* this is a bad beast, since it is misused by the 3d view drawing as well. */
-static HaloRen *initstar(Render *re, ObjectRen *obr, float *vec, float hasize)
+static HaloRen *initstar(Render *re, ObjectRen *obr, const float vec[3], float hasize)
{
HaloRen *har;
float hoco[4];
@@ -1324,7 +1324,8 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, const float vec[3
}
-static void particle_curve(Render *re, ObjectRen *obr, DerivedMesh *dm, Material *ma, ParticleStrandData *sd, float *loc, float *loc1, int seed, float *pa_co)
+static void particle_curve(Render *re, ObjectRen *obr, DerivedMesh *dm, Material *ma, ParticleStrandData *sd,
+ const float loc[3], const float loc1[3], int seed, float *pa_co)
{
HaloRen *har=0;
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index 6714fe1a29d..0f3a3111a13 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -586,7 +586,7 @@ void make_envmaps(Render *re)
/* ------------------------------------------------------------------------- */
-static int envcube_isect(EnvMap *env, float *vec, float *answ)
+static int envcube_isect(EnvMap *env, const float vec[3], float answ[2])
{
float labda;
int face;
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index bc61a26564d..85d0c36be1a 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -444,16 +444,16 @@ VlakRen *RE_vlakren_copy(ObjectRen *obr, VlakRen *vlr)
return vlr1;
}
-void RE_vlakren_get_normal(Render *UNUSED(re), ObjectInstanceRen *obi, VlakRen *vlr, float *nor)
+void RE_vlakren_get_normal(Render *UNUSED(re), ObjectInstanceRen *obi, VlakRen *vlr, float r_nor[3])
{
float (*nmat)[3]= obi->nmat;
if (obi->flag & R_TRANSFORMED) {
- mul_v3_m3v3(nor, nmat, vlr->n);
- normalize_v3(nor);
+ mul_v3_m3v3(r_nor, nmat, vlr->n);
+ normalize_v3(r_nor);
}
else {
- copy_v3_v3(nor, vlr->n);
+ copy_v3_v3(r_nor, vlr->n);
}
}
@@ -931,8 +931,9 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr)
/* ------------------------------------------------------------------------- */
-HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, float *vec1,
- float *orco, float hasize, float vectsize, int seed)
+HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma,
+ const float vec[3], const float vec1[3],
+ const float *orco, float hasize, float vectsize, int seed)
{
HaloRen *har;
MTex *mtex;
@@ -1044,8 +1045,9 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f
return har;
}
-HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Material *ma, float *vec, float *vec1,
- float *orco, float *uvco, float hasize, float vectsize, int seed, float *pa_co)
+HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Material *ma,
+ const float vec[3], const float vec1[3],
+ const float *orco, const float *uvco, float hasize, float vectsize, int seed, const float pa_co[3])
{
HaloRen *har;
MTex *mtex;
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index b3167e15df5..93587734e2b 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -1449,7 +1449,7 @@ typedef struct ISBBranch {
typedef struct BSPFace {
Boxf box;
- float *v1, *v2, *v3, *v4;
+ const float *v1, *v2, *v3, *v4;
int obi; /* object for face lookup */
int facenr; /* index to retrieve VlakRen */
int type; /* only for strand now */
@@ -1868,7 +1868,8 @@ static void isb_bsp_recalc_box(ISBBranch *root)
}
/* callback function for zbuf clip */
-static void isb_bsp_test_strand(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
+static void isb_bsp_test_strand(ZSpan *zspan, int obi, int zvlnr,
+ const float *v1, const float *v2, const float *v3, const float *v4)
{
BSPFace face;
@@ -1902,7 +1903,8 @@ static void isb_bsp_test_strand(ZSpan *zspan, int obi, int zvlnr, float *v1, flo
}
/* callback function for zbuf clip */
-static void isb_bsp_test_face(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
+static void isb_bsp_test_face(ZSpan *zspan, int obi, int zvlnr,
+ const float *v1, const float *v2, const float *v3, const float *v4)
{
BSPFace face;
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index cfbdf04d75a..8484e82c66c 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -116,9 +116,10 @@ static void zbuf_init_span(ZSpan *zspan)
zspan->minp1= zspan->maxp1= zspan->minp2= zspan->maxp2= NULL;
}
-static void zbuf_add_to_span(ZSpan *zspan, float *v1, float *v2)
+static void zbuf_add_to_span(ZSpan *zspan, const float *v1, const float *v2)
{
- float *minv, *maxv, *span;
+ const float *minv, *maxv;
+ float *span;
float xx1, dx0, xs0;
int y, my0, my2;
@@ -301,7 +302,8 @@ static APixstr *addpsA(ZSpan *zspan)
return zspan->curpstr;
}
-static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
+static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr,
+ const float *v1, const float *v2, const float *v3, const float *v4)
{
APixstr *ap, *apofs, *apn;
double zxd, zyd, zy0, zverg;
@@ -427,7 +429,7 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
-static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
+static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], const float vec2[3])
{
APixstr *ap, *apn;
int *rectz, *rectmask;
@@ -584,7 +586,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
/* ************* NORMAL ZBUFFER ************ */
-static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
+static void zbufline(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], const float vec2[3])
{
int *rectz, *rectp, *recto, *rectmask;
int start, end, x, y, oldx, oldy, ofs;
@@ -714,7 +716,7 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
}
}
-static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), float *vec1, float *vec2)
+static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), const float vec1[3], const float vec2[3])
{
int *rectz, *rectz1= NULL;
int start, end, x, y, oldx, oldy, ofs;
@@ -1039,7 +1041,8 @@ void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const
/* WATCH IT: zbuffillGLinv4 and zbuffillGL4 are identical except for a 2 lines,
* commented below */
-static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
+static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr,
+ const float *v1, const float *v2, const float *v3, const float *v4)
{
double zxd, zyd, zy0, zverg;
float x0, y0, z0;
@@ -1161,7 +1164,8 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
/* WATCH IT: zbuffillGLinv4 and zbuffillGL4 are identical except for a 2 lines,
* commented below */
-static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
+static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr,
+ const float *v1, const float *v2, const float *v3, const float *v4)
{
double zxd, zyd, zy0, zverg;
float x0, y0, z0;
@@ -1291,7 +1295,8 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
*/
/* now: filling two Z values, the closest and 2nd closest */
-static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), float *v1, float *v2, float *v3, float *v4)
+static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr),
+ const float *v1, const float *v2, const float *v3, const float *v4)
{
double zxd, zyd, zy0, zverg;
float x0, y0, z0;
@@ -2445,7 +2450,8 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
zbuf_free_span(&zspan);
}
-static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
+static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr,
+ const float *v1, const float *v2, const float *v3, const float *v4)
{
double zxd, zyd, zy0, z;
float x0, y0, x1, y1, x2, y2, z0, z1, z2, xx1, *span1, *span2;