BVB Source Codes

CRYENGINE Show AILightManager.h Source code

Return Download CRYENGINE: download AILightManager.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /********************************************************************
  4.    -------------------------------------------------------------------------
  5.    File name:   AILightManager.h
  6.    $Id$
  7.    Description: Keeps track of the logical light level in the game world and
  8.              provides services to make light levels queries.
  9.  
  10.    -------------------------------------------------------------------------
  11.    History:
  12.    - 2007          : Created by Mikko Mononen
  13.  
  14.  *********************************************************************/
  15.  
  16. #ifndef _AILIGHTMANAGER_H_
  17. #define _AILIGHTMANAGER_H_
  18.  
  19. #if _MSC_VER > 1000
  20.         #pragma once
  21. #endif
  22.  
  23. #include <CryCore/StlUtils.h>
  24.  
  25. class CAILightManager
  26. {
  27. public:
  28.         CAILightManager();
  29.  
  30.         void Reset();
  31.         void Update(bool forceUpdate);
  32.         void DebugDraw();
  33.         void Serialize(TSerialize ser);
  34.  
  35.         void DynOmniLightEvent(const Vec3& pos, float radius, EAILightEventType type, CAIActor* pShooter, float time);
  36.         void DynSpotLightEvent(const Vec3& pos, const Vec3& dir, float radius, float fov, EAILightEventType type, CAIActor* pShooter, float time);
  37.  
  38.         // Returns light level at specified location
  39.         EAILightLevel GetLightLevelAt(const Vec3& pos, const CAIActor* pAgent = 0, bool* outUsingCombatLight = 0);
  40.  
  41. private:
  42.  
  43.         void DebugDrawArea(const ListPositions& poly, float zmin, float zmax, ColorB color);
  44.         void UpdateTimeOfDay();
  45.         void UpdateLights();
  46.  
  47.         struct SAIDynLightSource
  48.         {
  49.                 SAIDynLightSource(const Vec3& pos, const Vec3& dir, float radius, float fov, EAILightLevel level, EAILightEventType type, CWeakRef<CAIActor> _refShooter, CCountedRef<CAIObject> _refAttrib, float t) :
  50.                         pos(pos), dir(dir), radius(radius), fov(fov), level(level), type(type), refShooter(_refShooter), refAttrib(_refAttrib), t(0), tmax((int)(t * 1000.0f)) {}
  51.                 SAIDynLightSource() :
  52.                         pos(ZERO), dir(Vec3Constants<float>::fVec3_OneY), radius(0), fov(0), level(AILL_NONE), type(AILE_GENERIC), t(0), tmax((int)(t * 1000.0f)) {}
  53.                 SAIDynLightSource(const SAIDynLightSource& that) :
  54.                         pos(that.pos), dir(that.dir), radius(that.radius), fov(that.fov), level(that.level), type(that.type), t(that.t), tmax(that.tmax)
  55.                         , refShooter(that.refShooter), refAttrib(that.refAttrib) {}
  56.  
  57.                 void Serialize(TSerialize ser);
  58.  
  59.                 Vec3                   pos;
  60.                 Vec3                   dir;
  61.                 float                  radius;
  62.                 float                  fov;
  63.                 EAILightLevel          level;
  64.                 CWeakRef<CAIActor>     refShooter;
  65.                 CCountedRef<CAIObject> refAttrib;
  66.                 EAILightEventType      type;
  67.  
  68.                 int                    t;
  69.                 int                    tmax;
  70.         };
  71.         std::vector<SAIDynLightSource> m_dynLights;
  72.  
  73.         struct SAILightSource
  74.         {
  75.                 SAILightSource(const Vec3& pos, float radius, EAILightLevel level) :
  76.                         pos(pos), radius(radius), level(level)
  77.                 {
  78.                         // Empty
  79.                 }
  80.  
  81.                 Vec3          pos;
  82.                 float         radius;
  83.                 EAILightLevel level;
  84.         };
  85.  
  86.         std::vector<SAILightSource> m_lights;
  87.         bool                        m_updated;
  88.         EAILightLevel               m_ambientLight;
  89.  
  90.         CTimeValue                  m_lastUpdateTime;
  91. };
  92.  
  93. #endif
  94.  
downloadAILightManager.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