Overte C++ Documentation
AbstractViewStateInterface.h
1 //
2 // AbstractViewStateInterface.h
3 // interface/src/renderer
4 //
5 // Created by Brad Hefta-Gaub on 12/16/14.
6 // Copyright 2014 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_AbstractViewStateInterface_h
13 #define hifi_AbstractViewStateInterface_h
14 
15 #include <glm/glm.hpp>
16 #include <functional>
17 
18 #include <render/Scene.h>
19 #include <render/Engine.h>
20 
21 #include <QtGlobal>
22 
23 class Transform;
24 class QThread;
25 class ViewFrustum;
26 class PickRay;
27 class ConicalViewFrustum;
28 using ConicalViewFrustums = std::vector<ConicalViewFrustum>;
29 
32 public:
33  virtual const ConicalViewFrustums& getConicalViews() const = 0;
34 
35  virtual QThread* getMainThread() = 0;
36 
37  virtual PickRay computePickRay(float x, float y) const = 0;
38 
39  virtual glm::vec3 getAvatarPosition() const = 0;
40 
41  // Unfortunately, having this here is a bad idea. Lots of objects connect to
42  // the aboutToQuit signal, and it's impossible to know the order in which
43  // the receivers will be called, so this might return false negatives
44  //virtual bool isAboutToQuit() const = 0;
45 
46  // Queue code to execute on the main thread.
47  // If called from the main thread, the lambda will execute synchronously
48  virtual void postLambdaEvent(const std::function<void()>& f) = 0;
49  // Synchronously execute code on the main thread. This function will
50  // not return until the code is executed, regardles of which thread it
51  // is called from
52  virtual void sendLambdaEvent(const std::function<void()>& f) = 0;
53 
54  virtual render::ScenePointer getMain3DScene() = 0;
55  virtual render::EnginePointer getRenderEngine() = 0;
56 
57  virtual void pushPostUpdateLambda(void* key, const std::function<void()>& func) = 0;
58 
59  virtual bool isHMDMode() const = 0;
60 
61  // FIXME - we shouldn't assume that there's a single instance of an AbstractViewStateInterface
62  static AbstractViewStateInterface* instance();
63  static void setInstance(AbstractViewStateInterface* instance);
64 };
65 
66 #endif // hifi_AbstractViewStateInterface_h
Interface provided by Application to other objects that need access to the current view state details...
Definition: AbstractViewStateInterface.h:31