VR-Engage  2.2
Loading...
Searching...
No Matches
vrvIntersector.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file vrvIntersector.h
7//! \brief Defines a VRV-based terrain and scene intersector
8//!
9//! The DtVrvIntersector class provides functionality for performing various types
10//! of intersection tests with the 3D scene, including ray casting, terrain elevation
11//! queries, and screen-space picking. It serves as a bridge between the VRE player
12//! station and the VRV rendering engine's intersection capabilities.
13
14#pragma once
15
18#include <vrvCore/DtIntersector.h>
19
20namespace makVrv
21{
22//! Forward declaration of the display engine class
23class DtDe;
24
25//! Forward declaration of the VRV intersector class
26class DtIntersector;
27} // namespace makVrv
28
29namespace makVre
30{
31//! \brief VRV-based implementation of the intersector interface
32//!
33//! This class provides terrain intersection, ray casting, and screen picking
34//! functionality using the VRV rendering engine. It handles coordinate
35//! transformations between local and network (geocentric) coordinate systems
36//! and supports various types of intersection queries against the 3D scene.
38{
39public:
40 //! \brief Constructor that initializes with a reference to the display engine
41 //! \param de Reference to the VRV display engine
42 //!
43 //! Creates a VRV intersector for the 3D model set and initializes internal state.
44 DtVrvIntersector(makVrv::DtDe& de);
45
46 //! \brief Virtual destructor to properly clean up resources
47 //!
48 //! Deletes the internal VRV intersector object.
49 virtual ~DtVrvIntersector() override;
50
51 //! \brief Gets the terrain elevation at a specific point
52 //! \param point The point in geocentric coordinates to query (only lat/lon are used)
53 //! \param result The resulting elevation in meters
54 //! \return True if the elevation was successfully determined, false otherwise
55 //!
56 //! Determines the terrain elevation at the specified geocentric point by
57 //! casting a ray downward from a high altitude and finding the intersection
58 //! with the terrain. The result is returned as an altitude value in meters.
59 virtual bool elevationAt(DtVector point, double& result) override;
60
61 //! \brief Gets the terrain intersection point at a specific location
62 //! \param point The point in geocentric coordinates to query (only lat/lon are used)
63 //! \param result The resulting intersection point in geocentric coordinates
64 //! \return True if an intersection was found, false otherwise
65 //!
66 //! Casts a ray downward from a high altitude at the specified lat/lon and
67 //! returns the geocentric coordinates of the intersection with the terrain.
68 virtual bool terrainIntersectionAt(DtVector point, DtVector& result) override;
69
70 //! \brief Gets the first intersection between two points
71 //! \param start The starting point in geocentric coordinates
72 //! \param end The ending point in geocentric coordinates
73 //! \param result The resulting intersection point in geocentric coordinates
74 //! \param ignoreId Optional list of element IDs to ignore during intersection testing
75 //! \return True if an intersection was found, false otherwise
76 //!
77 //! Tests for an intersection along the line segment between start and end,
78 //! returning the first intersection point encountered with pickable nodes.
79 virtual bool getIntersection(
80 DtVector start, DtVector end, DtVector& result, std::vector<makVrv::DtElementID>* ignoreId = 0) override;
81
82 //! \brief Gets the first intersection along a ray from a point in a direction
83 //! \param start The starting point in geocentric coordinates
84 //! \param ori The orientation defining the ray direction
85 //! \param result The resulting intersection point in geocentric coordinates
86 //! \param ignoreId Optional list of element IDs to ignore during intersection testing
87 //! \return True if an intersection was found, false otherwise
88 //!
89 //! Tests for an intersection along a ray defined by a start point and orientation,
90 //! returning the first intersection point encountered with pickable nodes.
91 virtual bool getIntersection(
92 DtVector start, DtTaitBryan ori, DtVector& result, std::vector<makVrv::DtElementID>* ignoreId = 0) override;
93
94 //! \brief Performs a ray cast from screen coordinates
95 //! \param x The normalized x screen coordinate (0.0 to 1.0, left to right)
96 //! \param y The normalized y screen coordinate (0.0 to 1.0, top to bottom)
97 //! \param result The resulting intersection point in geocentric coordinates
98 //! \return True if an intersection was found, false otherwise
99 //!
100 //! Projects a ray from the camera through the specified screen coordinates
101 //! and returns the first intersection with pickable nodes in the scene.
102 virtual bool screenRayCast(float x, float y, DtVector& result) override;
103
104 //! \brief Extended screen ray casting with additional control options
105 //! \param x The normalized x screen coordinate (0.0 to 1.0, left to right)
106 //! \param y The normalized y screen coordinate (0.0 to 1.0, top to bottom)
107 //! \param result The resulting intersection point in geocentric coordinates
108 //! \param id Output parameter that receives the element ID of the intersected object
109 //! \param props Properties that control which types of nodes to test against
110 //! \param ignoreId Optional list of element IDs to ignore during intersection testing
111 //! \param window Optional window name to use for picking (defaults to current)
112 //! \param channel Optional channel name to use for picking (defaults to current)
113 //! \return True if an intersection was found, false otherwise
114 //!
115 //! Extended version of screenRayCast that provides additional control over
116 //! the intersection test, including which types of nodes to test against,
117 //! specific windows and channels to use, and retrieving the element ID
118 //! of the intersected object.
119 virtual bool screenRayCast(float x, float y, DtVector& result, makVrv::DtElementID& id,
120 makVrv::DtIntersector::IntersectProperties props = makVrv::DtIntersector::SupportNodes,
121 std::vector<makVrv::DtElementID>* ignoreId = 0, const std::string& window = "", const std::string& channel = "");
122
123protected:
124 //! \brief Reference to the VRV display engine
125 makVrv::DtDe& myDe;
126
127 //! \brief Pointer to the internal VRV intersector implementation
128 makVrv::DtIntersector* myIntersector;
129};
130} // namespace makVre
DtIntersector()
Constructor.
makVrv::DtDe & myDe
Reference to the VRV display engine.
Definition vrvIntersector.h:125
makVrv::DtIntersector * myIntersector
Pointer to the internal VRV intersector implementation.
Definition vrvIntersector.h:128
virtual bool screenRayCast(float x, float y, DtVector &result) override
Performs a ray cast from screen coordinates.
virtual bool elevationAt(DtVector point, double &result) override
Gets the terrain elevation at a specific point.
virtual bool getIntersection(DtVector start, DtTaitBryan ori, DtVector &result, std::vector< makVrv::DtElementID > *ignoreId=0) override
Gets the first intersection along a ray from a point in a direction.
virtual bool screenRayCast(float x, float y, DtVector &result, makVrv::DtElementID &id, makVrv::DtIntersector::IntersectProperties props=makVrv::DtIntersector::SupportNodes, std::vector< makVrv::DtElementID > *ignoreId=0, const std::string &window="", const std::string &channel="")
Extended screen ray casting with additional control options.
virtual ~DtVrvIntersector() override
Virtual destructor to properly clean up resources.
DtVrvIntersector(makVrv::DtDe &de)
Constructor that initializes with a reference to the display engine.
virtual bool getIntersection(DtVector start, DtVector end, DtVector &result, std::vector< makVrv::DtElementID > *ignoreId=0) override
Gets the first intersection between two points.
virtual bool terrainIntersectionAt(DtVector point, DtVector &result) override
Gets the terrain intersection point at a specific location.
Defines export macros for the VR-Engage Player Station library.
#define PLAYERSTATION_DLL
Definition export.h:24
Defines the DtIntersector interface for ray casting and intersection testing.
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
Definition appLauncherComponent.h:28
makVrv::DtDe * de()
Gets the display element pointer used by the plugin.