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>2003-10-21 20:25:00 +0400
committerMartin Poirier <theeth@yahoo.com>2003-10-21 20:25:00 +0400
commit41f4940bff2c6ba3f17c69fbae6d6e8cfec8867f (patch)
tree2c928e00e1efb18e8ee5e0d053498139c4060f2a /source/blender/src/view.c
parent8280cab690aa6c7b9c4029d276f74885b5544b2b (diff)
Helpline drawing in transform (semi broken in this commit)
This is only usefull for rotate now, but the axis constraining code has a part that depended on this, so I commit this part first. For coders: void constline(float *center, float *dir, int col) Draw an infinite line on the screen. col is the color argument. It must be cpack compatible void project_short_infiniteline(float *vec, float *dir, short *adr1, short *adr2); clips infinite line to screen border
Diffstat (limited to 'source/blender/src/view.c')
-rw-r--r--source/blender/src/view.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index 6bfd945537e..8b8f11bd2ff 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -227,6 +227,61 @@ void project_float(float *vec, float *adr)
}
}
+void project_short_infiniteline(float *vec, float *dir, short *adr1, short *adr2) /* clips infinite line to screen border */
+{
+ float vp[2], vd[2], temp[2];
+ short min, max;
+ float tvec[3], tmp;
+
+ project_float(vec, vp);
+ VecMulf(dir, 10);
+ VecAddf(tvec, vec, dir);
+ project_float(tvec, temp);
+
+ vd[0] = temp[0] - vp[0];
+ vd[1] = temp[1] - vp[1];
+
+ if ((vd[0] == 0) && (vd[1] == 0)){
+ adr1[0] = adr2[0] = vp[0];
+ adr1[1] = adr2[1] = vp[1];
+ }
+ else if (vd[0] == 0){
+ adr1[0] = adr2[0] = vp[0];
+ adr1[1] = 0;
+ adr2[1] = curarea->winy;
+ }
+ else if (vd[1] == 0){
+ adr1[0] = 0;
+ adr2[0] = curarea->winx;
+ adr1[1] = adr2[1] = vp[1];
+ }
+ else{
+ tmp = vd[0];
+ max = (curarea->winx - vp[0]) / tmp * vd[1] + vp[1];
+ if (max > curarea->winy){
+ tmp = vd[1];
+ adr2[0] = ((curarea->winy) - vp[1]) / tmp * vd[0] + vp[0];
+ adr2[1] = curarea->winy;
+ }
+ else{
+ adr2[0] = curarea->winx;
+ adr2[1] = max;
+ }
+
+ tmp = vd[0];
+ min = (-vp[0]) / tmp * vd[1] + vp[1];
+ if (min < 0){
+ tmp = vd[1];
+ adr1[0] = (-vp[1]) / tmp * vd[0] + vp[0];
+ adr1[1] = 0;
+ }
+ else{
+ adr1[0] = 0;
+ adr1[1] = min;
+ }
+ }
+}
+
int boundbox_clip(float obmat[][4], BoundBox *bb)
{
/* return 1: draw */