wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
Loading...
Searching...
No Matches
Functions
wx_bgi_solid.h File Reference

Public C API for Phase 4 (3D Solid Primitives), Phase 5 (3D Surfaces), and Phase 6 (2D→3D Extrusion) of the wx_bgi_graphics library. More...

#include "bgi_types.h"
#include "wx_bgi_dds.h"
Include dependency graph for wx_bgi_solid.h:

Go to the source code of this file.

Functions

BGI_API void BGI_CALL wxbgi_dds_set_solid_draw_mode (int mode)
 Change the draw mode on ALL solid objects currently in the DDS scene.
 
BGI_API void BGI_CALL wxbgi_extrude_polygon (const float *xs, const float *ys, int n_pts, float dir_x, float dir_y, float dir_z, int cap_start, int cap_end)
 Extrude a 2-D polygon profile along a direction vector.
 
BGI_API void BGI_CALL wxbgi_solid_box (float cx, float cy, float cz, float width, float depth, float height)
 Draw an axis-aligned box centred at (cx, cy, cz).
 
BGI_API void BGI_CALL wxbgi_solid_cone (float cx, float cy, float cz, float radius, float height, int slices, int cap)
 Draw a Z-aligned cone.
 
BGI_API void BGI_CALL wxbgi_solid_cylinder (float cx, float cy, float cz, float radius, float height, int slices, int caps)
 Draw a Z-aligned cylinder centred at (cx, cy, cz).
 
BGI_API int BGI_CALL wxbgi_solid_get_draw_mode (void)
 Returns the current solid draw mode (WXBGI_SOLID_WIREFRAME or WXBGI_SOLID_SOLID).
 
BGI_API void BGI_CALL wxbgi_solid_set_draw_mode (int mode)
 Set the draw mode for subsequently created solids.
 
BGI_API void BGI_CALL wxbgi_solid_set_edge_color (int color)
 Set the edge colour (BGI palette index) for subsequently created solids.
 
BGI_API void BGI_CALL wxbgi_solid_set_face_color (int color)
 Set the face fill colour (BGI palette index) for subsequently created solids.
 
BGI_API void BGI_CALL wxbgi_solid_sphere (float cx, float cy, float cz, float radius, int slices, int stacks)
 Draw a UV sphere centred at (cx, cy, cz).
 
BGI_API void BGI_CALL wxbgi_solid_torus (float cx, float cy, float cz, float major_r, float minor_r, int rings, int sides)
 Draw a torus (donut) centred at (cx, cy, cz) in the XY plane.
 
BGI_API void BGI_CALL wxbgi_surface_heightmap (float ox, float oy, float oz, float cell_w, float cell_h, int rows, int cols, const float *heights)
 Draw a height-map surface.
 
BGI_API void BGI_CALL wxbgi_surface_parametric (float cx, float cy, float cz, int formula, float param1, float param2, int u_steps, int v_steps)
 Draw a parametric surface.
 

Detailed Description

Public C API for Phase 4 (3D Solid Primitives), Phase 5 (3D Surfaces), and Phase 6 (2D→3D Extrusion) of the wx_bgi_graphics library.

All functions write to the active BGI pixel buffer AND append a retained-mode DDS object to the scene graph. Call wxbgi_render_dds() to re-render the scene through a different camera.

Coordinate convention: Z-up, right-handed world space (same as the camera and UCS systems defined in wx_bgi_3d.h).

Function Documentation

◆ wxbgi_dds_set_solid_draw_mode()

BGI_API void BGI_CALL wxbgi_dds_set_solid_draw_mode ( int  mode)

Change the draw mode on ALL solid objects currently in the DDS scene.

This is a fast in-place update (no re-render, no JSON round-trip). Useful for switching the whole scene between wireframe and filled without rebuilding geometry.

Parameters
modeWXBGI_SOLID_WIREFRAME (0) or WXBGI_SOLID_SOLID (1).

◆ wxbgi_extrude_polygon()

BGI_API void BGI_CALL wxbgi_extrude_polygon ( const float *  xs,
const float *  ys,
int  n_pts,
float  dir_x,
float  dir_y,
float  dir_z,
int  cap_start,
int  cap_end 
)

Extrude a 2-D polygon profile along a direction vector.

The base profile is given as separate X and Y arrays of n_pts world-space points (Z is taken as zero for each vertex). The extrusion direction (dir_x, dir_y, dir_z) also determines the extrusion length via its magnitude.

Parameters
xs,ysArrays of n_pts world-space X and Y coordinates.
n_ptsNumber of profile vertices (≥3).
dir_x,dir_y,dir_zExtrusion direction vector (length = depth).
cap_startNon-zero → fill the base polygon.
cap_endNon-zero → fill the top polygon.

◆ wxbgi_solid_box()

BGI_API void BGI_CALL wxbgi_solid_box ( float  cx,
float  cy,
float  cz,
float  width,
float  depth,
float  height 
)

Draw an axis-aligned box centred at (cx, cy, cz).

