diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-03-11 01:56:23 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-03-11 01:56:23 +0400 |
commit | a2ebfc82dbe954acc432ae017ac62a30a11b6a16 (patch) | |
tree | 8cf8bf458d14a26849dbee6af312ff9361029b90 /source/blender/render | |
parent | e9eed190e83eb351aeb435d21287eaf37fcffeb0 (diff) | |
parent | e09ab8883ce0e41add94058ecd4045ac5efa74c6 (diff) |
Merged changes in the trunk up to revision 44797.
Conflicts resolved:
doc/python_api/sphinx_doc_gen.py
source/blender/makesdna/DNA_mesh_types.h
source/blender/makesrna/intern/rna_action.c
source/blender/makesrna/intern/rna_ID.c
source/blender/makesrna/intern/rna_mesh.c
Diffstat (limited to 'source/blender/render')
40 files changed, 433 insertions, 512 deletions
diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index 4ca8f6213bb..5be10f56d7a 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -27,6 +27,7 @@ set(INC extern/include intern/include + ../blenfont ../blenkernel ../blenlib ../blenloader diff --git a/source/blender/render/SConscript b/source/blender/render/SConscript index 5af2bf05ef3..46e483a7194 100644 --- a/source/blender/render/SConscript +++ b/source/blender/render/SConscript @@ -5,7 +5,7 @@ sources = env.Glob('intern/source/*.c') raysources = env.Glob('intern/raytrace/*.cpp') incs = 'intern/include #/intern/guardedalloc ../blenlib ../makesdna ../makesrna' -incs += ' extern/include ../blenkernel ../radiosity/extern/include ../imbuf' +incs += ' extern/include ../blenkernel ../radiosity/extern/include ../imbuf ../blenfont' incs += ' ../include ../blenloader ../../../intern/smoke/extern ../../../intern/mikktspace ../bmesh' incs += ' ../freestyle' diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 8da4738eab7..6c64545a8c7 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -58,12 +58,12 @@ struct EnvMap; typedef struct Render Render; /* Render Result usage: - -- render engine allocates/frees and delivers raw floating point rects -- right now it's full rects, but might become tiles or file -- the display client has to allocate display rects, sort out what to display, - and how it's converted -*/ + * + * - render engine allocates/frees and delivers raw floating point rects + * - right now it's full rects, but might become tiles or file + * - the display client has to allocate display rects, sort out what to display, + * and how it's converted + */ typedef struct RenderPass { struct RenderPass *next, *prev; 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/rayobject.h b/source/blender/render/intern/include/rayobject.h index c43712ab95e..ce20ce4ea46 100644 --- a/source/blender/render/intern/include/rayobject.h +++ b/source/blender/render/intern/include/rayobject.h @@ -43,11 +43,10 @@ struct RayHint; struct VlakRen; /* RayObject - - Can be a face/triangle, bvh tree, object instance, etc. This is the - public API used by the renderer, see rayobject_internal.h for the - internal implementation details. */ - + * Can be a face/triangle, bvh tree, object instance, etc. This is the + * public API used by the renderer, see rayobject_internal.h for the + * internal implementation details. + * */ typedef struct RayObject RayObject; /* Intersection, see rayintersection.h */ @@ -74,8 +73,8 @@ void RE_rayobject_free(RayObject *r); void RE_rayobject_set_control(RayObject *r, void *data, int (*test_break)(void *data)); /* RayObject representing faces, all data is locally available instead - of referring to some external data structure, for possibly faster - intersection tests. */ + * of referring to some external data structure, for possibly faster + * intersection tests. */ typedef struct RayFace { float v1[4], v2[4], v3[4], v4[3]; @@ -89,8 +88,8 @@ typedef struct RayFace { RayObject* RE_rayface_from_vlak(RayFace *face, struct ObjectInstanceRen *obi, struct VlakRen *vlr); /* RayObject representing faces directly from a given VlakRen structure. Thus - allowing to save memory, but making code triangle intersection dependent on - render structures. */ + * allowing to save memory, but making code triangle intersection dependent on + * render structures. */ typedef struct VlakPrimitive { struct ObjectInstanceRen *ob; @@ -104,10 +103,10 @@ RayObject* RE_vlakprimitive_from_vlak(VlakPrimitive *face, struct ObjectInstance /* extend min/max coords so that the rayobject is inside them */ void RE_rayobject_merge_bb(RayObject *ob, float *min, float *max); -/* initializes an hint for optiming raycast where it is know that a ray will pass by the given BB often the origin point */ +/* initializes an hint for optimizing raycast where it is know that a ray will pass by the given BB often the origin point */ void RE_rayobject_hint_bb(RayObject *r, struct RayHint *hint, float *min, float *max); -/* initializes an hint for optiming raycast where it is know that a ray will be contained inside the given cone*/ +/* initializes an hint for optimizing raycast where it is know that a ray will be contained inside the given cone*/ /* void RE_rayobject_hint_cone(RayObject *r, struct RayHint *hint, float *); */ /* Internals */ diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 9337dc63b62..fc64f0a6e1b 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 */ @@ -231,8 +231,8 @@ struct Render ListBase freestyle_renders; /* 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/include/sunsky.h b/source/blender/render/intern/include/sunsky.h index 5076a1541af..62b68484629 100644 --- a/source/blender/render/intern/include/sunsky.h +++ b/source/blender/render/intern/include/sunsky.h @@ -24,11 +24,6 @@ * \ingroup render */ -/** - * This feature comes from Preetham paper on "A Practical Analytic Model for Daylight" - * and example code from Brian Smits, another author of that paper in - * http://www.cs.utah.edu/vissim/papers/sunsky/code/ - * */ #ifndef __SUNSKY_H__ #define __SUNSKY_H__ @@ -41,14 +36,14 @@ typedef struct SunSky short effect_type, skyblendtype, sky_colorspace; float turbidity; float theta, phi; - + float toSun[3]; /*float sunSpectralRaddata[SPECTRUM_MAX_COMPONENTS];*/ float sunSolidAngle; float zenith_Y, zenith_x, zenith_y; - + float perez_Y[5], perez_x[5], perez_y[5]; /* suggested by glome in @@ -75,75 +70,16 @@ typedef struct SunSky float atm_BetaMie[3]; float atm_BetaDashMie[3]; float atm_BetaRM[3]; -}SunSky; +} SunSky; -/** - * InitSunSky: - * this function compute some sun,sky parameters according to input parameters and also initiate some other sun, sky parameters - * parameters: - * sunSky, is a structure that contains informtion about sun, sky and atmosphere, in this function, most of its values initiated - * turb, is atmosphere turbidity - * toSun, contains sun direction - * horizon_brighness, controls the brightness of the horizon colors - * spread, controls colors spreed at horizon - * sun_brightness, controls sun's brightness - * sun_size, controls sun's size - * back_scatter, controls back scatter light - * */ void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness, - float spread,float sun_brightness, float sun_size, float back_scatter, - float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace); - -/** - * GetSkyXYZRadiance: - * this function compute sky radiance according to a view parameters `theta' and `phi'and sunSky values - * parameters: - * sunSky, sontains sun and sky parameters - * theta, is sun's theta - * phi, is sun's phi - * color_out, is computed color that shows sky radiance in XYZ color format - * */ -void GetSkyXYZRadiance(struct SunSky* sunsky, float theta, float phi, float color_out[3]); + float spread,float sun_brightness, float sun_size, float back_scatter, + float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace); -/** - * GetSkyXYZRadiancef: - * this function compute sky radiance according to a view direction `varg' and sunSky values - * parameters: - * sunSky, sontains sun and sky parameters - * varg, shows direction - * color_out, is computed color that shows sky radiance in XYZ color format - * */ -void GetSkyXYZRadiancef(struct SunSky* sunsky, const float varg[3], float color_out[3]); - -/** - * InitAtmosphere: - * this function intiate sunSky structure with user input parameters. - * parameters: - * sunSky, contains information about sun, and in this function some atmosphere parameters will initiated - * sun_intens, shows sun intensity value - * mief, Mie scattering factor this factor currently call with 1.0 - * rayf, Rayleigh scattering factor, this factor currently call with 1.0 - * inscattf, inscatter light factor that range from 0.0 to 1.0, 0.0 means no inscatter light and 1.0 means full inscatter light - * extincf, extinction light factor that range from 0.0 to 1.0, 0.0 means no extinction and 1.0 means full extinction - * disf, is distance factor, multiplyed to pixle's z value to compute each pixle's distance to camera, - * */ +void GetSkyXYZRadiance(struct SunSky *sunsky, float theta, float phi, float color_out[3]); +void GetSkyXYZRadiancef(struct SunSky *sunsky, const float varg[3], float color_out[3]); void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float rayf, float inscattf, float extincf, float disf); - -/** - * AtmospherePixleShader: - * this function apply atmosphere effect on a pixle color `rgb' at distance `s' - * parameters: - * sunSky, contains information about sun parameters and user values - * view, is camera view vector - * s, is distance - * rgb, contains rendered color value for a pixle - * */ -void AtmospherePixleShader( struct SunSky* sunSky, float view[3], float s, float rgb[3]); - -/** - * ClipColor: - * clip a color to range [0,1]; - * */ +void AtmospherePixleShader( struct SunSky *sunSky, float view[3], float s, float rgb[3]); void ClipColor(float c[3]); #endif /*__SUNSKY_H__*/ 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 e5833604370..31bf6457385 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -127,7 +127,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. */ @@ -150,10 +150,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)) @@ -200,10 +200,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; @@ -251,9 +251,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; @@ -322,7 +322,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)) @@ -515,8 +515,8 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr /**************************************************************** -************ tangent space generation interface ***************** -****************************************************************/ + ************ tangent space generation interface **************** + ****************************************************************/ typedef struct { @@ -609,7 +609,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) { @@ -664,8 +664,8 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen } } - /* normalize vertex normals */ - for(a=0; a<obr->totvert; a++) { + /* normalize vertex normals */ + for (a=0; a<obr->totvert; a++) { VertRen *ver= RE_findOrAddVert(obr, a); normalize_v3(ver->n); if(do_tangent) { @@ -681,8 +681,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen } } - if(do_nmap_tangent!=0) - { + if (do_nmap_tangent != 0) { SRenderMeshToTangent mesh2tangent; SMikkTSpaceContext sContext; SMikkTSpaceInterface sInterface; @@ -2318,7 +2317,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 */ @@ -2336,7 +2335,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 */ @@ -2650,25 +2649,25 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, add_v3_v3(vlr->v4->n, vlr1->n); } } + /* last vertex is an extra case: - - ^ ()----()----()----() - | | | || | - u | |(0,n)||(0,0)| - | | || | - ()====()====[]====() - | | || | - | |(m,n)||(m,0)| - | | || | - ()----()----()----() - v -> - - vertex [] is no longer shared, therefore distribute - normals of the surrounding faces to all of the duplicates of [] - */ - - if ((dl->flag & DL_CYCL_V) && (dl->flag & DL_CYCL_U)) - { + * + * ^ ()----()----()----() + * | | | || | + * u | |(0,n)||(0,0)| + * | | || | + * ()====()====[]====() + * | | || | + * | |(m,n)||(m,0)| + * | | || | + * ()----()----()----() + * v -> + * + * vertex [] is no longer shared, therefore distribute + * normals of the surrounding faces to all of the duplicates of [] + */ + + if ((dl->flag & DL_CYCL_V) && (dl->flag & DL_CYCL_U)) { vlr= RE_findOrAddVlak(obr, UVTOINDEX(sizeu - 1, sizev - 1)); /* (m,n) */ vlr1= RE_findOrAddVlak(obr, UVTOINDEX(0,0)); /* (0,0) */ add_v3_v3v3(n1, vlr->n, vlr1->n); @@ -3517,10 +3516,8 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) for(vindex=0; vindex<nr_verts; vindex++) mc[vindex]=mcol[a*4+rev_tab[vindex]]; } - else if(layer->type == CD_TANGENT && mtng < 1) - { - if(need_nmap_tangent!=0) - { + else if (layer->type == CD_TANGENT && mtng < 1) { + if (need_nmap_tangent != 0) { const float * tangent = (const float *) layer->data; float * ftang = RE_vlakren_get_nmap_tangent(obr, vlr, 1); for(vindex=0; vindex<nr_verts; vindex++) @@ -4101,8 +4098,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); @@ -4141,7 +4138,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; @@ -5116,7 +5113,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l /* if no camera, viewmat should have been set! */ if(use_camera_view && camera) { - /* called before but need to call again incase of lens animation from the + /* called before but need to call again in case of lens animation from the * above call to scene_update_for_newframe, fixes bug. [#22702]. * following calls dont depend on 'RE_SetCamera' */ RE_SetCamera(re, camera); @@ -5540,8 +5537,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * for(j=0;j<3;j++) fsvec[j] = velarray[a].vel[j]; /* (bad) HACK insert average velocity if none is there (see previous comment) */ - if((fsvec[0] == 0.0f) && (fsvec[1] == 0.0f) && (fsvec[2] == 0.0f)) - { + if ((fsvec[0] == 0.0f) && (fsvec[1] == 0.0f) && (fsvec[2] == 0.0f)) { fsvec[0] = avgvel[0]; fsvec[1] = avgvel[1]; fsvec[2] = avgvel[2]; 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/external_engine.c b/source/blender/render/intern/source/external_engine.c index 703ca23c15b..335de2dd055 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -36,6 +36,8 @@ #include "MEM_guardedalloc.h" +#include "BLF_translation.h" + #include "BLI_listbase.h" #include "BLI_string.h" #include "BLI_utildefines.h" @@ -60,7 +62,7 @@ static RenderEngineType internal_render_type = { NULL, NULL, - "BLENDER_RENDER", "Blender Render", RE_INTERNAL, + "BLENDER_RENDER", N_("Blender Render"), RE_INTERNAL, NULL, NULL, NULL, NULL, {NULL, NULL, NULL}}; @@ -68,7 +70,7 @@ static RenderEngineType internal_render_type = { static RenderEngineType internal_game_type = { NULL, NULL, - "BLENDER_GAME", "Blender Game", RE_INTERNAL|RE_GAME, + "BLENDER_GAME", N_("Blender Game"), RE_INTERNAL|RE_GAME, NULL, NULL, NULL, NULL, {NULL, NULL, NULL}}; 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 daaf1b0c737..b0bcf793ce5 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -89,31 +89,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 ******** */ @@ -456,8 +455,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer * re->r.scemode |= R_EXR_TILE_FILE; /* enable automatic */ /* Until use_border is made compatible with save_buffers/full_sample, render without the later instead of not rendering at all.*/ - if(re->r.mode & R_BORDER) - { + if (re->r.mode & R_BORDER) { re->r.scemode &= ~(R_EXR_TILE_FILE|R_FULL_SAMPLE); } @@ -1252,8 +1250,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); @@ -1721,7 +1719,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); @@ -1996,7 +1994,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; @@ -2034,7 +2032,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); @@ -2083,7 +2081,7 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr if(write_still && !G.afbreek) { if(BKE_imtype_is_movie(scene->r.im_format.imtype)) { - /* operator checks this but incase its called from elsewhere */ + /* operator checks this but in case its called from elsewhere */ printf("Error: cant write single images with a movie format!\n"); } else { 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 38178db5dcb..9272dcf5b30 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -265,14 +265,12 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi) VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255); if(is_raytraceable_vlr(re, vlr)) { - if( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) ) - { + if ((re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS)) { RE_rayobject_add( raytree, RE_vlakprimitive_from_vlak( vlakprimitive, obi, vlr ) ); vlakprimitive++; } - else - { - RE_rayface_from_vlak( face, obi, vlr ); + else { + RE_rayface_from_vlak(face, obi, vlr); RE_rayobject_add( raytree, RE_rayobject_unalignRayFace(face) ); face++; } @@ -336,12 +334,10 @@ static void makeraytree_single(Render *re) ObjectRen *obr = obi->obr; obs++; - if(has_special_rayobject(re, obi)) - { + if (has_special_rayobject(re, obi)) { special++; } - else - { + else { int v; for(v=0;v<obr->totvlak;v++) { @@ -365,8 +361,7 @@ static void makeraytree_single(Render *re) { vlakprimitive = re->rayprimitives = (VlakPrimitive*)MEM_callocN(faces*sizeof(VlakPrimitive), "Raytrace vlak-primitives"); } - else - { + else { face = re->rayfaces = (RayFace*)MEM_callocN(faces*sizeof(RayFace), "Render ray faces"); } @@ -376,8 +371,7 @@ static void makeraytree_single(Render *re) if(test_break(re)) break; - if(has_special_rayobject(re, obi)) - { + if (has_special_rayobject(re, obi)) { RayObject *obj = makeraytree_object(re, obi); if(test_break(re)) @@ -386,8 +380,7 @@ static void makeraytree_single(Render *re) if (obj) RE_rayobject_add( re->raytree, obj ); } - else - { + else { int v; ObjectRen *obr = obi->obr; @@ -399,16 +392,13 @@ static void makeraytree_single(Render *re) for(v=0;v<obr->totvlak;v++) { VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255); - if(is_raytraceable_vlr(re, vlr)) - { - if( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) ) - { + if (is_raytraceable_vlr(re, vlr)) { + if ((re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS)) { RayObject *obj = RE_vlakprimitive_from_vlak( vlakprimitive, obi, vlr ); RE_rayobject_add( raytree, obj ); vlakprimitive++; } - else - { + else { RE_rayface_from_vlak(face, obi, vlr); if((obi->flag & R_TRANSFORMED)) { @@ -445,21 +435,19 @@ 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); makeraytree_single(re); - if(test_break(re)) - { + if (test_break(re)) { freeraytree(re); re->i.infostr= "Raytree building canceled"; re->stats_draw(re->sdh, &re->i); } - else - { + else { //Calculate raytree max_size //This is ONLY needed to kept a bogus behavior of SUN and HEMI lights INIT_MINMAX(min, max); @@ -1616,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)) { @@ -1721,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 */ @@ -2087,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 266b71971d3..b6c93d9b15f 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -112,7 +112,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) { @@ -219,8 +219,7 @@ static const char *get_pass_name(int passtype, int channel) if(channel==-1) return "Mist"; return "Mist.Z"; } - if(passtype == SCE_PASS_RAYHITS) - { + if(passtype == SCE_PASS_RAYHITS) { if(channel==-1) return "Rayhits"; if(channel==0) return "Rayhits.R"; if(channel==1) return "Rayhits.G"; @@ -1073,7 +1072,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 1e91738c77d..ede314a42e1 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -651,7 +651,7 @@ static float mg_distNoiseTex(Tex *tex, float *texvec, TexResult *texres) static float voronoiTex(Tex *tex, float *texvec, TexResult *texres) { int rv = TEX_INT; - float da[4], pa[12]; /* distance and point coordinate arrays of 4 nearest neighbours */ + float da[4], pa[12]; /* distance and point coordinate arrays of 4 nearest neighbors */ float aw1 = fabs(tex->vn_w1); float aw2 = fabs(tex->vn_w2); float aw3 = fabs(tex->vn_w3); @@ -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); } @@ -1965,10 +1965,10 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt); rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, texres); - if(shi->obr->ob->derivedFinal) - { + if(shi->obr->ob->derivedFinal) { auto_bump = shi->obr->ob->derivedFinal->auto_bump_scale; } + { float fVirtDim = sqrtf(fabsf((float) (dimx*dimy)*mtex->size[0]*mtex->size[1])); auto_bump /= MAX2(fVirtDim, FLT_EPSILON); @@ -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 43761be9d71..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; @@ -813,20 +813,20 @@ void free_renderdata_tables(Render *re) int a=0; for(obr=re->objecttable.first; obr; obr=obr->next) { - if(obr->vertnodes) { + if (obr->vertnodes) { free_renderdata_vertnodes(obr->vertnodes); obr->vertnodes= NULL; obr->vertnodeslen= 0; } - if(obr->vlaknodes) { + if (obr->vlaknodes) { free_renderdata_vlaknodes(obr->vlaknodes); obr->vlaknodes= NULL; obr->vlaknodeslen= 0; obr->totvlak= 0; } - if(obr->bloha) { + if (obr->bloha) { for(a=0; obr->bloha[a]; a++) MEM_freeN(obr->bloha[a]); @@ -835,7 +835,7 @@ void free_renderdata_tables(Render *re) obr->blohalen= 0; } - if(obr->strandnodes) { + if (obr->strandnodes) { free_renderdata_strandnodes(obr->strandnodes); obr->strandnodes= NULL; obr->strandnodeslen= 0; @@ -848,23 +848,23 @@ void free_renderdata_tables(Render *re) MEM_freeN(strandbuf); } - if(obr->mtface) + if (obr->mtface) MEM_freeN(obr->mtface); - if(obr->mcol) + + if (obr->mcol) MEM_freeN(obr->mcol); - if(obr->rayfaces) - { + if (obr->rayfaces) { MEM_freeN(obr->rayfaces); obr->rayfaces = NULL; } - if(obr->rayprimitives) - { + + if (obr->rayprimitives) { MEM_freeN(obr->rayprimitives); obr->rayprimitives = NULL; } - if(obr->raytree) - { + + if (obr->raytree) { RE_rayobject_free(obr->raytree); obr->raytree = NULL; } @@ -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 dd9e1df95cd..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 */ @@ -213,15 +214,15 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr) shr->z= -shi->co[2]; /* RAYHITS */ -/* - if(1 || shi->passflag & SCE_PASS_RAYHITS) - { +#if 0 + if(1 || shi->passflag & SCE_PASS_RAYHITS) { shr->rayhits[0] = (float)shi->raycounter.faces.test; shr->rayhits[1] = (float)shi->raycounter.bb.hit; shr->rayhits[2] = 0.0; shr->rayhits[3] = 1.0; } - */ +#endif + RE_RC_MERGE(&re_rc_counter[shi->thread], &shi->raycounter); } @@ -294,7 +295,7 @@ void shade_input_set_triangle_i(ShadeInput *shi, ObjectInstanceRen *obi, VlakRen } } -/* note, facenr declared volatile due to over-eager -O2 optimizations +/* note, facenr declared volatile due to over-eager -O2 optimization's * on cygwin (particularly -frerun-cse-after-loop) */ @@ -821,8 +822,7 @@ void shade_input_set_normals(ShadeInput *shi) normalize_v3(shi->vn); } - else - { + else { copy_v3_v3(shi->vn, shi->facenor); copy_v3_v3(shi->nmapnorm, shi->vn); } @@ -855,8 +855,7 @@ void shade_input_set_vertex_normals(ShadeInput *shi) normalize_v3(shi->vn); } - else - { + else { copy_v3_v3(shi->vn, shi->facenor); copy_v3_v3(shi->nmapnorm, shi->vn); } @@ -928,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; @@ -970,8 +969,7 @@ void shade_input_set_shade_texco(ShadeInput *shi) // keeping tangents normalized at vertex level // corresponds better to how it's done in game engines - if(obi->flag & R_TRANSFORMED) - { + if (obi->flag & R_TRANSFORMED) { mul_mat3_m4_v3(obi->mat, c0); normalize_v3(c0); mul_mat3_m4_v3(obi->mat, c1); normalize_v3(c1); mul_mat3_m4_v3(obi->mat, c2); normalize_v3(c2); @@ -1313,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 fad117d0ea4..346f42eaab1 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -113,7 +113,7 @@ static void fogcolor(float *colf, float *rco, float *view) hor[2]= hor[2]*alpha; addAlphaOverFloat(colf, hor); - VECSUB(vec, vec, dview); + sub_v3_v3(vec, dview); } } #endif @@ -173,17 +173,17 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) p1[1]= shi->co[1]-lar->co[1]; p1[2]= -lar->co[2]; mul_m3_v3(lar->imat, p1); - VECCOPY(npos, p1); // npos is double! + copy_v3db_v3fl(npos, p1); // npos is double! /* pre-scale */ npos[2] *= (double)lar->sh_zfac; } else { - VECCOPY(npos, lar->sh_invcampos); /* in initlamp calculated */ + copy_v3db_v3fl(npos, lar->sh_invcampos); /* in initlamp calculated */ } /* rotate view */ - VECCOPY(nray, shi->view); + copy_v3db_v3fl(nray, shi->view); mul_m3_v3_double(lar->imat, nray); if(R.wrld.mode & WO_MIST) { @@ -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 */ @@ -1771,8 +1771,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/sunsky.c b/source/blender/render/intern/source/sunsky.c index 71ca2e056ac..1ecf197f694 100644 --- a/source/blender/render/intern/source/sunsky.c +++ b/source/blender/render/intern/source/sunsky.c @@ -20,6 +20,10 @@ /** \file blender/render/intern/source/sunsky.c * \ingroup render + * + * This feature comes from Preetham paper on "A Practical Analytic Model for Daylight" + * and example code from Brian Smits, another author of that paper in + * http://www.cs.utah.edu/vissim/papers/sunsky/code/ */ @@ -129,7 +133,7 @@ static float PerezFunction(struct SunSky *sunsky, const float *lam, float theta, * InitSunSky: * this function compute some sun,sky parameters according to input parameters and also initiate some other sun, sky parameters * parameters: - * sunSky, is a structure that contains informtion about sun, sky and atmosphere, in this function, most of its values initiated + * sunSky, is a structure that contains information about sun, sky and atmosphere, in this function, most of its values initiated * turb, is atmosphere turbidity * toSun, contains sun direction * horizon_brighness, controls the brightness of the horizon colors @@ -345,7 +349,7 @@ static void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3]) /** * InitAtmosphere: - * this function intiate sunSky structure with user input parameters. + * this function initiate sunSky structure with user input parameters. * parameters: * sunSky, contains information about sun, and in this function some atmosphere parameters will initiated * sun_intens, shows sun intensity value diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index 8b3c3ec5c3d..f99eb0298bf 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -284,7 +284,7 @@ static inline int lc_to_ms_I(int x, int y, int z, int *n) /* *** multiple scattering approximation *** */ -/* get the total amount of light energy in the light cache. used to normalise after multiple scattering */ +/* get the total amount of light energy in the light cache. used to normalize after multiple scattering */ static float total_ss_energy(Render *re, int do_test_break, VolumePrecache *vp) { int x, y, z; @@ -437,7 +437,7 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi if (re->test_break(re->tbh)) break; } - /* normalisation factor to conserve energy */ + /* normalization factor to conserve energy */ energy_ms = total_ms_energy(re, do_test_break, sr, sg, sb, n); fac *= (energy_ss / energy_ms); @@ -775,8 +775,7 @@ static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *o //tree= NULL; } - if (ELEM(ma->vol.shade_type, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE)) - { + if (ELEM(ma->vol.shade_type, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE)) { /* this should be before the filtering */ multiple_scattering_diffusion(re, obi->volume_precache, ma); } diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index 66cbb18bc57..36895f8ad53 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -135,19 +135,20 @@ static int vol_get_bounds(ShadeInput *shi, const float co[3], const float vec[3] isect->skip = RE_SKIP_VLR_NEIGHBOUR; isect->orig.face = (void*)shi->vlr; isect->orig.ob = (void*)shi->obi; - } else { // if (intersect_type == VOL_BOUNDS_SS) { + } + else { // if (intersect_type == VOL_BOUNDS_SS) { isect->skip= 0; isect->orig.face= NULL; isect->orig.ob = NULL; } - if(RE_rayobject_raycast(R.raytree, isect)) - { + if(RE_rayobject_raycast(R.raytree, isect)) { hitco[0] = isect->start[0] + isect->dist*isect->dir[0]; hitco[1] = isect->start[1] + isect->dist*isect->dir[1]; hitco[2] = isect->start[2] + isect->dist*isect->dir[2]; return 1; - } else { + } + else { return 0; } } @@ -365,7 +366,7 @@ static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, const float w[3 const float normalize = 0.25f; // = 1.f/4.f = M_PI/(4.f*M_PI) /* normalization constant is 1/4 rather than 1/4pi, since - * Blender's shading system doesn't normalise for + * Blender's shading system doesn't normalize for * energy conservation - eg. multiplying by pdf ( 1/pi for a lambert brdf ). * This means that lambert surfaces in Blender are pi times brighter than they 'should be' * and therefore, with correct energy conservation, volumes will darker than other solid objects, @@ -382,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)); @@ -403,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) */ @@ -492,8 +493,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const if (shi->mat->vol.shade_type == MA_VOL_SHADE_SHADOWED) { mul_v3_fl(lacol, vol_get_shadow(shi, lar, co)); } - else if (ELEM3(shi->mat->vol.shade_type, MA_VOL_SHADE_SHADED, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE)) - { + else if (ELEM3(shi->mat->vol.shade_type, MA_VOL_SHADE_SHADED, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE)) { Isect is; if (shi->mat->vol.shadeflag & MA_VOL_RECV_EXT_SHADOW) { @@ -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 @@ -686,8 +686,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in } - if (inside_volume == VOL_SHADE_INSIDE) - { + if (inside_volume == VOL_SHADE_INSIDE) { startco = shi->camera_co; endco = shi->co; @@ -706,8 +705,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in } /* trace to find a backface, the other side bounds of the volume */ /* (ray intersect ignores front faces here) */ - else if (vol_get_bounds(shi, shi->co, shi->view, hitco, &is, VOL_BOUNDS_DEPTH)) - { + else if (vol_get_bounds(shi, shi->co, shi->view, hitco, &is, VOL_BOUNDS_DEPTH)) { VlakRen *vlr = (VlakRen *)is.hit.face; startco = shi->co; diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index ebcc2ce997f..88571bb297b 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -228,8 +228,7 @@ static void init_frame_smoke(VoxelData *vd, float cfra) ob= vd->object; /* draw code for smoke */ - if( (md = (ModifierData *)modifiers_findByType(ob, eModifierType_Smoke)) ) - { + if ((md = (ModifierData *)modifiers_findByType(ob, eModifierType_Smoke))) { SmokeModifierData *smd = (SmokeModifierData *)md; 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 |