wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
Loading...
Searching...
No Matches
bgi_types.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cstdint>
5#include <memory>
6#include <queue>
7#include <string>
8#include <unordered_map>
9#include <vector>
10
11#if defined(_WIN32)
12#define BGI_API extern "C" __declspec(dllexport)
13#else
14#define BGI_API extern "C"
15#endif
16
17#if defined(_MSC_VER)
18#define BGI_CALL __cdecl
19#else
20#define BGI_CALL
21#endif
22
23#ifdef __cplusplus
24#define BGI_DEFAULT_ARG(value) = value
25#else
26#define BGI_DEFAULT_ARG(value)
27#endif
28
29struct GLFWwindow;
30
46
55typedef void (BGI_CALL *WxbgiKeyHook)(int key, int scancode, int action, int mods);
56
63typedef void (BGI_CALL *WxbgiCharHook)(unsigned int codepoint);
64
71typedef void (BGI_CALL *WxbgiCursorPosHook)(int x, int y);
72
80typedef void (BGI_CALL *WxbgiMouseButtonHook)(int button, int action, int mods);
81
89typedef void (BGI_CALL *WxbgiScrollHook)(double xoffset, double yoffset);
90
92
100#define WXBGI_DEFAULT_KEY_QUEUE 0x01
102#define WXBGI_DEFAULT_CURSOR_TRACK 0x02
104#define WXBGI_DEFAULT_MOUSE_PICK 0x04
106#define WXBGI_DEFAULT_SCROLL_ACCUM 0x08
108#define WXBGI_DEFAULT_ALL 0x0F
110#define WXBGI_DEFAULT_NONE 0x00
112
119#define WXBGI_KEY_SPACE 32
120#define WXBGI_KEY_APOSTROPHE 39
121#define WXBGI_KEY_COMMA 44
122#define WXBGI_KEY_MINUS 45
123#define WXBGI_KEY_PERIOD 46
124#define WXBGI_KEY_SLASH 47
125#define WXBGI_KEY_SEMICOLON 59
126#define WXBGI_KEY_EQUAL 61
127#define WXBGI_KEY_LEFT_BRACKET 91
128#define WXBGI_KEY_RIGHT_BRACKET 93
129#define WXBGI_KEY_ESCAPE 256
130#define WXBGI_KEY_ENTER 257
131#define WXBGI_KEY_TAB 258
132#define WXBGI_KEY_BACKSPACE 259
133#define WXBGI_KEY_INSERT 260
134#define WXBGI_KEY_DELETE 261
135#define WXBGI_KEY_RIGHT 262
136#define WXBGI_KEY_LEFT 263
137#define WXBGI_KEY_DOWN 264
138#define WXBGI_KEY_UP 265
139#define WXBGI_KEY_PAGE_UP 266
140#define WXBGI_KEY_PAGE_DOWN 267
141#define WXBGI_KEY_HOME 268
142#define WXBGI_KEY_END 269
143#define WXBGI_KEY_F1 290
144#define WXBGI_KEY_F2 291
145#define WXBGI_KEY_F3 292
146#define WXBGI_KEY_F4 293
147#define WXBGI_KEY_F5 294
148#define WXBGI_KEY_F6 295
149#define WXBGI_KEY_F7 296
150#define WXBGI_KEY_F8 297
151#define WXBGI_KEY_F9 298
152#define WXBGI_KEY_F10 299
153#define WXBGI_KEY_F11 300
154#define WXBGI_KEY_F12 301
156
157namespace bgi
158{
159
160 constexpr int DETECT = 0;
161 constexpr int kDefaultWidth = 960;
162 constexpr int kDefaultHeight = 720;
163 constexpr int kPaletteSize = 16;
164 constexpr int kExtColorBase = 16;
165 constexpr int kExtPaletteSize = 240;
166 constexpr int kSelectionOrangeColor = 252;
167 constexpr int kSelectionPurpleColor = 253;
168 constexpr int kPageCount = 2;
169 constexpr int kPatternRows = 8;
170 constexpr int kPatternCols = 8;
171
172 constexpr int BLACK = 0;
173 constexpr int BLUE = 1;
174 constexpr int GREEN = 2;
175 constexpr int CYAN = 3;
176 constexpr int RED = 4;
177 constexpr int MAGENTA = 5;
178 constexpr int BROWN = 6;
179 constexpr int LIGHTGRAY = 7;
180 constexpr int DARKGRAY = 8;
181 constexpr int LIGHTBLUE = 9;
182 constexpr int LIGHTGREEN = 10;
183 constexpr int LIGHTCYAN = 11;
184 constexpr int LIGHTRED = 12;
185 constexpr int LIGHTMAGENTA = 13;
186 constexpr int YELLOW = 14;
187 constexpr int WHITE = 15;
188
189 constexpr int SOLID_LINE = 0;
190 constexpr int DOTTED_LINE = 1;
191 constexpr int CENTER_LINE = 2;
192 constexpr int DASHED_LINE = 3;
193 constexpr int USERBIT_LINE = 4;
194
195 constexpr int NORM_WIDTH = 1;
196 constexpr int THICK_WIDTH = 3;
197
198 constexpr int EMPTY_FILL = 0;
199 constexpr int SOLID_FILL = 1;
200 constexpr int LINE_FILL = 2;
201 constexpr int LTSLASH_FILL = 3;
202 constexpr int SLASH_FILL = 4;
203 constexpr int BKSLASH_FILL = 5;
204 constexpr int LTBKSLASH_FILL = 6;
205 constexpr int HATCH_FILL = 7;
206 constexpr int XHATCH_FILL = 8;
207 constexpr int INTERLEAVE_FILL = 9;
208 constexpr int WIDE_DOT_FILL = 10;
209 constexpr int CLOSE_DOT_FILL = 11;
210 constexpr int USER_FILL = 12;
211
212 constexpr int COPY_PUT = 0;
213 constexpr int XOR_PUT = 1;
214 constexpr int OR_PUT = 2;
215 constexpr int AND_PUT = 3;
216 constexpr int NOT_PUT = 4;
217
218 constexpr int DEFAULT_FONT = 0;
219 constexpr int TRIPLEX_FONT = 1;
220 constexpr int SMALL_FONT = 2;
221 constexpr int SANS_SERIF_FONT = 4;
222 constexpr int GOTHIC_FONT = 8;
223 constexpr int MODERN_ROBOTO_FONT = 16;
225 constexpr int MODERN_HANDJET_FONT = 18;
226 constexpr int HORIZ_DIR = 0;
227 constexpr int VERT_DIR = 1;
228
229 constexpr int LEFT_TEXT = 0;
230 constexpr int CENTER_TEXT = 1;
231 constexpr int RIGHT_TEXT = 2;
232 constexpr int BOTTOM_TEXT = 0;
233 constexpr int TOP_TEXT = 2;
234
258
260 {
261 int x;
262 int y;
265 int xend;
266 int yend;
267 };
268
270 {
272 int color;
273 };
274
276 {
278 unsigned upattern;
280 };
281
283 {
284 std::uint8_t size;
285 std::array<int, kPaletteSize> colors;
286 };
287
289 {
290 int font;
293 int horiz;
294 int vert;
295 };
296
298 {
299 int left;
300 int top;
301 int right;
303 int clip;
304 };
305
306 struct ColorRGB
307 {
308 std::uint8_t r;
309 std::uint8_t g;
310 std::uint8_t b;
311 };
312
313 using MouseHandler = void(BGI_CALL *)(int, int);
314
316 {
317 int kind;
318 int x;
319 int y;
320 };
321
323 {
324 std::uint32_t width;
325 std::uint32_t height;
326 };
327
328 extern const ColorRGB kBgiPalette[kPaletteSize];
329
330 // -------------------------------------------------------------------------
331 // Camera system
332 // -------------------------------------------------------------------------
333
336 {
339 };
340
353 struct Camera3D
354 {
355 // --- Eye/target/up (Z-up, right-handed) ---
356 float eyeX{0.f}, eyeY{-10.f}, eyeZ{5.f};
357 float targetX{0.f}, targetY{0.f}, targetZ{0.f};
358 float upX{0.f}, upY{0.f}, upZ{1.f}; // Z is up
359
360 // --- Projection ---
362
363 float fovYDeg{45.f};
364 float nearPlane{0.1f};
365 float farPlane{10000.f};
366
367 // Orthographic clip extents. All-zero triggers auto-fit via worldHeight2d.
368 float orthoLeft{0.f}, orthoRight{0.f};
369 float orthoBottom{0.f}, orthoTop{0.f};
370
371 // --- Screen-space viewport override (pixels).
372 // All-zero means the full GLFW window. ---
373 int vpX{0}, vpY{0}, vpW{0}, vpH{0};
374
375 // --- 2-D convenience layer (active when is2D == true) ---
376 bool is2D{false};
377 float pan2dX{0.f}, pan2dY{0.f};
378 float zoom2d{1.f};
379 float rot2dDeg{0.f};
381 float worldHeight2d{2.f};
382
383 // --- Per-camera visual overlay state (not serialised to DDS/DDJ) ---
384
386 struct {
387 bool enabled {false};
388 int count {3};
389 float innerRadius {25.f};
390 float outerRadius {100.f};
392
394 struct {
395 bool enabled {false};
396 int sizePx {8};
397 int colorScheme {0};
399
400 // --- Scene assignment ---
403 std::string assignedSceneName{"default"};
404 };
405
406 // -------------------------------------------------------------------------
407 // User Coordinate System (UCS)
408 // -------------------------------------------------------------------------
409
421 {
422 // Origin of this UCS in world space.
423 float originX{0.f}, originY{0.f}, originZ{0.f};
424
425 // Orthonormal axes expressed as world-space direction vectors.
426 // These default to the world identity frame (Z-up, right-handed).
427 float xAxisX{1.f}, xAxisY{0.f}, xAxisZ{0.f};
428 float yAxisX{0.f}, yAxisY{1.f}, yAxisZ{0.f};
429 float zAxisX{0.f}, zAxisY{0.f}, zAxisZ{1.f};
430 };
431
432 // -------------------------------------------------------------------------
433 // Visual overlay state
434 // -------------------------------------------------------------------------
435
444 {
445 bool enabled {false};
446 float spacing {25.f};
447 int halfExtent {4};
451 std::string ucsName;
452 };
453
461 {
462 bool enabled {false};
463 bool showWorld {true};
464 bool showActive {true};
465 float axisLength {80.f};
466 };
467
468 // -------------------------------------------------------------------------
469 // World extents
470 // -------------------------------------------------------------------------
471
481 {
482 float minX{0.f}, minY{0.f}, minZ{0.f};
483 float maxX{0.f}, maxY{0.f}, maxZ{0.f};
484 bool hasData{false};
485 };
486
494 {
495 // Primary (key) light direction — normalised, world-space by default.
496 float dirX{ -0.577f}, dirY{ 0.577f}, dirZ{0.577f};
497 bool worldSpace{true};
498
499 // Fill (secondary) light — softens shadows.
500 float fillX{0.f}, fillY{-1.f}, fillZ{0.f};
501 float fillStrength{0.30f};
502
503 // Phong material intensities.
504 float ambient {0.20f};
505 float diffuse {0.70f};
506 float specular {0.30f};
507 float shininess{32.f};
508 };
509
510 // -------------------------------------------------------------------------
511 // GL pass geometry buffers (populated by wxbgi_render_dds; consumed by
512 // renderSolidsGLPass / renderWorldLinesGLPass with the GL context current).
513 // -------------------------------------------------------------------------
514
516 struct GlVertex
517 {
518 float px, py, pz;
519 float nx, ny, nz;
520 float r, g, b;
521 };
522
525 {
526 float px, py, pz;
527 float r, g, b;
528 };
529
532 {
533 std::vector<GlVertex> solidVerts;
534 std::vector<GlVertex> smoothVerts;
535 std::vector<GlVertex> wireTriVerts;
536 std::vector<GlLineVertex> wireLineVerts;
537 std::vector<GlLineVertex> lineVerts;
538
539 bool hasSolids() const { return !solidVerts.empty() || !smoothVerts.empty(); }
540 bool hasWireframe() const { return !wireTriVerts.empty(); }
541 bool hasLines() const { return !lineVerts.empty(); }
542 bool hasPending() const { return hasSolids() || hasWireframe() || hasLines(); }
543 void clear()
544 {
545 solidVerts.clear(); smoothVerts.clear();
546 wireTriVerts.clear(); wireLineVerts.clear();
547 lineVerts.clear();
548 }
549 };
550
557 {
559 float viewProj[16]{};
560 float eyeX{0}, eyeY{0}, eyeZ{0};
563 int camVpX{0}, camVpY{0}, camVpW{0}, camVpH{0};
564 };
565
566 // -------------------------------------------------------------------------
567 // Forward declarations for DDS types (full definitions in bgi_dds.h).
568 // These let BgiState hold shared_ptr<DdsCamera>, the ddsRegistry map, and
569 // a raw DdsScene* shortcut without creating a circular include between
570 // bgi_types.h and bgi_dds.h.
571 // -------------------------------------------------------------------------
572 class DdsCamera;
573 class DdsUcs;
574 class DdsScene;
575
576 struct BgiState
577 {
578 GLFWwindow *window{nullptr};
582 int graphMode{0};
587 std::array<std::uint8_t, kPatternRows> fillMask{};
590 bool glfwInitialized{false};
592 int currentX{0};
593 int currentY{0};
600 int aspectX{1};
601 int aspectY{1};
603 arccoordstype lastArc{0, 0, 0, 0, 0, 0};
606 std::array<ColorRGB, kPaletteSize> palette{};
607 std::array<ColorRGB, kExtPaletteSize> extPalette{};
609 unsigned graphBufSize{0U};
612 std::vector<std::vector<std::uint8_t>> pageBuffers;
613 std::string windowTitle{"BGI OpenGL Wrapper"};
614 bool doubleBuffered{false};
615 std::queue<int> keyQueue;
616 std::array<std::uint8_t, 512> keyDown{};
617 int mouseX{0};
618 int mouseY{0};
619 bool mouseMoved{false};
620
621 // --- Camera registry (DdsCamera is the source of truth) ---
622 // shared_ptr<DdsCamera> maps are indexes into the DDS; Camera3D data
623 // lives inside each DdsCamera object. Forward declaration keeps this
624 // header free of the full bgi_dds.h include.
625 std::unordered_map<std::string, std::shared_ptr<DdsCamera>> cameras;
626 std::string activeCamera{"default"};
627
628 // --- UCS registry (DdsUcs is the source of truth) ---
629 std::unordered_map<std::string, std::shared_ptr<DdsUcs>> ucsSystems;
630 std::string activeUcs{"world"};
631
632 // --- World drawing extents (AABB in world space) ---
634
635 // --- Drawing Description Data Structure (DDS) scene graph registry ---
636 //
637 // ddsRegistry owns all named scene graphs. The "default" scene is
638 // created at startup and cannot be destroyed.
639 //
640 // dds is a non-owning raw-pointer shortcut that always points to
641 // ddsRegistry[activeDdsName].get(). All legacy gState.dds->foo() call
642 // sites continue to work without modification because both unique_ptr
643 // and raw pointer support operator->. The shortcut is updated whenever
644 // activeDdsName changes (wxbgi_dds_scene_set_active / resetStateForWindow).
645 std::unordered_map<std::string, std::unique_ptr<DdsScene>> ddsRegistry;
646 std::string activeDdsName{"default"};
647 DdsScene *dds{nullptr};
648
649 // --- 3D Solid / Surface / Extrusion defaults ---
654
655 // --- Global visual overlays (not serialised) ---
658
659 // --- DDS Object Selection state (not serialised) ---
660 std::vector<std::string> selectedObjectIds;
663
664 // --- User input hooks ---
670 double scrollDeltaX{0.0};
671 double scrollDeltaY{0.0};
672
673 // --- Input default behavior flags ---
675
676 // --- wx-embedded mode flag ---
677 bool wxEmbedded{false};
678 bool shouldClose{false};
679 bool inCrtMode{false};
683 void (*wxPollCallback)(){nullptr};
684
685 // --- GL rendering mode ---
686 bool legacyGlRender{false};
691 std::vector<PendingGlFrame> pendingGlQueue;
694 std::string pendingOverlayCam{};
695
696 // Constructor/destructor defined in bgi_state.cpp (where bgi_dds.h is
697 // included) so DdsScene is fully defined when the ddsRegistry map's
698 // unique_ptr destructors are generated.
701 BgiState(const BgiState &) = delete;
702 BgiState &operator=(const BgiState &) = delete;
703 };
704
705} // namespace bgi
#define WXBGI_DEFAULT_ALL
All default behaviors enabled (initial state after initwindow).
Definition bgi_types.h:108
#define BGI_CALL
Definition bgi_types.h:20
Camera stored in the DDS.
Definition bgi_dds.h:168
In-memory DDS scene graph.
Definition bgi_dds.h:509
UCS stored in the DDS.
Definition bgi_dds.h:183
void(BGI_CALL * WxbgiScrollHook)(double xoffset, double yoffset)
User hook fired after each mouse scroll (wheel) event.
Definition bgi_types.h:89
void(BGI_CALL * WxbgiCursorPosHook)(int x, int y)
User hook fired after every mouse cursor movement.
Definition bgi_types.h:71
void(BGI_CALL * WxbgiCharHook)(unsigned int codepoint)
User hook fired after each printable Unicode character input event.
Definition bgi_types.h:63
void(BGI_CALL * WxbgiKeyHook)(int key, int scancode, int action, int mods)
User hook fired after each key press, repeat, or release event.
Definition bgi_types.h:55
void(BGI_CALL * WxbgiMouseButtonHook)(int button, int action, int mods)
User hook fired after each mouse button press or release.
Definition bgi_types.h:80
Definition bgi_camera.h:28
constexpr int GREEN
Definition bgi_types.h:174
constexpr int INTERLEAVE_FILL
Definition bgi_types.h:207
constexpr int BLACK
Definition bgi_types.h:172
constexpr int WIDE_DOT_FILL
Definition bgi_types.h:208
constexpr int LIGHTBLUE
Definition bgi_types.h:181
const ColorRGB kBgiPalette[kPaletteSize]
constexpr int BKSLASH_FILL
Definition bgi_types.h:203
constexpr int DASHED_LINE
Definition bgi_types.h:192
constexpr int THICK_WIDTH
Definition bgi_types.h:196
constexpr int TOP_TEXT
Definition bgi_types.h:233
constexpr int LIGHTRED
Definition bgi_types.h:184
constexpr int SLASH_FILL
Definition bgi_types.h:202
GraphStatus
Definition bgi_types.h:236
@ grInvalidDriver
Definition bgi_types.h:241
@ grIOerror
Definition bgi_types.h:249
@ grInvalidFont
Definition bgi_types.h:250
@ grNoInitGraph
Definition bgi_types.h:238
@ grNoLoadMem
Definition bgi_types.h:242
@ grInitFailed
Definition bgi_types.h:253
@ grFileNotFound
Definition bgi_types.h:240
@ grInvalidVersion
Definition bgi_types.h:252
@ grNoFontMem
Definition bgi_types.h:246
@ grNotDetected
Definition bgi_types.h:239
@ grFontNotFound
Definition bgi_types.h:245
@ grNoScanMem
Definition bgi_types.h:243
@ grNoFloodMem
Definition bgi_types.h:244
@ grWindowClosed
Definition bgi_types.h:254
@ grError
Definition bgi_types.h:248
@ grDuplicateName
A camera or UCS with that name already exists.
Definition bgi_types.h:256
@ grInvalidInput
Definition bgi_types.h:255
@ grInvalidFontNum
Definition bgi_types.h:251
@ grOk
Definition bgi_types.h:237
@ grInvalidMode
Definition bgi_types.h:247
constexpr int NORM_WIDTH
Definition bgi_types.h:195
constexpr int kPaletteSize
classic BGI palette slots (0-15)
Definition bgi_types.h:163
constexpr int kExtColorBase
first user-assignable extended colour index
Definition bgi_types.h:164
constexpr int LTBKSLASH_FILL
Definition bgi_types.h:204
constexpr int BROWN
Definition bgi_types.h:178
constexpr int kPageCount
Definition bgi_types.h:168
constexpr int kSelectionOrangeColor
Reserved extended-palette slot — selection flash orange.
Definition bgi_types.h:166
constexpr int kPatternRows
Definition bgi_types.h:169
constexpr int SOLID_FILL
Definition bgi_types.h:199
constexpr int SMALL_FONT
Definition bgi_types.h:220
CameraProjection
Projection mode for a Camera3D.
Definition bgi_types.h:336
@ Orthographic
Definition bgi_types.h:337
@ Perspective
Definition bgi_types.h:338
constexpr int MODERN_PLAYFAIR_DISPLAY_FONT
Definition bgi_types.h:224
constexpr int XHATCH_FILL
Definition bgi_types.h:206
constexpr int RIGHT_TEXT
Definition bgi_types.h:231
constexpr int LIGHTCYAN
Definition bgi_types.h:183
constexpr int XOR_PUT
Definition bgi_types.h:213
constexpr int COPY_PUT
Definition bgi_types.h:212
constexpr int HORIZ_DIR
Definition bgi_types.h:226
constexpr int CENTER_TEXT
Definition bgi_types.h:230
constexpr int kDefaultHeight
Definition bgi_types.h:162
constexpr int NOT_PUT
Definition bgi_types.h:216
constexpr int CYAN
Definition bgi_types.h:175
constexpr int AND_PUT
Definition bgi_types.h:215
constexpr int LIGHTGREEN
Definition bgi_types.h:182
constexpr int MAGENTA
Definition bgi_types.h:177
constexpr int CENTER_LINE
Definition bgi_types.h:191
constexpr int VERT_DIR
Definition bgi_types.h:227
constexpr int EMPTY_FILL
Definition bgi_types.h:198
constexpr int BLUE
Definition bgi_types.h:173
constexpr int DARKGRAY
Definition bgi_types.h:180
constexpr int USERBIT_LINE
Definition bgi_types.h:193
constexpr int SOLID_LINE
Definition bgi_types.h:189
constexpr int GOTHIC_FONT
Definition bgi_types.h:222
constexpr int LIGHTGRAY
Definition bgi_types.h:179
constexpr int SANS_SERIF_FONT
Definition bgi_types.h:221
constexpr int OR_PUT
Definition bgi_types.h:214
constexpr int DEFAULT_FONT
Definition bgi_types.h:218
constexpr int LTSLASH_FILL
Definition bgi_types.h:201
constexpr int TRIPLEX_FONT
Definition bgi_types.h:219
constexpr int WHITE
Definition bgi_types.h:187
constexpr int LINE_FILL
Definition bgi_types.h:200
constexpr int DETECT
Definition bgi_types.h:160
constexpr int HATCH_FILL
Definition bgi_types.h:205
constexpr int CLOSE_DOT_FILL
Definition bgi_types.h:209
constexpr int USER_FILL
Definition bgi_types.h:210
constexpr int DOTTED_LINE
Definition bgi_types.h:190
void(BGI_CALL *)(int, int) MouseHandler
Definition bgi_types.h:313
constexpr int RED
Definition bgi_types.h:176
constexpr int kExtPaletteSize
extended slots 16-255 (fits uint8_t pixel buffer)
Definition bgi_types.h:165
constexpr int BOTTOM_TEXT
Definition bgi_types.h:232
constexpr int kPatternCols
Definition bgi_types.h:170
constexpr int YELLOW
Definition bgi_types.h:186
constexpr int MODERN_ROBOTO_FONT
Definition bgi_types.h:223
constexpr int kSelectionPurpleColor
Reserved extended-palette slot — selection flash purple.
Definition bgi_types.h:167
constexpr int kDefaultWidth
Definition bgi_types.h:161
constexpr int LIGHTMAGENTA
Definition bgi_types.h:185
constexpr int MODERN_HANDJET_FONT
Definition bgi_types.h:225
constexpr int LEFT_TEXT
Definition bgi_types.h:229
int activePage
Definition bgi_types.h:610
std::string activeDdsName
Definition bgi_types.h:646
BgiState & operator=(const BgiState &)=delete
bool mouseMoved
Set true by cursorPosCallback; cleared by wxbgi_mouse_moved().
Definition bgi_types.h:619
std::array< std::uint8_t, 512 > keyDown
Definition bgi_types.h:616
int selectionPickRadiusPx
Screen-pixel pick threshold for object selection.
Definition bgi_types.h:662
int width
Definition bgi_types.h:579
double scrollDeltaX
Accumulated horizontal scroll delta.
Definition bgi_types.h:670
std::vector< std::string > selectedObjectIds
IDs of currently selected DDS drawing objects.
Definition bgi_types.h:660
int graphDriver
Definition bgi_types.h:581
PendingGlRender pendingGl
Geometry collected by wxbgi_render_dds() for the GL solid/line passes. Per-camera GL frames queued in...
Definition bgi_types.h:688
WxbgiCharHook userCharHook
Definition bgi_types.h:666
int solidEdgeColor
Default edge colour (WHITE).
Definition bgi_types.h:651
int fillPattern
Definition bgi_types.h:585
int inputDefaultFlags
Bitmask controlling built-in callback behaviors.
Definition bgi_types.h:674
DdsScene * dds
Non-owning shortcut → ddsRegistry[activeDdsName].
Definition bgi_types.h:647
viewporttype viewport
Definition bgi_types.h:591
int fillColor
Definition bgi_types.h:586
unsigned graphBufSize
Definition bgi_types.h:609
std::array< ColorRGB, kExtPaletteSize > extPalette
user-assigned RGB slots 16-255
Definition bgi_types.h:607
WxbgiKeyHook userKeyHook
Definition bgi_types.h:665
WxbgiCursorPosHook userCursorPosHook
Called after cursorPosCallback logic; may be NULL.
Definition bgi_types.h:667
textsettingstype textSettings
Definition bgi_types.h:595
bool inCrtMode
Set by restorecrtmode(); cleared by setgraphmode(). Window stays open. Optional callback set by the s...
Definition bgi_types.h:679
std::vector< PendingGlFrame > pendingGlQueue
Definition bgi_types.h:691
int visualPage
Definition bgi_types.h:611
int lastResult
Definition bgi_types.h:589
std::unordered_map< std::string, std::shared_ptr< DdsCamera > > cameras
Definition bgi_types.h:625
int height
Definition bgi_types.h:580
std::string activeUcs
Definition bgi_types.h:630
GLFWwindow * window
Definition bgi_types.h:578
OverlayUcsAxesState overlayUcsAxes
Definition bgi_types.h:657
linesettingstype lineSettings
Definition bgi_types.h:594
int userCharSizeXDen
Definition bgi_types.h:597
void(* wxPollCallback)()
Definition bgi_types.h:683
bool doubleBuffered
Definition bgi_types.h:614
std::unordered_map< std::string, std::unique_ptr< DdsScene > > ddsRegistry
Definition bgi_types.h:645
bool glfwInitialized
Definition bgi_types.h:590
BgiState(const BgiState &)=delete
std::string activeCamera
Definition bgi_types.h:626
int aspectY
Definition bgi_types.h:601
std::array< std::uint8_t, kPatternRows > fillMask
Definition bgi_types.h:587
std::string windowTitle
Definition bgi_types.h:613
std::unordered_map< std::string, std::shared_ptr< DdsUcs > > ucsSystems
Definition bgi_types.h:629
WorldExtents worldExtents
Definition bgi_types.h:633
LightState lightState
Lighting parameters for GL Phong shading passes.
Definition bgi_types.h:687
int mouseX
Definition bgi_types.h:617
std::queue< int > keyQueue
Definition bgi_types.h:615
int selectionFlashScheme
Flash colour: 0 = orange (252), 1 = purple (253).
Definition bgi_types.h:661
bool shouldClose
In wx mode: set by wxbgi_request_close / frame close event.
Definition bgi_types.h:678
int aspectX
Definition bgi_types.h:600
bool wxEmbedded
True when the BGI surface is hosted inside a WxBgiCanvas.
Definition bgi_types.h:677
int solidColorOverride
When >= 0, replaces faceColor and edgeColor in renderTriangleBatch (used by selection flash).
Definition bgi_types.h:653
int userCharSizeYDen
Definition bgi_types.h:599
int mouseY
Definition bgi_types.h:618
std::array< ColorRGB, kPaletteSize > palette
Definition bgi_types.h:606
bool userFillPatternEnabled
Definition bgi_types.h:588
std::vector< std::vector< std::uint8_t > > pageBuffers
Definition bgi_types.h:612
OverlayGridState overlayGrid
Definition bgi_types.h:656
int userCharSizeYNum
Definition bgi_types.h:598
int currentX
Definition bgi_types.h:592
double scrollDeltaY
Accumulated vertical scroll delta.
Definition bgi_types.h:671
int bkColor
Definition bgi_types.h:584
int userCharSizeXNum
Definition bgi_types.h:596
int extColorNext
next auto-alloc slot
Definition bgi_types.h:608
int currentColor
Definition bgi_types.h:583
palettetype defaultPalette
Definition bgi_types.h:604
int writeMode
Definition bgi_types.h:602
std::string pendingOverlayCam
Camera name for the post-solid overlay alpha-blit in GLFW mode. Set by wxbgi_render_dds() and consume...
Definition bgi_types.h:694
WxbgiScrollHook userScrollHook
Definition bgi_types.h:669
int currentY
Definition bgi_types.h:593
int graphMode
Definition bgi_types.h:582
palettetype activePalette
Definition bgi_types.h:605
int solidFaceColor
Default face colour (LIGHTGRAY).
Definition bgi_types.h:652
int solidDrawMode
0 = Wireframe, 1 = Solid (painter's algorithm).
Definition bgi_types.h:650
WxbgiMouseButtonHook userMouseButtonHook
Definition bgi_types.h:668
arccoordstype lastArc
Definition bgi_types.h:603
bool legacyGlRender
When true, uses the old GL_POINTS per-pixel path.
Definition bgi_types.h:686
3-D camera definition (Z-up, right-handed world coordinate system).
Definition bgi_types.h:354
struct bgi::Camera3D::@024327144351373236147031117174216201073144346311 concentricOverlay
Concentric circles + crosshair overlay.
float upX
Definition bgi_types.h:358
float eyeY
Definition bgi_types.h:356
float rot2dDeg
Definition bgi_types.h:379
CameraProjection projection
Definition bgi_types.h:361
struct bgi::Camera3D::@027022166162365350056201127133125035201361044104 selCursorOverlay
Selection cursor square overlay (moves with the mouse in this viewport).
float farPlane
Definition bgi_types.h:365
float nearPlane
Definition bgi_types.h:364
float worldHeight2d
Visible world-units height used by 2-D cameras and auto-ortho.
Definition bgi_types.h:381
int count
number of circles (1..8)
Definition bgi_types.h:388
float eyeX
Definition bgi_types.h:356
int vpX
Definition bgi_types.h:373
float upY
Definition bgi_types.h:358
float pan2dY
Definition bgi_types.h:377
float orthoRight
Definition bgi_types.h:368
int vpH
Definition bgi_types.h:373
float eyeZ
Definition bgi_types.h:356
int colorScheme
0 = blue, 1 = green, 2 = red
Definition bgi_types.h:397
float outerRadius
world-unit radius of outermost circle
Definition bgi_types.h:390
std::string assignedSceneName
Name of the DDS scene graph this camera renders. Defaults to "default". Set with wxbgi_cam_set_scene(...
Definition bgi_types.h:403
float upZ
Definition bgi_types.h:358
float orthoLeft
Definition bgi_types.h:368
float zoom2d
Definition bgi_types.h:378
float pan2dX
Definition bgi_types.h:377
int sizePx
square side length, pixels (2..16)
Definition bgi_types.h:396
bool is2D
Definition bgi_types.h:376
int vpY
Definition bgi_types.h:373
bool enabled
Definition bgi_types.h:387
float targetX
Definition bgi_types.h:357
float targetZ
Definition bgi_types.h:357
int vpW
Definition bgi_types.h:373
float fovYDeg
Definition bgi_types.h:363
float orthoBottom
Definition bgi_types.h:369
float targetY
Definition bgi_types.h:357
float innerRadius
world-unit radius of innermost circle
Definition bgi_types.h:389
float orthoTop
Definition bgi_types.h:369
Definition bgi_types.h:307
std::uint8_t g
Definition bgi_types.h:309
std::uint8_t r
Definition bgi_types.h:308
std::uint8_t b
Definition bgi_types.h:310
A named user coordinate system (UCS).
Definition bgi_types.h:421
float xAxisY
Definition bgi_types.h:427
float yAxisZ
Definition bgi_types.h:428
float xAxisX
Definition bgi_types.h:427
float originY
Definition bgi_types.h:423
float yAxisX
Definition bgi_types.h:428
float zAxisZ
Definition bgi_types.h:429
float yAxisY
Definition bgi_types.h:428
float zAxisY
Definition bgi_types.h:429
float xAxisZ
Definition bgi_types.h:427
float zAxisX
Definition bgi_types.h:429
float originX
Definition bgi_types.h:423
float originZ
Definition bgi_types.h:423
One vertex in a GL depth-tested line batch (world-space, 6 floats).
Definition bgi_types.h:525
float g
Definition bgi_types.h:527
float py
Definition bgi_types.h:526
float px
Definition bgi_types.h:526
float r
Definition bgi_types.h:527
float pz
world-space position
Definition bgi_types.h:526
float b
linear RGB colour (0–1)
Definition bgi_types.h:527
One vertex in a GL solid triangle batch (world-space, 9 floats).
Definition bgi_types.h:517
float r
Definition bgi_types.h:520
float pz
world-space position
Definition bgi_types.h:518
float ny
Definition bgi_types.h:519
float nx
Definition bgi_types.h:519
float py
Definition bgi_types.h:518
float nz
world-space normal (face or smooth)
Definition bgi_types.h:519
float b
linear RGB colour (0–1)
Definition bgi_types.h:520
float g
Definition bgi_types.h:520
float px
Definition bgi_types.h:518
Definition bgi_types.h:323
std::uint32_t width
Definition bgi_types.h:324
std::uint32_t height
Definition bgi_types.h:325
Lighting parameters used by the GL Phong shading passes.
Definition bgi_types.h:494
float dirY
Definition bgi_types.h:496
float diffuse
Definition bgi_types.h:505
float fillY
Definition bgi_types.h:500
float dirX
Definition bgi_types.h:496
float ambient
Definition bgi_types.h:504
float fillX
Definition bgi_types.h:500
bool worldSpace
true = world-space, false = view-space
Definition bgi_types.h:497
float specular
Definition bgi_types.h:506
float dirZ
Definition bgi_types.h:496
float fillStrength
Definition bgi_types.h:501
float shininess
Definition bgi_types.h:507
float fillZ
Definition bgi_types.h:500
Definition bgi_types.h:316
int y
Definition bgi_types.h:319
int kind
Definition bgi_types.h:317
int x
Definition bgi_types.h:318
State for the reference grid overlay.
Definition bgi_types.h:444
int yAxisColor
colour for the line coincident with UCS local Y axis
Definition bgi_types.h:449
int xAxisColor
colour for the line coincident with UCS local X axis
Definition bgi_types.h:448
bool enabled
Definition bgi_types.h:445
float spacing
world units between adjacent grid lines
Definition bgi_types.h:446
int halfExtent
grid spans ±(halfExtent×spacing) from UCS origin
Definition bgi_types.h:447
std::string ucsName
which UCS to use; empty = BgiState::activeUcs
Definition bgi_types.h:451
int gridColor
colour for all non-axis grid lines
Definition bgi_types.h:450
State for the UCS axes overlay.
Definition bgi_types.h:461
bool enabled
Definition bgi_types.h:462
bool showActive
draw active UCS axes at its own origin
Definition bgi_types.h:464
float axisLength
world-unit length from origin to axis tip
Definition bgi_types.h:465
bool showWorld
draw world UCS axes at (0,0,0)
Definition bgi_types.h:463
Per-camera GL frame queued by wxbgi_render_dds() in wxEmbedded mode.
Definition bgi_types.h:557
LightState light
Definition bgi_types.h:561
int camVpW
Definition bgi_types.h:563
float eyeZ
Definition bgi_types.h:560
float eyeY
Definition bgi_types.h:560
int camVpY
Definition bgi_types.h:563
int camVpH
Definition bgi_types.h:563
float viewProj[16]
column-major 4×4 view-projection matrix
Definition bgi_types.h:559
float eyeX
Definition bgi_types.h:560
PendingGlRender geometry
Definition bgi_types.h:558
int camVpX
Camera screen viewport in BGI pixel coords (Y=0 at top). All-zero = full window.
Definition bgi_types.h:563
Geometry accumulated for a single wxbgi_render_dds() call.
Definition bgi_types.h:532
std::vector< GlVertex > solidVerts
flat-mode triangles (face normals)
Definition bgi_types.h:533
std::vector< GlLineVertex > wireLineVerts
wireframe visible edges (per-edge colour)
Definition bgi_types.h:536
bool hasLines() const
Definition bgi_types.h:541
bool hasSolids() const
Definition bgi_types.h:539
std::vector< GlVertex > smoothVerts
smooth-mode triangles (vertex normals)
Definition bgi_types.h:534
void clear()
Definition bgi_types.h:543
bool hasPending() const
Definition bgi_types.h:542
std::vector< GlLineVertex > lineVerts
depth-tested world lines
Definition bgi_types.h:537
bool hasWireframe() const
Definition bgi_types.h:540
std::vector< GlVertex > wireTriVerts
wireframe depth-pass triangles (positions only used)
Definition bgi_types.h:535
Axis-aligned bounding box (AABB) representing the programmer's declared drawing extents in world spac...
Definition bgi_types.h:481
float maxZ
Definition bgi_types.h:483
float maxX
Definition bgi_types.h:483
float minX
Definition bgi_types.h:482
float minZ
Definition bgi_types.h:482
float minY
Definition bgi_types.h:482
bool hasData
Definition bgi_types.h:484
float maxY
Definition bgi_types.h:483
Definition bgi_types.h:260
int ystart
Definition bgi_types.h:264
int xstart
Definition bgi_types.h:263
int y
Definition bgi_types.h:262
int x
Definition bgi_types.h:261
int xend
Definition bgi_types.h:265
int yend
Definition bgi_types.h:266
Definition bgi_types.h:270
int pattern
Definition bgi_types.h:271
int color
Definition bgi_types.h:272
Definition bgi_types.h:276
int linestyle
Definition bgi_types.h:277
unsigned upattern
Definition bgi_types.h:278
int thickness
Definition bgi_types.h:279
Definition bgi_types.h:283
std::uint8_t size
Definition bgi_types.h:284
std::array< int, kPaletteSize > colors
Definition bgi_types.h:285
Definition bgi_types.h:289
int font
Definition bgi_types.h:290
int direction
Definition bgi_types.h:291
int horiz
Definition bgi_types.h:293
int vert
Definition bgi_types.h:294
int charsize
Definition bgi_types.h:292
Definition bgi_types.h:298
int left
Definition bgi_types.h:299
int right
Definition bgi_types.h:301
int bottom
Definition bgi_types.h:302
int clip
Definition bgi_types.h:303
int top
Definition bgi_types.h:300