Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
IntersectionRecord.h
Go to the documentation of this file.
1/*
2Copyright (c) 2018 DIVIDE-Studio
3Copyright (c) 2009 Ionut Cava
4
5This file is part of DIVIDE Framework.
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software
9and associated documentation files (the "Software"), to deal in the Software
10without restriction,
11including without limitation the rights to use, copy, modify, merge, publish,
12distribute, sublicense,
13and/or sell copies of the Software, and to permit persons to whom the
14Software is furnished to do so,
15subject to the following conditions:
16
17The above copyright notice and this permission notice shall be included in
18all copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED,
22INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23PARTICULAR PURPOSE AND NONINFRINGEMENT.
24IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25DAMAGES OR OTHER LIABILITY,
26WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27IN CONNECTION WITH THE SOFTWARE
28OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30*/
31
32#pragma once
33#ifndef DVD_OCTREE_INTERSECTION_RECORD_H_
34#define DVD_OCTREE_INTERSECTION_RECORD_H_
35
37
38namespace Divide {
39
40class BoundsComponent;
41
43{
44 public:
45 IntersectionRecord() noexcept;
47 vec3<F32> hitNormal,
48 Ray ray,
49 D64 distance) noexcept;
51 IntersectionRecord(BoundsComponent* hitObject) noexcept;
52
54 void reset() noexcept;
55
66
70
71 bool _hasHit = false;
72
74 bool operator==(const IntersectionRecord& otherRecord) const noexcept;
75
76 [[nodiscard]] bool isEmpty() const noexcept {
77 return _intersectedObject1 == nullptr && _intersectedObject2 == nullptr;
78 }
79};
80
81using IntersectionContainer = eastl::fixed_vector<IntersectionRecord, 32u, true>;
82
83}; //namespace Divide
84
85#endif //DVD_OCTREE_INTERSECTION_RECORD_H_
BoundsComponent * _intersectedObject1
This is the object which is being intersected.
vec3< F32 > _normal
This is the normal of the surface at the point of intersection.
vec3< F32 > _position
This is the exact point in 3D space which has an intersection.
BoundsComponent * _intersectedObject2
This is the other object being intersected (may be null, as in the case of a ray-object intersection)
bool isEmpty() const noexcept
bool operator==(const IntersectionRecord &otherRecord) const noexcept
check the object identities between the two intersection records. If they match in either order,...
Ray _ray
This is the ray which caused the intersection.
void reset() noexcept
Reset all information contained by this record.
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
eastl::fixed_vector< IntersectionRecord, 32u, true > IntersectionContainer
double D64