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
This commit is contained in:
@@ -271,6 +271,40 @@ void helpline(float *vec)
|
||||
glDrawBuffer(GL_BACK);
|
||||
}
|
||||
|
||||
void constline(float *center, float *dir, int col)
|
||||
{
|
||||
float v1[3], v2[3];
|
||||
short val1[2], val2[2];
|
||||
|
||||
|
||||
VecCopyf(v1, center);
|
||||
VecCopyf(v2, dir);
|
||||
if(G.obedit){
|
||||
Mat4Mul3Vecfl(G.obedit->obmat, v1);
|
||||
VecAddf(v1, v1, G.obedit->obmat[3]);
|
||||
}
|
||||
if(G.obedit) Mat4Mul3Vecfl(G.obedit->obmat, v2);
|
||||
|
||||
project_short_infiniteline(v1, v2, val1, val2);
|
||||
|
||||
persp(0);
|
||||
|
||||
glDrawBuffer(GL_FRONT);
|
||||
|
||||
cpack(col);
|
||||
|
||||
setlinestyle(0);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2sv(val1);
|
||||
glVertex2sv(val2);
|
||||
glEnd();
|
||||
|
||||
persp(PERSP_VIEW);
|
||||
|
||||
glFinish(); // flush display for frontbuffer
|
||||
glDrawBuffer(GL_BACK);
|
||||
}
|
||||
|
||||
void drawaxes(float size)
|
||||
{
|
||||
int axis;
|
||||
|
||||
Reference in New Issue
Block a user