style cleanup: follow style guide for/with/if spacing
This commit is contained in:
@@ -60,7 +60,7 @@ MALWAYS_INLINE RayObject* rayface_from_coords(RayFace *rayface, void *ob, void *
|
||||
copy_v3_v3(rayface->v2, v2);
|
||||
copy_v3_v3(rayface->v3, v3);
|
||||
|
||||
if(v4)
|
||||
if (v4)
|
||||
{
|
||||
copy_v3_v3(rayface->v4, v4);
|
||||
rayface->quad = 1;
|
||||
@@ -77,13 +77,13 @@ MALWAYS_INLINE void rayface_from_vlak(RayFace *rayface, ObjectInstanceRen *obi,
|
||||
{
|
||||
rayface_from_coords(rayface, obi, vlr, vlr->v1->co, vlr->v2->co, vlr->v3->co, vlr->v4 ? vlr->v4->co : 0);
|
||||
|
||||
if(obi->transform_primitives)
|
||||
if (obi->transform_primitives)
|
||||
{
|
||||
mul_m4_v3(obi->mat, rayface->v1);
|
||||
mul_m4_v3(obi->mat, rayface->v2);
|
||||
mul_m4_v3(obi->mat, rayface->v3);
|
||||
|
||||
if(RE_rayface_isQuad(rayface))
|
||||
if (RE_rayface_isQuad(rayface))
|
||||
mul_m4_v3(obi->mat, rayface->v4);
|
||||
}
|
||||
}
|
||||
@@ -109,11 +109,11 @@ MALWAYS_INLINE int vlr_check_intersect(Isect *is, ObjectInstanceRen *obi, VlakRe
|
||||
{
|
||||
/* for baking selected to active non-traceable materials might still
|
||||
* be in the raytree */
|
||||
if(!(vlr->flag & R_TRACEBLE))
|
||||
if (!(vlr->flag & R_TRACEBLE))
|
||||
return 0;
|
||||
|
||||
/* I know... cpu cycle waste, might do smarter once */
|
||||
if(is->mode==RE_RAY_MIRROR)
|
||||
if (is->mode==RE_RAY_MIRROR)
|
||||
return !(vlr->mat->mode & MA_ONLYCAST);
|
||||
else
|
||||
return (is->lay & obi->lay);
|
||||
@@ -159,21 +159,21 @@ MALWAYS_INLINE int isec_tri_quad(float start[3], float dir[3], RayFace *face, fl
|
||||
sub_v3_v3v3(m, start, co3);
|
||||
det1= dot_v3v3(m, x);
|
||||
|
||||
if(divdet != 0.0f) {
|
||||
if (divdet != 0.0f) {
|
||||
divdet= 1.0f/divdet;
|
||||
v= det1*divdet;
|
||||
|
||||
if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
|
||||
if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
|
||||
float cros[3];
|
||||
|
||||
cross_v3_v3v3(cros, m, t0);
|
||||
u= divdet*dot_v3v3(cros, r);
|
||||
|
||||
if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) {
|
||||
if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) {
|
||||
l= divdet*dot_v3v3(cros, t1);
|
||||
|
||||
/* check if intersection is within ray length */
|
||||
if(l > -RE_RAYTRACE_EPSILON && l < *lambda) {
|
||||
if (l > -RE_RAYTRACE_EPSILON && l < *lambda) {
|
||||
uv[0]= u;
|
||||
uv[1]= v;
|
||||
*lambda= l;
|
||||
@@ -184,25 +184,25 @@ MALWAYS_INLINE int isec_tri_quad(float start[3], float dir[3], RayFace *face, fl
|
||||
}
|
||||
|
||||
/* intersect second triangle in quad */
|
||||
if(quad) {
|
||||
if (quad) {
|
||||
copy_v3_v3(co4, face->v4);
|
||||
sub_v3_v3v3(t0, co3, co4);
|
||||
divdet= dot_v3v3(t0, x);
|
||||
|
||||
if(divdet != 0.0f) {
|
||||
if (divdet != 0.0f) {
|
||||
divdet= 1.0f/divdet;
|
||||
v = det1*divdet;
|
||||
|
||||
if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
|
||||
if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
|
||||
float cros[3];
|
||||
|
||||
cross_v3_v3v3(cros, m, t0);
|
||||
u= divdet*dot_v3v3(cros, r);
|
||||
|
||||
if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) {
|
||||
if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) {
|
||||
l= divdet*dot_v3v3(cros, t1);
|
||||
|
||||
if(l >- RE_RAYTRACE_EPSILON && l < *lambda) {
|
||||
if (l >- RE_RAYTRACE_EPSILON && l < *lambda) {
|
||||
uv[0]= u;
|
||||
uv[1]= -(1.0f + v + u);
|
||||
*lambda= l;
|
||||
@@ -242,38 +242,38 @@ MALWAYS_INLINE int isec_tri_quad_neighbour(float start[3], float dir[3], RayFace
|
||||
sub_v3_v3v3(m, start, co3);
|
||||
det1= dot_v3v3(m, x);
|
||||
|
||||
if(divdet != 0.0f) {
|
||||
if (divdet != 0.0f) {
|
||||
divdet= 1.0f/divdet;
|
||||
v= det1*divdet;
|
||||
|
||||
if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
|
||||
if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
|
||||
float cros[3];
|
||||
|
||||
cross_v3_v3v3(cros, m, t0);
|
||||
u= divdet*dot_v3v3(cros, r);
|
||||
|
||||
if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON))
|
||||
if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* intersect second triangle in quad */
|
||||
if(quad) {
|
||||
if (quad) {
|
||||
copy_v3_v3(co4, face->v4);
|
||||
sub_v3_v3v3(t0, co3, co4);
|
||||
divdet= dot_v3v3(t0, x);
|
||||
|
||||
if(divdet != 0.0f) {
|
||||
if (divdet != 0.0f) {
|
||||
divdet= 1.0f/divdet;
|
||||
v = det1*divdet;
|
||||
|
||||
if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
|
||||
if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
|
||||
float cros[3];
|
||||
|
||||
cross_v3_v3v3(cros, m, t0);
|
||||
u= divdet*dot_v3v3(cros, r);
|
||||
|
||||
if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON))
|
||||
if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON))
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
@@ -291,24 +291,24 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i
|
||||
int ok= 0;
|
||||
|
||||
/* avoid self-intersection */
|
||||
if(is->orig.ob == face->ob && is->orig.face == face->face)
|
||||
if (is->orig.ob == face->ob && is->orig.face == face->face)
|
||||
return 0;
|
||||
|
||||
/* check if we should intersect this face */
|
||||
if(is->check == RE_CHECK_VLR_RENDER)
|
||||
if (is->check == RE_CHECK_VLR_RENDER)
|
||||
{
|
||||
if(vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
|
||||
if (vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
|
||||
return 0;
|
||||
}
|
||||
else if(is->check == RE_CHECK_VLR_NON_SOLID_MATERIAL)
|
||||
else if (is->check == RE_CHECK_VLR_NON_SOLID_MATERIAL)
|
||||
{
|
||||
if(vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
|
||||
if (vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
|
||||
return 0;
|
||||
if(vlr_check_intersect_solid(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
|
||||
if (vlr_check_intersect_solid(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
|
||||
return 0;
|
||||
}
|
||||
else if(is->check == RE_CHECK_VLR_BAKE) {
|
||||
if(vlr_check_bake(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
|
||||
else if (is->check == RE_CHECK_VLR_BAKE) {
|
||||
if (vlr_check_bake(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -318,13 +318,13 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i
|
||||
dist= is->dist;
|
||||
ok= isec_tri_quad(is->start, is->dir, face, uv, &dist);
|
||||
|
||||
if(ok) {
|
||||
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 */
|
||||
if(is->skip & RE_SKIP_VLR_NEIGHBOUR)
|
||||
if (is->skip & RE_SKIP_VLR_NEIGHBOUR)
|
||||
{
|
||||
if(dist < 0.1f && is->orig.ob == face->ob)
|
||||
if (dist < 0.1f && is->orig.ob == face->ob)
|
||||
{
|
||||
VlakRen * a = (VlakRen*)is->orig.face;
|
||||
VlakRen * b = (VlakRen*)face->face;
|
||||
@@ -332,7 +332,7 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i
|
||||
/* 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 */
|
||||
if(a->v1==b->v1 || a->v2==b->v1 || a->v3==b->v1 || a->v4==b->v1
|
||||
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
|
||||
|| (b->v4 && (a->v1==b->v4 || a->v2==b->v4 || a->v3==b->v4 || a->v4==b->v4))) {
|
||||
@@ -341,7 +341,7 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i
|
||||
ObjectInstanceRen *ob= (ObjectInstanceRen*)is->orig.ob;
|
||||
rayface_from_vlak(&origface, ob, (VlakRen*)is->orig.face);
|
||||
|
||||
if(!isec_tri_quad_neighbour(is->start, is->dir, &origface))
|
||||
if (!isec_tri_quad_neighbour(is->start, is->dir, &origface))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -375,7 +375,7 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
|
||||
RE_RC_COUNT(isec->raycounter->raycast.test);
|
||||
|
||||
/* setup vars used on raycast */
|
||||
for(i=0; i<3; i++)
|
||||
for (i=0; i<3; i++)
|
||||
{
|
||||
isec->idot_axis[i] = 1.0f / isec->dir[i];
|
||||
|
||||
@@ -388,11 +388,11 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
|
||||
|
||||
#ifdef RT_USE_LAST_HIT
|
||||
/* last hit heuristic */
|
||||
if(isec->mode==RE_RAY_SHADOW && isec->last_hit)
|
||||
if (isec->mode==RE_RAY_SHADOW && isec->last_hit)
|
||||
{
|
||||
RE_RC_COUNT(isec->raycounter->rayshadow_last_hit.test);
|
||||
|
||||
if(RE_rayobject_intersect(isec->last_hit, isec))
|
||||
if (RE_rayobject_intersect(isec->last_hit, isec))
|
||||
{
|
||||
RE_RC_COUNT(isec->raycounter->raycast.hit);
|
||||
RE_RC_COUNT(isec->raycounter->rayshadow_last_hit.hit);
|
||||
@@ -405,7 +405,7 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
|
||||
isec->hit_hint = 0;
|
||||
#endif
|
||||
|
||||
if(RE_rayobject_intersect(r, isec))
|
||||
if (RE_rayobject_intersect(r, isec))
|
||||
{
|
||||
RE_RC_COUNT(isec->raycounter->raycast.hit);
|
||||
|
||||
@@ -420,11 +420,11 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
|
||||
|
||||
int RE_rayobject_intersect(RayObject *r, Isect *i)
|
||||
{
|
||||
if(RE_rayobject_isRayFace(r))
|
||||
if (RE_rayobject_isRayFace(r))
|
||||
{
|
||||
return intersect_rayface(r, (RayFace*) RE_rayobject_align(r), i);
|
||||
}
|
||||
else if(RE_rayobject_isVlakPrimitive(r))
|
||||
else if (RE_rayobject_isVlakPrimitive(r))
|
||||
{
|
||||
//TODO optimize (useless copy to RayFace to avoid duplicate code)
|
||||
VlakPrimitive *face = (VlakPrimitive*) RE_rayobject_align(r);
|
||||
@@ -433,7 +433,7 @@ int RE_rayobject_intersect(RayObject *r, Isect *i)
|
||||
|
||||
return intersect_rayface(r, &nface, i);
|
||||
}
|
||||
else if(RE_rayobject_isRayAPI(r))
|
||||
else if (RE_rayobject_isRayAPI(r))
|
||||
{
|
||||
r = RE_rayobject_align(r);
|
||||
return r->api->raycast(r, i);
|
||||
@@ -466,11 +466,11 @@ void RE_rayobject_free(RayObject *r)
|
||||
|
||||
float RE_rayobject_cost(RayObject *r)
|
||||
{
|
||||
if(RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r))
|
||||
if (RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r))
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
else if(RE_rayobject_isRayAPI(r))
|
||||
else if (RE_rayobject_isRayAPI(r))
|
||||
{
|
||||
r = RE_rayobject_align(r);
|
||||
return r->api->cost(r);
|
||||
@@ -485,16 +485,16 @@ float RE_rayobject_cost(RayObject *r)
|
||||
|
||||
void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
|
||||
{
|
||||
if(RE_rayobject_isRayFace(r))
|
||||
if (RE_rayobject_isRayFace(r))
|
||||
{
|
||||
RayFace *face = (RayFace*) RE_rayobject_align(r);
|
||||
|
||||
DO_MINMAX(face->v1, min, max);
|
||||
DO_MINMAX(face->v2, min, max);
|
||||
DO_MINMAX(face->v3, min, max);
|
||||
if(RE_rayface_isQuad(face)) DO_MINMAX(face->v4, min, max);
|
||||
if (RE_rayface_isQuad(face)) DO_MINMAX(face->v4, min, max);
|
||||
}
|
||||
else if(RE_rayobject_isVlakPrimitive(r))
|
||||
else if (RE_rayobject_isVlakPrimitive(r))
|
||||
{
|
||||
VlakPrimitive *face = (VlakPrimitive*) RE_rayobject_align(r);
|
||||
RayFace nface;
|
||||
@@ -503,9 +503,9 @@ void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
|
||||
DO_MINMAX(nface.v1, min, max);
|
||||
DO_MINMAX(nface.v2, min, max);
|
||||
DO_MINMAX(nface.v3, min, max);
|
||||
if(RE_rayface_isQuad(&nface)) DO_MINMAX(nface.v4, min, max);
|
||||
if (RE_rayface_isQuad(&nface)) DO_MINMAX(nface.v4, min, max);
|
||||
}
|
||||
else if(RE_rayobject_isRayAPI(r))
|
||||
else if (RE_rayobject_isRayAPI(r))
|
||||
{
|
||||
r = RE_rayobject_align(r);
|
||||
r->api->bb(r, min, max);
|
||||
@@ -518,11 +518,11 @@ void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
|
||||
|
||||
void RE_rayobject_hint_bb(RayObject *r, RayHint *hint, float *min, float *max)
|
||||
{
|
||||
if(RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r))
|
||||
if (RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if(RE_rayobject_isRayAPI(r))
|
||||
else if (RE_rayobject_isRayAPI(r))
|
||||
{
|
||||
r = RE_rayobject_align(r);
|
||||
return r->api->hint_bb(r, hint, min, max);
|
||||
@@ -535,7 +535,7 @@ void RE_rayobject_hint_bb(RayObject *r, RayHint *hint, float *min, float *max)
|
||||
|
||||
int RE_rayobjectcontrol_test_break(RayObjectControl *control)
|
||||
{
|
||||
if(control->test_break)
|
||||
if (control->test_break)
|
||||
return control->test_break(control->data);
|
||||
|
||||
return 0;
|
||||
@@ -543,7 +543,7 @@ int RE_rayobjectcontrol_test_break(RayObjectControl *control)
|
||||
|
||||
void RE_rayobject_set_control(RayObject *r, void *data, RE_rayobjectcontrol_test_break_callback test_break)
|
||||
{
|
||||
if(RE_rayobject_isRayAPI(r))
|
||||
if (RE_rayobject_isRayAPI(r))
|
||||
{
|
||||
r = RE_rayobject_align(r);
|
||||
r->control.data = data;
|
||||
|
||||
Reference in New Issue
Block a user