|
wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
|
Internal GLM-based camera math for the camera viewport system. More...
#include "bgi_types.h"#include <glm/glm.hpp>#include <glm/gtc/matrix_transform.hpp>#include <glm/gtc/type_ptr.hpp>#include <vector>
Go to the source code of this file.
Namespaces | |
| namespace | bgi |
Functions | |
| 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. | |
| 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. | |
| glm::mat4 | bgi::cameraProjMatrix (const Camera3D &cam, float aspectRatio) |
| Builds the projection matrix. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| bool | bgi::clipLineZPlanes (glm::vec4 &A, glm::vec4 &B) |
| Clip a line segment against near and far Z planes. | |
| 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. | |
| 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). | |
| void | bgi::matToFloatArray (const glm::mat4 &m, float *out16) |
| Writes a GLM mat4 into a caller-supplied column-major float[16] array. | |
Internal GLM-based camera math for the camera viewport system.
All functions operate on Camera3D values stored in BgiState::cameras. The coordinate convention throughout is Z-up, right-handed (AutoCAD / engineering style): the XY plane is the ground plane and +Z points upward.
OpenGL uses a Y-up convention internally; the conversion is handled transparently inside the view-matrix construction for 2-D cameras and is the caller's responsibility for 3-D cameras (set upZ = 1 for the default Z-up orientation).
None of these functions are part of the public C API. Consumers use the wxbgi_cam_* / wxbgi_cam2d_* functions declared in wx_bgi_3d.h.