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_UNKNOWN -1
68
69// Parametric surface formula constants
70#define WXBGI_PARAM_SPHERE 0
71#define WXBGI_PARAM_CYLINDER 1
72#define WXBGI_PARAM_TORUS 2
73#define WXBGI_PARAM_SADDLE 3
74#define WXBGI_PARAM_MOBIUS 4
75
76// Solid draw mode constants
77#define WXBGI_SOLID_WIREFRAME 0
78#define WXBGI_SOLID_SOLID 1
79#define WXBGI_SOLID_FLAT 1
80#define WXBGI_SOLID_SMOOTH 2
81
82// CoordSpace constants (returned by wxbgi_dds_get_coord_space).
83#define WXBGI_COORD_BGI_PIXEL 0
84#define WXBGI_COORD_WORLD_3D 1
85#define WXBGI_COORD_UCS_LOCAL 2
86
87#ifdef __cplusplus
88extern "C" {
89#endif
90
91// =============================================================================
92// Scene inspection and management
93// =============================================================================
94
100
108BGI_API const char *BGI_CALL wxbgi_dds_get_id_at(int index);
109
115
122
130BGI_API const char *BGI_CALL wxbgi_dds_get_label(const char *id);
131
138BGI_API void BGI_CALL wxbgi_dds_set_label(const char *id, const char *label);
139
146BGI_API const char *BGI_CALL wxbgi_dds_find_by_label(const char *label);
147
154BGI_API void BGI_CALL wxbgi_dds_set_visible(const char *id, int visible);
155
160
171
179
187
188// =============================================================================
189// Serialization — JSON (DDJ) and YAML (DDY)
190// =============================================================================
191
200
208
217BGI_API int BGI_CALL wxbgi_dds_from_json(const char *jsonString);
218
224BGI_API int BGI_CALL wxbgi_dds_from_yaml(const char *yamlString);
225
230BGI_API int BGI_CALL wxbgi_dds_save_json(const char *filePath);
231
236BGI_API int BGI_CALL wxbgi_dds_load_json(const char *filePath);
237
242BGI_API int BGI_CALL wxbgi_dds_save_yaml(const char *filePath);
243
248BGI_API int BGI_CALL wxbgi_dds_load_yaml(const char *filePath);
249
250// =============================================================================
251// DDS-based rendering (Phase D — placeholder declaration)
252// =============================================================================
253
269BGI_API void BGI_CALL wxbgi_render_dds(const char *camName);
270
271// =============================================================================
272// GL rendering mode control
273// =============================================================================
274
284
293
294// =============================================================================
295// GL Phong lighting API
296// =============================================================================
297
300BGI_API void BGI_CALL wxbgi_solid_set_light_dir(float x, float y, float z);
301
305
308BGI_API void BGI_CALL wxbgi_solid_set_fill_light(float x, float y, float z, float strength);
309
312
315
318BGI_API void BGI_CALL wxbgi_solid_set_specular(float s, float shininess);
319
320// =============================================================================
321// Multi-Scene (CHDOP) Management
322// =============================================================================
323//
324// The library maintains a registry of named DDS scene graphs. A "default"
325// scene always exists and cannot be destroyed. Immediate-mode draw calls
326// (circle, box, wxbgi_world_line, etc.) always append to the *active* scene.
327// Each camera renders its *assigned* scene (see wxbgi_cam_set_scene).
328//
329// Typical usage:
330// wxbgi_dds_scene_create("secondary"); // create a second scene
331// wxbgi_dds_scene_set_active("secondary"); // route draws to it
332// wxbgi_world_box(0,0,0, 5,5,5); // appends to "secondary"
333// wxbgi_dds_scene_set_active("default"); // switch back
334// wxbgi_cam_set_scene("cam_side", "secondary");// cam_side renders "secondary"
335// wxbgi_render_dds("cam_main"); // renders "default" scene
336// wxbgi_render_dds("cam_side"); // renders "secondary" scene
337
344
353
363
369
376
384
393BGI_API void BGI_CALL wxbgi_cam_set_scene(const char *camName, const char *sceneName);
394
400BGI_API const char *BGI_CALL wxbgi_cam_get_scene(const char *camName);
401
402#ifdef __cplusplus
403} // extern "C"
404#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 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 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 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_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 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 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 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 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 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_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 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_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_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 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.