Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
raycast.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2016 juhdanad, Daniel Juhasz <juhdanad@gmail.com>
4
5#pragma once
6
7#include "voxelalgorithms.h"
8#include "util/pointedthing.h"
9
12{
13 bool operator() (const PointedThing &pt1, const PointedThing &pt2) const;
14};
15
18{
19public:
25 RaycastState(const core::line3d<f32> &shootline, bool objects_pointable,
26 bool liquids_pointable, const std::optional<Pointabilities> &pointabilities);
27
29 core::line3d<f32> m_shootline;
34
39 std::priority_queue<PointedThing, std::vector<PointedThing>, RaycastSort> m_found;
40
43 const std::optional<Pointabilities> m_pointabilities;
44
46 core::aabbox3d<s16> m_search_range { 0, 0, 0, 0, 0, 0 };
47
50};
51
62bool boxLineCollision(const aabb3f &box, v3f start, v3f dir,
63 v3f *collision_point, v3f *collision_normal);
64
65bool boxLineCollision(const aabb3f &box, v3f box_rotation,
66 v3f start, v3f dir,
67 v3f *collision_point, v3f *collision_normal, v3f *raw_collision_normal);
static v2f dir(const v2f &pos_dist)
Definition camera.cpp:191
Describes the state of a raycast.
Definition raycast.h:18
v3s16 m_previous_node
Previous tested node during the raycast.
Definition raycast.h:33
core::aabbox3d< s16 > m_search_range
The code needs to search these nodes around the center node.
Definition raycast.h:46
std::priority_queue< PointedThing, std::vector< PointedThing >, RaycastSort > m_found
Definition raycast.h:39
core::line3d< f32 > m_shootline
Shootline of the raycast.
Definition raycast.h:29
bool m_initialization_needed
If true, the Environment will initialize this state.
Definition raycast.h:49
bool m_objects_pointable
Definition raycast.h:41
bool m_liquids_pointable
Definition raycast.h:42
voxalgo::VoxelLineIterator m_iterator
Iterator to store the progress of the raycast.
Definition raycast.h:31
const std::optional< Pointabilities > m_pointabilities
Definition raycast.h:43
RaycastState(const core::line3d< f32 > &shootline, bool objects_pointable, bool liquids_pointable, const std::optional< Pointabilities > &pointabilities)
Definition raycast.cpp:45
core::aabbox3d< f32 > aabb3f
Definition irr_aabb3d.h:11
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
core::vector3df v3f
Definition irr_v3d.h:11
bool boxLineCollision(const aabb3f &box, v3f start, v3f dir, v3f *collision_point, v3f *collision_normal)
Definition raycast.cpp:58
An active object or node which is selected by a ray on the map.
Definition pointedthing.h:22
Sorts PointedThings based on their distance.
Definition raycast.h:12
bool operator()(const PointedThing &pt1, const PointedThing &pt2) const
Definition raycast.cpp:11
Definition voxelalgorithms.h:74