Leviathan  0.8.0.0
Leviathan game engine
Ray.h
Go to the documentation of this file.
1 // Leviathan Game Engine
2 // Copyright (c) 2012-2019 Henri Hyyryläinen
3 #pragma once
4 #include "Define.h"
5 // ------------------------------------ //
6 #include "Types.h"
7 
8 #include "bsfUtility/Math/BsRay.h"
9 
10 namespace Leviathan {
11 struct Plane;
12 
14 struct Ray {
15 public:
16  inline Ray() {}
17 
18  inline Ray(const Float3& origin, const Float3& direction) :
19  Origin(origin), Direction(direction)
20  {}
21 
22  inline Ray(const bs::Ray& bsray) :
23  Origin(bsray.getOrigin()), Direction(bsray.getDirection())
24  {}
25 
27  Float3 GetPoint(float distance) const
28  {
29  return Origin + (Direction * distance);
30  }
31 
32  const auto GetOrigin() const
33  {
34  return Origin;
35  }
36 
37  const auto GetDirection() const
38  {
39  return Direction;
40  }
41 
44  DLLEXPORT std::tuple<bool, float> CalculateIntersection(const Plane& plane) const;
45 
46 public:
49 };
50 
51 } // namespace Leviathan
52 
53 #ifdef LEAK_INTO_GLOBAL
54 using Leviathan::Ray;
55 #endif
Float3 Origin
Definition: Ray.h:47
const auto GetDirection() const
Definition: Ray.h:37
Ray starting from an origin with a direction.
Definition: Ray.h:14
Ray(const bs::Ray &bsray)
Definition: Ray.h:22
DLLEXPORT std::tuple< bool, float > CalculateIntersection(const Plane &plane) const
Definition: Ray.cpp:8
A plane represented by a normal and a distance.
Definition: Plane.h:12
Ray(const Float3 &origin, const Float3 &direction)
Definition: Ray.h:18
Float3 Direction
Definition: Ray.h:48
Float3 GetPoint(float distance) const
Definition: Ray.h:27
std::iterator_traits< octet_iterator >::difference_type distance(octet_iterator first, octet_iterator last)
Definition: checked.h:198
const auto GetOrigin() const
Definition: Ray.h:32
#define DLLEXPORT
Definition: Include.h:84
The access mask controls which registered functions and classes a script sees.
Definition: GameModule.h:12