Overte C++ Documentation
Pose.h
1 //
2 // Created by Bradley Austin Davis on 2015/10/18
3 // (based on UserInputMapper inner class created by Sam Gateau on 4/27/15)
4 // Copyright 2015 High Fidelity, Inc.
5 // Copyright 2023 Overte e.V.
6 //
7 // Distributed under the Apache License, Version 2.0.
8 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
9 // SPDX-License-Identifier: Apache-2.0
10 //
11 
12 #pragma once
13 #ifndef hifi_controllers_Pose_h
14 #define hifi_controllers_Pose_h
15 #include <ScriptValue.h>
16 
17 class ScriptEngine;
18 
19 #include <GLMHelpers.h>
20 
21 namespace controller {
22 
23  struct Pose {
24  public:
25  vec3 translation;
26  quat rotation;
27  vec3 velocity;
28  vec3 angularVelocity;
29  bool valid{ false };
30 
31  Pose() {}
32  Pose(const vec3& translation, const quat& rotation,
33  const vec3& velocity = vec3(), const vec3& angularVelocity = vec3());
34 
35  Pose(const Pose&) = default;
36  Pose& operator = (const Pose&) = default;
37  bool operator ==(const Pose& right) const;
38  bool operator !=(const Pose& right) const { return !(*this == right); }
39  bool isValid() const { return valid; }
40  vec3 getTranslation() const { return translation; }
41  quat getRotation() const { return rotation; }
42  vec3 getVelocity() const { return velocity; }
43  vec3 getAngularVelocity() const { return angularVelocity; }
44  mat4 getMatrix() const { return createMatFromQuatAndPos(rotation, translation); }
45 
46  Pose transform(const glm::mat4& mat) const;
47  Pose postTransform(const glm::mat4& mat) const;
48 
49  static ScriptValue toScriptValue(ScriptEngine* engine, const Pose& event);
50  static bool fromScriptValue(const ScriptValue& object, Pose& event);
51  };
52 }
53 
54 //Q_DECLARE_METATYPE(controller::Pose);
55 
56 #endif
Provides an engine-independent interface for a scripting engine.
Definition: ScriptEngine.h:93
[ScriptInterface] Provides an engine-independent interface for QScriptValue
Definition: ScriptValue.h:40