"Set Camera to View3d": SHIFT-NUMPAD0 selects the camera like NUMPAD0, and

in addition aligns and positions it so that it exactly "sees" the former
View3d.
This commit is contained in:
Alexander Ewering
2003-09-27 11:10:49 +00:00
parent 3cf1cacd5d
commit b843c8a0ea
2 changed files with 23 additions and 1 deletions

View File

@@ -391,8 +391,10 @@ void persptoetsen(unsigned short event)
if(G.vd->camera) {
G.vd->persp= 2;
G.vd->view= 0;
if(G.qual & LR_SHIFTKEY) {
setcameratoview3d();
}
}
}
else if(event==PAD9) {
countall();

View File

@@ -711,6 +711,26 @@ void setviewmatrixview3d()
}
}
void setcameratoview3d()
{
Object *ob;
float dvec[3];
ob= G.vd->camera;
dvec[0]= G.vd->dist*G.vd->viewinv[2][0];
dvec[1]= G.vd->dist*G.vd->viewinv[2][1];
dvec[2]= G.vd->dist*G.vd->viewinv[2][2];
VECCOPY(ob->loc, dvec);
VecSubf(ob->loc, ob->loc, G.vd->ofs);
G.vd->viewquat[0]= -G.vd->viewquat[0];
if (ob->transflag & OB_QUAT) {
QUATCOPY(ob->quat, G.vd->viewquat);
} else {
QuatToEul(G.vd->viewquat, ob->rot);
}
G.vd->viewquat[0]= -G.vd->viewquat[0];
}
/* IGLuint-> GLuint*/
short selectprojektie(unsigned int *buffer, short x1, short y1, short x2, short y2)
{