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:
authorMartin Poirier <theeth@yahoo.com>2008-06-05 18:49:12 +0400
committerMartin Poirier <theeth@yahoo.com>2008-06-05 18:49:12 +0400
commit172fe6ed2f963b952833f39729e1bac52b479a2f (patch)
treecd3755fd7ccdf8d3214eb647cce545f79cc78b13 /source/blender/src/view.c
parent6757b759ea29f8b59d92b2772efd2d0d1dac2c8a (diff)
Bugfix: [#13619] Transform Rotate and Scale Strange
view: noclip version of int and float projection. Also project from behind the view's position and return coherent values for near clipping transform: use the above functions for 2d center and helpline drawing NOTE: the result for centers behind the camera (in perspective) isn't 100% perfect in the case of rotations because they always use the centered view vector as rotation axis and not the one aligned with the 2d center. Changing this would not be desirable anyway. At least it's predictible now.
Diffstat (limited to 'source/blender/src/view.c')
-rw-r--r--source/blender/src/view.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index 1e45f2bf3e0..f53bcb3a9f7 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -228,6 +228,29 @@ void project_int(float *vec, int *adr)
}
}
+void project_int_noclip(float *vec, int *adr)
+{
+ float fx, fy, vec4[4];
+
+ VECCOPY(vec4, vec);
+ vec4[3]= 1.0;
+
+ Mat4MulVec4fl(G.vd->persmat, vec4);
+
+ if( fabs(vec4[3]) > BL_NEAR_CLIP ) {
+ fx = (curarea->winx/2)*(1 + vec4[0]/vec4[3]);
+ fy = (curarea->winy/2)*(1 + vec4[1]/vec4[3]);
+
+ adr[0] = floor(fx);
+ adr[1] = floor(fy);
+ }
+ else
+ {
+ adr[0] = curarea->winx / 2;
+ adr[1] = curarea->winy / 2;
+ }
+}
+
void project_short_noclip(float *vec, short *adr)
{
float fx, fy, vec4[4];
@@ -264,8 +287,28 @@ void project_float(float *vec, float *adr)
Mat4MulVec4fl(G.vd->persmat, vec4);
if( vec4[3]>BL_NEAR_CLIP ) {
- adr[0]= (curarea->winx/2.0)+(curarea->winx/2.0)*vec4[0]/vec4[3];
- adr[1]= (curarea->winy/2.0)+(curarea->winy/2.0)*vec4[1]/vec4[3];
+ adr[0] = (curarea->winx/2.0)+(curarea->winx/2.0)*vec4[0]/vec4[3];
+ adr[1] = (curarea->winy/2.0)+(curarea->winy/2.0)*vec4[1]/vec4[3];
+ }
+}
+
+void project_float_noclip(float *vec, float *adr)
+{
+ float vec4[4];
+
+ VECCOPY(vec4, vec);
+ vec4[3]= 1.0;
+
+ Mat4MulVec4fl(G.vd->persmat, vec4);
+
+ if( fabs(vec4[3]) > BL_NEAR_CLIP ) {
+ adr[0] = (curarea->winx/2.0)+(curarea->winx/2.0)*vec4[0]/vec4[3];
+ adr[1] = (curarea->winy/2.0)+(curarea->winy/2.0)*vec4[1]/vec4[3];
+ }
+ else
+ {
+ adr[0] = curarea->winx / 2.0f;
+ adr[1] = curarea->winy / 2.0f;
}
}