diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-09 22:28:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-09 22:28:30 +0400 |
commit | 89a963fb7fdff543b77de790355b9dac3019bd33 (patch) | |
tree | 4e1d2245e20f8c21625e99d771776f66c233a0de /source/blender/render/intern | |
parent | de4bd55e01bc574c13977537ace1a0901dcfcaf0 (diff) |
style cleanup: comment blocks
Diffstat (limited to 'source/blender/render/intern')
31 files changed, 316 insertions, 312 deletions
diff --git a/source/blender/render/intern/include/pixelblending.h b/source/blender/render/intern/include/pixelblending.h index 16d67fb95fe..97d41107856 100644 --- a/source/blender/render/intern/include/pixelblending.h +++ b/source/blender/render/intern/include/pixelblending.h @@ -33,7 +33,7 @@ /** -* add 1 pixel to into filtered three lines + * add 1 pixel to into filtered three lines * (float vecs to float vec) */ void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w); diff --git a/source/blender/render/intern/include/pixelshading.h b/source/blender/render/intern/include/pixelshading.h index c0adc36f3a3..00d731912b6 100644 --- a/source/blender/render/intern/include/pixelshading.h +++ b/source/blender/render/intern/include/pixelshading.h @@ -25,15 +25,10 @@ /** \file blender/render/intern/include/pixelshading.h * \ingroup render + * + * These functions determine what actual color a pixel will have. */ - -/* pixelshading.h -* -* These functions determine what actual color a pixel will have. -*/ - - #ifndef __PIXELSHADING_H__ #define __PIXELSHADING_H__ diff --git a/source/blender/render/intern/include/rayintersection.h b/source/blender/render/intern/include/rayintersection.h index 934bf92db8f..4dceae56a4c 100644 --- a/source/blender/render/intern/include/rayintersection.h +++ b/source/blender/render/intern/include/rayintersection.h @@ -59,7 +59,7 @@ typedef struct RayHint { typedef struct Isect { /* ray start, direction (normalized vector), and max distance. on hit, - the distance is modified to be the distance to the hit point. */ + * the distance is modified to be the distance to the hit point. */ float start[3]; float dir[3]; float dist; diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 4c0a1b26dd6..74255560025 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -131,8 +131,8 @@ struct Render /* a list of RenderResults, for fullsample */ ListBase fullresult; /* read/write mutex, all internal code that writes to re->result must use a - write lock, all external code must use a read lock. internal code is assumed - to not conflict with writes, so no lock used for that */ + * write lock, all external code must use a read lock. internal code is assumed + * to not conflict with writes, so no lock used for that */ ThreadRWMutex resultmutex; /* window size, display rect, viewplane */ @@ -149,7 +149,7 @@ struct Render /* real maximum amount of xparts/yparts after correction for minimum */ int xparts, yparts; /* real maximum size of parts after correction for minimum - partx*xparts can be larger than rectx, in that case last part is smaller */ + * partx*xparts can be larger than rectx, in that case last part is smaller */ int partx, party; /* values for viewing */ @@ -229,8 +229,8 @@ struct Render ListBase volume_precache_parts; /* arena for allocating data for use during render, for - * example dynamic TFaces to go in the VlakRen structure. - */ + * example dynamic TFaces to go in the VlakRen structure. + */ struct MemArena *memArena; /* callbacks */ diff --git a/source/blender/render/intern/raytrace/bvh.h b/source/blender/render/intern/raytrace/bvh.h index 6eaad444ed4..ac86a65ff0b 100644 --- a/source/blender/render/intern/raytrace/bvh.h +++ b/source/blender/render/intern/raytrace/bvh.h @@ -267,7 +267,7 @@ static int bvh_node_stack_raycast_simd(Node *root, Isect *isec) const __m128 Y2Z2Y3Z3 = _mm_shuffle_ps( _mm_load_ps(bb2+4), _mm_load_ps(bb3+4), _MM_SHUFFLE(1,0,1,0) ); t_bb[4] = _mm_shuffle_ps( Y0Z0Y1Z1, Y2Z2Y3Z3, _MM_SHUFFLE(2,0,2,0) ); t_bb[5] = _mm_shuffle_ps( Y0Z0Y1Z1, Y2Z2Y3Z3, _MM_SHUFFLE(3,1,3,1) ); -/* +#if 0 for(int i=0; i<4; i++) { Node *t = stack[stack_pos+i]; @@ -282,7 +282,7 @@ static int bvh_node_stack_raycast_simd(Node *root, Isect *isec) bb[4*5] = t->bb[5]; t_node[i] = t->child; } -*/ +#endif RE_RC_COUNT(isec->raycounter->simd_bb.test); int res = test_bb_group4( t_bb, isec ); @@ -333,7 +333,7 @@ static int bvh_node_stack_raycast_simd(Node *root, Isect *isec) /* * recursively transverse a BVH looking for a rayhit using system stack */ -/* +#if 0 template<class Node> static int bvh_node_raycast(Node *node, Isect *isec) { @@ -378,7 +378,7 @@ static int bvh_node_raycast(Node *node, Isect *isec) } return hit; } -*/ +#endif template<class Node,class HintObject> void bvh_dfs_make_hint(Node *node, LCTSHint *hint, int reserve_space, HintObject *hintObject) diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp index 26c0105b624..3f675a1b9ab 100644 --- a/source/blender/render/intern/raytrace/rayobject.cpp +++ b/source/blender/render/intern/raytrace/rayobject.cpp @@ -45,10 +45,10 @@ #include "render_types.h" /* RayFace - - note we force always inline here, because compiler refuses to otherwise - because function is too long. Since this is code that is called billions - of times we really do want to inline. */ + * + * note we force always inline here, because compiler refuses to otherwise + * because function is too long. Since this is code that is called billions + * of times we really do want to inline. */ MALWAYS_INLINE RayObject* rayface_from_coords(RayFace *rayface, void *ob, void *face, float *v1, float *v2, float *v3, float *v4) @@ -283,7 +283,7 @@ MALWAYS_INLINE int isec_tri_quad_neighbour(float start[3], float dir[3], RayFace } /* RayFace intersection with checks and neighbor verifaction included, - Isect is modified if the face is hit. */ + * Isect is modified if the face is hit. */ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *is) { @@ -321,7 +321,7 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i if(ok) { /* when a shadow ray leaves a face, it can be little outside the edges - of it, causing intersection to be detected in its neighbor face */ + * of it, causing intersection to be detected in its neighbor face */ if(is->skip & RE_SKIP_VLR_NEIGHBOUR) { if(dist < 0.1f && is->orig.ob == face->ob) @@ -330,8 +330,8 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i VlakRen * b = (VlakRen*)face->face; /* so there's a shared edge or vertex, let's intersect ray with - face itself, if that's true we can safely return 1, otherwise - we assume the intersection is invalid, 0 */ + * face itself, if that's true we can safely return 1, otherwise + * we assume the intersection is invalid, 0 */ if(a->v1==b->v1 || a->v2==b->v1 || a->v3==b->v1 || a->v4==b->v1 || a->v1==b->v2 || a->v2==b->v2 || a->v3==b->v2 || a->v4==b->v2 || a->v1==b->v3 || a->v2==b->v3 || a->v3==b->v3 || a->v4==b->v3 diff --git a/source/blender/render/intern/raytrace/rayobject_hint.h b/source/blender/render/intern/raytrace/rayobject_hint.h index 9e505b68101..3689aa8ac17 100644 --- a/source/blender/render/intern/raytrace/rayobject_hint.h +++ b/source/blender/render/intern/raytrace/rayobject_hint.h @@ -49,7 +49,7 @@ inline int hint_test_bb(HintBB *obj, float *Nmin, float *Nmax) else return HINT_ACCEPT; } -/* +#if 0 struct HintFrustum { float co[3]; @@ -69,7 +69,6 @@ inline int hint_test_bb(HintFrustum &obj, float *Nmin, float *Nmax) return HINT_ACCEPT; } -*/ - #endif +#endif /* __RAYOBJECT_HINT_H__ */ diff --git a/source/blender/render/intern/raytrace/rayobject_internal.h b/source/blender/render/intern/raytrace/rayobject_internal.h index 8e39b687b34..8c8e432b6bd 100644 --- a/source/blender/render/intern/raytrace/rayobject_internal.h +++ b/source/blender/render/intern/raytrace/rayobject_internal.h @@ -33,40 +33,40 @@ typedef struct RayObjectControl { int RE_rayobjectcontrol_test_break(RayObjectControl *c); /* RayObject - - A ray object is everything where we can cast rays like: - * a face/triangle - * an octree - * a bvh tree - * an octree of bvh's - * a bvh of bvh's - - - All types of RayObjects can be created by implementing the - callbacks of the RayObject. - - Due to high computing time evolved with casting on faces - there is a special type of RayObject (named RayFace) - which won't use callbacks like other generic nodes. - - In order to allow a mixture of RayFace+RayObjects, - all RayObjects must be 4byte aligned, allowing us to use the - 2 least significant bits (with the mask 0x03) to define the - type of RayObject. - - This leads to 4 possible types of RayObject: - - addr&3 - type of object - 0 Self (reserved for each structure) - 1 RayFace (tri/quad primitive) - 2 RayObject (generic with API callbacks) - 3 VlakPrimitive - (vlak primitive - to be used when we have a vlak describing the data - eg.: on render code) - - 0 means it's reserved and has it own meaning inside each ray acceleration structure - (this way each structure can use the allign offset to determine if a node represents a - RayObject primitive, which can be used to save memory) + * + * A ray object is everything where we can cast rays like: + * * a face/triangle + * * an octree + * * a bvh tree + * * an octree of bvh's + * * a bvh of bvh's + * + * + * All types of RayObjects can be created by implementing the + * callbacks of the RayObject. + * + * Due to high computing time evolved with casting on faces + * there is a special type of RayObject (named RayFace) + * which won't use callbacks like other generic nodes. + * + * In order to allow a mixture of RayFace+RayObjects, + * all RayObjects must be 4byte aligned, allowing us to use the + * 2 least significant bits (with the mask 0x03) to define the + * type of RayObject. + * + * This leads to 4 possible types of RayObject: + * + * addr&3 - type of object + * 0 Self (reserved for each structure) + * 1 RayFace (tri/quad primitive) + * 2 RayObject (generic with API callbacks) + * 3 VlakPrimitive + * (vlak primitive - to be used when we have a vlak describing the data + * eg.: on render code) + * + * 0 means it's reserved and has it own meaning inside each ray acceleration structure + * (this way each structure can use the allign offset to determine if a node represents a + * RayObject primitive, which can be used to save memory) */ /* used to test the type of ray object */ diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp index 648cb940af4..3e2c60cfcc0 100644 --- a/source/blender/render/intern/raytrace/rayobject_octree.cpp +++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp @@ -29,7 +29,7 @@ /* IMPORTANT NOTE: this code must be independent of any other render code - to use it outside the renderer! */ + * to use it outside the renderer! */ #include <math.h> #include <string.h> @@ -805,9 +805,9 @@ static int cliptest(float p, float q, float *u1, float *u2) } /* extensive coherence checks/storage cancels out the benefit of it, and gives errors... we - need better methods, sample code commented out below (ton) */ + * need better methods, sample code commented out below (ton) */ -/* +#if 0 in top: static int coh_nodes[16*16*16][6]; in makeoctree: memset(coh_nodes, 0, sizeof(coh_nodes)); @@ -832,7 +832,7 @@ static int do_coherence_test(int ocx1, int ocx2, int ocy1, int ocy2, int ocz1, i return 0; } -*/ +#endif /* return 1: found valid intersection */ /* starts with is->orig.face */ @@ -986,7 +986,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) vec2[2]= oz1; /* this loop has been constructed to make sure the first and last node of ray - are always included, even when ddalabda==1.0f or larger */ + * are always included, even when ddalabda==1.0f or larger */ while(TRUE) { @@ -1013,7 +1013,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) labdao= ddalabda; /* traversing ocree nodes need careful detection of smallest values, with proper - exceptions for equal labdas */ + * exceptions for equal labdas */ eqval= (labdax==labday); if(labday==labdaz) eqval += 2; if(labdax==labdaz) eqval += 4; diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp index dc75ed5e37b..6988e3fcc38 100644 --- a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp +++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp @@ -105,8 +105,8 @@ void rtbuild_add(RTBuilder *b, RayObject *o) RE_rayobject_merge_bb(o, bb, bb+3); /* skip objects with invalid bounding boxes, nan causes DO_MINMAX - to do nothing, so we get these invalid values. this shouldn't - happen usually, but bugs earlier in the pipeline can cause it. */ + * to do nothing, so we get these invalid values. this shouldn't + * happen usually, but bugs earlier in the pipeline can cause it. */ if(bb[0] > bb[3] || bb[1] > bb[4] || bb[2] > bb[5]) return; /* skip objects with inf bounding boxes */ @@ -115,7 +115,7 @@ void rtbuild_add(RTBuilder *b, RayObject *o) if(!finite(bb[3]) || !finite(bb[4]) || !finite(bb[5])) return; /* skip objects with zero bounding box, they are of no use, and - will give problems in rtbuild_heuristic_object_split later */ + * will give problems in rtbuild_heuristic_object_split later */ if(bb[0] == bb[3] && bb[1] == bb[4] && bb[2] == bb[5]) return; @@ -205,7 +205,7 @@ void rtbuild_merge_bb(RTBuilder *b, float *min, float *max) DO_MAX(b->bb+3, max); } -/* +#if 0 int rtbuild_get_largest_axis(RTBuilder *b) { rtbuild_calc_bb(b); @@ -269,13 +269,13 @@ int rtbuild_mean_split_largest_axis(RTBuilder *b, int nchilds) int axis = rtbuild_get_largest_axis(b); return rtbuild_mean_split(b, nchilds, axis); } -*/ +#endif /* * "separators" is an array of dim NCHILDS-1 * and indicates where to cut the childs */ -/* +#if 0 int rtbuild_median_split(RTBuilder *b, float *separators, int nchilds, int axis) { int size = rtbuild_size(b); @@ -318,7 +318,7 @@ int rtbuild_median_split_largest_axis(RTBuilder *b, int nchilds) return rtbuild_median_split(b, separators, nchilds, la); } -*/ +#endif //Heuristics Object Splitter @@ -454,7 +454,7 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds) * PARTITION code / used on mean-split * basicly this a std::nth_element (like on C++ STL algorithm) */ -/* +#if 0 static void split_leafs(RTBuilder *b, int *nth, int partitions, int split_axis) { int i; @@ -469,7 +469,7 @@ static void split_leafs(RTBuilder *b, int *nth, int partitions, int split_axis) if(split_axis == 2) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,2>); } } -*/ +#endif /* * Bounding Box utils diff --git a/source/blender/render/intern/raytrace/vbvh.h b/source/blender/render/intern/raytrace/vbvh.h index ab6a1bbfd33..7d4d25c8d00 100644 --- a/source/blender/render/intern/raytrace/vbvh.h +++ b/source/blender/render/intern/raytrace/vbvh.h @@ -65,14 +65,17 @@ inline static void bvh_node_push_childs(Node *node, Isect *UNUSED(isec), Node ** { while(child) { - //Skips BB tests on primitives -/* - if(is_leaf(child->child)) + /* Skips BB tests on primitives */ +#if 0 + if(is_leaf(child->child)) { stack[stack_pos++] = child->child; + } else -*/ +#endif + { stack[stack_pos++] = child; - + } + child = child->sibling; } } @@ -197,7 +200,7 @@ struct BuildBinaryVBVH } }; -/* +#if 0 template<class Tree,class OldNode> struct Reorganize_VBVH { @@ -242,4 +245,4 @@ struct Reorganize_VBVH return node; } }; -*/ +#endif diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 89e10cf37eb..1501c6ca4b3 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -126,7 +126,7 @@ /* ------------------------------------------------------------------------- */ /* Stuff for stars. This sits here because it uses gl-things. Part of -this code may move down to the converter. */ + * this code may move down to the converter. */ /* ------------------------------------------------------------------------- */ /* this is a bad beast, since it is misused by the 3d view drawing as well. */ @@ -149,10 +149,10 @@ static HaloRen *initstar(Render *re, ObjectRen *obr, float *vec, float hasize) } /* there must be a 'fixed' amount of stars generated between -* near and far -* all stars must by preference lie on the far and solely -* differ in clarity/color -*/ + * near and far + * all stars must by preference lie on the far and solely + * differ in clarity/color + */ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void), void (*vertexfunc)(float*), void (*termfunc)(void)) @@ -199,10 +199,10 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void), else unit_m4(mat); /* BOUNDING BOX CALCULATION - * bbox goes from z = loc_near_var | loc_far_var, - * x = -z | +z, - * y = -z | +z - */ + * bbox goes from z = loc_near_var | loc_far_var, + * x = -z | +z, + * y = -z | +z + */ camera= re ? RE_GetCamera(re) : scene->camera; @@ -250,9 +250,9 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void), mul_m4_v3(re->viewmat, vec); /* in vec are global coordinates - * calculate distance to camera - * and using that, define the alpha - */ + * calculate distance to camera + * and using that, define the alpha + */ { float tx, ty, tz; @@ -321,7 +321,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void), /* ------------------------------------------------------------------------- */ /* tool functions/defines for ad hoc simplification and possible future - cleanup */ + * cleanup */ /* ------------------------------------------------------------------------- */ #define UVTOINDEX(u,v) (startvlak + (u) * sizev + (v)) @@ -514,8 +514,8 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr /**************************************************************** -************ tangent space generation interface ***************** -****************************************************************/ + ************ tangent space generation interface **************** + ****************************************************************/ typedef struct { @@ -608,7 +608,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen } /* calculate cos of angles and point-masses, use as weight factor to - add face normal to vertex */ + * add face normal to vertex */ for(a=0; a<obr->totvlak; a++) { VlakRen *vlr= RE_findOrAddVlak(obr, a); if(vlr->flag & ME_SMOOTH) { @@ -2316,7 +2316,7 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve //printf("after co=%f, %f, %f\n", vr->co[0], vr->co[1], vr->co[2]); /* we just don't do this vertex again, bad luck for other face using same vertex with - different material... */ + * different material... */ vr->flag |= 1; /* Pass sample back so displace_face can decide which way to split the quad */ @@ -2334,7 +2334,7 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float ShadeInput shi; /* Warning, This is not that nice, and possibly a bit slow, - however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */ + * however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */ memset(&shi, 0, sizeof(ShadeInput)); /* end warning! - Campbell */ @@ -4054,8 +4054,8 @@ static void set_phong_threshold(ObjectRen *obr) int tot=0, i; /* Added check for 'pointy' situations, only dotproducts of 0.9 and larger - are taken into account. This threshold is meant to work on smooth geometry, not - for extreme cases (ton) */ + * are taken into account. This threshold is meant to work on smooth geometry, not + / for extreme cases (ton) */ for(i=0; i<obr->totvlak; i++) { vlr= RE_findOrAddVlak(obr, i); @@ -4094,7 +4094,7 @@ static void set_phong_threshold(ObjectRen *obr) } /* per face check if all samples should be taken. - if raytrace or multisample, do always for raytraced material, or when material full_osa set */ + * if raytrace or multisample, do always for raytraced material, or when material full_osa set */ static void set_fullsample_trace_flag(Render *re, ObjectRen *obr) { VlakRen *vlr; diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index a45bb63ff06..f9641ed9fbe 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -295,8 +295,8 @@ static void env_rotate_scene(Render *re, float mat[][4], int mode) lar= go->lampren; /* removed here some horrible code of someone in NaN who tried to fix - prototypes... just solved by introducing a correct cmat[3][3] instead - of using smat. this works, check square spots in reflections (ton) */ + * prototypes... just solved by introducing a correct cmat[3][3] instead + * of using smat. this works, check square spots in reflections (ton) */ copy_m3_m3(cmat, lar->imat); mul_m3_m3m3(lar->imat, cmat, imat); @@ -330,12 +330,12 @@ static void env_layerflags(Render *re, unsigned int notlay) int a; /* invert notlay, so if face is in multiple layers it will still be visible, - unless all 'notlay' bits match the face bits. - face: 0110 - not: 0100 - ~not: 1011 - now (face & ~not) is true - */ + * unless all 'notlay' bits match the face bits. + * face: 0110 + * not: 0100 + * ~not: 1011 + * now (face & ~not) is true + */ notlay= ~notlay; diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index 2d64828b6b3..4a6558474f0 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -455,7 +455,7 @@ static float clipy_rctf(rctf *rf, float y1, float y2) static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres) { /* sample box, is clipped already, and minx etc. have been set at ibuf size. - Enlarge with antialiased edges of the pixels */ + * Enlarge with antialiased edges of the pixels */ float muly, mulx, div, col[4]; int x, y, startx, endx, starty, endy; diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c index c9729aecfae..47b13cd484d 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -235,9 +235,9 @@ static void occ_build_shade(Render *re, OcclusionTree *tree) /* ------------------------- Spherical Harmonics --------------------------- */ /* Use 2nd order SH => 9 coefficients, stored in this order: - 0 = (0,0), - 1 = (1,-1), 2 = (1,0), 3 = (1,1), - 4 = (2,-2), 5 = (2,-1), 6 = (2,0), 7 = (2,1), 8 = (2,2) */ + * 0 = (0,0), + * 1 = (1,-1), 2 = (1,0), 3 = (1,1), + * 4 = (2,-2), 5 = (2,-1), 6 = (2,0), 7 = (2,1), 8 = (2,2) */ static void sh_copy(float *shresult, float *sh) { @@ -263,7 +263,7 @@ static void sh_add(float *shresult, float *sh1, float *sh2) static void sh_from_disc(float *n, float area, float *shresult) { /* See formula (3) in: - "An Efficient Representation for Irradiance Environment Maps" */ + * "An Efficient Representation for Irradiance Environment Maps" */ float sh[9], x, y, z; x= n[0]; @@ -289,7 +289,7 @@ static void sh_from_disc(float *n, float area, float *shresult) static float sh_eval(float *sh, float *v) { /* See formula (13) in: - "An Efficient Representation for Irradiance Environment Maps" */ + * "An Efficient Representation for Irradiance Environment Maps" */ static const float c1 = 0.429043f, c2 = 0.511664f, c3 = 0.743125f; static const float c4 = 0.886227f, c5 = 0.247708f; float x, y, z, sum; @@ -1307,12 +1307,14 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float if(occ) *occ= resultocc; if(rad) copy_v3_v3(rad, resultrad); - /*if(rad && exclude) { +#if 0 + if(rad && exclude) { int a; for(a=0; a<tree->totface; a++) if((tree->face[a].obi == exclude->obi && tree->face[a].facenr == exclude->facenr)) copy_v3_v3(rad, tree->rad[a]); - }*/ + } +#endif if(bentn) normalize_v3(bentn); } diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index d06df07f6b0..73305755fc5 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -86,31 +86,30 @@ #include "pixelblending.h" #include "zbuf.h" - /* render flow - -1) Initialize state -- state data, tables -- movie/image file init -- everything that doesn't change during animation - -2) Initialize data -- camera, world, matrices -- make render verts, faces, halos, strands -- everything can change per frame/field - -3) Render Processor -- multiple layers -- tiles, rect, baking -- layers/tiles optionally to disk or directly in Render Result - -4) Composite Render Result -- also read external files etc - -5) Image Files -- save file or append in movie - -*/ + * + * 1) Initialize state + * - state data, tables + * - movie/image file init + * - everything that doesn't change during animation + * + * 2) Initialize data + * - camera, world, matrices + * - make render verts, faces, halos, strands + * - everything can change per frame/field + * + * 3) Render Processor + * - multiple layers + * - tiles, rect, baking + * - layers/tiles optionally to disk or directly in Render Result + * + * 4) Composite Render Result + * - also read external files etc + * + * 5) Image Files + * - save file or append in movie + * + */ /* ********* globals ******** */ @@ -1241,8 +1240,8 @@ static void do_render_fields_blur_3d(Render *re) /* within context of current Render *re, render another scene. - it uses current render image size and disprect, but doesn't execute composite -*/ + * it uses current render image size and disprect, but doesn't execute composite + */ static void render_scene(Render *re, Scene *sce, int cfra) { Render *resc= RE_NewRender(sce->id.name); @@ -1646,7 +1645,7 @@ static void do_render_seq(Render * re) if((re->r.mode & R_BORDER) && (re->r.mode & R_CROP)==0) { /* if border rendering is used and cropping is disabled, final buffer should - be as large as the whole frame */ + * be as large as the whole frame */ context = seq_new_render_data(re->main, re->scene, re->winx, re->winy, 100); @@ -1921,7 +1920,7 @@ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, Sc rcti disprect; /* r.xsch and r.ysch has the actual view window size - r.border is the clipping rect */ + * r.border is the clipping rect */ /* calculate actual render result and display size */ winx= (scene->r.size*scene->r.xsch)/100; @@ -1959,7 +1958,7 @@ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, Sc * Disabled completely for now, * can be later set as render profile option * and default for background render. - */ + */ if(0) { /* make sure dynamics are up to date */ update_physics_cache(re, scene, anim_init); diff --git a/source/blender/render/intern/source/pixelblending.c b/source/blender/render/intern/source/pixelblending.c index 11e8e792159..0a8a59a860c 100644 --- a/source/blender/render/intern/source/pixelblending.c +++ b/source/blender/render/intern/source/pixelblending.c @@ -233,18 +233,17 @@ void mask_array(unsigned int mask, float filt[][3]) } -/* - -index ordering, scanline based: - - --- --- --- -| 2,0 | 2,1 | 2,2 | - --- --- --- -| 1,0 | 1,1 | 1,2 | - --- --- --- -| 0,0 | 0,1 | 0,2 | - --- --- --- -*/ +/** + * Index ordering, scanline based: + * + * --- --- --- + * | 2,0 | 2,1 | 2,2 | + * --- --- --- + * | 1,0 | 1,1 | 1,2 | + * --- --- --- + * | 0,0 | 0,1 | 0,2 | + * --- --- --- + */ void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w, int col_h, int x, int y) { diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index 223c56ef9d6..965abb361fd 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -142,7 +142,8 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) ShadeInput shi; /* Warning, This is not that nice, and possibly a bit slow, - however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */ + * however some variables were not initialized properly in, unless using shade_input_initialize(...), + * we need to do a memset */ memset(&shi, 0, sizeof(ShadeInput)); /* end warning! - Campbell */ @@ -593,17 +594,17 @@ void shadeSunView(float col_r[3], const float view[3]) /* - Stuff the sky color into the collector. + * Stuff the sky color into the collector. */ void shadeSkyPixel(float collector[4], float fx, float fy, short thread) { float view[3], dxyview[2]; /* - The rules for sky: - 1. Draw an image, if a background image was provided. Stop - 2. get texture and color blend, and combine these. - */ + * The rules for sky: + * 1. Draw an image, if a background image was provided. Stop + * 2. get texture and color blend, and combine these. + */ float fac; diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index ae3748755ff..1904d5dce63 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -346,9 +346,9 @@ static void accum_density(void *userdata, int index, float squared_dist) float density = 0.0f; if (pdr->point_data_used & POINT_DATA_VEL) { - pdr->vec[0] += pdr->point_data[index*3 + 0]; //* density; - pdr->vec[1] += pdr->point_data[index*3 + 1]; //* density; - pdr->vec[2] += pdr->point_data[index*3 + 2]; //* density; + pdr->vec[0] += pdr->point_data[index*3 + 0]; // * density; + pdr->vec[1] += pdr->point_data[index*3 + 1]; // * density; + pdr->vec[2] += pdr->point_data[index*3 + 2]; // * density; } if (pdr->point_data_used & POINT_DATA_LIFE) { *pdr->age += pdr->point_data[pdr->offset + index]; // * density; @@ -515,9 +515,9 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres) return retval; - /* +#if 0 if (texres->nor!=NULL) { texres->nor[0] = texres->nor[1] = texres->nor[2] = 0.0f; } - */ +#endif } diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 526f709e13b..9272dcf5b30 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -435,7 +435,7 @@ void makeraytree(Render *re) re->stats_draw(re->sdh, &re->i); /* disable options not yet supported by octree, - they might actually never be supported (unless people really need it) */ + * they might actually never be supported (unless people really need it) */ if(re->r.raytrace_structure == R_RAYSTRUCTURE_OCTREE) re->r.raytrace_options &= ~( R_RAYTRACE_USE_INSTANCES | R_RAYTRACE_USE_LOCAL_COORDS); @@ -1604,7 +1604,7 @@ static void addAlphaLight(float shadfac[4], const float col[3], float alpha, flo static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int traflag, float col[4]) { /* ray to lamp, find first face that intersects, check alpha properties, - if it has col[3]>0.0f continue. so exit when alpha is full */ + * if it has col[3]>0.0f continue. so exit when alpha is full */ const float initial_dist = is->dist; if(RE_rayobject_raycast(R.raytree, is)) { @@ -1709,7 +1709,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult * float fac; /* Warning, This is not that nice, and possibly a bit slow for every ray, - however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */ + * however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */ memset(&shi, 0, sizeof(ShadeInput)); /* end warning! - Campbell */ @@ -2075,7 +2075,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3]) if(resol>32) resol= 32; /* get sphere samples. for faces we get the same samples for sample x/y values, - for strand render we always require a new sampler because x/y are not set */ + * for strand render we always require a new sampler because x/y are not set */ vec= sphere_sampler(R.wrld.aomode, resol, shi->thread, shi->xs, shi->ys, shi->strand != NULL); // warning: since we use full sphere now, and dotproduct is below, we do twice as much diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index 384b2e13e90..f9ceaa63fc1 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -110,7 +110,7 @@ void render_result_free_list(ListBase *lb, RenderResult *rr) /********************************* Names *************************************/ /* NOTE: OpenEXR only supports 32 chars for layer+pass names - In blender we now use max 10 chars for pass, max 20 for layer */ + * In blender we now use max 10 chars for pass, max 20 for layer */ static const char *get_pass_name(int passtype, int channel) { @@ -1069,7 +1069,7 @@ void render_result_rect_from_ibuf(RenderResult *rr, RenderData *rd, ImBuf *ibuf) rr->rectx, rr->recty, rr->rectx, rr->rectx); /* TSK! Since sequence render doesn't free the *rr render result, the old rect32 - can hang around when sequence render has rendered a 32 bits one before */ + * can hang around when sequence render has rendered a 32 bits one before */ if(rr->rect32) { MEM_freeN(rr->rect32); rr->rect32= NULL; diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 76b9537116b..ede314a42e1 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -1348,7 +1348,7 @@ int multitex_mtex(ShadeInput *shi, MTex *mtex, float *texvec, float *dxt, float if(tex->use_nodes && tex->nodetree) { /* stupid exception here .. but we have to pass shi and mtex to - textures nodes for 2d mapping and color management for images */ + * textures nodes for 2d mapping and color management for images */ return ntreeTexExecTree(tex->nodetree, texres, texvec, dxt, dyt, shi->osatex, shi->thread, tex, mtex->which_output, R.r.cfra, (R.r.scemode & R_TEXNODE_PREVIEW) != 0, shi, mtex); } @@ -2064,8 +2064,8 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T texres->nor = nvec; /* replaced newbump with code based on listing 1 and 2 of - [Mik10] Mikkelsen M. S.: Bump Mapping Unparametrized Surfaces on the GPU. - -> http://jbit.net/~sparky/sfgrad_bump/mm_sfgrad_bump.pdf */ + * [Mik10] Mikkelsen M. S.: Bump Mapping Unparametrized Surfaces on the GPU. + * -> http://jbit.net/~sparky/sfgrad_bump/mm_sfgrad_bump.pdf */ if( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) iBumpSpace = 1; @@ -2494,7 +2494,7 @@ void do_material_tex(ShadeInput *shi, Render *re) found_nmapping = 1; /* qdn: for normalmaps, to invert the normalmap vector, - it is better to negate x & y instead of subtracting the vector as was done before */ + * it is better to negate x & y instead of subtracting the vector as was done before */ if (norfac < 0.0f) { texres.nor[0] = -texres.nor[0]; texres.nor[1] = -texres.nor[1]; @@ -3508,7 +3508,7 @@ void render_realtime_texture(ShadeInput *shi, Image *ima) } /* A modified part of shadeinput.c -> shade_input_set_uv() -* Used for sampling UV mapped texture color */ + * Used for sampling UV mapped texture color */ static void textured_face_generate_uv(float *uv, float *normal, float *hit, float *v1, float *v2, float *v3) { @@ -3647,15 +3647,15 @@ void RE_free_sample_material(Material *mat) /* -* Get material diffuse color and alpha (including linked textures) in given coordinates -* -* color,alpha : input/output color values -* volume_co : sample coordinate in global space. used by volumetric materials -* surface_co : sample surface coordinate in global space. used by "surface" materials -* face_index : surface face index -* hit_quad : whether point is on second "half" of a quad -* orcoDm : orco state derived mesh -*/ + * Get material diffuse color and alpha (including linked textures) in given coordinates + * + * color,alpha : input/output color values + * volume_co : sample coordinate in global space. used by volumetric materials + * surface_co : sample surface coordinate in global space. used by "surface" materials + * face_index : surface face index + * hit_quad : whether point is on second "half" of a quad + * orcoDm : orco state derived mesh + */ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const float volume_co[3], const float surface_co[3], int face_index, short hit_quad, DerivedMesh *orcoDm, Object *ob) { MFace *mface; diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 2d3837acbfa..28988af64c4 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -1469,7 +1469,7 @@ static void addps_sss(void *cb_handle, int obi, int facenr, int x, int y, int z) RenderPart *pa= handle->pa; /* extra border for filter gives double samples on part edges, - don't use those */ + * don't use those */ if(x<pa->crop || x>=pa->rectx-pa->crop) return; if(y<pa->crop || y>=pa->recty-pa->crop) @@ -1528,9 +1528,9 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe sy = y + 0.5f; /* we estimate the area here using shi->dxco and shi->dyco. we need to - enabled shi->osatex these are filled. we compute two areas, one with - the normal pointed at the camera and one with the original normal, and - then clamp to avoid a too large contribution from a single pixel */ + * enabled shi->osatex these are filled. we compute two areas, one with + * the normal pointed at the camera and one with the original normal, and + * then clamp to avoid a too large contribution from a single pixel */ shi->osatex= 1; copy_v3_v3(nor, shi->facenor); @@ -1559,7 +1559,7 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe } /* if nodetree, use the material that we are currently preprocessing - instead of the node material */ + * instead of the node material */ if(shi->mat->nodetree && shi->mat->use_nodes) shi->mat= mat; @@ -2054,7 +2054,7 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua shade_input_set_shade_texco(shi); /* only do AO for a full bake (and obviously AO bakes) - AO for light bakes is a leftover and might not be needed */ + * AO for light bakes is a leftover and might not be needed */ if( ELEM3(bs->type, RE_BAKE_ALL, RE_BAKE_AO, RE_BAKE_LIGHT)) shade_samples_do_AO(ssamp); diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 9bec8595569..c04daa11b3e 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -91,10 +91,10 @@ /* ------------------------------------------------------------------------- */ /* More dynamic allocation of options for render vertices and faces, so we dont - have to reserve this space inside vertices. - Important; vertices and faces, should have been created already (to get tables - checked) that's a reason why the calls demand VertRen/VlakRen * as arg, not - the index */ + * have to reserve this space inside vertices. + * Important; vertices and faces, should have been created already (to get tables + * checked) that's a reason why the calls demand VertRen/VlakRen * as arg, not + * the index */ /* NOTE! the hardcoded table size 256 is used still in code for going quickly over vertices/faces */ @@ -460,7 +460,7 @@ void RE_vlakren_get_normal(Render *UNUSED(re), ObjectInstanceRen *obi, VlakRen * void RE_set_customdata_names(ObjectRen *obr, CustomData *data) { /* CustomData layer names are stored per object here, because the - DerivedMesh which stores the layers is freed */ + * DerivedMesh which stores the layers is freed */ CustomDataLayer *layer; int numtf = 0, numcol = 0, i, mtfn, mcn; @@ -1223,15 +1223,15 @@ static int panotestclip(Render *re, int do_pano, float *v) return c; } -/* - This adds the hcs coordinates to vertices. It iterates over all - vertices, halos and faces. After the conversion, we clip in hcs. - - Elsewhere, all primites are converted to vertices. - Called in - - envmapping (envmap.c) - - shadow buffering (shadbuf.c) -*/ +/** + * This adds the hcs coordinates to vertices. It iterates over all + * vertices, halos and faces. After the conversion, we clip in hcs. + * + * Elsewhere, all primites are converted to vertices. + * Called in + * - envmapping (envmap.c) + * - shadow buffering (shadbuf.c) + */ void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat[][4], float *), int do_pano, float xoffs, int UNUSED(do_buckets)) { diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index 0e90fbf7536..3ef62f7b383 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -59,8 +59,7 @@ #include "shading.h" #include "zbuf.h" -/* XXX, could be better implemented... this is for endian issues -*/ +/* XXX, could be better implemented... this is for endian issues */ #ifdef __BIG_ENDIAN__ # define RCOMP 3 # define GCOMP 2 @@ -185,17 +184,19 @@ static int verg_deepsample(const void *poin1, const void *poin2) static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon) { /* uses doubles to avoid overflows and other numerical issues, - could be improved */ + * could be improved */ DeepSample *ds, *newds; float v; double slope, slopemin, slopemax, min, max, div, newmin, newmax; int a, first, z, newtot= 0; - /*if(print) { +#if 0 + if(print) { for(a=0, ds=dsample; a<tot; a++, ds++) printf("%lf,%f ", ds->z/(double)0x7FFFFFFF, ds->v); printf("\n"); - }*/ + } +#endif /* read from and write into same array */ ds= dsample; @@ -212,7 +213,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon) //dz= ds->z - newds->z; if(ds->z == newds->z) { /* still in same z position, simply check - visibility difference against epsilon */ + * visibility difference against epsilon */ if(!(fabs(newds->v - ds->v) <= epsilon)) { break; } @@ -274,11 +275,13 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon) if(newtot == 0 || (newds->v != (newds-1)->v)) newtot++; - /*if(print) { +#if 0 + if(print) { for(a=0, ds=dsample; a<newtot; a++, ds++) printf("%lf,%f ", ds->z/(double)0x7FFFFFFF, ds->v); printf("\n"); - }*/ + } +#endif return newtot; } @@ -769,7 +772,7 @@ void makeshadowbuf(Render *re, LampRen *lar) shb->size= 1024; /* matrices and window: in winmat the transformation is being put, - transforming from observer view to lamp view, including lamp window matrix */ + * transforming from observer view to lamp view, including lamp window matrix */ angle= saacos(lar->spotsi); temp= 0.5f*shb->size*cos(angle)/sin(angle); @@ -1134,7 +1137,7 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc shadowbuf_project_co(&xs1, &ys1, &zs1, shb, co); /* clip z coordinate, z is projected so that (-1.0, 1.0) matches - (clipstart, clipend), so we can do this simple test */ + * (clipstart, clipend), so we can do this simple test */ if(zs1>=1.0f) return 0.0f; else if(zs1<= -1.0f) @@ -1151,7 +1154,7 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc if(mat_bias!=0.0f) biasf= shb->bias*mat_bias; else biasf= shb->bias; /* with inp==1.0, bias is half the size. correction value was 1.1, giving errors - on cube edges, with one side being almost frontal lighted (ton) */ + * on cube edges, with one side being almost frontal lighted (ton) */ bias= (1.5f-inp*inp)*biasf; /* in case of no filtering we can do things simpler */ @@ -1416,12 +1419,12 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3]) /* ********** storage of all view samples in a raster of lists ***** */ /* based on several articles describing this method, like: -The Irregular Z-Buffer and its Application to Shadow Mapping -Gregory S. Johnson - William R. Mark - Christopher A. Burns -and -Alias-Free Shadow Maps -Timo Aila and Samuli Laine -*/ + * The Irregular Z-Buffer and its Application to Shadow Mapping + * Gregory S. Johnson - William R. Mark - Christopher A. Burns + * and + * Alias-Free Shadow Maps + * Timo Aila and Samuli Laine + */ /* bsp structure (actually kd tree) */ diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index e855f2e62f3..29c1318727c 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -66,30 +66,31 @@ extern struct Render R; /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - -#define VECADDISFAC(v1,v3,fac) {*(v1)+= *(v3)*(fac); *(v1+1)+= *(v3+1)*(fac); *(v1+2)+= *(v3+2)*(fac);} - - - /* Shade Sample order: + * + * - shade_samples_fill_with_ps() + * - for each sample + * - shade_input_set_triangle() <- if prev sample-face is same, use shade_input_copy_triangle() + * - if vlr + * - shade_input_set_viewco() <- not for ray or bake + * - shade_input_set_uv() <- not for ray or bake + * - shade_input_set_normals() + * - shade_samples() + * - if AO + * - shade_samples_do_AO() + * - if shading happens + * - for each sample + * - shade_input_set_shade_texco() + * - shade_samples_do_shade() + * - OSA: distribute sample result with filter masking + * + */ -- shade_samples_fill_with_ps() - - for each sample - - shade_input_set_triangle() <- if prev sample-face is same, use shade_input_copy_triangle() - - if vlr - - shade_input_set_viewco() <- not for ray or bake - - shade_input_set_uv() <- not for ray or bake - - shade_input_set_normals() -- shade_samples() - - if AO - - shade_samples_do_AO() - - if shading happens - - for each sample - - shade_input_set_shade_texco() - - shade_samples_do_shade() -- OSA: distribute sample result with filter masking - - */ +#define VECADDISFAC(v1,v3,fac) { \ + *(v1 + 0) += *(v3 + 0) * (fac); \ + *(v1 + 1) += *(v3 + 1) * (fac); \ + *(v1 + 2) += *(v3 + 2) * (fac); \ +} /* initialize material variables in shadeinput, * doing inverse gamma correction where applicable */ @@ -926,7 +927,7 @@ void shade_input_set_shade_texco(ShadeInput *shi) } else { /* qdn: flat faces have tangents too, - could pick either one, using average here */ + * could pick either one, using average here */ tl= 1.0f/3.0f; tu= -1.0f/3.0f; tv= -1.0f/3.0f; @@ -1310,9 +1311,12 @@ void shade_input_set_shade_texco(ShadeInput *shi) } } } - } /* else { - Note! For raytracing winco is not set, important because thus means all shader input's need to have their variables set to zero else in-initialized values are used - */ + } + /* else { + * Note! For raytracing winco is not set, + * important because thus means all shader input's need to have their variables set to zero + * else un-initialized values are used + */ if (shi->do_manage) { if(mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)) { srgb_to_linearrgb_v3_v3(shi->vcol, shi->vcol); diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 85b545269e5..04fde7bf0b9 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -326,7 +326,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) *intens= c*( (1.0-a)+(1.0-b) ); /* WATCH IT: do not clip a,b en c at 1.0, this gives nasty little overflows - at the edges (especially with narrow halos) */ + * at the edges (especially with narrow halos) */ if(*intens<=0.0f) return; /* soft area */ @@ -1765,8 +1765,8 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) shade_one_light(lar, shi, shr, passflag); } - /*this check is to prevent only shadow lamps from producing negative - colors.*/ + /* this check is to prevent only shadow lamps from producing negative + * colors.*/ if (shr->spec[0] < 0) shr->spec[0] = 0; if (shr->spec[1] < 0) shr->spec[1] = 0; if (shr->spec[2] < 0) shr->spec[2] = 0; diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index 4192aaf42aa..a60db8a963f 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -32,16 +32,16 @@ /* Possible Improvements: - - add fresnel terms - - adapt Rd table to scale, now with small scale there are a lot of misses? - - possible interesting method: perform sss on all samples in the tree, - and then use those values interpolated somehow later. can also do this - filtering on demand for speed. since we are doing things in screen - space now there is an exact correspondence - - avoid duplicate shading (filtering points in advance, irradiance cache - like lookup?) - - lower resolution samples -*/ + * - add fresnel terms + * - adapt Rd table to scale, now with small scale there are a lot of misses? + * - possible interesting method: perform sss on all samples in the tree, + * and then use those values interpolated somehow later. can also do this + * filtering on demand for speed. since we are doing things in screen + * space now there is an exact correspondence + * - avoid duplicate shading (filtering points in advance, irradiance cache + * like lookup?) + * - lower resolution samples + */ #include <math.h> #include <string.h> @@ -82,11 +82,11 @@ extern Render R; // meh /* Generic Multiple Scattering API */ /* Relevant papers: - [1] A Practical Model for Subsurface Light Transport - [2] A Rapid Hierarchical Rendering Technique for Translucent Materials - [3] Efficient Rendering of Local Subsurface Scattering - [4] Implementing a skin BSSRDF (or several...) -*/ + * [1] A Practical Model for Subsurface Light Transport + * [2] A Rapid Hierarchical Rendering Technique for Translucent Materials + * [3] Efficient Rendering of Local Subsurface Scattering + * [4] Implementing a skin BSSRDF (or several...) + */ /* Defines */ @@ -164,7 +164,7 @@ typedef struct ScatterResult { } ScatterResult; /* Functions for BSSRDF reparametrization in to more intuitive parameters, - see [2] section 4 for more info. */ + * see [2] section 4 for more info. */ static float f_Rd(float alpha_, float A, float ro) { @@ -182,7 +182,7 @@ static float compute_reduced_albedo(ScatterSettings *ss) int i; /* use secant method to compute reduced albedo using Rd function inverse - with a given reflectance */ + * with a given reflectance */ fxn= f_Rd(xn, ss->A, ss->ro); fxn_1= f_Rd(xn_1, ss->A, ss->ro); @@ -232,10 +232,10 @@ static float Rd(ScatterSettings *ss, float r) } /* table lookups for Rd. this avoids expensive exp calls. we use two - separate tables as well for lower and higher numbers to improve - precision, since the number are poorly distributed because we do - a lookup with the squared distance for smaller distances, saving - another sqrt. */ + * separate tables as well for lower and higher numbers to improve + * precision, since the number are poorly distributed because we do + * a lookup with the squared distance for smaller distances, saving + * another sqrt. */ static void approximate_Rd_rgb(ScatterSettings **ss, float rr, float *rd) { @@ -444,10 +444,10 @@ static void compute_radiance(ScatterTree *tree, float *co, float *rad) traverse_octree(tree, tree->root, co, 1, &result); /* the original paper doesn't do this, but we normalize over the - sampled area and multiply with the reflectance. this is because - our point samples are incomplete, there are no samples on parts - of the mesh not visible from the camera. this can not only make - it darker, but also lead to ugly color shifts */ + * sampled area and multiply with the reflectance. this is because + * our point samples are incomplete, there are no samples on parts + * of the mesh not visible from the camera. this can not only make + * it darker, but also lead to ugly color shifts */ mul_v3_fl(result.rad, tree->ss[0]->frontweight); mul_v3_fl(result.backrad, tree->ss[0]->backweight); @@ -484,7 +484,7 @@ static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node) node->backrad[0]= node->backrad[1]= node->backrad[2]= 0.0; /* compute total rad, rad weighted average position, - and total area */ + * and total area */ for(i=0; i<node->totpoint; i++) { p= &node->points[i]; @@ -532,7 +532,7 @@ static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node) } else { /* make sure that if radiance is 0.0f, we still have these points in - the tree at a good position, they count for rdsum too */ + * the tree at a good position, they count for rdsum too */ for(i=0; i<node->totpoint; i++) { p= &node->points[i]; @@ -558,7 +558,7 @@ static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node) node->backrad[0]= node->backrad[1]= node->backrad[2]= 0.0; /* compute total rad, rad weighted average position, - and total area */ + * and total area */ for(i=0; i<8; i++) { if(node->child[i] == NULL) continue; @@ -606,7 +606,7 @@ static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node) } else { /* make sure that if radiance is 0.0f, we still have these points in - the tree at a good position, they count for rdsum too */ + * the tree at a good position, they count for rdsum too */ totnode= 0; for(i=0; i<8; i++) { @@ -686,8 +686,8 @@ static void create_octree_node(ScatterTree *tree, ScatterNode *node, float *mid, } /* here we check if only one subnode is used. if this is the case, we don't - create a new node, but rather call this function again, with different - size and middle position for the same node. */ + * create a new node, but rather call this function again, with different + * size and middle position for the same node. */ for(usedi=0, usednodes=0, i=0; i<8; i++) { if(nsize[i]) { usednodes++; @@ -865,7 +865,7 @@ static void sss_create_tree_mat(Render *re, Material *mat) points.first= points.last= NULL; /* TODO: this is getting a bit ugly, copying all those variables and - setting them back, maybe we need to create our own Render? */ + * setting them back, maybe we need to create our own Render? */ /* do SSS preprocessing render */ BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE); diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index cdc185160d5..5f034ee9aeb 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -680,7 +680,7 @@ static void strand_render(Render *re, StrandSegment *sseg, float winmat[][4], St zbufclip4(re, &zspan[a], obi, index, p1->hoco2, p1->hoco1, p2->hoco1, p2->hoco2, p1->clip2, p1->clip1, p2->clip1, p2->clip2); #endif /* only render a line for now, which makes the shadow map more - similiar across frames, and so reduces flicker */ + * similiar across frames, and so reduces flicker */ zbufsinglewire(&zspan[a], obi, index, hoco1, hoco2); } } diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index fee71563d2b..36895f8ad53 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -383,8 +383,8 @@ static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, const float w[3 return normalize * (1.f - k*k) / ((1.f - kcostheta) * (1.f - kcostheta)); } - /* - * not used, but here for reference: + /* not used, but here for reference: */ +#if 0 switch (phasefunc_type) { case MA_VOL_PH_MIEHAZY: return normalize * (0.5f + 4.5f * powf(0.5 * (1.f + costheta), 8.f)); @@ -404,7 +404,7 @@ static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, const float w[3 default: return normalize * 1.f; } - */ +#endif } /* Compute transmittance = e^(-attenuation) */ @@ -568,15 +568,15 @@ void vol_get_scattering(ShadeInput *shi, float scatter_col[3], const float co[3] /* -The main volumetric integrator, using an emission/absorption/scattering model. - -Incoming radiance = - -outgoing radiance from behind surface * beam transmittance/attenuation -+ added radiance from all points along the ray due to participating media - --> radiance for each segment = - (radiance added by scattering + radiance added by emission) * beam transmittance/attenuation -*/ + * The main volumetric integrator, using an emission/absorption/scattering model. + * + * Incoming radiance = + * + * outgoing radiance from behind surface * beam transmittance/attenuation + * + added radiance from all points along the ray due to participating media + * --> radiance for each segment = + * (radiance added by scattering + radiance added by emission) * beam transmittance/attenuation + */ /* For ease of use, I've also introduced a 'reflection' and 'reflection color' parameter, which isn't * physically correct. This works as an RGB tint/gain on out-scattered light, but doesn't affect the light @@ -667,12 +667,12 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in int render_this=0; /* don't render the backfaces of ztransp volume materials. - + * * volume shading renders the internal volume from between the * ' view intersection of the solid volume to the * intersection on the other side, as part of the shading of * the front face. - + * * Because ztransp renders both front and back faces independently * this will double up, so here we prevent rendering the backface as well, * which would otherwise render the volume in between the camera and the backface diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 0727fd6fdd7..d5ed5c7a824 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -244,7 +244,7 @@ int testclip(const float v[4]) short c=0; /* if we set clip flags, the clipping should be at least larger than epsilon. - prevents issues with vertices lying exact on borders */ + * prevents issues with vertices lying exact on borders */ abs4= fabsf(v[3]) + FLT_EPSILON; if( v[0] < -abs4) c+=1; @@ -851,8 +851,8 @@ static int clipline(float v1[4], float v2[4]) /* return 0: do not draw */ dw= v2[3]-v1[3]; /* this 1.01 is for clipping x and y just a tinsy larger. that way it is - filled in with zbufwire correctly when rendering in parts. otherwise - you see line endings at edges... */ + * filled in with zbufwire correctly when rendering in parts. otherwise + * you see line endings at edges... */ if(cliptestf(-dz, -dw, v1[3], v1[2], &u1,&u2)) { if(cliptestf(dz, -dw, v1[3], -v1[2], &u1,&u2)) { @@ -1591,8 +1591,7 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float * /** * (clip pyramid) * Sets labda: flag, and parametrize the clipping of vertices in - * viewspace coordinates. labda = -1 means no clipping, labda in [0, - * 1] means a clipping. + * viewspace coordinates. labda = -1 means no clipping, labda in [0, 1] means a clipping. * Note: uses globals. * \param v1 start coordinate s * \param v2 target coordinate t |