svn merge ^/branches/bmesh/blender -r40512:40513

This commit is contained in:
Campbell Barton 2011-09-24 11:10:53 +00:00
parent 37cd3368da
commit 8247bf6fa6

@ -713,7 +713,7 @@ void view3d_unproject(bglMats *mats, float out[3], const short x, const short y,
} }
#endif #endif
/* use above call to get projecting mat */ /* use view3d_get_object_project_mat to get projecting mat */
void ED_view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float mat[4][4]) void ED_view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float mat[4][4])
{ {
float vec4[4]; float vec4[4];
@ -732,6 +732,26 @@ void ED_view3d_project_float(ARegion *ar, const float vec[3], float adr[2], floa
} }
} }
/* use view3d_get_object_project_mat to get projecting mat */
void ED_view3d_project_float_v3(ARegion *ar, float *vec, float *adr, float mat[4][4])
{
float vec4[4];
copy_v3_v3(vec4, vec);
vec4[3]= 1.0;
adr[0]= IS_CLIPPED;
mul_m4_v4(mat, vec4);
if( vec4[3]>FLT_EPSILON ) {
adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3];
adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3];
adr[2] = vec4[2]/vec4[3];
} else {
adr[0] = adr[1] = adr[2] = 0.0f;
}
}
int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb) int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb)
{ {
/* return 1: draw */ /* return 1: draw */
@ -803,9 +823,9 @@ void project_int(ARegion *ar, const float vec[3], int adr[2])
RegionView3D *rv3d= ar->regiondata; RegionView3D *rv3d= ar->regiondata;
float fx, fy, vec4[4]; float fx, fy, vec4[4];
adr[0]= (int)2140000000.0f;
copy_v3_v3(vec4, vec); copy_v3_v3(vec4, vec);
vec4[3]= 1.0; vec4[3]= 1.0;
adr[0]= (int)2140000000.0f;
mul_m4_v4(rv3d->persmat, vec4); mul_m4_v4(rv3d->persmat, vec4);
@ -851,9 +871,9 @@ void project_short_noclip(ARegion *ar, const float vec[3], short adr[2])
RegionView3D *rv3d= ar->regiondata; RegionView3D *rv3d= ar->regiondata;
float fx, fy, vec4[4]; float fx, fy, vec4[4];
adr[0]= IS_CLIPPED;
copy_v3_v3(vec4, vec); copy_v3_v3(vec4, vec);
vec4[3]= 1.0; vec4[3]= 1.0;
adr[0]= IS_CLIPPED;
mul_m4_v4(rv3d->persmat, vec4); mul_m4_v4(rv3d->persmat, vec4);
@ -877,9 +897,9 @@ void project_float(ARegion *ar, const float vec[3], float adr[2])
RegionView3D *rv3d= ar->regiondata; RegionView3D *rv3d= ar->regiondata;
float vec4[4]; float vec4[4];
adr[0]= IS_CLIPPED;
copy_v3_v3(vec4, vec); copy_v3_v3(vec4, vec);
vec4[3]= 1.0; vec4[3]= 1.0;
adr[0]= IS_CLIPPED;
mul_m4_v4(rv3d->persmat, vec4); mul_m4_v4(rv3d->persmat, vec4);