mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
minor refactor + 4 spaces indentation
This commit is contained in:
parent
5bc79c8a77
commit
4d70138b24
8 changed files with 381 additions and 325 deletions
|
|
@ -255,4 +255,4 @@ RayRelation Ray::intersectAABBFaces(
|
|||
|
||||
if (isIntersect) return RayRelation::Intersect;
|
||||
return RayRelation::None;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,25 +9,24 @@
|
|||
|
||||
#include <array>
|
||||
|
||||
typedef glm::highp_dvec3 rayvec3;
|
||||
typedef glm::highp_dvec2 rayvec2;
|
||||
typedef double scalar_t;
|
||||
using rayvec3 = glm::highp_dvec3;
|
||||
using rayvec2 = glm::highp_dvec2;
|
||||
using scalar_t = double;
|
||||
|
||||
enum class RayRelation{
|
||||
enum class RayRelation {
|
||||
Embed=2, Intersect=1, Parallel=0, None=0
|
||||
};
|
||||
|
||||
class AABBFaces{
|
||||
class AABBFaces {
|
||||
static const unsigned char AABBFACES_COUNT = 6;
|
||||
public:
|
||||
std::array<std::pair<rayvec3, rayvec2>, AABBFACES_COUNT> faces; // every face is min-point and opposite corner point
|
||||
|
||||
AABBFaces(){};
|
||||
AABBFaces(const rayvec3& parentBoxPos, const AABB& parentBox);
|
||||
|
||||
};
|
||||
|
||||
class Ray{
|
||||
class Ray {
|
||||
public:
|
||||
rayvec3 origin;
|
||||
rayvec3 dir;
|
||||
|
|
@ -45,7 +44,7 @@ public:
|
|||
const rayvec3& faceMin,
|
||||
const rayvec2& faceOppositeCorner);
|
||||
|
||||
//returns normal and distance
|
||||
///returns normal and distance
|
||||
RayRelation intersectYZFace(
|
||||
const rayvec3& faceMin,
|
||||
const rayvec2& faceOppositeCorner,
|
||||
|
|
@ -63,17 +62,17 @@ public:
|
|||
scalar_t& distance_ret);
|
||||
|
||||
RayRelation intersectAABB(
|
||||
const rayvec3& boxPos,
|
||||
const AABB& box,
|
||||
float maxDist,
|
||||
glm::ivec3& normal_ret,
|
||||
scalar_t& distance_ret);
|
||||
const rayvec3& boxPos,
|
||||
const AABB& box,
|
||||
float maxDist,
|
||||
glm::ivec3& normal_ret,
|
||||
scalar_t& distance_ret);
|
||||
|
||||
RayRelation intersectAABBFaces( // calculates only normal and distance
|
||||
const AABBFaces& boxFaces,
|
||||
float maxDist,
|
||||
glm::ivec3& normal_ret,
|
||||
scalar_t& distance_ret);
|
||||
const AABBFaces& boxFaces,
|
||||
float maxDist,
|
||||
glm::ivec3& normal_ret,
|
||||
scalar_t& distance_ret);
|
||||
};
|
||||
|
||||
#endif // SRC_VOXNATHS_H_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue