Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Member Functions | List of all members
GPUShaders::Common::Geometry Class Reference

Geometry general shader. More...

Public Member Functions

bool intersectSphere (vec3 rayOrigin, vec3 rayDir, float radius, out vec2 roots)
 
bool intersectBox (vec3 rayOrigin, vec3 rayDir, vec3 extent, out vec2 roots)
 
vec3 rotateY (vec3 p, vec2 csAngle)
 

Detailed Description

Geometry general shader.

See also
GPUShaders::Common::Constants

Member Function Documentation

◆ intersectBox()

bool GPUShaders::Common::Geometry::intersectBox ( vec3  rayOrigin,
vec3  rayDir,
vec3  extent,
out vec2  roots 
)
inline

Check if a box of a given extent is intersected by a ray defined by an origin and a normalized direction in the frame where the box is centered and axis-aligned.

Parameters
rayOriginthe origin of the ray
rayDirthe direction of the ray (normalized)
extentthe half size of the box in its local frame
rootswill contain the distances to the two intersections with the box
Returns
true if there is intersection.
Warning
The intersections can be in the negative direction along the ray. Check the sign of the roots to know.

◆ intersectSphere()

bool GPUShaders::Common::Geometry::intersectSphere ( vec3  rayOrigin,
vec3  rayDir,
float  radius,
out vec2  roots 
)
inline

Check if a sphere of a given radius is intersected by a ray defined by an origin wrt to the sphere center and a normalized direction.

Parameters
rayOriginthe origin of the ray
rayDirthe direction of the ray (normalized)
radiusthe radius of the sphere to intersect
rootswill contain the two roots of the associated polynomial, ordered.
Returns
true if there is intersection.
Warning
The intersection can be in the negative direction along the ray. Check the sign of the roots to know.

◆ rotateY()

vec3 GPUShaders::Common::Geometry::rotateY ( vec3  p,
vec2  csAngle 
)
inline

Rotate a point around the vertical axis.

Parameters
pthe point to trnasform
csAngleprecomputed cosine and sine of the rotation angle
Returns
the transformed point

The documentation for this class was generated from the following file: