(frustum l t r b n f)
Sets up a viewing frustum, shaped like a truncated pyramid with the camera where the tip of the pyramid would be. This emulates the OpenGL function glFrustum().
Sets up a viewing frustum, shaped like a truncated pyramid with the camera where the tip of the pyramid would be. This emulates the OpenGL function glFrustum().
(frustum-bounds fovy aspect near)
Given vertical FOV in degrees, aspect ratio and near plane distance, computes map of left/right/top/bottom view frustum bounds.
Given vertical FOV in degrees, aspect ratio and near plane distance, computes map of left/right/top/bottom view frustum bounds.
(frustum-planes view proj)
Given a view matrix & projection matrix, returns vector of the frustum's 6 plane parameters, each a 2-element vector: [normal w] Planes are ordered: left, right, top, bottom, near, far. These coefficients can then (for example) be used for AABB-frustum culling with thi.ng.geom.utils.intersect/intersect-aabb-frustum?
Given a view matrix & projection matrix, returns vector of the frustum's 6 plane parameters, each a 2-element vector: [normal w] Planes are ordered: left, right, top, bottom, near, far. These coefficients can then (for example) be used for AABB-frustum culling with thi.ng.geom.utils.intersect/intersect-aabb-frustum?
(look-at eye target up)
Returns a matrix that puts the camera at the eye position looking toward the target point with the given up direction.
Returns a matrix that puts the camera at the eye position looking toward the target point with the given up direction.
(look-at-vectors ex ey ez tx ty tz)
Takes 6 numbers representing eye & target positions, computes up vector and returns vector of all three vec3's.
Takes 6 numbers representing eye & target positions, computes up vector and returns vector of all three vec3's.
(matrix44)
(matrix44 [m00 m01 m02 m03 m10 m11 m12 m13 m20 m21 m22 m23 m30 m31 m32 m33])
(matrix44 m00 m01 m02 m03 m10 m11 m12 m13 m20 m21 m22 m23 m30 m31 m32 m33)
(ortho)
(ortho view-rect)
(ortho left top right bottom near far)
Returns an orthographic projection matrix, in which objects are the same size no matter how far away or nearby they are. This emulates the OpenGL function glOrtho().
Returns an orthographic projection matrix, in which objects are the same size no matter how far away or nearby they are. This emulates the OpenGL function glOrtho().
(perspective fovy aspect near far)
Returns a perspective transform matrix, which makes far away
objects appear smaller than nearby objects. fovy
is the vertical
angle of the field of view in degrees. The aspect
argument should
be a rect, a map with a :size
key (vec2) or the width divided by
the height of your viewport. near
and far
are the distances of
the clipping planes.
Returns a perspective transform matrix, which makes far away objects appear smaller than nearby objects. `fovy` is the vertical angle of the field of view in degrees. The `aspect` argument should be a rect, a map with a `:size` key (vec2) or the width divided by the height of your viewport. `near` and `far` are the distances of the clipping planes.
(project-point p mvp vtx)
Projects 3D point p using MVP matrix into 2D and the applies viewport matrix to produce screen coordinate.
Projects 3D point p using MVP matrix into 2D and the applies viewport matrix to produce screen coordinate.
(project-point-z p mvp vtx)
Like project-point, but returns vec3 with z component representing depth value.
Like project-point, but returns vec3 with z component representing depth value.
(unproject-point p inv-mat {[vx vy] :p [w h] :size})
(unproject-point p view proj screen-rect)
(unproject-point [x y z] inv-mat vx vy w h)
Takes a vec3 in screenspace, view matrix, projection matrix and screen rect. A second arity exists accepting an already inverted view-projection matrix instead of having to supply view & proj separately. Returns vector in world space or nil if matrix is not invertible.
Takes a vec3 in screenspace, view matrix, projection matrix and screen rect. A second arity exists accepting an already inverted view-projection matrix instead of having to supply view & proj separately. Returns vector in world space or nil if matrix is not invertible.
(viewport-matrix width height)
(viewport-matrix width height invert-y?)
Given viewport width/height, computes a 2D transformation matrix mapping normalized coordinates to screen space. If invert-y? is true, the Y axis is flipped.
Given viewport width/height, computes a 2D transformation matrix mapping normalized coordinates to screen space. If invert-y? is true, the Y axis is flipped.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close