Parameters
cxWorld-space X coordinate of the box centre.
cyWorld-space Y coordinate of the box centre.
czWorld-space Z coordinate of the box centre.
widthExtent along the world X axis.
depthExtent along the world Y axis.
heightExtent along the world Z axis.

◆ wxbgi_solid_cone()

BGI_API void BGI_CALL wxbgi_solid_cone ( float  cx,
float  cy,
float  cz,
float  radius,
float  height,
int  slices,
int  cap 
)

Draw a Z-aligned cone.

Base is at (cx, cy, cz), apex at (cx, cy, cz+height).

Parameters
cxWorld-space X coordinate of the cone base centre.
cyWorld-space Y coordinate of the cone base centre.
czWorld-space Z coordinate of the cone base centre.
radiusBase radius.
heightHeight along Z.
slicesCircumference subdivisions (≥3).
capNon-zero → draw the base disc cap.

◆ wxbgi_solid_cylinder()

BGI_API void BGI_CALL wxbgi_solid_cylinder ( float  cx,
float  cy,
float  cz,
float  radius,
float  height,
int  slices,
int  caps 
)

Draw a Z-aligned cylinder centred at (cx, cy, cz).

Parameters
cxWorld-space X coordinate of the cylinder centre.
cyWorld-space Y coordinate of the cylinder centre.
czWorld-space Z coordinate of the cylinder centre.
radiusCylinder radius.
heightTotal height along Z.
slicesCircumference subdivisions (≥3).
capsNon-zero → draw top and bottom disc caps.

◆ wxbgi_solid_get_draw_mode()

BGI_API int BGI_CALL wxbgi_solid_get_draw_mode ( void  )

Returns the current solid draw mode (WXBGI_SOLID_WIREFRAME or WXBGI_SOLID_SOLID).

◆ wxbgi_solid_set_draw_mode()

BGI_API void BGI_CALL wxbgi_solid_set_draw_mode ( int  mode)

Set the draw mode for subsequently created solids.

Parameters
modeWXBGI_SOLID_WIREFRAME (0) or WXBGI_SOLID_SOLID (1).

◆ wxbgi_solid_set_edge_color()

BGI_API void BGI_CALL wxbgi_solid_set_edge_color ( int  color)

Set the edge colour (BGI palette index) for subsequently created solids.

◆ wxbgi_solid_set_face_color()

BGI_API void BGI_CALL wxbgi_solid_set_face_color ( int  color)

Set the face fill colour (BGI palette index) for subsequently created solids.

◆ wxbgi_solid_sphere()

BGI_API void BGI_CALL wxbgi_solid_sphere ( float  cx,
float  cy,
float  cz,
float  radius,
int  slices,
int  stacks 
)

Draw a UV sphere centred at (cx, cy, cz).

Parameters
cxWorld-space X coordinate of the sphere centre.
cyWorld-space Y coordinate of the sphere centre.
czWorld-space Z coordinate of the sphere centre.
radiusSphere radius in world units.
slicesLongitude subdivisions (≥3).
stacksLatitude subdivisions (≥2).

◆ wxbgi_solid_torus()

BGI_API void BGI_CALL wxbgi_solid_torus ( float  cx,
float  cy,
float  cz,
float  major_r,
float  minor_r,
int  rings,
int  sides 
)

Draw a torus (donut) centred at (cx, cy, cz) in the XY plane.

Parameters
cxWorld-space X coordinate of the torus centre.
cyWorld-space Y coordinate of the torus centre.
czWorld-space Z coordinate of the torus centre.
major_rDistance from torus centre to tube centre.
minor_rTube radius.
ringsSegments around the main axis (≥3).
sidesSegments of the tube cross-section (≥3).

◆ wxbgi_surface_heightmap()

BGI_API void BGI_CALL wxbgi_surface_heightmap ( float  ox,
float  oy,
float  oz,
float  cell_w,
float  cell_h,
int  rows,
int  cols,
const float *  heights 
)

Draw a height-map surface.

Parameters
ox,oy,ozWorld-space origin at the bottom-left corner of the grid.
cell_wWorld-unit spacing between grid columns (X direction).
cell_hWorld-unit spacing between grid rows (Y direction).
rowsNumber of rows in the grid (≥2).
colsNumber of columns in the grid (≥2).
heightsRow-major flat array of (rows × cols) Z values.

◆ wxbgi_surface_parametric()

BGI_API void BGI_CALL wxbgi_surface_parametric ( float  cx,
float  cy,
float  cz,
int  formula,
float  param1,
float  param2,
int  u_steps,
int  v_steps 
)

Draw a parametric surface.

Parameters
cx,cy,czCentre offset applied to all surface points.
formulaWXBGI_PARAM_* constant selecting the surface formula.
param1Primary shape parameter (e.g. radius for sphere/cylinder).
param2Secondary shape parameter (e.g. minor radius, height).
u_stepsTessellation steps along the U parameter axis (≥2).
v_stepsTessellation steps along the V parameter axis (≥2).