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:
34  virtual void copyCurrentViewFrustum(ViewFrustum& viewOut) const = 0;
35 
36  virtual const ConicalViewFrustums& getConicalViews() const = 0;
37 
38  virtual QThread* getMainThread() = 0;
39 
40  virtual PickRay computePickRay(float x, float y) const = 0;
41 
42  virtual glm::vec3 getAvatarPosition() const = 0;
43 
44  // Unfortunately, having this here is a bad idea. Lots of objects connect to
45  // the aboutToQuit signal, and it's impossible to know the order in which
46  // the receivers will be called, so this might return false negatives
47  //virtual bool isAboutToQuit() const = 0;
48 
49  // Queue code to execute on the main thread.
50  // If called from the main thread, the lambda will execute synchronously
51  virtual void postLambdaEvent(const std::function<void()>& f) = 0;
52  // Synchronously execute code on the main thread. This function will
53  // not return until the code is executed, regardles of which thread it
54  // is called from
55  virtual void sendLambdaEvent(const std::function<void()>& f) = 0;
56 
57  virtual qreal getDevicePixelRatio() = 0;
58 
59  virtual render::ScenePointer getMain3DScene() = 0;
60  virtual render::EnginePointer getRenderEngine() = 0;
61 
62  virtual void pushPostUpdateLambda(void* key, const std::function<void()>& func) = 0;
63 
64  virtual bool isHMDMode() const = 0;
65 
66  // FIXME - we shouldn't assume that there's a single instance of an AbstractViewStateInterface
67  static AbstractViewStateInterface* instance();
68  static void setInstance(AbstractViewStateInterface* instance);
69 };
70 
71 #endif // hifi_AbstractViewStateInterface_h
Interface provided by Application to other objects that need access to the current view state details...
Definition: AbstractViewStateInterface.h:31
virtual void copyCurrentViewFrustum(ViewFrustum &viewOut) const =0
copies the current view frustum for rendering the view state