6#include <glm/gtc/matrix_transform.hpp>
7#include <glm/gtc/type_ptr.hpp>
39 int &x,
int &y,
int &w,
int &h);
89 float wx,
float wy,
float wz,
90 float &screenX,
float &screenY);
103 float wx,
float wy,
float wz,
104 float &screenX,
float &screenY);
111 float wx,
float wy,
float wz);
149 const glm::vec4 &clip,
150 float &screenX,
float &screenY);
166 float screenX,
float screenY,
167 float &rayOx,
float &rayOy,
float &rayOz,
168 float &rayDx,
float &rayDy,
float &rayDz);
Definition bgi_camera.h:28
glm::mat4 cameraVPMatrix(const Camera3D &cam, float aspectRatio)
Returns the combined view-projection matrix (proj × view).
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).
bool clipLineZPlanes(glm::vec4 &A, glm::vec4 &B)
Clip a line segment against near and far Z planes.
glm::mat4 cameraProjMatrix(const Camera3D &cam, float aspectRatio)
Builds the projection matrix.
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.
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 cameraViewMatrix(const Camera3D &cam)
Builds the view matrix from eye / target / up, or from the 2-D pan / zoom / rotation fields when cam....
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.
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.
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.
void matToFloatArray(const glm::mat4 &m, float *out16)
Writes a GLM mat4 into a caller-supplied column-major float[16] array.
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 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.
float cameraAspectRatio(const Camera3D &cam, int winW, int winH)
Returns the aspect ratio (width / height) of the camera's effective viewport.
3-D camera definition (Z-up, right-handed world coordinate system).
Definition bgi_types.h:348