rework API
This commit is contained in:
@@ -13,14 +13,26 @@
|
||||
namespace OpenVulkano::Scene
|
||||
{
|
||||
class Drawable;
|
||||
class Node;
|
||||
|
||||
struct RayHit
|
||||
{
|
||||
Math::Vector3f point;
|
||||
Math::Vector3f normal;
|
||||
float distance;
|
||||
bool operator==(const RayHit& other) const = default;
|
||||
bool operator!=(const RayHit& other) const = default;
|
||||
float distance2;
|
||||
[[nodiscard]] float GetDistance() const
|
||||
{
|
||||
if (distance == -1)
|
||||
{
|
||||
distance = std::sqrt(distance2);
|
||||
}
|
||||
return distance;
|
||||
}
|
||||
bool operator==(const RayHit& other) const;
|
||||
bool operator!=(const RayHit& other) const;
|
||||
friend class Ray;
|
||||
private:
|
||||
mutable float distance = -1;
|
||||
};
|
||||
|
||||
struct DrawableRayHit : RayHit
|
||||
@@ -28,6 +40,7 @@ namespace OpenVulkano::Scene
|
||||
DrawableRayHit() = default;
|
||||
DrawableRayHit(const RayHit& hit) : RayHit(hit) {};
|
||||
Drawable* drawable = nullptr;
|
||||
Node* node = nullptr;
|
||||
};
|
||||
|
||||
class Ray
|
||||
|
||||
Reference in New Issue
Block a user