Minetest  5.4.0
pointedthing.h
Go to the documentation of this file.
1 /*
2 Minetest
3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14 
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 #pragma once
21 
22 #include "irrlichttypes.h"
23 #include "irr_v3d.h"
24 #include <iostream>
25 #include <string>
26 
28 {
32 };
33 
36 {
64  s16 object_id = -1;
82  u16 box_id = 0;
87  f32 distanceSq = 0;
88 
90  PointedThing() = default;
92  PointedThing(const v3s16 &under, const v3s16 &above,
93  const v3s16 &real_under, const v3f &point, const v3s16 &normal,
94  u16 box_id, f32 distSq);
96  PointedThing(s16 id, const v3f &point, const v3s16 &normal, f32 distSq);
97  std::string dump() const;
98  void serialize(std::ostream &os) const;
99  void deSerialize(std::istream &is);
103  bool operator==(const PointedThing &pt2) const;
104  bool operator!=(const PointedThing &pt2) const;
105 };
core::vector3d< s16 > v3s16
Definition: irr_v3d.h:28
core::vector3df v3f
Definition: irr_v3d.h:26
PointedThingType
Definition: pointedthing.h:28
@ POINTEDTHING_OBJECT
Definition: pointedthing.h:31
@ POINTEDTHING_NODE
Definition: pointedthing.h:30
@ POINTEDTHING_NOTHING
Definition: pointedthing.h:29
An active object or node which is selected by a ray on the map.
Definition: pointedthing.h:36
f32 distanceSq
Definition: pointedthing.h:87
std::string dump() const
Definition: pointedthing.cpp:48
v3s16 node_abovesurface
Definition: pointedthing.h:53
v3s16 intersection_normal
Definition: pointedthing.h:77
PointedThing()=default
Constructor for POINTEDTHING_NOTHING.
s16 object_id
Definition: pointedthing.h:64
u16 box_id
Definition: pointedthing.h:82
v3s16 node_undersurface
Definition: pointedthing.h:46
bool operator!=(const PointedThing &pt2) const
Definition: pointedthing.cpp:131
v3f intersection_point
Definition: pointedthing.h:70
void deSerialize(std::istream &is)
Definition: pointedthing.cpp:89
PointedThingType type
The type of the pointed object.
Definition: pointedthing.h:38
void serialize(std::ostream &os) const
Definition: pointedthing.cpp:72
bool operator==(const PointedThing &pt2) const
Definition: pointedthing.cpp:110
v3s16 node_real_undersurface
Definition: pointedthing.h:59