home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / alt / sources / 2608 / graphics.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-23  |  2.7 KB  |  150 lines

  1. /*    @(#)graphics.h 1.2 92/05/28 SMI    */
  2. /*    from graphics.h 1.4 90/07/23 SMI    */
  3.  
  4. /*
  5.  * Copyright (c) 1986 by Sun Microsystems, Inc.
  6.  */
  7.  
  8. #ifndef GRAPHICS_H
  9. #define GRAPHICS_H
  10.  
  11.  
  12. #ifndef    window_hs_DEFINED
  13. #ifdef XV
  14. #include <xview/window_hs.h>
  15. #else
  16. #include <sunwindow/window_hs.h>
  17. #endif XV
  18. #endif    window_hs_DEFINED
  19.  
  20. #ifdef XV
  21. #include <X11/Xlib.h>
  22. #include <X11/Xatom.h>
  23. #include <xview/xview.h>
  24. #include <xview/canvas.h>
  25. #endif XV
  26.  
  27. #ifdef    XGL
  28. #ifndef XGL_INCLUDED
  29. #include <xgl/xgl.h>
  30. #endif
  31. #else
  32. #ifndef    DEV_GP1_ERR_NO_GP1
  33. #include "dev_gp1.h"
  34. #endif
  35. #endif    XGL
  36.  
  37.  
  38.  
  39. #ifdef    XGL
  40.  
  41.     Xgl_trans    Ctrl_view_mat ;
  42.     Xgl_trans    WIN_MAT ;
  43.     Xgl_trans    OBJ_MAT ;
  44.     Xgl_trans    ROT_MAT ;
  45.     Xgl_trans    TM1 ;
  46.     Xgl_trans    TM2 ;
  47.     Xgl_trans    TM3 ;
  48.     Xgl_trans    PERSP_MAT ;
  49.     Xgl_trans    ID_MAT ;
  50.  
  51. typedef    Xgl_pt_f2d    Pt2d ;
  52. typedef    Xgl_pt_f3d    Pt3d ;
  53. typedef    Xgl_matrix_f3d    Mat3d ;
  54. typedef    Xgl_matrix_f2d    Mat2d ;
  55.  
  56.  
  57. #else
  58.  
  59. #define    WIN_MAT    0        /* final viewing matrix */
  60. #define    TM1    1
  61. #define    TM2    2
  62. #define    TM3    3
  63. #define    OBJ_MAT    4        /* (TRANLATION*ROTATION*PERSPECTIVE) */
  64. #define    ROT_MAT    5        /* matrix that holds ship orientation */
  65.  
  66. typedef    Point2df    Pt2d ;
  67. typedef    Point3df    Pt3d ;
  68. typedef    Matrix3df    Mat3d ;
  69. typedef    Matrix2df    Mat2d ;
  70.  
  71. #endif    XGL
  72.  
  73. #include "object_types.h"
  74.  
  75. #define    WHITE    1
  76. #define    LGREY    2
  77. #define    GREY    3
  78. #define    RED    4
  79. #define    GREEN    5
  80. #define    BLUE    6
  81. #define    YELLOW    7
  82.  
  83.  
  84.  
  85. #ifdef    XGL
  86. #define Set_color(ctx, i)            \
  87.     do {                    \
  88.       current_xgl_color.index = dbmap[i] ;    \
  89.       xgl_object_set(ctx, XGL_CTX_LINE_COLOR, ¤t_xgl_color, 0) ; \
  90.     } while(0) ;
  91. #define Set_marker_color(ctx)            \
  92.       xgl_object_set(ctx, XGL_CTX_MARKER_COLOR, ¤t_xgl_color, 0) ;
  93. #else
  94. #define    Set_color(gp,color)            \
  95. {                        \
  96.     if(hwdb)                \
  97.     {                    \
  98.       Dev_gp1_set_color((gp),(color)) ;    \
  99.     }                    \
  100.     else                    \
  101.     {                    \
  102.       Dev_gp1_dbuf_color((gp),(color)) ;    \
  103.     }                    \
  104. }
  105. #endif    XGL
  106.  
  107.  
  108.  
  109. #ifdef XV
  110. extern    Xv_Window       Main_pw, Control_pw;
  111. #else
  112. extern    Pixwin    *Main_pw, *Control_pw ;
  113. #endif XV
  114.  
  115. #ifdef    XGL
  116. extern    Xgl_3d_ctx    Main_gfx, Control_gfx ;
  117. extern    Xgl_2d_ctx    Text_gfx;
  118. extern    Xgl_mem_ras    Cursor_ras;
  119. #else
  120. extern    GP1_handle    Main_gfx, Control_gfx ;
  121. #endif    XGL
  122.  
  123. #ifdef    XGL
  124.     Xgl_matrix_f3d    P_matrix ;
  125. #else
  126.     Matrix3df    P_matrix ;
  127. #endif    XGL
  128.  
  129. #ifdef    XGL
  130.     Xgl_color current_xgl_color ;
  131. #endif    XGL
  132.  
  133.     int    Mouse_x, Mouse_y ;
  134.     int    Left_But, Middle_But, Right_But ;
  135.     int    Side_1, Side_2, Side_3, Side_4, Side_5 ;
  136.     int    Side_6, Side_7, Side_8, Side_9, Side_10 ;
  137.     float    Mouse_ax, Mouse_ay ;
  138.     int    hwdb ;
  139.     int    mouse_control ;
  140.  
  141.         /* sort_list is a list of objects that starts out in
  142.            strictly increasing order but then gets sorted.  It
  143.            is kept from frame to frame in order to optimize
  144.            sorting time (taking advantage of coherence) */
  145.     short    sort_list[MAX_OBJECTS] ;
  146.     short    nobjects ;
  147.     int    dbmap[256] ;
  148.  
  149. #endif    GRAPHICS_H
  150.