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