public class FrustumRayBuilder extends Object
Matrix4fc.
This can be used to compute the eye-rays in simple software-based raycasting/raytracing.
To obtain the origin of the rays call origin(Vector3f).
Then to compute the directions of subsequent rays use dir(float, float, Vector3f).
| Constructor and Description |
|---|
FrustumRayBuilder()
Create a new
FrustumRayBuilder with an undefined frustum. |
FrustumRayBuilder(Matrix4fc m)
Create a new
FrustumRayBuilder from the given matrix by extracing the matrix's frustum. |
| Modifier and Type | Method and Description |
|---|---|
Vector3fc |
dir(float x,
float y,
Vector3f dir)
Obtain the normalized direction of a ray starting at the center of the coordinate system and going
through the near frustum plane.
|
Vector3fc |
origin(Vector3f origin)
Store the eye/origin of the perspective frustum in the given
origin. |
FrustumRayBuilder |
set(Matrix4fc m)
|
public FrustumRayBuilder()
FrustumRayBuilder with an undefined frustum.
Before obtaining ray directions, make sure to define the frustum using set(Matrix4fc).
public FrustumRayBuilder(Matrix4fc m)
FrustumRayBuilder from the given matrix by extracing the matrix's frustum.m - the Matrix4fc to create the frustum frompublic FrustumRayBuilder set(Matrix4fc m)
this FrustumRayBuilder with the given matrix.
Reference: Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix
Reference: http://geomalgorithms.com
m - the matrix to update the frustum corner rays and origin withpublic Vector3fc origin(Vector3f origin)
origin.origin - will hold the perspective originorigin vectorpublic Vector3fc dir(float x, float y, Vector3f dir)
The parameters x and y are used to interpolate the generated ray direction
from the bottom-left to the top-right frustum corners.
x - the interpolation factor along the left-to-right frustum planes, within [0..1]y - the interpolation factor along the bottom-to-top frustum planes, within [0..1]dir - will hold the normalized ray directiondir vectorCopyright © 2015–2019 JOML. All rights reserved.