Package org.joml
Class FrustumRayBuilder
- java.lang.Object
-
- org.joml.FrustumRayBuilder
-
public class FrustumRayBuilder extends java.lang.ObjectProvides methods to compute rays through an arbitrary perspective transformation defined by aMatrix4fc.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 usedir(float, float, Vector3f).- Author:
- Kai Burjack
-
-
Constructor Summary
Constructors Constructor Description FrustumRayBuilder()Create a newFrustumRayBuilderwith an undefined frustum.FrustumRayBuilder(Matrix4fc m)Create a newFrustumRayBuilderfrom the givenmatrixby extracing the matrix's frustum.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector3fcdir(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.Vector3fcorigin(Vector3f origin)Store the eye/origin of the perspective frustum in the givenorigin.FrustumRayBuilderset(Matrix4fc m)
-
-
-
Constructor Detail
-
FrustumRayBuilder
public FrustumRayBuilder()
Create a newFrustumRayBuilderwith an undefined frustum.Before obtaining ray directions, make sure to define the frustum using
set(Matrix4fc).
-
FrustumRayBuilder
public FrustumRayBuilder(Matrix4fc m)
Create a newFrustumRayBuilderfrom the givenmatrixby extracing the matrix's frustum.- Parameters:
m- theMatrix4fcto create the frustum from
-
-
Method Detail
-
set
public FrustumRayBuilder set(Matrix4fc m)
Update the stored frustum corner rays and origin ofthisFrustumRayBuilderwith the givenmatrix.Reference: Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix
Reference: http://geomalgorithms.com
- Parameters:
m- thematrixto update the frustum corner rays and origin with- Returns:
- this
-
origin
public Vector3fc origin(Vector3f origin)
Store the eye/origin of the perspective frustum in the givenorigin.- Parameters:
origin- will hold the perspective origin- Returns:
- the
originvector
-
dir
public 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.The parameters
xandyare used to interpolate the generated ray direction from the bottom-left to the top-right frustum corners.- Parameters:
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 direction- Returns:
- the
dirvector
-
-