code cleanup: use NULL rather then zero for pointers

This commit is contained in:
2013-08-07 03:30:23 +00:00
parent da4679f6d8
commit c2ad963e28
10 changed files with 83 additions and 73 deletions

View File

@@ -577,7 +577,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
if (bs->type == RE_BAKE_NORMALS && R.r.bake_normal_space == R_BAKE_SPACE_TANGENT)
bake_shade(handle, ob, shi, quad, x, y, u, v, tvn, ttang);
else
bake_shade(handle, ob, shi, quad, x, y, u, v, 0, 0);
bake_shade(handle, ob, shi, quad, x, y, u, v, NULL, NULL);
}
static int get_next_bake_face(BakeShade *bs)

View File

@@ -726,7 +726,7 @@ static int as_testvertex(VlakRen *vlr, VertRen *UNUSED(ver), ASvert *asv, float
float inp;
int a;
if (vlr==0) return 0;
if (vlr == NULL) return 0;
asf= asv->faces.first;
while (asf) {
@@ -1289,7 +1289,7 @@ 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,
const float loc[3], const float loc1[3], int seed, float *pa_co)
{
HaloRen *har=0;
HaloRen *har = NULL;
if (ma->material_type == MA_TYPE_WIRE)
static_particle_wire(obr, ma, loc, loc1, sd->first, sd->line);
@@ -1466,7 +1466,7 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re
default:
{
HaloRen *har=0;
HaloRen *har = NULL;
har = RE_inithalo_particle(re, obr, dm, ma, loc, NULL, sd->orco, sd->uvco, hasize, 0.0, seed, pa_co);
@@ -1516,22 +1516,22 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
{
Object *ob= obr->ob;
// Object *tob=0;
Material *ma=0;
Material *ma = NULL;
ParticleSystemModifierData *psmd;
ParticleSystem *tpsys=0;
ParticleSettings *part, *tpart=0;
ParticleData *pars, *pa=0, *tpa=0;
ParticleKey *states=0;
ParticleSystem *tpsys = NULL;
ParticleSettings *part, *tpart = NULL;
ParticleData *pars, *pa = NULL, *tpa = NULL;
ParticleKey *states = NULL;
ParticleKey state;
ParticleCacheKey *cache=0;
ParticleCacheKey *cache = NULL;
ParticleBillboardData bb;
ParticleSimulationData sim = {0};
ParticleSimulationData sim = {NULL};
ParticleStrandData sd;
StrandBuffer *strandbuf=0;
StrandVert *svert=0;
StrandBound *sbound= 0;
StrandRen *strand=0;
RNG *rng= 0;
StrandBuffer *strandbuf = NULL;
StrandVert *svert = NULL;
StrandBound *sbound = NULL;
StrandRen *strand = NULL;
RNG *rng = NULL;
float loc[3], loc1[3], loc0[3], mat[4][4], nmat[3][3], co[3], nor[3], duplimat[4][4];
float strandlen=0.0f, curlen=0.0f;
float hasize, pa_size, r_tilt, r_length;
@@ -1542,7 +1542,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=0;
char **uv_name = NULL;
const int *index_mf_to_mpoly = NULL;
const int *index_mp_to_orig = NULL;
@@ -1735,7 +1735,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
}
}
if (sd.orco == 0) {
if (sd.orco == NULL) {
sd.orco = MEM_mallocN(3 * sizeof(float), "particle orco");
orco1 = 1;
}
@@ -1760,10 +1760,17 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
/* get orco */
if (tpsys && part->phystype == PART_PHYS_NO) {
tpa = tpsys->particles + pa->num;
psys_particle_on_emitter(psmd, tpart->from, tpa->num, pa->num_dmcache, tpa->fuv, tpa->foffset, co, nor, 0, 0, sd.orco, 0);
psys_particle_on_emitter(
psmd,
tpart->from, tpa->num, pa->num_dmcache, tpa->fuv,
tpa->foffset, co, nor, NULL, NULL, sd.orco, NULL);
}
else {
psys_particle_on_emitter(
psmd,
part->from, pa->num, pa->num_dmcache,
pa->fuv, pa->foffset, co, nor, NULL, NULL, sd.orco, NULL);
}
else
psys_particle_on_emitter(psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, sd.orco, 0);
/* get uvco & mcol */
num= pa->num_dmcache;
@@ -1808,15 +1815,17 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
/* get orco */
if (part->childtype == PART_CHILD_FACES) {
psys_particle_on_emitter(psmd,
PART_FROM_FACE, cpa->num, DMCACHE_ISCHILD,
cpa->fuv, cpa->foffset, co, nor, 0, 0, sd.orco, 0);
psys_particle_on_emitter(
psmd,
PART_FROM_FACE, cpa->num, DMCACHE_ISCHILD,
cpa->fuv, cpa->foffset, co, nor, NULL, NULL, sd.orco, NULL);
}
else {
ParticleData *par = psys->particles + cpa->parent;
psys_particle_on_emitter(psmd, part->from,
par->num, DMCACHE_ISCHILD, par->fuv,
par->foffset, co, nor, 0, 0, sd.orco, 0);
psys_particle_on_emitter(
psmd,
part->from, par->num, DMCACHE_ISCHILD, par->fuv,
par->foffset, co, nor, NULL, NULL, sd.orco, NULL);
}
/* get uvco & mcol */
@@ -2419,7 +2428,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
BKE_displist_make_mball_forRender(re->scene, ob, &dispbase);
dl= dispbase.first;
if (dl==0) return;
if (dl == NULL) return;
data= dl->verts;
nors= dl->nors;
@@ -2464,7 +2473,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
vlr->v1= RE_findOrAddVert(obr, index[0]);
vlr->v2= RE_findOrAddVert(obr, index[1]);
vlr->v3= RE_findOrAddVert(obr, index[2]);
vlr->v4= 0;
vlr->v4 = NULL;
if (negative_scale)
normal_tri_v3(vlr->n, vlr->v1->co, vlr->v2->co, vlr->v3->co);
@@ -2729,7 +2738,7 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
vlr->v2= RE_findOrAddVert(obr, vertofs+v2);
vlr->v3= RE_findOrAddVert(obr, vertofs+v3);
if (v4) vlr->v4= RE_findOrAddVert(obr, vertofs+v4);
else vlr->v4= 0;
else vlr->v4 = NULL;
/* render normals are inverted in render */
if (vlr->v4)
@@ -2787,7 +2796,7 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
static void init_render_surf(Render *re, ObjectRen *obr, int timeoffset)
{
Object *ob= obr->ob;
Nurb *nu=0;
Nurb *nu = NULL;
Curve *cu;
ListBase displist= {NULL, NULL};
DispList *dl;
@@ -2798,7 +2807,7 @@ static void init_render_surf(Render *re, ObjectRen *obr, int timeoffset)
cu= ob->data;
nu= cu->nurb.first;
if (nu==0) return;
if (nu == NULL) return;
mul_m4_m4m4(mat, re->viewmat, ob->obmat);
invert_m4_m4(ob->imat, mat);
@@ -3311,7 +3320,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
DerivedMesh *dm;
CustomDataMask mask;
float xn, yn, zn, imat[3][3], mat[4][4]; //nor[3],
float *orco=0;
float *orco = NULL;
int need_orco=0, need_stress=0, need_nmap_tangent=0, need_tangent=0, need_origindex=0;
int a, a1, ok, vertofs;
int end, do_autosmooth = FALSE, totvert = 0;
@@ -3526,8 +3535,8 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
vlr->v1= RE_findOrAddVert(obr, vertofs+v1);
vlr->v2= RE_findOrAddVert(obr, vertofs+v2);
vlr->v3= RE_findOrAddVert(obr, vertofs+v3);
if (v4) vlr->v4= RE_findOrAddVert(obr, vertofs+v4);
else vlr->v4= 0;
if (v4) vlr->v4 = RE_findOrAddVert(obr, vertofs+v4);
else vlr->v4 = NULL;
#ifdef WITH_FREESTYLE
/* Freestyle edge/face marks */
@@ -4706,7 +4715,8 @@ static void set_dupli_tex_mat(Render *re, ObjectInstanceRen *obi, DupliObject *d
obi->duplitexmat= BLI_memarena_alloc(re->memArena, sizeof(float)*4*4);
invert_m4_m4(imat, dob->mat);
mul_serie_m4(obi->duplitexmat, re->viewmat, dob->omat, imat, re->viewinv, 0, 0, 0, 0);
mul_serie_m4(obi->duplitexmat, re->viewmat, dob->omat, imat, re->viewinv,
NULL, NULL, NULL, NULL);
}
if (dob) {
@@ -5068,7 +5078,7 @@ static void add_group_render_dupli_obs(Render *re, Group *group, int nolamps, in
if (ob->flag & OB_DONE) {
if (ob->transflag & OB_RENDER_DUPLI) {
if (allow_render_object(re, ob, nolamps, onlyselected, actob)) {
init_render_object(re, ob, NULL, 0, timeoffset);
init_render_object(re, ob, NULL, NULL, timeoffset);
ob->transflag &= ~OB_RENDER_DUPLI;
if (ob->dup_group)
@@ -5128,7 +5138,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
* it still needs to create the ObjectRen containing the data */
if (ob->transflag & OB_RENDER_DUPLI) {
if (allow_render_object(re, ob, nolamps, onlyselected, actob)) {
init_render_object(re, ob, NULL, 0, timeoffset);
init_render_object(re, ob, NULL, NULL, timeoffset);
ob->transflag &= ~OB_RENDER_DUPLI;
}
}
@@ -5236,10 +5246,10 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
free_object_duplilist(lb);
if (allow_render_object(re, ob, nolamps, onlyselected, actob))
init_render_object(re, ob, NULL, 0, timeoffset);
init_render_object(re, ob, NULL, NULL, timeoffset);
}
else if (allow_render_object(re, ob, nolamps, onlyselected, actob))
init_render_object(re, ob, NULL, 0, timeoffset);
init_render_object(re, ob, NULL, NULL, timeoffset);
}
if (re->test_break(re->tbh)) break;
@@ -5327,7 +5337,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
set_node_shader_lamp_loop(shade_material_loop);
/* MAKE RENDER DATA */
database_init_objects(re, lay, 0, 0, 0, 0);
database_init_objects(re, lay, 0, 0, NULL, 0);
if (!re->test_break(re->tbh)) {
set_material_lightgroups(re);
@@ -5486,7 +5496,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la
}
/* MAKE RENDER DATA */
database_init_objects(re, lay, 0, 0, 0, timeoffset);
database_init_objects(re, lay, 0, 0, NULL, timeoffset);
if (!re->test_break(re->tbh))
project_renderdata(re, projectverto, re->r.mode & R_PANORAMA, 0, 1);

View File

@@ -776,7 +776,7 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
get_ccgdm_data(lores_dm, hires_dm,
height_data->orig_index_mf_to_mpoly, height_data->orig_index_mp_to_orig,
lvl, face_index, uv[0], uv[1], p1, 0);
lvl, face_index, uv[0], uv[1], p1, NULL);
if (height_data->ssdm) {
get_ccgdm_data(lores_dm, height_data->ssdm,

View File

@@ -371,7 +371,7 @@ static void occ_sum_occlusion(OcclusionTree *tree, OccNode *node)
for (b = 0; b < TOTCHILD; b++) {
if (node->childflag & (1 << b)) {
a = node->child[b].face;
occ_face(&tree->face[a], 0, 0, &area);
occ_face(&tree->face[a], NULL, NULL, &area);
occ += area * tree->occlusion[a];
if (indirect) madd_v3_v3fl(rad, tree->rad[a], area);
totarea += area;
@@ -521,7 +521,7 @@ static void *exec_occ_build(void *data)
occ_build_recursive(othread->tree, othread->node, othread->begin, othread->end, othread->depth);
return 0;
return NULL;
}
static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, int end, int depth)
@@ -1244,7 +1244,7 @@ static void *exec_strandsurface_sample(void *data)
copy_v3_v3(othread->faceindirect[a], indirect);
}
return 0;
return NULL;
}
void make_occ_tree(Render *re)

View File

@@ -198,7 +198,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
if (psys->lattice) {
end_latt_deform(psys->lattice);
psys->lattice=0;
psys->lattice = NULL;
}
psys_render_restore(ob, psys);

View File

@@ -731,7 +731,7 @@ static void ray_fadeout(Isect *is, ShadeInput *shi, float col[3], const float bl
* note: 'col' must be initialized */
static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, const float start[3], const float dir[3], float col[4], ObjectInstanceRen *obi, VlakRen *vlr, int traflag)
{
ShadeInput shi= {0};
ShadeInput shi = {NULL};
Isect isec;
float dist_mir = origshi->mat->dist_mir;
@@ -741,7 +741,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
isec.mode= RE_RAY_MIRROR;
isec.check = RE_CHECK_VLR_RENDER;
isec.skip = RE_SKIP_VLR_NEIGHBOUR;
isec.hint = 0;
isec.hint = NULL;
isec.orig.ob = obi;
isec.orig.face = vlr;
@@ -1866,10 +1866,10 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
isec.orig.face = shi->vlr;
isec.check = RE_CHECK_VLR_NON_SOLID_MATERIAL;
isec.skip = RE_SKIP_VLR_NEIGHBOUR;
isec.hint = 0;
isec.hint = NULL;
isec.hit.ob = 0;
isec.hit.face = 0;
isec.hit.ob = NULL;
isec.hit.face = NULL;
isec.last_hit = NULL;
@@ -2013,10 +2013,10 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3])
isec.orig.face = shi->vlr;
isec.check = RE_CHECK_VLR_RENDER;
isec.skip = RE_SKIP_VLR_NEIGHBOUR;
isec.hint = 0;
isec.hint = NULL;
isec.hit.ob = 0;
isec.hit.face = 0;
isec.hit.ob = NULL;
isec.hit.face = NULL;
isec.last_hit = NULL;
@@ -2468,7 +2468,7 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4])
RE_RC_INIT(isec, *shi);
if (shi->mat->mode & MA_SHADOW_TRA) isec.mode= RE_RAY_SHADOW_TRA;
else isec.mode= RE_RAY_SHADOW;
isec.hint = 0;
isec.hint = NULL;
if (lar->mode & (LA_LAYER|LA_LAYER_SHADOW))
isec.lay= lar->lay;

View File

@@ -2163,7 +2163,7 @@ void do_material_tex(ShadeInput *shi, Render *re)
mtex= shi->mat->mtex[tex_nr];
tex= mtex->tex;
if (tex==0) continue;
if (tex == NULL) continue;
found_deriv_map = (tex->type==TEX_IMAGE) && (tex->imaflag & TEX_DERIVATIVEMAP);
use_compat_bump= (mtex->texflag & MTEX_COMPAT_BUMP);
@@ -2686,7 +2686,7 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float col_
if (shi->mat->mtex[tex_nr]) {
mtex= shi->mat->mtex[tex_nr];
tex= mtex->tex;
if (tex==0) continue;
if (tex == NULL) continue;
/* only process if this texture is mapped
* to one that we're interested in */
@@ -3028,7 +3028,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
mtex= R.wrld.mtex[tex_nr];
tex= mtex->tex;
if (tex==0) continue;
if (tex == NULL) continue;
/* if (mtex->mapto==0) continue; */
/* which coords */
@@ -3609,7 +3609,7 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene)
}
if (tex->type==TEX_POINTDENSITY) {
/* set dummy values for render and do cache */
Render dummy_re = {0};
Render dummy_re = {NULL};
dummy_re.scene = scene;
unit_m4(dummy_re.viewinv);
unit_m4(dummy_re.viewmat);
@@ -3668,8 +3668,8 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const
int v1, v2, v3;
MVert *mvert;
float uv[3], normal[3];
ShadeInput shi = {0};
Render re = {0};
ShadeInput shi = {NULL};
Render re = {NULL};
/* Get face data */
mvert = orcoDm->getVertArray(orcoDm);
@@ -3752,7 +3752,7 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const
*alpha = shi.alpha;
}
else if (mat->material_type == MA_TYPE_VOLUME) {
ObjectInstanceRen obi = {0};
ObjectInstanceRen obi = {NULL};
obi.ob = ob;
shi.obi = &obi;
unit_m4(re.viewinv);

View File

@@ -1026,7 +1026,7 @@ static float readdeepshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias,
if (biast != 0.0f) {
/* in soft bias area */
biasv= readdeepvisibility(shsample->deepbuf[ofs], tot, zs, 0, 0);
biasv = readdeepvisibility(shsample->deepbuf[ofs], tot, zs, 0, NULL);
biast= biast*biast;
return (1.0f-biast)*v + biast*biasv;
@@ -2045,7 +2045,7 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
if (vlr->v4)
zbufclipwire(&zspan, i, a+1, vlr->ec, hoco[0], hoco[1], hoco[2], hoco[3], c1, c2, c3, c4);
else
zbufclipwire(&zspan, i, a+1, vlr->ec, hoco[0], hoco[1], hoco[2], 0, c1, c2, c3, 0);
zbufclipwire(&zspan, i, a+1, vlr->ec, hoco[0], hoco[1], hoco[2], NULL, c1, c2, c3, 0);
}
else if (vlr->v4) {
if (vlr->flag & R_STRAND)

View File

@@ -783,7 +783,7 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
ObjectRen *obr;
ObjectInstanceRen *obi;
ZSpan zspan;
StrandRen *strand=0;
StrandRen *strand = NULL;
StrandVert *svert;
StrandBound *sbound;
StrandPart spart;

View File

@@ -504,7 +504,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], co
if (apn->p[2]==zvlnr && apn->obi[2]==obi) {apn->mask[2]|= mask; break; }
if (apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= vergz; apn->mask[3]= mask; break; }
if (apn->p[3]==zvlnr && apn->obi[3]==obi) {apn->mask[3]|= mask; break; }
if (apn->next==0) apn->next= addpsA(zspan);
if (apn->next == NULL) apn->next = addpsA(zspan);
apn= apn->next;
}
}
@@ -575,7 +575,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], co
if (apn->p[2]==zvlnr) {apn->mask[2]|= mask; break; }
if (apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= vergz; apn->mask[3]= mask; break; }
if (apn->p[3]==zvlnr) {apn->mask[3]|= mask; break; }
if (apn->next==0) apn->next= addpsA(zspan);
if (apn->next == NULL) apn->next = addpsA(zspan);
apn= apn->next;
}
}
@@ -2068,7 +2068,7 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart *
ZSpan zspans[16], *zspan; /* 16 = RE_MAX_OSA */
VlakRen *vlr= NULL;
VertRen *v1, *v2, *v3, *v4;
Material *ma=0;
Material *ma = NULL;
ObjectInstanceRen *obi;
ObjectRen *obr;
float obwinmat[4][4], winmat[4][4], bounds[4];
@@ -2238,7 +2238,7 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart *
if (v4)
zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
else
zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, 0, c1, c2, c3, 0);
zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, NULL, c1, c2, c3, 0);
}
else {
/* strands allow to be filled in as quad */
@@ -2375,7 +2375,7 @@ void zbuffer_shadow(Render *re, float winmat[4][4], LampRen *lar, int *rectz, in
zbufclipwire(&zspan, 0, a+1, vlr->ec, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
}
else
zbufclipwire(&zspan, 0, a+1, vlr->ec, ho1, ho2, ho3, 0, c1, c2, c3, 0);
zbufclipwire(&zspan, 0, a+1, vlr->ec, ho1, ho2, ho3, NULL, c1, c2, c3, 0);
}
else {
if (vlr->v4) {
@@ -2539,7 +2539,7 @@ void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(vo
ObjectRen *obr;
VlakRen *vlr= NULL;
VertRen *v1, *v2, *v3, *v4;
Material *ma=0, *sss_ma= R.sss_mat;
Material *ma = NULL, *sss_ma = R.sss_mat;
float obwinmat[4][4], winmat[4][4], bounds[4];
float ho1[4], ho2[4], ho3[4], ho4[4]={0};
int i, v, zvlnr, c1, c2, c3, c4=0;
@@ -3399,7 +3399,7 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
if (v4)
zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
else
zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, 0, c1, c2, c3, 0);
zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, NULL, c1, c2, c3, 0);
}
else {
if (v4 && (vlr->flag & R_STRAND)) {