wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
Loading...
Searching...
No Matches
wx_bgi_dds.h
Go to the documentation of this file.
1#pragma once
2
34#include "bgi_types.h" // BGI_API, BGI_CALL
35
36// DDS object-type constants (returned by wxbgi_dds_get_type).
37// Values match bgi::DdsObjectType; kept as plain ints for C compatibility.
38#define WXBGI_DDS_CAMERA 0
39#define WXBGI_DDS_UCS 1
40#define WXBGI_DDS_WORLD_EXTENTS 2
41#define WXBGI_DDS_POINT 3
42#define WXBGI_DDS_LINE 4
43#define WXBGI_DDS_CIRCLE 5
44#define WXBGI_DDS_ARC 6
45#define WXBGI_DDS_ELLIPSE 7
46#define WXBGI_DDS_FILL_ELLIPSE 8
47#define WXBGI_DDS_PIE_SLICE 9
48#define WXBGI_DDS_SECTOR 10
49#define WXBGI_DDS_RECTANGLE 11
50#define WXBGI_DDS_BAR 12
51#define WXBGI_DDS_BAR3D 13
52#define WXBGI_DDS_POLYGON 14
53#define WXBGI_DDS_FILL_POLY 15
54#define WXBGI_DDS_TEXT 16
55#define WXBGI_DDS_IMAGE 17
56// Phase 4 — 3D Solid Primitives
57#define WXBGI_DDS_BOX 18
58#define WXBGI_DDS_SPHERE 19
59#define WXBGI_DDS_CYLINDER 20
60#define WXBGI_DDS_CONE 21
61#define WXBGI_DDS_TORUS 22
62// Phase 5 — 3D Surfaces
63#define WXBGI_DDS_HEIGHTMAP 23
64#define WXBGI_DDS_PARAM_SURFACE 24
65// Phase 6 — 2D→3D Extrusion
66#define WXBGI_DDS_EXTRUSION 25
67#define WXBGI_DDS_TRANSFORM 26
68#define WXBGI_DDS_SET_UNION 27
69#define WXBGI_DDS_SET_INTERSECTION 28
70#define WXBGI_DDS_SET_DIFFERENCE 29
71#define WXBGI_DDS_UNKNOWN -1
72
73// Parametric surface formula constants
74#define WXBGI_PARAM_SPHERE 0
75#define WXBGI_PARAM_CYLINDER 1
76#define WXBGI_PARAM_TORUS 2
77#define WXBGI_PARAM_SADDLE 3
78#define WXBGI_PARAM_MOBIUS 4
79
80// Solid draw mode constants
81#define WXBGI_SOLID_WIREFRAME 0
82#define WXBGI_SOLID_SOLID 1
83#define WXBGI_SOLID_FLAT 1
84#define WXBGI_SOLID_SMOOTH 2
85
86// CoordSpace constants (returned by wxbgi_dds_get_coord_space).
87#define WXBGI_COORD_BGI_PIXEL 0
88#define WXBGI_COORD_WORLD_3D 1
89#define WXBGI_COORD_UCS_LOCAL 2
90
91#ifdef __cplusplus
92extern "C" {
93#endif
94
95// =============================================================================
96// Scene inspection and management
97// =============================================================================
98
104
112BGI_API const char *BGI_CALL wxbgi_dds_get_id_at(int index);
113
119
126
134BGI_API const char *BGI_CALL wxbgi_dds_get_label(const char *id);
135
142BGI_API void BGI_CALL wxbgi_dds_set_label(const char *id, const char *label);
143
150BGI_API int BGI_CALL wxbgi_dds_set_external_attr(const char *id, const char *key, const char *value);
151
159BGI_API const char *BGI_CALL wxbgi_dds_get_external_attr(const char *id, const char *key);
160
166BGI_API int BGI_CALL wxbgi_dds_clear_external_attr(const char *id, const char *key);
167
174
181BGI_API const char *BGI_CALL wxbgi_dds_get_external_attr_key_at(const char *id, int index);
182
189BGI_API const char *BGI_CALL wxbgi_dds_get_external_attr_value_at(const char *id, int index);
190
197BGI_API const char *BGI_CALL wxbgi_dds_find_by_label(const char *label);
198
205BGI_API void BGI_CALL wxbgi_dds_set_visible(const char *id, int visible);
206
211
219BGI_API int BGI_CALL wxbgi_object_set_face_color(const char *id, int color);
220
231
239
247
248// =============================================================================
249// Retained composition helpers
250// =============================================================================
251
261BGI_API const char *BGI_CALL wxbgi_dds_translate(const char *id, float dx, float dy, float dz);
262
269BGI_API const char *BGI_CALL wxbgi_dds_rotate_x_deg(const char *id, float angleDeg);
270BGI_API const char *BGI_CALL wxbgi_dds_rotate_y_deg(const char *id, float angleDeg);
271BGI_API const char *BGI_CALL wxbgi_dds_rotate_z_deg(const char *id, float angleDeg);
272BGI_API const char *BGI_CALL wxbgi_dds_rotate_x_rad(const char *id, float angleRad);
273BGI_API const char *BGI_CALL wxbgi_dds_rotate_y_rad(const char *id, float angleRad);
274BGI_API const char *BGI_CALL wxbgi_dds_rotate_z_rad(const char *id, float angleRad);
275
282BGI_API const char *BGI_CALL wxbgi_dds_rotate_axis_deg(const char *id,
283 float axisX, float axisY, float axisZ,
284 float angleDeg);
285BGI_API const char *BGI_CALL wxbgi_dds_rotate_axis_rad(const char *id,
286 float axisX, float axisY, float axisZ,
287 float angleRad);
288
295BGI_API const char *BGI_CALL wxbgi_dds_scale_uniform(const char *id, float factor);
296BGI_API const char *BGI_CALL wxbgi_dds_scale_xyz(const char *id, float sx, float sy, float sz);
297
306BGI_API const char *BGI_CALL wxbgi_dds_skew(const char *id,
307 float xy, float xz,
308 float yx, float yz,
309 float zx, float zy);
310
317BGI_API const char *BGI_CALL wxbgi_dds_union(int count, const char *const *ids);
318
325BGI_API const char *BGI_CALL wxbgi_dds_intersection(int count, const char *const *ids);
326
334BGI_API const char *BGI_CALL wxbgi_dds_difference(int count, const char *const *ids);
335
343
351BGI_API const char *BGI_CALL wxbgi_dds_get_child_at(const char *id, int index);
352
353// =============================================================================
354// Serialization — JSON (DDJ) and YAML (DDY)
355// =============================================================================
356
365
373
382BGI_API int BGI_CALL wxbgi_dds_from_json(const char *jsonString);
383
389BGI_API int BGI_CALL wxbgi_dds_from_yaml(const char *yamlString);
390
395BGI_API int BGI_CALL wxbgi_dds_save_json(const char *filePath);
396
401BGI_API int BGI_CALL wxbgi_dds_load_json(const char *filePath);
402
407BGI_API int BGI_CALL wxbgi_dds_save_yaml(const char *filePath);
408
413BGI_API int BGI_CALL wxbgi_dds_load_yaml(const char *filePath);
414
415// =============================================================================
416// DDS-based rendering (Phase D — placeholder declaration)
417// =============================================================================
418
434BGI_API void BGI_CALL wxbgi_render_dds(const char *camName);
435
436// =============================================================================
437// GL rendering mode control
438// =============================================================================
439
449
458
459// =============================================================================
460// GL Phong lighting API
461// =============================================================================
462
465BGI_API void BGI_CALL wxbgi_solid_set_light_dir(float x, float y, float z);
466
470
473BGI_API void BGI_CALL wxbgi_solid_set_fill_light(float x, float y, float z, float strength);
474
477
480
483BGI_API void BGI_CALL wxbgi_solid_set_specular(float s, float shininess);
484
485// =============================================================================
486// Multi-Scene (CHDOP) Management
487// =============================================================================
488//
489// The library maintains a registry of named DDS scene graphs. A "default"
490// scene always exists and cannot be destroyed. Immediate-mode draw calls
491// (circle, box, wxbgi_world_line, etc.) always append to the *active* scene.
492// Each camera renders its *assigned* scene (see wxbgi_cam_set_scene).
493//
494// Typical usage:
495// wxbgi_dds_scene_create("secondary"); // create a second scene
496// wxbgi_dds_scene_set_active("secondary"); // route draws to it
497// wxbgi_world_box(0,0,0, 5,5,5); // appends to "secondary"
498// wxbgi_dds_scene_set_active("default"); // switch back
499// wxbgi_cam_set_scene("cam_side", "secondary");// cam_side renders "secondary"
500// wxbgi_render_dds("cam_main"); // renders "default" scene
501// wxbgi_render_dds("cam_side"); // renders "secondary" scene
502
509
518
528
534
541
549
558BGI_API void BGI_CALL wxbgi_cam_set_scene(const char *camName, const char *sceneName);
559
565BGI_API const char *BGI_CALL wxbgi_cam_get_scene(const char *camName);
566
567#ifdef __cplusplus
568} // extern "C"
569#endif
#define BGI_CALL
Definition bgi_types.h:20
#define BGI_API
Definition bgi_types.h:14
BGI_API const char *BGI_CALL wxbgi_dds_get_id_at(int index)
Returns the auto-assigned ID string of the object at position index (0-based insertion order,...
BGI_API void BGI_CALL wxbgi_solid_set_diffuse(float d)
Set the diffuse light intensity (0–1).
BGI_API const char *BGI_CALL wxbgi_dds_get_external_attr_key_at(const char *id, int index)
Return the key at index within a DDS object's external metadata map.
BGI_API void BGI_CALL wxbgi_solid_set_light_dir(float x, float y, float z)
Set the primary (key) light direction.
BGI_API const char *BGI_CALL wxbgi_dds_to_json(void)
Serialises the full DDS scene to a JSON string (DDJ format).
BGI_API int BGI_CALL wxbgi_dds_set_external_attr(const char *id, const char *key, const char *value)
Set one generic external metadata key/value pair on a DDS object.
BGI_API void BGI_CALL wxbgi_dds_clear_all(void)
Removes ALL objects from the DDS including cameras and UCS.
BGI_API int BGI_CALL wxbgi_dds_load_json(const char *filePath)
Loads and restores a DDS from a JSON file at filePath.
BGI_API const char *BGI_CALL wxbgi_dds_rotate_x_deg(const char *id, float angleDeg)
Creates a retained transform node that rotates id about the world X axis.
BGI_API void BGI_CALL wxbgi_dds_scene_set_active(const char *name)
Sets the active scene for immediate-mode draw calls.
BGI_API const char *BGI_CALL wxbgi_dds_rotate_y_rad(const char *id, float angleRad)
BGI_API const char *BGI_CALL wxbgi_dds_rotate_z_deg(const char *id, float angleDeg)
BGI_API const char *BGI_CALL wxbgi_cam_get_scene(const char *camName)
Returns the name of the scene currently assigned to a camera.
BGI_API int BGI_CALL wxbgi_dds_get_coord_space(const char *id)
Returns the CoordSpace (WXBGI_COORD_*) of a drawing object.
BGI_API void BGI_CALL wxbgi_render_dds(const char *camName)
Renders all visible DDS drawing objects through the named camera into the BGI pixel buffer.
BGI_API const char *BGI_CALL wxbgi_dds_get_label(const char *id)
Returns the user label of the object identified by id.
BGI_API const char *BGI_CALL wxbgi_dds_difference(int count, const char *const *ids)
Creates a retained SetDifference node over count operand IDs.
BGI_API void BGI_CALL wxbgi_solid_set_light_space(int worldSpace)
Select light coordinate space.
BGI_API void BGI_CALL wxbgi_dds_set_visible(const char *id, int visible)
Sets the visibility flag of the object identified by id.
BGI_API void BGI_CALL wxbgi_gl_pass_destroy(void)
Release all OpenGL objects managed by the GL render pass.
BGI_API const char *BGI_CALL wxbgi_dds_scale_xyz(const char *id, float sx, float sy, float sz)
BGI_API int BGI_CALL wxbgi_object_set_face_color(const char *id, int color)
Sets the face fill colour for an existing DDS object identified by id.
BGI_API void BGI_CALL wxbgi_dds_scene_destroy(const char *name)
Destroys a named DDS scene graph and all its objects.
BGI_API int BGI_CALL wxbgi_dds_from_json(const char *jsonString)
Replaces the current DDS scene with the data in jsonString.
BGI_API const char *BGI_CALL wxbgi_dds_translate(const char *id, float dx, float dy, float dz)
Creates a retained transform node that translates the object/subtree identified by id by (dx,...
BGI_API void BGI_CALL wxbgi_dds_set_label(const char *id, const char *label)
Sets the user label of the object identified by id.
BGI_API void BGI_CALL wxbgi_dds_scene_clear(const char *name)
Clears all drawing-primitive objects from a named scene.
BGI_API void BGI_CALL wxbgi_solid_set_fill_light(float x, float y, float z, float strength)
Set the secondary (fill) light direction and relative strength.
BGI_API void BGI_CALL wxbgi_solid_set_specular(float s, float shininess)
Set the specular intensity and shininess exponent.
BGI_API const char *BGI_CALL wxbgi_dds_scale_uniform(const char *id, float factor)
Creates a retained transform node that scales id by the given factor(s).
BGI_API const char *BGI_CALL wxbgi_dds_get_child_at(const char *id, int index)
Returns the direct child ID at index for a retained Transform / SetUnion / SetIntersection / SetDiffe...
BGI_API int BGI_CALL wxbgi_dds_from_yaml(const char *yamlString)
Replaces the current DDS scene with the data in yamlString.
BGI_API int BGI_CALL wxbgi_dds_object_count(void)
Returns the total number of non-deleted, visible + hidden objects in the DDS (cameras,...
BGI_API int BGI_CALL wxbgi_dds_save_json(const char *filePath)
Serialises the DDS to a JSON file at filePath.
BGI_API const char *BGI_CALL wxbgi_dds_rotate_axis_deg(const char *id, float axisX, float axisY, float axisZ, float angleDeg)
Creates a retained transform node that rotates id around an arbitrary axis.
BGI_API int BGI_CALL wxbgi_dds_scene_create(const char *name)
Creates a new named DDS scene graph.
BGI_API int BGI_CALL wxbgi_dds_scene_exists(const char *name)
Tests whether a named scene exists in the registry.
BGI_API const char *BGI_CALL wxbgi_dds_rotate_z_rad(const char *id, float angleRad)
BGI_API const char *BGI_CALL wxbgi_dds_rotate_axis_rad(const char *id, float axisX, float axisY, float axisZ, float angleRad)
BGI_API int BGI_CALL wxbgi_dds_external_attr_count(const char *id)
Return the number of external metadata entries stored on a DDS object.
BGI_API const char *BGI_CALL wxbgi_dds_scene_get_active(void)
Returns the name of the currently active scene.
BGI_API void BGI_CALL wxbgi_dds_clear(void)
Removes all drawing-primitive objects from the DDS.
BGI_API const char *BGI_CALL wxbgi_dds_union(int count, const char *const *ids)
Creates a retained SetUnion node over count operand IDs.
BGI_API void BGI_CALL wxbgi_cam_set_scene(const char *camName, const char *sceneName)
Assigns a DDS scene to a camera.
BGI_API int BGI_CALL wxbgi_dds_get_visible(const char *id)
Returns 1 if the object exists and is visible, 0 otherwise.
BGI_API void BGI_CALL wxbgi_set_legacy_gl_render(int enable)
Enable or disable the legacy per-pixel GL_POINTS rendering path.
BGI_API void BGI_CALL wxbgi_solid_set_ambient(float a)
Set the ambient light intensity (0–1).
BGI_API int BGI_CALL wxbgi_dds_clear_external_attr(const char *id, const char *key)
Remove one external metadata key from a DDS object.
BGI_API int BGI_CALL wxbgi_dds_get_type(const char *id)
Returns the WXBGI_DDS_* type constant for the object identified by id, or WXBGI_DDS_UNKNOWN if not fo...
BGI_API int BGI_CALL wxbgi_dds_save_yaml(const char *filePath)
Serialises the DDS to a YAML file at filePath.
BGI_API const char *BGI_CALL wxbgi_dds_get_external_attr_value_at(const char *id, int index)
Return the value at index within a DDS object's external metadata map.
BGI_API const char *BGI_CALL wxbgi_dds_to_yaml(void)
Serialises the full DDS scene to a YAML string (DDY format).
BGI_API int BGI_CALL wxbgi_dds_load_yaml(const char *filePath)
Loads and restores a DDS from a YAML file at filePath.
BGI_API const char *BGI_CALL wxbgi_dds_intersection(int count, const char *const *ids)
Creates a retained SetIntersection node over count operand IDs.
BGI_API int BGI_CALL wxbgi_dds_remove(const char *id)
Soft-deletes the object identified by id.
BGI_API const char *BGI_CALL wxbgi_dds_find_by_label(const char *label)
Returns the ID of the first non-deleted object with the given label, or "" if not found.
BGI_API int BGI_CALL wxbgi_dds_get_child_count(const char *id)
Returns the number of direct child IDs referenced by a retained Transform / SetUnion / SetIntersectio...
BGI_API const char *BGI_CALL wxbgi_dds_get_external_attr(const char *id, const char *key)
Get one external metadata value from a DDS object.
BGI_API const char *BGI_CALL wxbgi_dds_skew(const char *id, float xy, float xz, float yx, float yz, float zx, float zy)
Creates a retained transform node with a 3D shear/skew matrix.
BGI_API const char *BGI_CALL wxbgi_dds_rotate_y_deg(const char *id, float angleDeg)
BGI_API const char *BGI_CALL wxbgi_dds_rotate_x_rad(const char *id, float angleRad)