Allink  v0.1
Draw.h
00001 #ifndef DISEGNA_H
00002 #define DISEGNA_H
00003 
00004 #include "../include/Matematica.h"
00005 #ifdef USE_GL
00006 
00007 #include <GL/glut.h>
00008 
00009 
00010 #if !defined(GLUT_WHEEL_UP)
00011 #  define GLUT_WHEEL_UP   3
00012 #  define GLUT_WHEEL_DOWN 4
00013 #endif
00014 
00015 class Draw{
00016  private:
00018   int pr;//prospettiva
00020   int IfShift;
00022   void Expand(void);
00024   void spinDisplay(void);
00026   void Illuminazione(void);
00028   void init (void);
00030   void Spot(void);
00032   void Nebbia(void);
00034   void processEvent(int value);
00036   void ChangeSize(GLsizei w,GLsizei h);
00038   void Shout(const char *s, ... );
00039   //Matematica *Mat;
00041   int BlendSource;
00043   int BlendDest;
00044  public:
00045   //Draw(int argc,char** argv);
00046   Draw();
00048   void Draw1(void);
00050   void DMinimal(void);
00052   void DrTriangles(int NPoint);
00054   void ShowImage();
00056   void Window(int argc,char **argv);
00058   void DFigure(void);
00060   void DTimer(int v);
00062   void Dreshape(int w,int h);
00064   int ApplyTexture();
00066   int ShowTexture();
00068   void Transform();
00070   void DrCube();
00072   void ChooseBlend(int Which);
00074   void PutString(double *Pos,char *String);
00076   void PutString(double Posx,double Posy,double Posz,char *String);
00078   void Numera(double *Pos,int n);
00079   //------------Definition.cpp-------------
00081   void Lista(int NSquare);
00083   int DefPoint();
00085   int DefCube(int NSquare);
00087   int DefQuad(int NSquare);
00089   int DefCylinder(double Rad,double Height);
00091   int DefMetalCylinder(double Rad,double Height);
00093   int DefHexagon();
00095   int DefGriglia();
00097   int DefWall();
00099   int DefArrow();
00101   int DefArrowThin();
00103   int DefTexture();
00105   void InitConstant();
00107   double Normal(double *v,double *u,double *w,double *n);
00109   typedef void(Draw::*DEPTH_MAP)(double Val,GLfloat *Color);
00111   DEPTH_MAP Depth_Map;
00113   void DepthMap(double Val,GLfloat *Color){(*this.*Depth_Map)(Val,Color);}
00115   void DepthMap1(double Val,GLfloat *Color);
00117   void ChooseDepthMap(int n);
00119   int DefLegend();
00120   //-------------Control.cpp
00122   void Dmouse(int button, int state,int x,int y);
00124   void DMouseMove(int x,int y);
00126   void Dspecial(int k, int x, int y);
00128   void keyboardDraw(unsigned char key);
00130   void CameraQuat();
00132   void ChangeSuGiu(GLfloat Movement);
00134   void ChangeDxSx(GLfloat Movement);
00135   //----------File.cpp-------------
00137   void abort_(const char * s, ...);
00139   int Picture();
00141   int WritePixel();
00143   int WritePng();
00145   int WritePngwriter();
00147   int OpenImage(const char *FileName);
00149   void ReadScript();
00151   void ReadConf();
00153   int ImWidth,ImHeight;
00155   GLfloat spin,angolo, dspin,
00157     xa, ya, za,
00159     xf, yf, zf,
00161     xp, yp, zp, zw,
00163     xi, yi, zi,
00165     xLeg, yLeg, zLeg,
00167     dxLeg, dyLeg,
00169     xl0, yl0, zl0,
00171     xl1, yl1, zl1,
00173     scale, dscale,tscale,
00175     Rback, Gback,Bback,Aback;
00177   GLfloat IncrVisDxSx, IncrVisSuGiu;
00179   GLfloat AngleDxSx, AngleSuGiu;
00181   double InvScaleUn;
00183   double GridStep;//Griglia
00185   GLuint Hexagon;
00187   GLuint DrLegend;
00189   GLuint Griglia;
00191   GLuint Quad;
00193   GLuint Point;
00195   GLuint Cylinder;
00197   GLuint MetalCylinder;
00200   GLuint Particles;
00202   GLuint ScriptList;
00204   GLuint GlWall;
00206   GLuint Arrow;
00208   GLuint Cube;
00210   GLuint Texture;
00212   GLuint XCenter;
00214   GLuint YCenter;
00216   int la;
00218   int gr;
00220   int lu;
00222   int sp;
00224   int ne;
00226   int MainWindow,SubWindow1,SubWindow2;
00228   int Diap,tDiap,tDiapBase;
00230   int IfPoint;//point or Sphere
00232   int IfInfo;
00234   int IfScript;
00236   int IfImage;
00238   int IfBlend;
00240   int IfMaterial;
00242   int Values;
00244   int Step;
00246   int WinWidth;
00248   int WinHeight;
00250   int xRem; 
00252   int yRem;
00254   int ChangeMouse;
00256   int NLevel;
00258   float Diameter,StepDiameter;
00260   float NanoRad,ExtraDiam;
00262   double Edge[3];
00264   int GridEdge[3];
00266   double ExtRad;
00268   double ExtHeight;
00270   GLubyte *pixel;
00272   char *Number;
00274   char *frame;
00276   char *info;
00277 };
00278 
00279 extern void keyboard(unsigned char key,int x, int y);
00280 extern void MenuChoise(int option);
00281 extern void MenuVisual(int option);
00282 extern void ParticleList(void);
00283 extern void ParticleRealTime();
00284 extern void Figure();
00285 extern void Figure1();
00286 extern void Timer(int v);
00287 extern void reshape(int w,int h);
00288 extern void mouse(int button, int state,int x,int y);
00289 extern void MouseMove(int x,int y);
00290 extern void special(int k, int x, int y);
00291 extern void DefCylinder(GLuint Cylinder,double CyEdge,double CyHeight,double InvScaleUn);
00292 static const GLfloat DrAmbientWhite [] = {0.25, 0.25, 0.25, 1.00}; 
00293 static const GLfloat DrAmbientRed   [] = {0.25, 0.00, 0.00, 1.00}; 
00294 static const GLfloat DrAmbientGreen [] = {0.00, 0.25, 0.00, 1.00}; 
00295 static const GLfloat DrAmbientBlue  [] = {0.00, 0.00, 0.25, 1.00}; 
00296 static const GLfloat DrDiffuseWhite [] = {0.75, 0.75, 0.75, 1.00}; 
00297 static const GLfloat DrDiffuseRed   [] = {0.75, 0.00, 0.00, 1.00}; 
00298 static const GLfloat DrDiffuseGreen [] = {0.00, 0.75, 0.00, 1.00}; 
00299 static const GLfloat DrDiffuseBlue  [] = {0.00, 0.00, 0.75, 1.00}; 
00300 static const GLfloat DrSpecularWhite[] = {1.00, 1.00, 1.00, 1.00}; 
00301 static const GLfloat DrSpecularRed  [] = {1.00, 0.25, 0.25, 1.00}; 
00302 static const GLfloat DrSpecularGreen[] = {0.25, 1.00, 0.25, 1.00}; 
00303 static const GLfloat DrSpecularBlue [] = {0.25, 0.25, 1.00, 1.00}; 
00304 #endif//USE_GL
00305 #endif//DISEGNA_H
00306 static float ColorType[12][4] = 
00307   { {0.,.7,0.,1.},
00308     {0.,.0,.7,1.},
00309     {.7,.0,.0,1.},
00310     {.4,.1,.7,1.},
00311     {.4,.5,.0,1.},
00312     {.7,.3,.3,1.},
00313     {0.,.4,.3,1.},
00314     {0.,.0,.5,1.},
00315     {.0,.2,.5,1.},
00316     {.0,.4,.7,1.},
00317     {.7,.1,.4,1.},
00318     {.4,.7,.2,1.}};