0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / AIS / AIS_WalkDelta.hxx
CommitLineData
49582f9d 1// Copyright (c) 2019 OPEN CASCADE SAS
2//
3// This file is part of Open CASCADE Technology software library.
4//
5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
10//
11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
13
14#ifndef _AIS_WalkDelta_HeaderFile
15#define _AIS_WalkDelta_HeaderFile
16
17#include <Standard_Real.hxx>
18
19//! Walking translation components.
20enum AIS_WalkTranslation
21{
22 AIS_WalkTranslation_Forward = 0, //!< translation delta, Forward walk
23 AIS_WalkTranslation_Side, //!< translation delta, Side walk
24 AIS_WalkTranslation_Up, //!< translation delta, Up walk
25};
26
27//! Walking rotation components.
28enum AIS_WalkRotation
29{
30 AIS_WalkRotation_Yaw = 0, //!< yaw rotation angle
31 AIS_WalkRotation_Pitch, //!< pitch rotation angle
32 AIS_WalkRotation_Roll, //!< roll rotation angle
33};
34
35//! Walking value.
36struct AIS_WalkPart
37{
38 Standard_Real Value; //!< value
39 Standard_Real Pressure; //!< key pressure
40 Standard_Real Duration; //!< duration
41
42 //! Return TRUE if delta is empty.
43 bool IsEmpty() const { return Abs (Value) <= RealSmall(); }
44
45 //! Empty constructor.
46 AIS_WalkPart() : Value (0.0), Pressure (1.0), Duration (0.0) {}
47};
48
49//! Walking values.
50struct AIS_WalkDelta
51{
52 //! Empty constructor.
53 AIS_WalkDelta()
54 : myIsJumping (false), myIsCrouching (false), myIsRunning (false) {}
55
56 //! Return translation component.
57 const AIS_WalkPart& operator[] (AIS_WalkTranslation thePart) const { return myTranslation[thePart]; }
58
59 //! Return translation component.
60 AIS_WalkPart& operator[] (AIS_WalkTranslation thePart) { return myTranslation[thePart]; }
61
62 //! Return rotation component.
63 const AIS_WalkPart& operator[] (AIS_WalkRotation thePart) const { return myRotation[thePart]; }
64
65 //! Return rotation component.
66 AIS_WalkPart& operator[] (AIS_WalkRotation thePart) { return myRotation[thePart]; }
67
68 //! Return jumping state.
69 bool IsJumping() const { return myIsJumping; }
70
71 //! Set jumping state.
72 void SetJumping (bool theIsJumping) { myIsJumping = theIsJumping; }
73
74 //! Return crouching state.
75 bool IsCrouching() const { return myIsCrouching; }
76
77 //! Set crouching state.
78 void SetCrouching (bool theIsCrouching) { myIsCrouching = theIsCrouching; }
79
80 //! Return running state.
81 bool IsRunning() const { return myIsRunning; }
82
83 //! Set running state.
84 void SetRunning (bool theIsRunning) { myIsRunning = theIsRunning; }
85
86 //! Return TRUE when both Rotation and Translation deltas are empty.
87 bool IsEmpty() const { return !ToMove() && !ToRotate(); }
88
89 //! Return TRUE if translation delta is defined.
90 bool ToMove() const
91 {
92 return !myTranslation[AIS_WalkTranslation_Forward].IsEmpty()
93 || !myTranslation[AIS_WalkTranslation_Side].IsEmpty()
94 || !myTranslation[AIS_WalkTranslation_Up].IsEmpty();
95 }
96
97 //! Return TRUE if rotation delta is defined.
98 bool ToRotate() const
99 {
100 return !myRotation[AIS_WalkRotation_Yaw].IsEmpty()
101 || !myRotation[AIS_WalkRotation_Pitch].IsEmpty()
102 || !myRotation[AIS_WalkRotation_Roll].IsEmpty();
103 }
104
105private:
106
107 AIS_WalkPart myTranslation[3];
108 AIS_WalkPart myRotation[3];
109 bool myIsJumping;
110 bool myIsCrouching;
111 bool myIsRunning;
112
113};
114
115#endif // _AIS_WalkDelta_HeaderFile