|
wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
|
Namespaces | |
| namespace | embedded |
Data Structures | |
| struct | arccoordstype |
| struct | BgiState |
| struct | Camera3D |
| 3-D camera definition (Z-up, right-handed world coordinate system). More... | |
| struct | ColorRGB |
| struct | CoordSystem |
| A named user coordinate system (UCS). More... | |
| struct | DdsArc |
| struct | DdsBar |
| struct | DdsBar3D |
| struct | DdsBox |
| class | DdsCamera |
| Camera stored in the DDS. More... | |
| struct | DdsCircle |
| struct | DdsCone |
| struct | DdsCylinder |
| struct | DdsEllipse |
| struct | DdsExternalAttributes |
| struct | DdsExtrusion |
| struct | DdsFillEllipse |
| struct | DdsFillPoly |
| struct | DdsHeightMap |
| struct | DdsImage |
| struct | DdsLine |
| class | DdsObject |
| struct | DdsParamSurface |
| struct | DdsPieSlice |
| struct | DdsPoint |
| struct | DdsPolygon |
| struct | DdsRectangle |
| class | DdsScene |
| In-memory DDS scene graph. More... | |
| struct | DdsSector |
| class | DdsSetDifference |
| class | DdsSetIntersection |
| class | DdsSetUnion |
| struct | DdsSolid3D |
| Base for all Phase 4/5/6 solid/surface/extrusion objects. More... | |
| struct | DdsSphere |
| struct | DdsStyle |
| Baked rendering state captured at draw-call time. More... | |
| struct | DdsText |
| struct | DdsTorus |
| class | DdsTransform |
| class | DdsUcs |
| UCS stored in the DDS. More... | |
| class | DdsWorldExtentsObj |
| World-extents AABB stored in the DDS. More... | |
| struct | fillsettingstype |
| struct | GlLineVertex |
| One vertex in a GL depth-tested line batch (world-space, 6 floats). More... | |
| struct | GlVertex |
| One vertex in a GL solid triangle batch (world-space, 9 floats). More... | |
| struct | ImageHeader |
| struct | LightState |
| Lighting parameters used by the GL Phong shading passes. More... | |
| struct | linesettingstype |
| struct | MouseClickEvent |
| struct | OpenLbMaterialHit |
| Result of classifying a single world-space point against an OpenLB-tagged DDS scene. More... | |
| struct | OverlayGridState |
| State for the reference grid overlay. More... | |
| struct | OverlayUcsAxesState |
| State for the UCS axes overlay. More... | |
| struct | palettetype |
| struct | PendingGlFrame |
| Per-camera GL frame queued by wxbgi_render_dds() in wxEmbedded mode. More... | |
| struct | PendingGlRender |
| Geometry accumulated for a single wxbgi_render_dds() call. More... | |
| struct | SolidTriangle |
| struct | textsettingstype |
| struct | viewporttype |
| struct | WorldExtents |
| Axis-aligned bounding box (AABB) representing the programmer's declared drawing extents in world space. More... | |
Typedefs | |
| using | MouseHandler = void(BGI_CALL *)(int, int) |
Functions | |
| std::vector< std::uint8_t > & | activePageBuffer () |
| std::vector< std::pair< int, int > > | buildArcPoints (int cx, int cy, int startAngle, int endAngle, int xradius, int yradius) |
| float | cameraAspectRatio (const Camera3D &cam, int winW, int winH) |
| Returns the aspect ratio (width / height) of the camera's effective viewport. | |
| bool | cameraClipToScreen (const Camera3D &cam, int winW, int winH, const glm::vec4 &clip, float &screenX, float &screenY) |
| Project a 4-D clip-space point (after SH clipping) to a screen pixel. | |
| void | cameraEffectiveViewport (const Camera3D &cam, int winW, int winH, int &x, int &y, int &w, int &h) |
| Returns the effective screen-space viewport rectangle (pixels) for a camera. | |
| glm::mat4 | cameraProjMatrix (const Camera3D &cam, float aspectRatio) |
| Builds the projection matrix. | |
| void | cameraScreenToRay (const Camera3D &cam, int winW, int winH, float screenX, float screenY, float &rayOx, float &rayOy, float &rayOz, float &rayDx, float &rayDy, float &rayDz) |
| Unprojects a screen pixel to a world-space ray. | |
| glm::mat4 | cameraViewMatrix (const Camera3D &cam) |
Builds the view matrix from eye / target / up, or from the 2-D pan / zoom / rotation fields when cam.is2D is true. | |
| glm::mat4 | cameraVPMatrix (const Camera3D &cam, float aspectRatio) |
| Returns the combined view-projection matrix (proj × view). | |
| glm::vec4 | cameraWorldToClip (const Camera3D &cam, int winW, int winH, float wx, float wy, float wz) |
| Transform a world-space point to 4-D clip space via the camera's VP matrix. | |
| bool | cameraWorldToScreen (const Camera3D &cam, int winW, int winH, float wx, float wy, float wz, float &screenX, float &screenY) |
| Projects a world-space point to a screen pixel. | |
| bool | cameraWorldToScreenForced (const Camera3D &cam, int winW, int winH, float wx, float wy, float wz, float &screenX, float &screenY) |
| Like cameraWorldToScreen but skips the NDC frustum boundary test. | |
| bool | captureImage (int left, int top, int right, int bottom, void *bitmap) |
| void | clearActivePage (int color) |
| void | clearViewportRegion (int color) |
| bool | clipLineByPlane (glm::vec4 &A, glm::vec4 &B, const glm::vec4 &plane) |
| Clip a LINE SEGMENT in clip space against one half-space in place. | |
| bool | clipLineZPlanes (glm::vec4 &A, glm::vec4 &B) |
| Clip a line segment against near and far Z planes. | |
| void | clipPolyByPlane (std::vector< glm::vec4 > &poly, const glm::vec4 &plane) |
| Sutherland-Hodgman clip step: clip a convex polygon (in 4-D clip space) against one half-space. | |
| void | clipPolyZPlanes (std::vector< glm::vec4 > &poly) |
| Clip a convex polygon in clip space against the near plane (Z+W>0) and far plane (-Z+W>0). | |
| ColorRGB | colorToRGB (int c) |
| resolves any colour index (0-255) to an RGB triple | |
| int | currentTextScaleX () |
| int | currentTextScaleY () |
| void | destroyWindowIfNeeded (bool resetGlState=false) |
| void | drawCircleInternal (int cx, int cy, int radius, int color) |
| void | drawEllipseInternal (int cx, int cy, int startAngle, int endAngle, int xradius, int yradius, int color) |
| void | drawGlyph (int x, int y, std::uint32_t codepoint, int color) |
| bool | drawImage (int left, int top, const void *bitmap, int op) |
| void | drawLineInternal (int x1, int y1, int x2, int y2, int color) |
| void | drawOutlineText (int x, int y, int fontId, const std::vector< std::uint32_t > &codepoints, int color, int scaleX, int scaleY, bool vertical) |
| void | drawOverlaysForCamera (const std::string &camName, const Camera3D &cam) |
| Draw all active overlays for one camera viewport. | |
| void | drawPolygonInternal (const std::vector< std::pair< int, int > > &points, int color) |
| void | drawSelectionCursorsGL () |
| Draw selection cursor squares for all cameras that have the cursor enabled. | |
| void | drawText (int x, int y, const std::string &text, int color) |
| void | fillEllipseInternal (int cx, int cy, int xradius, int yradius, int color) |
| void | fillPolygonInternal (const std::vector< std::pair< int, int > > &points, int color) |
| void | fillRectInternal (int left, int top, int right, int bottom, int color) |
| void | flushToScreen () |
| int | fontCount () |
| int | fontIdFromName (const std::string &name) |
| const char * | fontName (int fontId) |
| int | getPixel (int x, int y) |
| void | glPassDestroy () |
| Release all GL objects (call before context is destroyed). | |
| void | glPassInit (int w, int h) |
| Initialise GL objects (shaders, VAO/VBO, page texture). | |
| void | glPassResetState () |
| Reset GL object handles to zero WITHOUT calling GL delete functions. | |
| void | glPassResize (int w, int h) |
| Resize the page texture to match a new canvas size. | |
| unsigned | imageSizeForRect (int left, int top, int right, int bottom) |
| void | initForWxCanvas (int width, int height) |
| bool | isKnownFont (int fontId) |
| bool | isOutlineFont (int fontId) |
| bool | isReady () |
| std::array< std::uint8_t, kPatternRows > | makeFillPatternMask (int pattern) |
| void | matToFloatArray (const glm::mat4 &m, float *out16) |
| Writes a GLM mat4 into a caller-supplied column-major float[16] array. | |
| std::pair< int, int > | measureOutlineText (int fontId, const std::vector< std::uint32_t > &codepoints, int scaleX, int scaleY, bool vertical) |
| std::pair< int, int > | measureText (const std::string &text) |
| int | normalizeColor (int color) |
| std::uint8_t | normalizeColorByte (int value) |
| bool | openlbClassifyPoint (const DdsScene &scene, const glm::vec3 &worldPoint, OpenLbMaterialHit &hit, int defaultFluidMaterial=1, int defaultSolidMaterial=2) |
| Classify a single world-space point against all OpenLB-tagged render roots in a DDS scene and populate a hit record. | |
| void | openlbSampleMaterials2D (const DdsScene &scene, float minX, float minY, float z, int cols, int rows, float stepX, float stepY, std::vector< int > &materials, int defaultFluidMaterial=1, int defaultSolidMaterial=2) |
Sample a 2-D axis-aligned grid of world-space points and write per-cell material IDs into a std::vector<int>. | |
| int | outlineFontIdFromName (const std::string &name) |
| const char * | outlineFontName (int fontId) |
| void | overlayPerformPick (int screenX, int screenY, bool multiSelect) |
| Handle a left-click pick event. | |
| void | renderPageAsTexture (int w, int h, int vpW=-1, int vpH=-1) |
| Pass 1 — Upload the visual page buffer as an RGBA texture and draw a fullscreen quad. | |
| void | renderPageAsTextureAlpha (int w, int h, int vpW=-1, int vpH=-1) |
| Overlay pass — Upload the visual page buffer as an RGBA texture and composite it ON TOP of the current framebuffer contents using alpha blending. | |
| void | renderPageLegacyPoints (int w, int h, int vpW=-1, int vpH=-1) |
| Legacy per-pixel GL_POINTS path (kept for backward compat / diagnostics). | |
| void | renderPageToCurrentGLContext (int w, int h) |
| void | renderSolid3D (const Camera3D &cam, const DdsObject &obj) |
| Render a single Phase 4/5/6 solid/surface/extrusion DDS object through the given camera into the active BGI pixel buffer. | |
| void | renderSolidsGLPass (const PendingGlRender &pending, int w, int h, const LightState &light, const glm::mat4 &vp, const glm::vec3 &camPos, int vpX=0, int vpY=0) |
| Pass 2a — Draw Phong-lit solid triangles (flat and/or smooth shading) with depth test. | |
| void | renderSolidTriangles (const Camera3D &cam, std::vector< SolidTriangle > &tris, SolidDrawMode mode) |
| Render a pre-tessellated triangle list using the current GL/software path. | |
| void | renderWireframeGLPass (const PendingGlRender &pending, int w, int h, const glm::mat4 &vp, const glm::vec3 &camPos, int vpX=0, int vpY=0) |
| Pass 2b — Two-pass hidden-line wireframe with proper depth-buffer HSR. | |
| void | renderWorldLinesGLPass (const PendingGlRender &pending, int w, int h, const glm::mat4 &vp, int vpX=0, int vpY=0) |
| Pass 3 — Draw world-space line segments with depth test (hidden behind solids). | |
| void | resetDrawingState () |
| void | resetPaletteState () |
| void | resetStateForWindow (int width, int height, bool doubleBuffered) |
| void | resizePixelBuffer (int width, int height) |
| Resize only — preserves DDS scenes, cameras, UCS. | |
| void | setPixel (int x, int y, int color) |
| void | setPixelWithMode (int x, int y, int color, int mode) |
| bool | syncGlfwWindowSize () |
| void | syncPagesIfNeeded () |
| bool | tessellateSolid3D (const DdsObject &obj, std::vector< SolidTriangle > &tris) |
| Tessellate a solid/surface/extrusion DDS object into world-space triangles. | |
| bool | toDeviceCoordinates (int x, int y, int &screenX, int &screenY) |
| CoordSystem | ucsFromNormal (float nx, float ny, float nz, float ox, float oy, float oz) |
| Constructs a right-handed orthonormal frame from a surface normal. | |
| void | ucsLocalToWorld (const CoordSystem &cs, float lx, float ly, float lz, float &wx, float &wy, float &wz) |
| Transforms a UCS local point into world-space coordinates. | |
| glm::mat4 | ucsLocalToWorldMatrix (const CoordSystem &cs) |
| Returns the 4×4 matrix that transforms a point from UCS local space to world space. | |
| void | ucsOrthonormalise (CoordSystem &cs) |
| Orthonormalises the three axis vectors of a CoordSystem in-place using the Gram-Schmidt process. | |
| void | ucsWorldToLocal (const CoordSystem &cs, float wx, float wy, float wz, float &lx, float &ly, float &lz) |
| Transforms a world-space point into UCS local coordinates. | |
| glm::mat4 | ucsWorldToLocalMatrix (const CoordSystem &cs) |
| Returns the 4×4 matrix that transforms a point from world space to UCS local space. | |
| bool | useFillAt (int x, int y) |
| const std::vector< std::uint8_t > & | visualPageBuffer () |
| glm::vec3 | worldExtentsCentre (const WorldExtents &extents) |
| Returns the centre of the AABB as a vec3. | |
| void | worldExtentsExpand (WorldExtents &extents, float x, float y, float z) |
Expands extents to include the point (x, y, z). | |
| glm::vec3 | worldExtentsHalfSize (const WorldExtents &extents) |
| Returns the half-extents (half-size of each axis) as a vec3. | |
Variables | |
| constexpr int | AND_PUT = 3 |
| constexpr int | BKSLASH_FILL = 5 |
| constexpr int | BLACK = 0 |
| constexpr int | BLUE = 1 |
| constexpr int | BOTTOM_TEXT = 0 |
| constexpr int | BROWN = 6 |
| constexpr int | CENTER_LINE = 2 |
| constexpr int | CENTER_TEXT = 1 |
| constexpr int | CLOSE_DOT_FILL = 11 |
| constexpr int | COPY_PUT = 0 |
| constexpr int | CYAN = 3 |
| constexpr int | DARKGRAY = 8 |
| constexpr int | DASHED_LINE = 3 |
| constexpr int | DEFAULT_FONT = 0 |
| constexpr int | DETECT = 0 |
| constexpr int | DOTTED_LINE = 1 |
| constexpr int | EMPTY_FILL = 0 |
| std::mutex | gMutex |
| constexpr int | GOTHIC_FONT = 8 |
| constexpr int | GREEN = 2 |
| BgiState | gState |
| constexpr int | HATCH_FILL = 7 |
| constexpr int | HORIZ_DIR = 0 |
| constexpr int | INTERLEAVE_FILL = 9 |
| const ColorRGB | kBgiPalette [kPaletteSize] |
| constexpr int | kDefaultHeight = 720 |
| constexpr int | kDefaultWidth = 960 |
| constexpr int | kExtColorBase = 16 |
| first user-assignable extended colour index | |
| constexpr int | kExtPaletteSize = 240 |
| extended slots 16-255 (fits uint8_t pixel buffer) | |
| constexpr int | kPageCount = 2 |
| constexpr int | kPaletteSize = 16 |
| classic BGI palette slots (0-15) | |
| constexpr int | kPatternCols = 8 |
| constexpr int | kPatternRows = 8 |
| constexpr int | kSelectionOrangeColor = 252 |
| Reserved extended-palette slot — selection flash orange. | |
| constexpr int | kSelectionPurpleColor = 253 |
| Reserved extended-palette slot — selection flash purple. | |
| constexpr int | LEFT_TEXT = 0 |
| constexpr int | LIGHTBLUE = 9 |
| constexpr int | LIGHTCYAN = 11 |
| constexpr int | LIGHTGRAY = 7 |
| constexpr int | LIGHTGREEN = 10 |
| constexpr int | LIGHTMAGENTA = 13 |
| constexpr int | LIGHTRED = 12 |
| constexpr int | LINE_FILL = 2 |
| constexpr int | LTBKSLASH_FILL = 6 |
| constexpr int | LTSLASH_FILL = 3 |
| constexpr int | MAGENTA = 5 |
| constexpr int | MODERN_HANDJET_FONT = 18 |
| constexpr int | MODERN_PLAYFAIR_DISPLAY_FONT = 17 |
| constexpr int | MODERN_ROBOTO_FONT = 16 |
| constexpr int | NORM_WIDTH = 1 |
| constexpr int | NOT_PUT = 4 |
| constexpr int | OR_PUT = 2 |
| constexpr int | RED = 4 |
| constexpr int | RIGHT_TEXT = 2 |
| constexpr int | SANS_SERIF_FONT = 4 |
| constexpr int | SLASH_FILL = 4 |
| constexpr int | SMALL_FONT = 2 |
| constexpr int | SOLID_FILL = 1 |
| constexpr int | SOLID_LINE = 0 |
| constexpr int | THICK_WIDTH = 3 |
| constexpr int | TOP_TEXT = 2 |
| constexpr int | TRIPLEX_FONT = 1 |
| constexpr int | USER_FILL = 12 |
| constexpr int | USERBIT_LINE = 4 |
| constexpr int | VERT_DIR = 1 |
| constexpr int | WHITE = 15 |
| constexpr int | WIDE_DOT_FILL = 10 |
| constexpr int | XHATCH_FILL = 8 |
| constexpr int | XOR_PUT = 1 |
| constexpr int | YELLOW = 14 |
| using bgi::MouseHandler = typedef void(BGI_CALL *)(int, int) |
|
strong |
Projection mode for a Camera3D.
| Enumerator | |
|---|---|
| Orthographic | |
| Perspective | |
|
strong |
Indicates the coordinate space in which a drawing object's coordinates are expressed when it was recorded.
The DDS-based renderer uses this to choose the correct projection pipeline.
|
strong |
| enum bgi::GraphStatus |
|
strong |
|
strong |
| std::vector< std::uint8_t > & bgi::activePageBuffer | ( | ) |
| std::vector< std::pair< int, int > > bgi::buildArcPoints | ( | int | cx, |
| int | cy, | ||
| int | startAngle, | ||
| int | endAngle, | ||
| int | xradius, | ||
| int | yradius | ||
| ) |
| float bgi::cameraAspectRatio | ( | const Camera3D & | cam, |
| int | winW, | ||
| int | winH | ||
| ) |
Returns the aspect ratio (width / height) of the camera's effective viewport.
| bool bgi::cameraClipToScreen | ( | const Camera3D & | cam, |
| int | winW, | ||
| int | winH, | ||
| const glm::vec4 & | clip, | ||
| float & | screenX, | ||
| float & | screenY | ||
| ) |
Project a 4-D clip-space point (after SH clipping) to a screen pixel.
No NDC X/Y boundary test — the caller relies on per-pixel viewport clipping inside drawLineInternal / fillPolygonInternal. Returns false only when clip.w <= 0 (should not occur after near clipping).
| void bgi::cameraEffectiveViewport | ( | const Camera3D & | cam, |
| int | winW, | ||
| int | winH, | ||
| int & | x, | ||
| int & | y, | ||
| int & | w, | ||
| int & | h | ||
| ) |
Returns the effective screen-space viewport rectangle (pixels) for a camera.
When cam.vpW == 0 the entire window (winW × winH) is used.
| glm::mat4 bgi::cameraProjMatrix | ( | const Camera3D & | cam, |
| float | aspectRatio | ||
| ) |
Builds the projection matrix.
For orthographic cameras the extents are taken from orthoLeft … orthoTop. When all four are zero the extents are auto-computed from worldHeight2d (and aspectRatio for the width). For 2-D cameras (is2D == true) the ortho extents are derived from pan2dX/Y, zoom2d, and worldHeight2d so that the view is always aspect-correct.
| void bgi::cameraScreenToRay | ( | const Camera3D & | cam, |
| int | winW, | ||
| int | winH, | ||
| float | screenX, | ||
| float | screenY, | ||
| float & | rayOx, | ||
| float & | rayOy, | ||
| float & | rayOz, | ||
| float & | rayDx, | ||
| float & | rayDy, | ||
| float & | rayDz | ||
| ) |
Unprojects a screen pixel to a world-space ray.
The ray origin is on the near plane; the direction is normalised. Screen coordinates follow the same top-left / Y-down convention as cameraWorldToScreen.
| cam | Camera to use for unprojection. |
| winW,winH | Full GLFW window dimensions. |
| screenX,screenY | Input screen pixel. |
| rayOx,rayOy,rayOz | Output ray origin (world space). |
| rayDx,rayDy,rayDz | Output normalised ray direction (world space). |
| glm::mat4 bgi::cameraViewMatrix | ( | const Camera3D & | cam | ) |
Builds the view matrix from eye / target / up, or from the 2-D pan / zoom / rotation fields when cam.is2D is true.
| glm::mat4 bgi::cameraVPMatrix | ( | const Camera3D & | cam, |
| float | aspectRatio | ||
| ) |
Returns the combined view-projection matrix (proj × view).
| glm::vec4 bgi::cameraWorldToClip | ( | const Camera3D & | cam, |
| int | winW, | ||
| int | winH, | ||
| float | wx, | ||
| float | wy, | ||
| float | wz | ||
| ) |
Transform a world-space point to 4-D clip space via the camera's VP matrix.
Use this to prepare vertices for Sutherland-Hodgman clipping.
| bool bgi::cameraWorldToScreen | ( | const Camera3D & | cam, |
| int | winW, | ||
| int | winH, | ||
| float | wx, | ||
| float | wy, | ||
| float | wz, | ||
| float & | screenX, | ||
| float & | screenY | ||
| ) |
Projects a world-space point to a screen pixel.
Screen coordinates are returned with (0,0) at the top-left corner and Y increasing downward, matching classic BGI and most windowing conventions.
| cam | Camera to use for projection. |
| winW | Full GLFW window width in pixels. |
| winH | Full GLFW window height in pixels. |
| wx,wy,wz | World-space input point. |
| screenX | Output screen X pixel coordinate. |
| screenY | Output screen Y pixel coordinate. |
true if the point is within the view frustum (visible), false if it is behind the camera or outside clip depth. | bool bgi::cameraWorldToScreenForced | ( | const Camera3D & | cam, |
| int | winW, | ||
| int | winH, | ||
| float | wx, | ||
| float | wy, | ||
| float | wz, | ||
| float & | screenX, | ||
| float & | screenY | ||
| ) |
Like cameraWorldToScreen but skips the NDC frustum boundary test.
The returned screen coordinates may be outside the viewport rectangle (negative or beyond winW/winH). The only hard rejection is a point that is truly behind the camera (clip.w ≤ 0 for perspective cameras). This variant is used by polygon and line renderers that rely on per-pixel viewport clipping inside drawLineInternal / fillPolygonInternal, enabling correct partial clipping when primitives straddle viewport edges.
| bool bgi::captureImage | ( | int | left, |
| int | top, | ||
| int | right, | ||
| int | bottom, | ||
| void * | bitmap | ||
| ) |
| void bgi::clearActivePage | ( | int | color | ) |
| void bgi::clearViewportRegion | ( | int | color | ) |
| bool bgi::clipLineByPlane | ( | glm::vec4 & | A, |
| glm::vec4 & | B, | ||
| const glm::vec4 & | plane | ||
| ) |
Clip a LINE SEGMENT in clip space against one half-space in place.
Returns false (and leaves A/B undefined) when both endpoints are outside.
| bool bgi::clipLineZPlanes | ( | glm::vec4 & | A, |
| glm::vec4 & | B | ||
| ) |
Clip a line segment against near and far Z planes.
Returns false when the segment is fully clipped away.
| void bgi::clipPolyByPlane | ( | std::vector< glm::vec4 > & | poly, |
| const glm::vec4 & | plane | ||
| ) |
Sutherland-Hodgman clip step: clip a convex polygon (in 4-D clip space) against one half-space.
"Inside" is dot(plane, P) > 0.
| poly | Polygon vertices (clip-space 4-D homogeneous), modified in place. |
| plane | Clip-plane coefficients (A,B,C,D): A·X+B·Y+C·Z+D·W > 0. |
| void bgi::clipPolyZPlanes | ( | std::vector< glm::vec4 > & | poly | ) |
Clip a convex polygon in clip space against the near plane (Z+W>0) and far plane (-Z+W>0).
Together these ensure W>0 (safe for perspective divide) and Z within the camera depth range.
| ColorRGB bgi::colorToRGB | ( | int | c | ) |
resolves any colour index (0-255) to an RGB triple
| int bgi::currentTextScaleX | ( | ) |
| int bgi::currentTextScaleY | ( | ) |
| void bgi::destroyWindowIfNeeded | ( | bool | resetGlState = false | ) |
| void bgi::drawCircleInternal | ( | int | cx, |
| int | cy, | ||
| int | radius, | ||
| int | color | ||
| ) |
| void bgi::drawEllipseInternal | ( | int | cx, |
| int | cy, | ||
| int | startAngle, | ||
| int | endAngle, | ||
| int | xradius, | ||
| int | yradius, | ||
| int | color | ||
| ) |
| void bgi::drawGlyph | ( | int | x, |
| int | y, | ||
| std::uint32_t | codepoint, | ||
| int | color | ||
| ) |
| bool bgi::drawImage | ( | int | left, |
| int | top, | ||
| const void * | bitmap, | ||
| int | op | ||
| ) |
| void bgi::drawLineInternal | ( | int | x1, |
| int | y1, | ||
| int | x2, | ||
| int | y2, | ||
| int | color | ||
| ) |
| void bgi::drawOutlineText | ( | int | x, |
| int | y, | ||
| int | fontId, | ||
| const std::vector< std::uint32_t > & | codepoints, | ||
| int | color, | ||
| int | scaleX, | ||
| int | scaleY, | ||
| bool | vertical | ||
| ) |
| void bgi::drawOverlaysForCamera | ( | const std::string & | camName, |
| const Camera3D & | cam | ||
| ) |
Draw all active overlays for one camera viewport.
Called from wxbgi_render_dds() while gMutex is held, after the DDS scene traversal and before flushToScreen(). The BGI viewport is already set to the camera panel, so overlay drawing is clipped correctly.
| camName | Name of the camera being rendered. |
| cam | Camera3D data for this camera. |
| void bgi::drawPolygonInternal | ( | const std::vector< std::pair< int, int > > & | points, |
| int | color | ||
| ) |
| void bgi::drawSelectionCursorsGL | ( | ) |
Draw selection cursor squares for all cameras that have the cursor enabled.
Called from flushToScreen() in the OpenGL pass (after the pixel-buffer GL_POINTS loop, before glFlush). Draws using immediate-mode OpenGL in the same pixel-space ortho projection as the page-buffer rendering.
Does NOT acquire gMutex — the caller may already hold it.
| void bgi::drawText | ( | int | x, |
| int | y, | ||
| const std::string & | text, | ||
| int | color | ||
| ) |
| void bgi::fillEllipseInternal | ( | int | cx, |
| int | cy, | ||
| int | xradius, | ||
| int | yradius, | ||
| int | color | ||
| ) |
| void bgi::fillPolygonInternal | ( | const std::vector< std::pair< int, int > > & | points, |
| int | color | ||
| ) |
| void bgi::fillRectInternal | ( | int | left, |
| int | top, | ||
| int | right, | ||
| int | bottom, | ||
| int | color | ||
| ) |
| void bgi::flushToScreen | ( | ) |
| int bgi::fontCount | ( | ) |
| int bgi::fontIdFromName | ( | const std::string & | name | ) |
| const char * bgi::fontName | ( | int | fontId | ) |
| int bgi::getPixel | ( | int | x, |
| int | y | ||
| ) |
| void bgi::glPassDestroy | ( | ) |
Release all GL objects (call before context is destroyed).
| void bgi::glPassInit | ( | int | w, |
| int | h | ||
| ) |
Initialise GL objects (shaders, VAO/VBO, page texture).
Must be called once after a valid GL context is current and GLEW is inited. Safe to call multiple times — reinitialises if already initialised.
| void bgi::glPassResetState | ( | ) |
Reset GL object handles to zero WITHOUT calling GL delete functions.
Call this after the GL context has already been destroyed (e.g., after closegraph() tears down the GLFW window) so that the next context can start fresh. It is NOT safe to call GL functions after context destruction.
| void bgi::glPassResize | ( | int | w, |
| int | h | ||
| ) |
Resize the page texture to match a new canvas size.
| unsigned bgi::imageSizeForRect | ( | int | left, |
| int | top, | ||
| int | right, | ||
| int | bottom | ||
| ) |
| void bgi::initForWxCanvas | ( | int | width, |
| int | height | ||
| ) |
| bool bgi::isKnownFont | ( | int | fontId | ) |
| bool bgi::isOutlineFont | ( | int | fontId | ) |
| bool bgi::isReady | ( | ) |
| std::array< std::uint8_t, kPatternRows > bgi::makeFillPatternMask | ( | int | pattern | ) |
| void bgi::matToFloatArray | ( | const glm::mat4 & | m, |
| float * | out16 | ||
| ) |
Writes a GLM mat4 into a caller-supplied column-major float[16] array.
| std::pair< int, int > bgi::measureOutlineText | ( | int | fontId, |
| const std::vector< std::uint32_t > & | codepoints, | ||
| int | scaleX, | ||
| int | scaleY, | ||
| bool | vertical | ||
| ) |
| std::pair< int, int > bgi::measureText | ( | const std::string & | text | ) |
| int bgi::normalizeColor | ( | int | color | ) |
| std::uint8_t bgi::normalizeColorByte | ( | int | value | ) |
| bool bgi::openlbClassifyPoint | ( | const DdsScene & | scene, |
| const glm::vec3 & | worldPoint, | ||
| OpenLbMaterialHit & | hit, | ||
| int | defaultFluidMaterial = 1, |
||
| int | defaultSolidMaterial = 2 |
||
| ) |
Classify a single world-space point against all OpenLB-tagged render roots in a DDS scene and populate a hit record.
Traverses the scene's render-root list and, for each root, recursively walks the DDS object graph (handling Transforms, set-union, set-intersection, set-difference, and leaf primitives). When multiple objects contain the point, the one with the highest openlb.priority attribute wins; ties are resolved by the last candidate found (last insertion order).
An object participates only if:
openlb.enabled = "0" / "false" / "off"."openlb.".| [in] | scene | The DDS scene to query (read-only). |
| [in] | worldPoint | Query point in world (physical) coordinates. |
| [out] | hit | Hit record populated on return. Always re-initialised to a default OpenLbMaterialHit before traversal starts. |
| [in] | defaultFluidMaterial | Material ID used when an object's role resolves to "fluid". Defaults to 1. |
| [in] | defaultSolidMaterial | Material ID used when an object has no explicit material and its role is not "fluid". Defaults to 2. |
true if at least one DDS object was matched; false otherwise.bgi::gMutex (or ensure no other thread modifies the scene) for the duration of the call. | void bgi::openlbSampleMaterials2D | ( | const DdsScene & | scene, |
| float | minX, | ||
| float | minY, | ||
| float | z, | ||
| int | cols, | ||
| int | rows, | ||
| float | stepX, | ||
| float | stepY, | ||
| std::vector< int > & | materials, | ||
| int | defaultFluidMaterial = 1, |
||
| int | defaultSolidMaterial = 2 |
||
| ) |
Sample a 2-D axis-aligned grid of world-space points and write per-cell material IDs into a std::vector<int>.
Resizes materials to cols * rows and fills it with defaultFluidMaterial. Then iterates every cell (col, row) in row-major order and samples the DDS scene at the cell's centre:
Output index: materials[row * cols + col]. Unmatched cells retain defaultFluidMaterial.
| [in] | scene | DDS scene to query (read-only). |
| [in] | minX | X world coordinate of the grid's lower-left corner. |
| [in] | minY | Y world coordinate of the grid's lower-left corner. |
| [in] | z | Constant Z world coordinate for all sample points. |
| [in] | cols | Number of grid columns (X direction). |
| [in] | rows | Number of grid rows (Y direction). |
| [in] | stepX | Cell width in world units. |
| [in] | stepY | Cell height in world units. |
| [out] | materials | Output vector. Resized to max(0, cols*rows) and populated with material IDs on return. |
| [in] | defaultFluidMaterial | Fill value for unmatched cells and fluid-role objects. Defaults to 1. |
| [in] | defaultSolidMaterial | Solid-role fallback passed to openlbClassifyPoint. Defaults to 2. |
cols <= 0 or rows <= 0 the function returns immediately after resizing materials to 0. bgi::gMutex (or ensure no other thread modifies the scene) for the duration of the call. | int bgi::outlineFontIdFromName | ( | const std::string & | name | ) |
| const char * bgi::outlineFontName | ( | int | fontId | ) |
| void bgi::overlayPerformPick | ( | int | screenX, |
| int | screenY, | ||
| bool | multiSelect | ||
| ) |
Handle a left-click pick event.
Called from the GLFW mouse-button callback while gMutex is held. Finds the nearest visible DDS drawing object within gState.selectionPickRadiusPx screen pixels of (screenX, screenY) for any camera whose selection-cursor overlay is enabled, and updates gState.selectedObjectIds.
| screenX | Absolute window X of the click. |
| screenY | Absolute window Y of the click. |
| multiSelect | If true (CTRL held), add/toggle; otherwise replace selection. |
| void bgi::renderPageAsTexture | ( | int | w, |
| int | h, | ||
| int | vpW = -1, |
||
| int | vpH = -1 |
||
| ) |
Pass 1 — Upload the visual page buffer as an RGBA texture and draw a fullscreen quad.
Clears GL_DEPTH_BUFFER_BIT so subsequent 3-D passes have a fresh depth buffer. Does NOT swap buffers. Auto-initialises.
| w,h | Page-buffer (logical) dimensions — used for the texture. |
| vpW,vpH | Physical viewport dimensions for glViewport. Pass -1 to use the page dimensions (default for non-DPI-scaled paths). |
| void bgi::renderPageAsTextureAlpha | ( | int | w, |
| int | h, | ||
| int | vpW = -1, |
||
| int | vpH = -1 |
||
| ) |
Overlay pass — Upload the visual page buffer as an RGBA texture and composite it ON TOP of the current framebuffer contents using alpha blending.
Background-coloured pixels are rendered as fully transparent (alpha = 0) so only non-background overlay pixels appear.
Call AFTER all 3-D solid/line passes so overlays always appear in front. Does NOT clear the colour or depth buffer.
| w,h | Page-buffer (logical) dimensions — used for the texture. |
| vpW,vpH | Physical viewport dimensions for glViewport. Pass -1 to use the page dimensions. |
| void bgi::renderPageLegacyPoints | ( | int | w, |
| int | h, | ||
| int | vpW = -1, |
||
| int | vpH = -1 |
||
| ) |
Legacy per-pixel GL_POINTS path (kept for backward compat / diagnostics).
| void bgi::renderPageToCurrentGLContext | ( | int | w, |
| int | h | ||
| ) |
Render a single Phase 4/5/6 solid/surface/extrusion DDS object through the given camera into the active BGI pixel buffer.
Called both from bgi_solid_api.cpp (immediate render) and from bgi_dds_render.cpp (DDS re-render pass).
Caller must already hold gMutex.
| void bgi::renderSolidsGLPass | ( | const PendingGlRender & | pending, |
| int | w, | ||
| int | h, | ||
| const LightState & | light, | ||
| const glm::mat4 & | vp, | ||
| const glm::vec3 & | camPos, | ||
| int | vpX = 0, |
||
| int | vpY = 0 |
||
| ) |
Pass 2a — Draw Phong-lit solid triangles (flat and/or smooth shading) with depth test.
Uses flat program for solidVerts, smooth program for smoothVerts. vpX/vpY: GL-coord bottom-left of the target sub-panel (0,0 = full window).
| void bgi::renderSolidTriangles | ( | const Camera3D & | cam, |
| std::vector< SolidTriangle > & | tris, | ||
| SolidDrawMode | mode | ||
| ) |
Render a pre-tessellated triangle list using the current GL/software path.
| void bgi::renderWireframeGLPass | ( | const PendingGlRender & | pending, |
| int | w, | ||
| int | h, | ||
| const glm::mat4 & | vp, | ||
| const glm::vec3 & | camPos, | ||
| int | vpX = 0, |
||
| int | vpY = 0 |
||
| ) |
Pass 2b — Two-pass hidden-line wireframe with proper depth-buffer HSR.
Pass 1 fills the depth buffer with solid triangles (no colour output, back-face culled). Pass 2 draws only the visible edges (depth write off, GL_LEQUAL). vpX/vpY: GL-coord bottom-left of the target sub-panel (0,0 = full window).
| void bgi::renderWorldLinesGLPass | ( | const PendingGlRender & | pending, |
| int | w, | ||
| int | h, | ||
| const glm::mat4 & | vp, | ||
| int | vpX = 0, |
||
| int | vpY = 0 |
||
| ) |
Pass 3 — Draw world-space line segments with depth test (hidden behind solids).
vpX/vpY: GL-coord bottom-left of the target sub-panel (0,0 = full window).
| void bgi::resetDrawingState | ( | ) |
| void bgi::resetPaletteState | ( | ) |
| void bgi::resetStateForWindow | ( | int | width, |
| int | height, | ||
| bool | doubleBuffered | ||
| ) |
| void bgi::resizePixelBuffer | ( | int | width, |
| int | height | ||
| ) |
Resize only — preserves DDS scenes, cameras, UCS.
| void bgi::setPixel | ( | int | x, |
| int | y, | ||
| int | color | ||
| ) |
| void bgi::setPixelWithMode | ( | int | x, |
| int | y, | ||
| int | color, | ||
| int | mode | ||
| ) |
| bool bgi::syncGlfwWindowSize | ( | ) |
| void bgi::syncPagesIfNeeded | ( | ) |
| bool bgi::tessellateSolid3D | ( | const DdsObject & | obj, |
| std::vector< SolidTriangle > & | tris | ||
| ) |
Tessellate a solid/surface/extrusion DDS object into world-space triangles.
| bool bgi::toDeviceCoordinates | ( | int | x, |
| int | y, | ||
| int & | screenX, | ||
| int & | screenY | ||
| ) |
| CoordSystem bgi::ucsFromNormal | ( | float | nx, |
| float | ny, | ||
| float | nz, | ||
| float | ox, | ||
| float | oy, | ||
| float | oz | ||
| ) |
Constructs a right-handed orthonormal frame from a surface normal.
The normal becomes the UCS Z axis. An arbitrary perpendicular is chosen for X and Y using the Gram-Schmidt process, with a fallback that avoids degeneracy when the normal is parallel to the world Z axis.
| nx,ny,nz | Surface normal (need not be unit length). |
| ox,oy,oz | Origin of the new UCS in world space. |
CoordSystem with unit-length axes. | void bgi::ucsLocalToWorld | ( | const CoordSystem & | cs, |
| float | lx, | ||
| float | ly, | ||
| float | lz, | ||
| float & | wx, | ||
| float & | wy, | ||
| float & | wz | ||
| ) |
Transforms a UCS local point into world-space coordinates.
| cs | UCS to transform from. |
| lx,ly,lz | UCS local input. |
| wx,wy,wz | Output world-space coordinates. |
| glm::mat4 bgi::ucsLocalToWorldMatrix | ( | const CoordSystem & | cs | ) |
Returns the 4×4 matrix that transforms a point from UCS local space to world space.
This is the standard "model" matrix for objects defined in UCS coordinates.
| void bgi::ucsOrthonormalise | ( | CoordSystem & | cs | ) |
Orthonormalises the three axis vectors of a CoordSystem in-place using the Gram-Schmidt process.
Z is recomputed as X × Y, then Y is recomputed as Z × X to guarantee a right-handed system.
| void bgi::ucsWorldToLocal | ( | const CoordSystem & | cs, |
| float | wx, | ||
| float | wy, | ||
| float | wz, | ||
| float & | lx, | ||
| float & | ly, | ||
| float & | lz | ||
| ) |
Transforms a world-space point into UCS local coordinates.
| cs | UCS to transform into. |
| wx,wy,wz | World-space input. |
| lx,ly,lz | Output UCS local coordinates. |
| glm::mat4 bgi::ucsWorldToLocalMatrix | ( | const CoordSystem & | cs | ) |
Returns the 4×4 matrix that transforms a point from world space to UCS local space.
This is the inverse of ucsLocalToWorldMatrix.
| bool bgi::useFillAt | ( | int | x, |
| int | y | ||
| ) |
| const std::vector< std::uint8_t > & bgi::visualPageBuffer | ( | ) |
| glm::vec3 bgi::worldExtentsCentre | ( | const WorldExtents & | extents | ) |
Returns the centre of the AABB as a vec3.
Returns the origin if extents.hasData is false.
| void bgi::worldExtentsExpand | ( | WorldExtents & | extents, |
| float | x, | ||
| float | y, | ||
| float | z | ||
| ) |
Expands extents to include the point (x, y, z).
Sets extents.hasData = true on first call.
| glm::vec3 bgi::worldExtentsHalfSize | ( | const WorldExtents & | extents | ) |
Returns the half-extents (half-size of each axis) as a vec3.
Returns (0,0,0) if extents.hasData is false.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
extern |
|
constexpr |
|
constexpr |
|
extern |
|
constexpr |
|
constexpr |
|
constexpr |
|
extern |
|
constexpr |
|
constexpr |
|
constexpr |
first user-assignable extended colour index
|
constexpr |
extended slots 16-255 (fits uint8_t pixel buffer)
|
constexpr |
|
constexpr |
classic BGI palette slots (0-15)
|
constexpr |
|
constexpr |
|
constexpr |
Reserved extended-palette slot — selection flash orange.
|
constexpr |
Reserved extended-palette slot — selection flash purple.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |