mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Cleanup.
This commit is contained in:
@@ -423,11 +423,6 @@ Ray makeRay(float _x, float _y, const float* _invVp)
|
||||
return ray;
|
||||
}
|
||||
|
||||
inline Vec3 getPointAt(const Ray& _ray, float _t)
|
||||
{
|
||||
return mad(_ray.dir, _t, _ray.pos);
|
||||
}
|
||||
|
||||
bool intersect(const Ray& _ray, const Aabb& _aabb, Hit* _hit)
|
||||
{
|
||||
const Vec3 invDir = rcp(_ray.dir);
|
||||
@@ -717,16 +712,13 @@ bool intersect(const Ray& _ray, const Cone& _cone, Hit* _hit)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool intersect(const Ray& _ray, const Plane& _plane, Hit* _hit)
|
||||
bool intersect(const Ray& _ray, const Plane& _plane, bool _doublesided, Hit* _hit)
|
||||
{
|
||||
const float dist = distance(_plane, _ray.pos);
|
||||
if (0.0f > dist)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const float dist = distance(_plane, _ray.pos);
|
||||
const float ndotd = dot(_ray.dir, _plane.normal);
|
||||
if (0.0f < ndotd)
|
||||
|
||||
if (!_doublesided
|
||||
&& (0.0f > dist || 0.0f < ndotd) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -82,6 +82,9 @@ struct Hit
|
||||
bx::Plane plane = bx::init::None;
|
||||
};
|
||||
|
||||
///
|
||||
bx::Vec3 getPointAt(const Ray& _ray, float _t);
|
||||
|
||||
///
|
||||
bx::Vec3 getCenter(const Aabb& _aabb);
|
||||
|
||||
@@ -169,6 +172,9 @@ bool intersect(const Ray& _ray, const Disk& _disk, Hit* _hit = NULL);
|
||||
/// Intersect ray / plane.
|
||||
bool intersect(const Ray& _ray, const bx::Plane& _plane, Hit* _hit = NULL);
|
||||
|
||||
/// Intersect ray / plane.
|
||||
bool intersect(const Ray& _ray, const bx::Plane& _plane, bool _doublesided, Hit* _hit = NULL);
|
||||
|
||||
/// Intersect ray / sphere.
|
||||
bool intersect(const Ray& _ray, const Sphere& _sphere, Hit* _hit = NULL);
|
||||
|
||||
|
||||
@@ -7,6 +7,16 @@
|
||||
# error "Must be included from bounds.h!"
|
||||
#endif // BOUNDS_H_HEADER_GUARD
|
||||
|
||||
inline bx::Vec3 getPointAt(const Ray& _ray, float _t)
|
||||
{
|
||||
return bx::mad(_ray.dir, _t, _ray.pos);
|
||||
}
|
||||
|
||||
inline bool intersect(const Ray& _ray, const bx::Plane& _plane, Hit* _hit)
|
||||
{
|
||||
return intersect(_ray, _plane, false, _hit);
|
||||
}
|
||||
|
||||
inline bool overlap(const Aabb& _aabb, const Sphere& _sphere)
|
||||
{
|
||||
return overlap(_sphere, _aabb);
|
||||
|
||||
Reference in New Issue
Block a user