53 |
# include <GL/gl.h> |
# include <GL/gl.h> |
54 |
#endif |
#endif |
55 |
|
|
56 |
|
/* Version number */ |
57 |
|
|
58 |
#define GL2PS_VERSION 0.81 |
#define GL2PS_MAJOR_VERSION 0 |
59 |
#define GL2PS_NONE 0 |
#define GL2PS_MINOR_VERSION 9 |
60 |
|
#define GL2PS_PATCH_VERSION 2 |
61 |
|
|
62 |
|
#define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \ |
63 |
|
0.01 * GL2PS_MINOR_VERSION + \ |
64 |
|
0.0001 * GL2PS_PATCH_VERSION) |
65 |
|
|
66 |
/* Output file format */ |
/* Output file format */ |
67 |
|
|
68 |
#define GL2PS_PS 1 |
#define GL2PS_PS 1 |
69 |
#define GL2PS_EPS 2 |
#define GL2PS_EPS 2 |
70 |
#define GL2PS_TEX 3 |
#define GL2PS_TEX 3 |
71 |
|
|
72 |
/* Sorting algorithms */ |
/* Sorting algorithms */ |
73 |
|
|
74 |
#define GL2PS_NO_SORT 1 |
#define GL2PS_NO_SORT 1 |
75 |
#define GL2PS_SIMPLE_SORT 2 |
#define GL2PS_SIMPLE_SORT 2 |
76 |
#define GL2PS_BSP_SORT 3 |
#define GL2PS_BSP_SORT 3 |
77 |
|
|
78 |
/* Options for gl2psBeginPage */ |
/* Options for gl2psBeginPage */ |
79 |
|
|
80 |
#define GL2PS_DRAW_BACKGROUND (1<<0) |
#define GL2PS_NONE 0 |
81 |
#define GL2PS_SIMPLE_LINE_OFFSET (1<<1) |
#define GL2PS_DRAW_BACKGROUND (1<<0) |
82 |
#define GL2PS_SILENT (1<<2) |
#define GL2PS_SIMPLE_LINE_OFFSET (1<<1) |
83 |
#define GL2PS_BEST_ROOT (1<<3) |
#define GL2PS_SILENT (1<<2) |
84 |
#define GL2PS_OCCLUSION_CULL (1<<4) |
#define GL2PS_BEST_ROOT (1<<3) |
85 |
#define GL2PS_NO_TEXT (1<<5) |
#define GL2PS_OCCLUSION_CULL (1<<4) |
86 |
#define GL2PS_LANDSCAPE (1<<6) |
#define GL2PS_NO_TEXT (1<<5) |
87 |
#define GL2PS_NO_PS3_SHADING (1<<7) |
#define GL2PS_LANDSCAPE (1<<6) |
88 |
#define GL2PS_NO_PIXMAP (1<<8) |
#define GL2PS_NO_PS3_SHADING (1<<7) |
89 |
|
#define GL2PS_NO_PIXMAP (1<<8) |
90 |
|
#define GL2PS_USE_CURRENT_VIEWPORT (1<<9) |
91 |
|
|
92 |
/* Arguments for gl2psEnable/gl2psDisable */ |
/* Arguments for gl2psEnable/gl2psDisable */ |
93 |
|
|
94 |
#define GL2PS_POLYGON_OFFSET_FILL 1 |
#define GL2PS_POLYGON_OFFSET_FILL 1 |
95 |
#define GL2PS_POLYGON_BOUNDARY 2 |
#define GL2PS_POLYGON_BOUNDARY 2 |
96 |
#define GL2PS_LINE_STIPPLE 3 |
#define GL2PS_LINE_STIPPLE 3 |
97 |
|
|
98 |
/* Magic numbers */ |
/* Magic numbers */ |
99 |
|
|
100 |
#define GL2PS_EPSILON 5.e-3 |
#define GL2PS_EPSILON 5.e-3 |
101 |
#define GL2PS_DEPTH_FACT 1000.0 |
#define GL2PS_DEPTH_FACT 1000.0 |
102 |
#define GL2PS_SIMPLE_OFFSET 0.05 |
#define GL2PS_SIMPLE_OFFSET 0.05 |
103 |
#define GL2PS_SIMPLE_OFFSET_LARGE 1.0 |
#define GL2PS_SIMPLE_OFFSET_LARGE 1.0 |
104 |
#define GL2PS_ZERO(arg) (fabs(arg)<1.e-20) |
#define GL2PS_ZERO(arg) (fabs(arg)<1.e-20) |
105 |
|
|
106 |
/* Message levels and error codes */ |
/* Message levels and error codes */ |
107 |
|
|
108 |
#define GL2PS_SUCCESS 0 |
#define GL2PS_SUCCESS 0 |
109 |
#define GL2PS_INFO 1 |
#define GL2PS_INFO 1 |
110 |
#define GL2PS_WARNING 2 |
#define GL2PS_WARNING 2 |
111 |
#define GL2PS_ERROR 3 |
#define GL2PS_ERROR 3 |
112 |
#define GL2PS_NO_FEEDBACK 4 |
#define GL2PS_NO_FEEDBACK 4 |
113 |
#define GL2PS_OVERFLOW 5 |
#define GL2PS_OVERFLOW 5 |
114 |
#define GL2PS_UNINITIALIZED 6 |
#define GL2PS_UNINITIALIZED 6 |
115 |
|
|
116 |
/* Primitive types */ |
/* Primitive types */ |
117 |
|
|
118 |
#define GL2PS_TEXT 1 |
#define GL2PS_TEXT 1 |
119 |
#define GL2PS_POINT 2 |
#define GL2PS_POINT 2 |
120 |
#define GL2PS_LINE 3 |
#define GL2PS_LINE 3 |
121 |
#define GL2PS_QUADRANGLE 4 |
#define GL2PS_QUADRANGLE 4 |
122 |
#define GL2PS_TRIANGLE 5 |
#define GL2PS_TRIANGLE 5 |
123 |
#define GL2PS_PIXMAP 6 |
#define GL2PS_PIXMAP 6 |
124 |
|
|
125 |
/* BSP tree primitive comparison */ |
/* BSP tree primitive comparison */ |
126 |
|
|
127 |
#define GL2PS_COINCIDENT 1 |
#define GL2PS_COINCIDENT 1 |
128 |
#define GL2PS_IN_FRONT_OF 2 |
#define GL2PS_IN_FRONT_OF 2 |
129 |
#define GL2PS_IN_BACK_OF 3 |
#define GL2PS_IN_BACK_OF 3 |
130 |
#define GL2PS_SPANNING 4 |
#define GL2PS_SPANNING 4 |
131 |
|
|
132 |
/* 2D BSP tree primitive comparison */ |
/* 2D BSP tree primitive comparison */ |
133 |
|
|
134 |
#define GL2PS_POINT_COINCIDENT 0 |
#define GL2PS_POINT_COINCIDENT 0 |
135 |
#define GL2PS_POINT_INFRONT 1 |
#define GL2PS_POINT_INFRONT 1 |
136 |
#define GL2PS_POINT_BACK 2 |
#define GL2PS_POINT_BACK 2 |
137 |
|
|
138 |
/* Pass through options */ |
/* Pass through options */ |
139 |
|
|
140 |
#define GL2PS_BEGIN_POLYGON_OFFSET_FILL 1 |
#define GL2PS_BEGIN_POLYGON_OFFSET_FILL 1 |
141 |
#define GL2PS_END_POLYGON_OFFSET_FILL 2 |
#define GL2PS_END_POLYGON_OFFSET_FILL 2 |
142 |
#define GL2PS_BEGIN_POLYGON_BOUNDARY 3 |
#define GL2PS_BEGIN_POLYGON_BOUNDARY 3 |
143 |
#define GL2PS_END_POLYGON_BOUNDARY 4 |
#define GL2PS_END_POLYGON_BOUNDARY 4 |
144 |
#define GL2PS_BEGIN_LINE_STIPPLE 5 |
#define GL2PS_BEGIN_LINE_STIPPLE 5 |
145 |
#define GL2PS_END_LINE_STIPPLE 6 |
#define GL2PS_END_LINE_STIPPLE 6 |
146 |
#define GL2PS_SET_POINT_SIZE 7 |
#define GL2PS_SET_POINT_SIZE 7 |
147 |
#define GL2PS_SET_LINE_WIDTH 8 |
#define GL2PS_SET_LINE_WIDTH 8 |
148 |
|
|
149 |
typedef GLfloat GL2PSrgba[4]; |
typedef GLfloat GL2PSrgba[4]; |
150 |
typedef GLfloat GL2PSxyz[3]; |
typedef GLfloat GL2PSxyz[3]; |
198 |
typedef struct { |
typedef struct { |
199 |
GLint format, sort, options, colorsize, colormode, buffersize, maxbestroot; |
GLint format, sort, options, colorsize, colormode, buffersize, maxbestroot; |
200 |
const char *title, *producer, *filename; |
const char *title, *producer, *filename; |
201 |
GLboolean shade, boundary; |
GLboolean boundary, zerosurfacearea; |
202 |
GLfloat *feedback, offset[2]; |
GLfloat *feedback, offset[2]; |
203 |
GLint viewport[4]; |
GLint viewport[4]; |
204 |
GL2PSrgba *colormap, lastrgba, threshold; |
GL2PSrgba *colormap, lastrgba, threshold; |
206 |
GL2PSlist *primitives; |
GL2PSlist *primitives; |
207 |
GL2PSbsptree2d *imagetree; |
GL2PSbsptree2d *imagetree; |
208 |
FILE *stream; |
FILE *stream; |
209 |
|
GL2PSprimitive *primitivetoadd; |
210 |
} GL2PScontext; |
} GL2PScontext; |
211 |
|
|
212 |
/* public functions */ |
/* public functions */ |