Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-07-27 01:35:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-07-27 01:35:24 +0400
commit7dd0395181a6e24c2d59b80c69a19a8f0e6dd8d1 (patch)
tree0349a6716feeb66639ac7724b92f38cd59d390ae /source/blender/editors/space_view3d/drawobject.c
parent2ab8a2a516109c9c892f2343dfebadb3a7995c69 (diff)
patch [#22901] pixel- and aspectratio corrected camera representation in 3dview
from Ralf Hölzemer (cheleb) with my own edits to make the selected camera more clear in the camera view, this also works around the problem where you cant see the camera to select it with passepartout close to 1.0. --- snip --- Attached patch changes the camera representation to draw pixel- and aspectratio corrected in 3dview. It does also fix a little issue where the camera name would jump when the title save would be (de)activated in the camera view.
Diffstat (limited to 'source/blender/editors/space_view3d/drawobject.c')
-rw-r--r--source/blender/editors/space_view3d/drawobject.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 6e9b437dbc5..30bfa123007 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1248,17 +1248,28 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
/* a standing up pyramid with (0,0,0) as top */
Camera *cam;
World *wrld;
- float nobmat[4][4], vec[8][4], fac, facx, facy, depth;
+ float nobmat[4][4], vec[8][4], fac, facx, facy, depth, aspx, aspy, caspx, caspy;
int i;
cam= ob->data;
+ aspx= (float) scene->r.xsch*scene->r.xasp;
+ aspy= (float) scene->r.ysch*scene->r.yasp;
+
+ if(aspx < aspy) {
+ caspx= aspx / aspy;
+ caspy= 1.0;
+ }
+ else {
+ caspx= 1.0;
+ caspy= aspy / aspx;
+ }
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
if(rv3d->persp>=2 && cam->type==CAM_ORTHO && ob==v3d->camera) {
- facx= 0.5*cam->ortho_scale*1.28;
- facy= 0.5*cam->ortho_scale*1.024;
+ facx= 0.5*cam->ortho_scale*caspx;
+ facy= 0.5*cam->ortho_scale*caspy;
depth= -cam->clipsta-0.1;
}
else {
@@ -1266,8 +1277,8 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
if(rv3d->persp>=2 && ob==v3d->camera) fac= cam->clipsta+0.1; /* that way it's always visible */
depth= - fac*cam->lens/16.0;
- facx= fac*1.28;
- facy= fac*1.024;
+ facx= fac*caspx;
+ facy= fac*caspy;
}
vec[0][0]= 0.0; vec[0][1]= 0.0; vec[0][2]= 0.001; /* GLBUG: for picking at iris Entry (well thats old!) */
@@ -1308,16 +1319,16 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
else if (i==1 && (ob == v3d->camera)) glBegin(GL_TRIANGLES);
else break;
- vec[0][0]= -0.7*cam->drawsize;
- vec[0][1]= 1.1*cam->drawsize;
+ vec[0][0]= -0.7*cam->drawsize*caspx;
+ vec[0][1]= 1.1*cam->drawsize*caspy;
glVertex3fv(vec[0]);
vec[0][0]= 0.0;
- vec[0][1]= 1.8*cam->drawsize;
+ vec[0][1]= 1.8*cam->drawsize*caspy;
glVertex3fv(vec[0]);
- vec[0][0]= 0.7*cam->drawsize;
- vec[0][1]= 1.1*cam->drawsize;
+ vec[0][0]= 0.7*cam->drawsize*caspx;
+ vec[0][1]= 1.1*cam->drawsize*caspy;
glVertex3fv(vec[0]);
glEnd();
@@ -6138,7 +6149,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
/* draw extra: after normal draw because of makeDispList */
if(dtx && (G.f & G_RENDER_OGL)==0) {
-
+
if(dtx & OB_AXIS) {
drawaxes(rv3d, rv3d->viewmatob, 1.0f, flag, OB_ARROWS);
}