Overte C++ Documentation
RotateFilter.h
1 //
2 // Created by Brad Hefta-Gaub 2017/04/11
3 // Copyright 2017 High Fidelity, Inc.
4 //
5 // Distributed under the Apache License, Version 2.0.
6 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
7 //
8 
9 #pragma once
10 #ifndef hifi_Controllers_Filters_Rotate_h
11 #define hifi_Controllers_Filters_Rotate_h
12 
13 #include <glm/gtx/transform.hpp>
14 
15 #include "../Filter.h"
16 
17 namespace controller {
18 
19 class RotateFilter : public Filter {
20  REGISTER_FILTER_CLASS(RotateFilter);
21 public:
22  RotateFilter() = default;
23  RotateFilter(glm::quat rotation) : _rotation(rotation) {}
24 
25  virtual AxisValue apply(AxisValue value) const override { return value; }
26 
27  virtual Pose apply(Pose value) const override {
28  return value.transform(glm::mat4(glm::quat(_rotation)));
29  }
30 
31  virtual bool parseParameters(const QJsonValue& parameters) override { return parseQuatParameter(parameters, _rotation); }
32 
33 private:
34  glm::quat _rotation;
35 };
36 
37 }
38 
39 #endif