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:
authorDaniel Dunbar <daniel@zuster.org>2005-03-08 21:58:27 +0300
committerDaniel Dunbar <daniel@zuster.org>2005-03-08 21:58:27 +0300
commita26d91fddf813e5a9d3233f71a1da4618283e8c8 (patch)
treec6c6510e598f0ee217c0811597d01e7ed325e212 /source/blender
parent8eef3cfd9c36f3e442885cf46a6ca0365efcfdeb (diff)
- replaced call to project_short_noclip with direct implementation
because project_short_noclip doesn't do the calculation if the value would be near-clipped. For background picture we don't care about this.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/src/drawview.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index 696ddf89a05..663c3b571a8 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -335,9 +335,8 @@ static void draw_bgpic(void)
{
BGpic *bgpic;
Image *ima;
- float vec[3], fac, asp, zoomx, zoomy;
+ float vec[4], fac, asp, zoomx, zoomy;
int x1, y1, x2, y2, cx, cy;
- short mval[2];
bgpic= G.vd->bgpic;
if(bgpic==0) return;
@@ -401,11 +400,17 @@ static void draw_bgpic(void)
fac= 1.0/fac;
asp= ( (float)ima->ibuf->y)/(float)ima->ibuf->x;
-
- vec[0]= vec[1]= vec[2]= 0.0;
- project_short_noclip(vec, mval);
- cx= mval[0];
- cy= mval[1];
+
+ /* This code below was lifted from project_short_noclip
+ * because that code fails if the point is to close to
+ * the near clipping plane but we don't really care about
+ * that here.
+ */
+ vec[0]= vec[1]= vec[2]= 0.0; vec[3]= 1.0;
+ Mat4MulVec4fl(G.vd->persmat, vec);
+
+ cx= (curarea->winx/2.0)*(1 + vec[0]/vec[3]);
+ cy= (curarea->winy/2.0)*(1 + vec[1]/vec[3]);
x1= cx+ fac*(bgpic->xof-bgpic->size);
y1= cy+ asp*fac*(bgpic->yof-bgpic->size);
@@ -439,7 +444,7 @@ static void draw_bgpic(void)
glPixelZoom(zoomx, zoomy);
glaDrawPixelsSafe(x1, y1, ima->ibuf->x, ima->ibuf->y, bgpic->rect);
glPixelZoom(1.0, 1.0);
-
+
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);