Added reflection Name

This commit is contained in:
Paolo Cignoni 2007-02-26 01:30:02 +00:00
parent e19402c171
commit ece2f97c8b
3 changed files with 21 additions and 5 deletions

View File

@ -24,6 +24,10 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.17 2007/01/15 15:04:15 tarini
added "ToAscii" and "SetFromAscii" methods to load/store current trackball status from/to ascii strings
(intended uses: clipboard operations and comments inside png snapshots!)
Revision 1.16 2006/07/26 13:54:45 cignoni Revision 1.16 2006/07/26 13:54:45 cignoni
Reversed the direction of wheel scaling and added middle mouse panning Reversed the direction of wheel scaling and added middle mouse panning
@ -218,7 +222,7 @@ bool Trackball::SetFromAscii(char * st){
int res= sscanf(st, "trackball(%f,%f,%f,%f,%f,%f,%f,%f,%f)", int res= sscanf(st, "trackball(%f,%f,%f,%f,%f,%f,%f,%f,%f)",
f+0,f+1,f+2,f+3,f+4,f+5,f+6,f+7,f+8 ); f+0,f+1,f+2,f+3,f+4,f+5,f+6,f+7,f+8 );
return res=9; return (res==9);
} }

View File

@ -25,6 +25,10 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.12 2007/01/15 15:04:15 tarini
added "ToAscii" and "SetFromAscii" methods to load/store current trackball status from/to ascii strings
(intended uses: clipboard operations and comments inside png snapshots!)
Revision 1.11 2006/08/23 15:40:57 marfr960 Revision 1.11 2006/08/23 15:40:57 marfr960
*** empty log message *** *** empty log message ***
@ -223,7 +227,7 @@ namespace vcg {
void Store(); void Store();
void HistorySize(int lenght); void HistorySize(int lenght);
//internals /* //internals // commented out no more used this stuff!
enum Action { NONE = 0, enum Action { NONE = 0,
VIEW_ROTATE = 1, VIEW_ROTATE = 1,
// Axis Constrained Rotation // Axis Constrained Rotation
@ -237,7 +241,7 @@ namespace vcg {
//scale trackball and model //scale trackball and model
TRACK_SCALE = 13 TRACK_SCALE = 13
}; };
*/
// loads/stores current status from/to ascii stings // loads/stores current status from/to ascii stings
void ToAscii(char * st); void ToAscii(char * st);
bool SetFromAscii(char * st); bool SetFromAscii(char * st);

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.9 2006/02/13 13:10:27 cignoni
Added Zmode for moving objects along the perpendicular to the viewplane
Revision 1.8 2004/07/18 06:54:08 cignoni Revision 1.8 2004/07/18 06:54:08 cignoni
Added Scaling Added Scaling
@ -64,7 +67,7 @@ public:
virtual ~TrackMode() {} virtual ~TrackMode() {}
virtual void Apply(Trackball *trackball, Point3f new_point) = 0; virtual void Apply(Trackball *trackball, Point3f new_point) = 0;
virtual void Apply(Trackball *trackball, float WheelNotch); virtual void Apply(Trackball *trackball, float WheelNotch);
virtual const char *Name()=0;
virtual void Draw() {} virtual void Draw() {}
protected: protected:
Plane3f GetViewPlane(const View<float> &view, const Point3f &center); Plane3f GetViewPlane(const View<float> &view, const Point3f &center);
@ -76,16 +79,17 @@ public:
class SphereMode: public TrackMode { class SphereMode: public TrackMode {
public: public:
void Apply(Trackball *trackball, Point3f new_point); void Apply(Trackball *trackball, Point3f new_point);
const char* Name() {return "SphereMode";};
protected: protected:
Point3f Hit(Trackball *trackball, const Point3f &p); Point3f Hit(Trackball *trackball, const Point3f &p);
bool HitHyper(Point3f center, float radius, Point3f viewpoint, Plane3f vp, Point3f hitplane, Point3f &hit) ; bool HitHyper(Point3f center, float radius, Point3f viewpoint, Plane3f vp, Point3f hitplane, Point3f &hit) ;
}; };
class CylinderMode: public TrackMode { class CylinderMode: public TrackMode {
public: public:
CylinderMode(const Line3f &/*line*/, float /*radius = 1*/) {} CylinderMode(const Line3f &/*line*/, float /*radius = 1*/) {}
void Apply(Trackball * /*trackball*/, Point3f /*new_point*/) {} void Apply(Trackball * /*trackball*/, Point3f /*new_point*/) {}
const char* Name() {return "CylinderMode";};
protected: protected:
Line3f line; Line3f line;
float radius; float radius;
@ -95,6 +99,7 @@ class PlaneMode: public TrackMode {
public: public:
PlaneMode(const Plane3f &pl): plane(pl) {} PlaneMode(const Plane3f &pl): plane(pl) {}
void Apply(Trackball *trackball, Point3f new_point); void Apply(Trackball *trackball, Point3f new_point);
const char* Name() {return "PlaneMode";};
protected: protected:
Plane3f plane; Plane3f plane;
}; };
@ -102,6 +107,7 @@ protected:
// Move the object along the Z of the Camera // Move the object along the Z of the Camera
// complement of the Plane mode // complement of the Plane mode
class ZMode: public TrackMode { class ZMode: public TrackMode {
const char* Name() {return "ZMode";};
public: public:
void Apply(Trackball *trackball, Point3f new_point); void Apply(Trackball *trackball, Point3f new_point);
}; };
@ -110,12 +116,14 @@ class LineMode: public TrackMode {
public: public:
LineMode(const Line3f &/*line*/) {} LineMode(const Line3f &/*line*/) {}
void Apply(Trackball * /*trackball*/, Point3f /*new_point*/) {} void Apply(Trackball * /*trackball*/, Point3f /*new_point*/) {}
const char* Name() {return "LineMode";};
protected: protected:
Line3f line; Line3f line;
}; };
class ScaleMode: public TrackMode { class ScaleMode: public TrackMode {
public: public:
const char* Name() {return "ScaleMode";};
void Apply(Trackball *trackball, Point3f new_point); void Apply(Trackball *trackball, Point3f new_point);
}; };