Overte C++ Documentation
RegionState.h
1 //
2 // RegionState.h
3 // libraries/workload/src/workload
4 //
5 // Created by Andrew Meadows 2018.03.07
6 // Copyright 2018 High Fidelity, Inc.
7 //
8 // Originally from lighthouse3d. Modified to utilize glm::vec3 and clean up to our coding standards
9 // Simple plane class.
10 //
11 // Distributed under the Apache License, Version 2.0.
12 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
13 //
14 
15 #ifndef hifi_workload_RegionState_h
16 #define hifi_workload_RegionState_h
17 
18 #include "Space.h"
19 #include "Engine.h"
20 
21 namespace workload {
22  class RegionStateConfig : public Job::Config{
23  Q_OBJECT
24  Q_PROPERTY(float numR0 READ getNumR0 NOTIFY dirty)
25  Q_PROPERTY(float numR1 READ getNumR1 NOTIFY dirty)
26  Q_PROPERTY(float numR2 READ getNumR2 NOTIFY dirty)
27  Q_PROPERTY(float numR3 READ getNumR3 NOTIFY dirty)
28  public:
29 
30  uint32_t getNumR0() const { return data.numR0; }
31  uint32_t getNumR1() const { return data.numR1; }
32  uint32_t getNumR2() const { return data.numR2; }
33  uint32_t getNumR3() const { return data.numR3; }
34 
35  void setNum(const uint32_t r0, const uint32_t r1, const uint32_t r2, const uint32_t r3) {
36  data.numR0 = r0; data.numR1 = r1; data.numR2 = r2; data.numR3 = r3; emit dirty();
37  }
38 
39  struct Data {
40  uint32_t numR0{ 0 };
41  uint32_t numR1{ 0 };
42  uint32_t numR2{ 0 };
43  uint32_t numR3{ 0 };
44  } data;
45 
46  signals:
47  void dirty();
48  };
49 
50  class RegionState {
51  public:
52  using Config = RegionStateConfig;
53  using Inputs = IndexVectors;
54  using JobModel = workload::Job::ModelI<RegionState, Inputs, Config>;
55 
56  RegionState() { _state.resize(workload::Region::NUM_TRACKED_REGIONS); }
57 
58  void configure(const Config& config);
59  void run(const workload::WorkloadContextPointer& renderContext, const Inputs& inputs);
60 
61  protected:
62  IndexVectors _state;
63  };
64 }
65 #endif // hifi_workload_RegionState_h