Geometry general shader.
More...
|
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) |
|
◆ 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
-
rayOrigin | the origin of the ray |
rayDir | the direction of the ray (normalized) |
extent | the half size of the box in its local frame |
roots | will 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
-
rayOrigin | the origin of the ray |
rayDir | the direction of the ray (normalized) |
radius | the radius of the sphere to intersect |
roots | will 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
-
p | the point to trnasform |
csAngle | precomputed cosine and sine of the rotation angle |
- Returns
- the transformed point
The documentation for this class was generated from the following file:
- resources/common/shaders/geometry.glsl