1 | // Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QT3DINPUT_INPUT_AXISACCUMULATOR_H |
5 | #define QT3DINPUT_INPUT_AXISACCUMULATOR_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists for the convenience |
12 | // of other Qt classes. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <Qt3DInput/qaxisaccumulator.h> |
19 | #include <Qt3DInput/private/backendnode_p.h> |
20 | #include <Qt3DCore/qbackendnode.h> |
21 | #include <Qt3DCore/qnodeid.h> |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | |
25 | namespace Qt3DInput { |
26 | namespace Input { |
27 | |
28 | class AxisManager; |
29 | |
30 | class Q_AUTOTEST_EXPORT AxisAccumulator : public BackendNode |
31 | { |
32 | public: |
33 | AxisAccumulator(); |
34 | void cleanup(); |
35 | |
36 | Qt3DCore::QNodeId sourceAxisId() const { return m_sourceAxisId; } |
37 | QAxisAccumulator::SourceAxisType sourceAxisType() const { return m_sourceAxisType; } |
38 | float scale() const { return m_scale; } |
39 | |
40 | float value() const noexcept { return m_value; } |
41 | void setValue(float value); |
42 | |
43 | float velocity() const noexcept { return m_velocity; } |
44 | void setVelocity(float velocity); |
45 | |
46 | void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override; |
47 | |
48 | void stepIntegration(AxisManager *axisManager, float dt); |
49 | |
50 | private: |
51 | Qt3DCore::QNodeId m_sourceAxisId; |
52 | QAxisAccumulator::SourceAxisType m_sourceAxisType; |
53 | float m_scale; |
54 | float m_value; |
55 | float m_velocity; |
56 | }; |
57 | |
58 | } // namespace Input |
59 | } // namespace Qt3DInput |
60 | |
61 | QT_END_NAMESPACE |
62 | |
63 | #endif // QT3DINPUT_INPUT_AXISACCUMULATOR_H |
64 | |