minor changes

This commit is contained in:
Nico Pietroni 2005-05-19 09:09:54 +00:00
parent 973c48fb76
commit 0a7cd4af5c
1 changed files with 118 additions and 106 deletions

View File

@ -46,7 +46,7 @@ namespace vcg
enum DrawMode {DMUser,DMWire,DMSolid} ; enum DrawMode {DMUser,DMWire,DMSolid} ;
private: private:
///used to find right trasformation in caso of rotation ///used to find right trasformation in case of rotation
static void XAxis( Point3d zero, Point3d uno, Matrix44d & tr){ static void XAxis( Point3d zero, Point3d uno, Matrix44d & tr){
tr.SetZero(); tr.SetZero();
*((Point3d*)&tr[0][0]) = uno-zero; *((Point3d*)&tr[0][0]) = uno-zero;
@ -302,6 +302,8 @@ namespace vcg
template <DrawMode dm> template <DrawMode dm>
static void glArrow(Point3d tail, Point3d head,double body_width,double head_lenght, static void glArrow(Point3d tail, Point3d head,double body_width,double head_lenght,
double head_width,int body_slice=10,int head_slice=10,bool useDisplList=true) double head_width,int body_slice=10,int head_slice=10,bool useDisplList=true)
{
if (tail!=head)
{ {
//assert(!glGetError()); //assert(!glGetError());
Matrix44d tr; Matrix44d tr;
@ -323,12 +325,15 @@ namespace vcg
glPopAttrib(); glPopAttrib();
//assert(!glGetError()); //assert(!glGetError());
} }
}
/// draw a cone from tail to head /// draw a cone from tail to head
/// width = width of the base of the cone /// width = width of the base of the cone
/// slice = number of slices on the cone /// slice = number of slices on the cone
template <DrawMode dm> template <DrawMode dm>
static void glCone(Point3d tail, Point3d head,double width,int slice=10,bool useDisplList=true) static void glCone(Point3d tail, Point3d head,double width,int slice=10,bool useDisplList=true)
{
if (tail!=head)
{ {
Matrix44d tr; Matrix44d tr;
XAxis(tail,head,tr); XAxis(tail,head,tr);
@ -343,12 +348,15 @@ namespace vcg
glPopMatrix(); glPopMatrix();
glPopAttrib(); glPopAttrib();
} }
}
/// draw a cylinder from tail to head /// draw a cylinder from tail to head
/// width = width of the base of the cylinder /// width = width of the base of the cylinder
/// slice = number of slices on the cylinder /// slice = number of slices on the cylinder
template <DrawMode dm> template <DrawMode dm>
static void glCylinder(Point3d tail, Point3d head,double width,int slice=10,bool useDisplList=true) static void glCylinder(Point3d tail, Point3d head,double width,int slice=10,bool useDisplList=true)
{
if (tail!=head)
{ {
Matrix44d tr; Matrix44d tr;
XAxis(tail,head,tr); XAxis(tail,head,tr);
@ -362,7 +370,7 @@ namespace vcg
Cylinder(slice,l_body,width,useDisplList); Cylinder(slice,l_body,width,useDisplList);
glPopMatrix(); glPopMatrix();
glPopAttrib(); glPopAttrib();
}
} }
@ -373,6 +381,7 @@ namespace vcg
template <DrawMode dm> template <DrawMode dm>
static void glPoint(vcg::Point3f Center,float size,int slices =16,int stacks =16) static void glPoint(vcg::Point3f Center,float size,int slices =16,int stacks =16)
{ {
if (size!=0){
glPushMatrix(); glPushMatrix();
glTranslate(Center); glTranslate(Center);
if (dm==DMWire) if (dm==DMWire)
@ -384,6 +393,7 @@ namespace vcg
glutSolidSphere(size,slices,stacks); glutSolidSphere(size,slices,stacks);
glPopMatrix(); glPopMatrix();
} }
}
/// draw a point in Center /// draw a point in Center
/// size = Radius of the point /// size = Radius of the point
@ -392,6 +402,7 @@ namespace vcg
template <DrawMode dm> template <DrawMode dm>
static void glDiamond (Point3f Center, double size,bool useDisplList=true) static void glDiamond (Point3f Center, double size,bool useDisplList=true)
{ {
if (size!=0){
glPushAttrib(GL_ALL_ATTRIB_BITS); glPushAttrib(GL_ALL_ATTRIB_BITS);
SetGLParameters(dm); SetGLParameters(dm);
glPushMatrix(); glPushMatrix();
@ -400,6 +411,7 @@ namespace vcg
glPopMatrix(); glPopMatrix();
glPopAttrib(); glPopAttrib();
} }
}
}; };
} }
#endif #endif