BVB Source Codes

CRYENGINE Show ViewSystem.h Source code

Return Download CRYENGINE: download ViewSystem.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /*************************************************************************
  4.    -------------------------------------------------------------------------
  5.    $Id$
  6.    $DateTime$
  7.    Description: View System interfaces.
  8.  
  9.    -------------------------------------------------------------------------
  10.    History:
  11.    - 17:9:2004 : Created by Filippo De Luca
  12.    24:11:2005: added movie system (Craig Tiller)
  13. *************************************************************************/
  14. #ifndef __VIEWSYSTEM_H__
  15. #define __VIEWSYSTEM_H__
  16.  
  17. #if _MSC_VER > 1000
  18.         #pragma once
  19. #endif
  20.  
  21. #include "View.h"
  22. #include <CryMovie/IMovieSystem.h>
  23. #include <ILevelSystem.h>
  24.  
  25. //typedef std::map<string, IView *(*)()>        TViewClassMap;
  26.  
  27. class CViewSystem : public IViewSystem, public IMovieUser, public ILevelSystemListener
  28. {
  29.  
  30. private:
  31.  
  32.         typedef std::map<unsigned int, CView*> TViewMap;
  33.         typedef std::vector<unsigned int>      TViewIdVector;
  34.  
  35. public:
  36.  
  37.         //IViewSystem
  38.         virtual IView* CreateView() override;
  39.         virtual void   RemoveView(IView* pView) override;
  40.         virtual void   RemoveView(unsigned int viewId) override;
  41.  
  42.         virtual void   SetActiveView(IView* pView) override;
  43.         virtual void   SetActiveView(unsigned int viewId) override;
  44.  
  45.         //utility functions
  46.         virtual IView*       GetView(unsigned int viewId) const override;
  47.         virtual IView*       GetActiveView() const override;
  48.         virtual bool         IsClientActorViewActive() const override;
  49.  
  50.         virtual unsigned int GetViewId(IView* pView) const override;
  51.         virtual unsigned int GetActiveViewId() const override;
  52.  
  53.         virtual void         Serialize(TSerialize ser) override;
  54.         virtual void         PostSerialize() override;
  55.  
  56.         virtual IView*       GetViewByEntityId(EntityId id, bool forceCreate) override;
  57.  
  58.         virtual float        GetDefaultZNear() const override { return m_fDefaultCameraNearZ; };
  59.         virtual void         SetBlendParams(float fBlendPosSpeed, float fBlendRotSpeed, bool performBlendOut) override
  60.         {
  61.                 m_fBlendInPosSpeed = fBlendPosSpeed;
  62.                 m_fBlendInRotSpeed = fBlendRotSpeed;
  63.                 m_bPerformBlendOut = performBlendOut;
  64.         };
  65.         virtual void SetOverrideCameraRotation(bool bOverride, Quat rotation) override;
  66.         virtual bool IsPlayingCutScene() const override
  67.         {
  68.                 return m_cutsceneCount > 0;
  69.         }
  70.         virtual void UpdateSoundListeners() override;
  71.  
  72.         virtual void SetDeferredViewSystemUpdate(bool const bDeferred) override { m_useDeferredViewSystemUpdate = bDeferred; }
  73.         virtual bool UseDeferredViewSystemUpdate() const override               { return m_useDeferredViewSystemUpdate; }
  74.         virtual void SetControlAudioListeners(bool const bActive) override;
  75.         //~IViewSystem
  76.  
  77.         //IMovieUser
  78.         virtual void SetActiveCamera(const SCameraParams& Params) override;
  79.         virtual void BeginCutScene(IAnimSequence* pSeq, unsigned long dwFlags, bool bResetFX) override;
  80.         virtual void EndCutScene(IAnimSequence* pSeq, unsigned long dwFlags) override;
  81.         virtual void SendGlobalEvent(const char* pszEvent) override;
  82.         //virtual void PlaySubtitles( IAnimSequence* pSeq, ISound *pSound );
  83.         //~IMovieUser
  84.  
  85.         // ILevelSystemListener
  86.         virtual void OnLevelNotFound(const char* levelName) override                    {};
  87.         virtual void OnLoadingStart(ILevelInfo* pLevel) override;
  88.         virtual void OnLoadingLevelEntitiesStart(ILevelInfo* pLevel) override           {};
  89.         virtual void OnLoadingComplete(ILevelInfo* pLevel) override                     {};
  90.         virtual void OnLoadingError(ILevelInfo* pLevel, const char* error) override     {};
  91.         virtual void OnLoadingProgress(ILevelInfo* pLevel, int progressAmount) override {};
  92.         virtual void OnUnloadComplete(ILevelInfo* pLevel) override;
  93.         //~ILevelSystemListener
  94.  
  95.         explicit CViewSystem(ISystem* const pSystem);
  96.         ~CViewSystem();
  97.  
  98.         void Release() { delete this; };
  99.         void Update(float frameTime);
  100.  
  101.         //void RegisterViewClass(const char *name, IView *(*func)());
  102.  
  103.         bool AddListener(IViewSystemListener* pListener) override
  104.         {
  105.                 return stl::push_back_unique(m_listeners, pListener);
  106.         }
  107.  
  108.         bool RemoveListener(IViewSystemListener* pListener) override
  109.         {
  110.                 return stl::find_and_erase(m_listeners, pListener);
  111.         }
  112.  
  113.         void GetMemoryUsage(ICrySizer* s) const;
  114.  
  115.         void ClearAllViews();
  116.  
  117.         bool ShouldApplyHmdOffset() const { return m_bApplyHmdOffset != 0; }
  118.  
  119. private:
  120.  
  121.         void RemoveViewById(unsigned int viewId);
  122.         void ClearCutsceneViews();
  123.         void DebugDraw();
  124.  
  125.         ISystem* const m_pSystem;
  126.  
  127.         //TViewClassMap m_viewClasses;
  128.         TViewMap      m_views;
  129.         TViewIdVector m_cutsceneViewIdVector;
  130.  
  131.         // Listeners
  132.         std::vector<IViewSystemListener*> m_listeners;
  133.  
  134.         unsigned int                      m_activeViewId;
  135.         unsigned int                      m_nextViewIdToAssign; // next id which will be assigned
  136.         unsigned int                      m_preSequenceViewId;  // viewId before a movie cam dropped in
  137.  
  138.         unsigned int                      m_cutsceneViewId;
  139.         unsigned int                      m_cutsceneCount;
  140.  
  141.         bool                              m_bActiveViewFromSequence;
  142.  
  143.         bool                              m_bOverridenCameraRotation;
  144.         Quat                              m_overridenCameraRotation;
  145.         float                             m_fCameraNoise;
  146.         float                             m_fCameraNoiseFrequency;
  147.  
  148.         float                             m_fDefaultCameraNearZ;
  149.         float                             m_fBlendInPosSpeed;
  150.         float                             m_fBlendInRotSpeed;
  151.         bool                              m_bPerformBlendOut;
  152.         int                               m_nViewSystemDebug;
  153.  
  154.         int                               m_bApplyHmdOffset;
  155.  
  156.         bool                              m_useDeferredViewSystemUpdate;
  157.         bool                              m_bControlsAudioListeners;
  158. };
  159.  
  160. #endif //__VIEWSYSTEM_H__
  161.  
downloadViewSystem.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top