4 * PCB, interactive printed circuit board design
5 * Copyright (C) 2009-2011 PCB Contributors (See ChangeLog for details).
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef PCB_HID_COMMON_HIDGL_H
24 #define PCB_HID_COMMON_HIDGL_H
27 #define _GLUfuncptr void *
30 #define TRIANGLE_ARRAY_SIZE 5461
32 GLfloat triangle_array
[3 * 3 * TRIANGLE_ARRAY_SIZE
];
33 unsigned int triangle_count
;
34 unsigned int coord_comp_count
;
37 extern triangle_buffer buffer
;
38 extern float global_depth
;
40 void hidgl_flush_triangles (triangle_buffer
*buffer
);
41 void hidgl_ensure_triangle_space (triangle_buffer
*buffer
, int count
);
44 hidgl_add_triangle_3D (triangle_buffer
*buffer
,
45 GLfloat x1
, GLfloat y1
, GLfloat z1
,
46 GLfloat x2
, GLfloat y2
, GLfloat z2
,
47 GLfloat x3
, GLfloat y3
, GLfloat z3
)
49 buffer
->triangle_array
[buffer
->coord_comp_count
++] = x1
;
50 buffer
->triangle_array
[buffer
->coord_comp_count
++] = y1
;
51 buffer
->triangle_array
[buffer
->coord_comp_count
++] = z1
;
52 buffer
->triangle_array
[buffer
->coord_comp_count
++] = x2
;
53 buffer
->triangle_array
[buffer
->coord_comp_count
++] = y2
;
54 buffer
->triangle_array
[buffer
->coord_comp_count
++] = z2
;
55 buffer
->triangle_array
[buffer
->coord_comp_count
++] = x3
;
56 buffer
->triangle_array
[buffer
->coord_comp_count
++] = y3
;
57 buffer
->triangle_array
[buffer
->coord_comp_count
++] = z3
;
58 buffer
->triangle_count
++;
62 hidgl_add_triangle (triangle_buffer
*buffer
,
63 GLfloat x1
, GLfloat y1
,
64 GLfloat x2
, GLfloat y2
,
65 GLfloat x3
, GLfloat y3
)
67 hidgl_add_triangle_3D (buffer
, x1
, y1
, global_depth
,
69 x3
, y3
, global_depth
);
72 void hidgl_draw_grid (BoxType
*drawn_area
, double coord_per_px
);
73 void hidgl_set_depth (float depth
);
74 void hidgl_draw_line (int cap
, Coord width
, Coord x1
, Coord y1
, Coord x2
, Coord y2
, double scale
);
75 void hidgl_draw_arc (Coord width
, Coord vx
, Coord vy
, Coord vrx
, Coord vry
, Angle start_angle
, Angle delta_angle
, double scale
);
76 void hidgl_draw_rect (Coord x1
, Coord y1
, Coord x2
, Coord y2
);
77 void hidgl_fill_circle (Coord vx
, Coord vy
, Coord vr
, double scale
);
78 void hidgl_fill_polygon (int n_coords
, Coord
*x
, Coord
*y
);
79 void hidgl_fill_pcb_polygon (PolygonType
*poly
, const BoxType
*clip_box
, double scale
);
80 void hidgl_fill_rect (Coord x1
, Coord y1
, Coord x2
, Coord y2
);
82 void hidgl_init (void);
83 void hidgl_start_render (void);
84 void hidgl_finish_render (void);
85 int hidgl_stencil_bits (void);
86 int hidgl_assign_clear_stencil_bit (void);
87 void hidgl_return_stencil_bit (int bit
);
88 void hidgl_reset_stencil_usage (void);
90 #endif /* PCB_HID_COMMON_HIDGL_H */