From 89a963fb7fdff543b77de790355b9dac3019bd33 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 9 Mar 2012 18:28:30 +0000 Subject: style cleanup: comment blocks --- source/blender/render/intern/raytrace/bvh.h | 8 +-- .../blender/render/intern/raytrace/rayobject.cpp | 16 ++--- .../render/intern/raytrace/rayobject_hint.h | 5 +- .../render/intern/raytrace/rayobject_internal.h | 68 +++++++++++----------- .../render/intern/raytrace/rayobject_octree.cpp | 12 ++-- .../render/intern/raytrace/rayobject_rtbuild.cpp | 18 +++--- source/blender/render/intern/raytrace/vbvh.h | 17 +++--- 7 files changed, 73 insertions(+), 71 deletions(-) (limited to 'source/blender/render/intern/raytrace') 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 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 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 #include @@ -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); } } -*/ +#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 struct Reorganize_VBVH { @@ -242,4 +245,4 @@ struct Reorganize_VBVH return node; } }; -*/ +#endif -- cgit v1.2.3