]> git.treefish.org Git - phys/latlib.git/blobdiff - culooks.h
implemented linewidth.
[phys/latlib.git] / culooks.h
index 32e36a814872ca585ec9f7ad7ecec9de6889dc76..34466c1ba0373f0f5ba2dde75307e878e85b1c4d 100644 (file)
--- a/culooks.h
+++ b/culooks.h
 #include <X11/Xutil.h>
 #include <string>
 
-#include "culooks_cube.h"
-
 using namespace std;
 
 class culooks
 {
  public:
+  
+  culooks (const char* name, const int& xcubes, const int& ycubes, const int& l, int *argc, char **argv);
+  void setLink (const int& cubeid, const int& posdir,
+               const float& red, const float& green, const float& blue, const float& alpha);
+  void setPlaq (const int& cubeid, const int& posdir,
+               const float& red, const float& green, const float& blue, const float& alpha);
+  void swapBuffers();
+  void hidePlaqs(const int& cubeid);
+  void hidePlaqs();
+  void hideLinks(const int& cubeid);
+  void hideLinks();
+  void setBgColor(const float& red, const float& green, const float& blue, const float& alpha);
+  void setWireColor(const float& r, const float& g, const float& b, const float& a);
+  void setLineWidth(float width);
+
+ private:
+
+  struct comarg {
+    int *argc;
+    char **argv;
+  };
+
+  static comarg comArg;
+  
+  class cube {
+  public:
+    cube (int l);
+    void draw();
+    int id;
+    float az, alt;
+    float azRotSpeed;
+    float zoom;
+    void setLink (const int& posdir, 
+                 const float& red, const float& green, const float& blue, const float& alpha);
+    void setPlaq (const int& posdir, 
+                 const float& red, const float& green, const float& blue, const float& alpha);
+    void swapLinkBuffer();
+    void swapPlaqBuffer();
+    void hidePlaqs();
+    void hideLinks();
+    void setWireColor(const float& r, const float& g, const float& b, const float& a);
+  private:
+    float wireColor[4];
+    void drawAll();
+    void drawBox();
+    static void drawFrame();
+    float *plaq;
+    float *link;
+    float *plaqbuf[2];
+    float *linkbuf[2];
+    int l;
+    int plaqbuf_active;
+    int linkbuf_active;
+    static int allid;
+    bool hideplaquettes;
+    bool hidelinks;
+  };
+  
   struct window {
     int layout[2];
     double aspect;
@@ -25,23 +81,31 @@ class culooks
     int gwinid;
     bool initialized;
     string name;
+    float bgcolor[4];
+    bool redisplay;
+    float linewidth;
   };
 
-  culooks (const char* name, const int& xcubes, const int& ycubes, const int& l, int *argc, char **argv);
-
-  static vector< pair<int,window*> > Windows;
-
-  struct wincontext {
-    GLXDrawable gDrawable;
-    Display *gDisplay;
-    GLXContext gContext;
+  class drawing 
+  {
+  private:
+    static int rotcube[3];
+    static culooks::window* getWin();
+    static int getCubeFromPos(int x, int y);
+    static void motionFunc(int x, int y);
+    static void mouseFunc(int button, int state, int x, int y);
+    static void reshapeFunc(int w, int h);
+    static void displayFunc();
+    static void initWindow(int winid);
+    static void idleFunc();
+  public:
+    static void* glutThread(void *leer);
   };
-
- private:
+  
+  static vector< pair<int,window*> > Windows;
   static pthread_t glThreadId;
   static int windowid;
   int mywid;
-  
 };
 
 #endif