VR-Engage
2.3
Loading...
Searching...
No Matches
inputEvaluator.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 2025 MAK Technologies, Inc.
3
** All rights reserved.
4
******************************************************************************/
5
6
//! \file
7
//! \brief Defines evaluators that convert input data to actions
8
9
#pragma once
10
11
#include "
vreInput/export.h
"
12
13
#include <string>
14
#include <vector>
15
#include <memory>
16
17
namespace
makVre
18
{
19
//! Forward declarations
20
class
DtValueTransform
;
21
class
DtVreInputManager
;
22
class
DtInitTable
;
23
struct
DtInputData
;
24
struct
DtAction
;
25
26
//! \brief Evaluates input data and converts it to actions
27
//!
28
//! This class evaluates input data from devices and determines if it should
29
//! trigger an action. It applies transformations to the input values and
30
//! handles features like input repetition and smoothing.
31
class
VREINPUT_DLL
DtInputEvaluator
32
{
33
public
:
34
//! \brief Constructor that initializes the evaluator
35
//!
36
//! Creates a new input evaluator with the given configuration.
37
//!
38
//! \param mapper Reference to the input manager
39
//! \param group The input group name for organizing related evaluators
40
//! \param config Pointer to the configuration data for this evaluator
41
DtInputEvaluator
(
DtVreInputManager
& mapper,
const
std::string& group,
DtInitTable
* config);
42
43
//! \brief Virtual destructor
44
virtual
~DtInputEvaluator
();
45
46
//! \brief Copy constructor (deleted)
47
//!
48
//! Input evaluators cannot be copied due to unique ownership of transforms
49
DtInputEvaluator
(
const
DtInputEvaluator
& mapping) =
delete
;
50
51
//! \brief Assignment operator (deleted)
52
//!
53
//! Input evaluators cannot be assigned due to unique ownership of transforms
54
DtInputEvaluator
&
operator=
(
const
DtInputEvaluator
&) =
delete
;
55
56
//! \brief Evaluates input data to determine if an action should be triggered
57
//!
58
//! Processes the input data by applying transformations and determining
59
//! if it should trigger the associated action. If an action is triggered,
60
//! it creates an Action event and dispatches it to the event manager.
61
//!
62
//! \param data The input data structure containing the event information
63
//! \return True if an action was triggered, false otherwise
64
virtual
bool
evaluate
(
const
DtInputData
& data);
65
66
//! \brief Initializes or reinitializes the evaluator
67
//!
68
//! Resets the state of the evaluator to its initial values. May be called
69
//! multiple times to reset the evaluator's state during runtime.
70
virtual
void
initialize
();
71
72
//! \brief Updates time-based functionality for input evaluation
73
//!
74
//! Handles time-based evaluations such as input repetition based on
75
//! the configured repeat rate. Should be called once per frame.
76
//!
77
//! \param dt Delta time in seconds since the last frame
78
virtual
void
tick
(
double
dt);
79
80
//! \brief Checks if the action associated with this evaluator can be triggered
81
//!
82
//! Determines whether an action handler is registered for this evaluator's action.
83
//! If no handler is registered, the action cannot be evaluated or triggered.
84
//!
85
//! \return True if the action can be evaluated (has a registered handler), false otherwise
86
virtual
bool
canEvaluate
()
const
;
87
88
//! \brief Gets the action name associated with this evaluator
89
//!
90
//! Returns the name of the action that this evaluator triggers when
91
//! its input conditions are met.
92
//!
93
//! \return String containing the action name
94
virtual
const
std::string&
getActionName
()
const
{
return
myAction
; }
95
96
//! \brief Executes the associated action with the given value
97
//!
98
//! Passes the transformed input value to the registered action handler,
99
//! triggering the action in the system.
100
//!
101
//! \param value The final transformed value to pass to the action handler
102
virtual
void
executeAction
(
float
value);
103
104
protected
:
105
//! \brief Reference to the input manager that owns this evaluator
106
DtVreInputManager
&
myManager
;
107
108
//! \brief Group name this evaluator's action is part of.
109
std::string
myGroup
;
110
111
//! \brief Name of the action associated with this evaluator
112
std::string
myAction
;
113
114
//! \brief List of value transformations to apply to input values
115
std::vector<std::unique_ptr<DtValueTransform>>
myTransforms
;
116
117
//! \brief Current input value after processing
118
float
myInputValue
;
119
120
//! \brief Flag indicating if input should be repeated when held
121
bool
myRepeatInput
;
122
123
//! \brief Rate at which input should be repeated (in Hz)
124
float
myRepeatRate
;
125
126
//! \brief Simulation time when the next repeated input should occur
127
double
myNextRepeatTime
;
128
129
//! \brief Flag indicating if input smoothing is enabled
130
bool
mySmoothing
;
131
132
//! \brief Buffer for smoothing input values
133
float
myInputBuffer
;
134
};
135
136
}
// namespace makVre
makVre::DtInitTable
Table-based access to Lua state for configuration data.
Definition
initializer.h:38
makVre::DtInputEvaluator::myRepeatInput
bool myRepeatInput
Flag indicating if input should be repeated when held.
Definition
inputEvaluator.h:121
makVre::DtInputEvaluator::myTransforms
std::vector< std::unique_ptr< DtValueTransform > > myTransforms
List of value transformations to apply to input values.
Definition
inputEvaluator.h:115
makVre::DtInputEvaluator::operator=
DtInputEvaluator & operator=(const DtInputEvaluator &)=delete
Assignment operator (deleted)
makVre::DtInputEvaluator::myManager
DtVreInputManager & myManager
Reference to the input manager that owns this evaluator.
Definition
inputEvaluator.h:106
makVre::DtInputEvaluator::getActionName
virtual const std::string & getActionName() const
Gets the action name associated with this evaluator.
Definition
inputEvaluator.h:94
makVre::DtInputEvaluator::myGroup
std::string myGroup
Group name this evaluator's action is part of.
Definition
inputEvaluator.h:109
makVre::DtInputEvaluator::evaluate
virtual bool evaluate(const DtInputData &data)
Evaluates input data to determine if an action should be triggered.
makVre::DtInputEvaluator::myAction
std::string myAction
Name of the action associated with this evaluator.
Definition
inputEvaluator.h:112
makVre::DtInputEvaluator::myNextRepeatTime
double myNextRepeatTime
Simulation time when the next repeated input should occur.
Definition
inputEvaluator.h:127
makVre::DtInputEvaluator::canEvaluate
virtual bool canEvaluate() const
Checks if the action associated with this evaluator can be triggered.
makVre::DtInputEvaluator::myInputValue
float myInputValue
Current input value after processing.
Definition
inputEvaluator.h:118
makVre::DtInputEvaluator::initialize
virtual void initialize()
Initializes or reinitializes the evaluator.
makVre::DtInputEvaluator::DtInputEvaluator
DtInputEvaluator(DtVreInputManager &mapper, const std::string &group, DtInitTable *config)
Constructor that initializes the evaluator.
makVre::DtInputEvaluator::myInputBuffer
float myInputBuffer
Buffer for smoothing input values.
Definition
inputEvaluator.h:133
makVre::DtInputEvaluator::~DtInputEvaluator
virtual ~DtInputEvaluator()
Virtual destructor.
makVre::DtInputEvaluator::DtInputEvaluator
DtInputEvaluator(const DtInputEvaluator &mapping)=delete
Copy constructor (deleted)
makVre::DtInputEvaluator::myRepeatRate
float myRepeatRate
Rate at which input should be repeated (in Hz)
Definition
inputEvaluator.h:124
makVre::DtInputEvaluator::mySmoothing
bool mySmoothing
Flag indicating if input smoothing is enabled.
Definition
inputEvaluator.h:130
makVre::DtInputEvaluator::executeAction
virtual void executeAction(float value)
Executes the associated action with the given value.
makVre::DtInputEvaluator::tick
virtual void tick(double dt)
Updates time-based functionality for input evaluation.
makVre::DtValueTransform
Abstract base class for transforming input values.
Definition
valueTransform.h:24
makVre::DtVreInputManager
Central manager for input device handling, action mapping, and input processing.
Definition
vreInputManager.h:81
export.h
Defines DLL export/import macros for the vreInput library.
VREINPUT_DLL
#define VREINPUT_DLL
DLL export/import macro for the vreInput library.
Definition
export.h:25
makVre
!
Definition
glsVreMessageUtil.h:50
makVre::DtAction
Structure representing an input action with a name and value.
Definition
vreInputManager.h:39
makVre::DtInputData
Structure for transferring input data through the input system.
Definition
inputData.h:89
Generated on 2026-10-22 from SVN revision 296863 - Copyright © 2005-2026 MAK Technologies. All Rights Reserved.