Package org.joml
Class FrustumRayBuilder
java.lang.Object
org.joml.FrustumRayBuilder
Provides methods to compute rays through an arbitrary perspective transformation defined by a
Matrix4fc
.
This can be used to compute the eyerays in simple softwarebased 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)
.
 Author:
 Kai Burjack

Constructor Summary
ConstructorDescriptionCreate a newFrustumRayBuilder
with an undefined frustum.Create a newFrustumRayBuilder
from the givenmatrix
by extracing the matrix's frustum. 
Method Summary
Modifier and TypeMethodDescriptionObtain the normalized direction of a ray starting at the center of the coordinate system and going through the near frustum plane.Store the eye/origin of the perspective frustum in the givenorigin
.

Constructor Details

FrustumRayBuilder
public FrustumRayBuilder()Create a newFrustumRayBuilder
with an undefined frustum.Before obtaining ray directions, make sure to define the frustum using
set(Matrix4fc)
. 
FrustumRayBuilder
Create a newFrustumRayBuilder
from the givenmatrix
by extracing the matrix's frustum. Parameters:
m
 theMatrix4fc
to create the frustum from


Method Details

set
Update the stored frustum corner rays and origin ofthis
FrustumRayBuilder
with the givenmatrix
.Reference: Fast Extraction of Viewing Frustum Planes from the WorldViewProjection Matrix
Reference: http://geomalgorithms.com
 Parameters:
m
 thematrix
to update the frustum corner rays and origin with Returns:
 this

origin
Store the eye/origin of the perspective frustum in the givenorigin
. Parameters:
origin
 will hold the perspective origin Returns:
 the
origin
vector

dir
Obtain the normalized direction of a ray starting at the center of the coordinate system and going through the near frustum plane.The parameters
x
andy
are used to interpolate the generated ray direction from the bottomleft to the topright frustum corners. Parameters:
x
 the interpolation factor along the lefttoright frustum planes, within[0..1]
y
 the interpolation factor along the bottomtotop frustum planes, within[0..1]
dir
 will hold the normalized ray direction Returns:
 the
dir
vector
