|
3 | 3 | * |
4 | 4 | * This file is part of Open PHIGS |
5 | 5 | * Copyright (C) 2014 Surplus Users Ham Society |
6 | | -* (C) 2022-2023 CERN |
| 6 | +* (C) 2022-2025 CERN |
7 | 7 | * |
8 | 8 | * Open PHIGS is free software: you can redistribute it and/or modify |
9 | 9 | * it under the terms of the GNU Lesser General Public License as published by |
@@ -119,6 +119,80 @@ typedef struct _Wsgl { |
119 | 119 | Ws_dev_st dev_st; |
120 | 120 | } Wsgl; |
121 | 121 |
|
| 122 | +/* record geometry */ |
| 123 | +typedef enum { |
| 124 | + GEOM_LINE, |
| 125 | + GEOM_FACE |
| 126 | +} GeomType; |
| 127 | + |
| 128 | +typedef struct { |
| 129 | + GeomType type; |
| 130 | + int* indices; |
| 131 | + int* norms; |
| 132 | + int count; |
| 133 | +} Geometry; |
| 134 | + |
| 135 | +extern Ppoint3 * vertices; |
| 136 | +extern Ppoint3 * normals; |
| 137 | +extern int vertex_count; |
| 138 | +extern int normal_count; |
| 139 | + |
| 140 | +extern Geometry* geometries; |
| 141 | +extern int geom_count; |
| 142 | +extern Ppoint3 current_normal; |
| 143 | + |
| 144 | +extern int record_geom; |
| 145 | +extern int record_geom_fill; |
| 146 | +extern int normal_valid; |
| 147 | + |
| 148 | +#define MAX_VERTICES 10000 |
| 149 | +/******************************************************************************* |
| 150 | + * wsgl_set_current_normal(float x, float y, float z) |
| 151 | + * |
| 152 | + * DESCR: add 3d vertex |
| 153 | + * RETURNS: Non zero or zero on error |
| 154 | + */ |
| 155 | + void wsgl_set_current_normal(float x, float y, float z); |
| 156 | + |
| 157 | +/******************************************************************************* |
| 158 | + * wsgl_add_vertex(float x, float y, float z) |
| 159 | + * |
| 160 | + * DESCR: add 3d vertex |
| 161 | + * RETURNS: Non zero or zero on error |
| 162 | + */ |
| 163 | + int wsgl_add_vertex(float x, float y, float z); |
| 164 | + |
| 165 | +/******************************************************************************* |
| 166 | + * wsgl_add_normal(float x, float y, float z) |
| 167 | + * |
| 168 | + * DESCR: add 3d vertex |
| 169 | + * RETURNS: Non zero or zero on error |
| 170 | + */ |
| 171 | + int wsgl_add_normal(float x, float y, float z); |
| 172 | + |
| 173 | +/******************************************************************************* |
| 174 | + * wsgl_add_geometry(GeomType type, const int* verts, const int* norms, int count) |
| 175 | + * |
| 176 | + * DESCR: add 3d geometry |
| 177 | + * RETURNS: Non zero or zero on error |
| 178 | + */ |
| 179 | + void wsgl_add_geometry(GeomType type, const int* verts, const int* norms, int count); |
| 180 | + |
| 181 | +/******************************************************************************* |
| 182 | + * wsgl_export_obj(const char* filename, const char* title) |
| 183 | + * DESCR: export as OBJ file |
| 184 | + * RETURNS: Non zero or zero on error |
| 185 | + */ |
| 186 | + |
| 187 | + void wsgl_export_obj(const char* filename, const char* title); |
| 188 | +/******************************************************************************* |
| 189 | + * wsgl_clear_geometry() |
| 190 | + * |
| 191 | + * DESCR: cleanup geometry records |
| 192 | + * RETURNS: Non zero or zero on error |
| 193 | + */ |
| 194 | + void wsgl_clear_geometry(); |
| 195 | + |
122 | 196 | /******************************************************************************* |
123 | 197 | * wsgl_init |
124 | 198 | * |
@@ -1209,8 +1283,7 @@ void wsgl_anno_text_rel( |
1209 | 1283 | * DESCR: Initialise shaders |
1210 | 1284 | * RETURNS: N/A |
1211 | 1285 | */ |
1212 | | - |
1213 | | - void wsgl_shaders(Ws * ws); |
| 1286 | +void wsgl_shaders(Ws * ws); |
1214 | 1287 |
|
1215 | 1288 | extern Phg_font *fnt_fonts[]; |
1216 | 1289 | extern unsigned char *wsgl_hatch_tbl[]; |
|
0 commit comments