BVB Source Codes

CRYENGINE Show IEffectSystem.h Source code

Return Download CRYENGINE: download IEffectSystem.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: Manage the activation and lifetime of multiple effects.
  8.  
  9.    -------------------------------------------------------------------------
  10.    History:
  11.    - 17:01:2006:                Created by Marco Koegler
  12.  
  13. *************************************************************************/
  14.  
  15. #ifndef __IEFFECTSYSTEM_H__
  16. #define __IEFFECTSYSTEM_H__
  17. #pragma once
  18.  
  19. #include <CryGame/IGameFramework.h>
  20.  
  21. typedef int32 EffectId;
  22.  
  23. /*
  24.    IEffects at the beginning are inactive. They can be activated through the
  25.    IEffectSystem. At this point the effect starts to receive OnActivate() calls. It
  26.    can transition to the next state by responding with a return value of true. As long
  27.    as false is returned OnActivate will continue being called. Once true is returned,
  28.    the effect will transition to the active state and OnUpdate() will get called on it
  29.  
  30.    Since activating, updating and deactivating effects are processed in that order, it
  31.    is possible for an effect to go through this lifecycle within a single frame!!!
  32.  */
  33.  
  34. enum EEffectState
  35. {
  36.         eES_Deactivated,
  37.         eES_Activating,
  38.         eES_Updating,
  39.         eES_Deactivating,
  40. };
  41.  
  42. struct IEffect
  43. {
  44.         virtual ~IEffect(){}
  45.  
  46.         // processing
  47.         virtual bool Activating(float delta) = 0;
  48.         virtual bool Update(float delta) = 0;
  49.         virtual bool Deactivating(float delta) = 0;
  50.  
  51.         // events
  52.         virtual bool OnActivate() = 0;
  53.         virtual bool OnDeactivate() = 0;
  54.  
  55.         // state management and information
  56.         virtual void         SetState(EEffectState state) = 0;
  57.         virtual EEffectState GetState() = 0;
  58.  
  59.         virtual void         GetMemoryUsage(ICrySizer* s) const = 0;
  60. };
  61.  
  62. struct IGroundEffect
  63. {
  64.         enum EGroundEffectFlags
  65.         {
  66.                 eGEF_AlignToGround = (1 << 0),
  67.                 eGEF_AlignToOcean  = (1 << 1), // takes higher precedence than AlignToGround
  68.                 eGEF_PrimeEffect   = (1 << 2),
  69.                 eGEF_StickOnGround = (1 << 3),
  70.         };
  71.  
  72.         virtual ~IGroundEffect(){}
  73.  
  74.         // set maximum height
  75.         virtual void SetHeight(float height) = 0;
  76.  
  77.         // use if effect should be scaled dependending on height ratio.
  78.         // scale(zero height) = 1,1
  79.         // scale(max height) = sizeScale,countScale
  80.         // use e.g. sizeScale=0,countScale=0 to fade it out completely at max height
  81.         virtual void SetHeightScale(float sizeScale, float countScale) = 0;
  82.  
  83.         // set additional scale parameters, if user control is needed
  84.         // these are always multiplied by height scale parameters
  85.         virtual void SetBaseScale(float sizeScale, float countScale, float speedScale = 1.f) = 0;
  86.  
  87.         // set interpolation speed for size scale
  88.         // speed 0 means no interpolation
  89.         virtual void SetInterpolation(float speed) = 0;
  90.  
  91.         virtual void SetFlags(int flags) = 0;
  92.         virtual int  GetFlags() const = 0;
  93.  
  94.         virtual bool SetParticleEffect(const char* name) = 0;
  95.  
  96.         // if an interaction name is set, the particle effect is looked up in MaterialEffects.
  97.         // if not, one can still call SetParticleEffect by herself
  98.         virtual void SetInteraction(const char* name) = 0;
  99.  
  100.         // must be called by user
  101.         virtual void Update() = 0;
  102.  
  103.         //stop == true will keep the effect on hold until a stop == false is set.
  104.         virtual void Stop(bool stop) = 0;
  105. };
  106.  
  107. struct IEffectSystem
  108. {
  109.         virtual ~IEffectSystem(){}
  110.  
  111.         virtual bool           Init() = 0;
  112.         virtual void           Update(float delta) = 0;
  113.         virtual void           Shutdown() = 0;
  114.         virtual void           GetMemoryStatistics(ICrySizer* s) = 0;
  115.  
  116.         virtual EffectId       GetEffectId(const char* name) = 0;
  117.  
  118.         virtual void           Activate(const EffectId& eid) = 0;
  119.         virtual bool           BindEffect(const char* name, IEffect* pEffect) = 0;
  120.         virtual IGroundEffect* CreateGroundEffect(IEntity* pEntity) = 0;
  121.  
  122.         DECLARE_GAMEOBJECT_FACTORY(IEffect);
  123. };
  124.  
  125. #endif //__IEFFECTSYSTEM_H__
  126.  
downloadIEffectSystem.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