Ton broke a couple of things in his last commit including PET in rotation mode and local axis constraints on objects.

Bringing that back and enabling PET in trackball rotate.

Changed the rotation manipulator drawing code to really align the Trackball rotate ball with the view (using getViewVector) so that it always looks centered on the selection.
This was particularly ugly in perspective mode with a selection far from the center of the screen: http://www.clubinfo.bdeb.qc.ca/~theeth/screenie.jpg

Moved getViewVector from transform_constraints.c to transform_generics.c since it is not really a constraint related function. Also made it independant on the TransInfo structure so it might be useful elsewhere too.
This commit is contained in:
2005-03-20 02:00:16 +00:00
parent 0d2179774d
commit e65b0beea8
5 changed files with 189 additions and 133 deletions

View File

@@ -79,6 +79,7 @@
#include "blendef.h"
#include "transform.h"
#include "transform_generics.h"
/* drawing defines */
#define MAN_SIZE 0.15
@@ -430,27 +431,30 @@ static void draw_manipulator_rotate(float mat[][4])
/* Trackball center */
if(Gval & MAN_ROT_T) {
float smat[3][3], imat[3][3], tmat[3][3];
float smat[3][3], imat[3][3];
float offset[3];
if(G.f & G_PICKSEL) glLoadName(MAN_ROT_T);
Mat3CpyMat4(smat, mat);
Mat3Inv(imat, smat);
Mat3CpyMat4(smat, G.vd->viewinv);
Mat3MulMat3(tmat, imat, smat);
Normalise(tmat[2]);
getViewVector(mat[3], offset);
VecMulf(offset, -1.0f);
Mat3MulVecfl(imat, offset);
BIF_ThemeColor(TH_TRANSFORM);
glBegin(GL_LINES);
glVertex3f(0.0, 0.0, 0.0);
glVertex3fv(tmat[2]);
glVertex3fv(offset);
glEnd();
glEnable(GL_LIGHTING);
BIF_GetThemeColor3fv(TH_TRANSFORM, vec);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, vec);
VECCOPY(vec, tmat[2]);
VECCOPY(vec, offset);
glTranslatef(vec[0], vec[1], vec[2]);
gluSphere(qobj, CYWID, 8, 6);