BVB Source Codes

CRYENGINE Show ColorGradientNode.cpp Source code

Return Download CRYENGINE: download ColorGradientNode.cpp Source code - Download CRYENGINE Source code - Type:.cpp
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #include "StdAfx.h"
  4.  
  5. #include "ColorGradientNode.h"
  6. #include "ColorGradientManager.h"
  7. #include <CryRenderer/IColorGradingController.h>
  8.  
  9. enum InputPorts
  10. {
  11.         eIP_Trigger,
  12. };
  13.  
  14. const SInputPortConfig CFlowNode_ColorGradient::inputPorts[] =
  15. {
  16.         InputPortConfig_Void("Trigger",            _HELP("")),
  17.         InputPortConfig<string>("tex_TexturePath", _HELP("Path to the Color Chart texture.")),
  18.         InputPortConfig<float>("TransitionTime",   _HELP("Fade in time (Seconds).")),
  19.         { 0 },
  20. };
  21.  
  22. CFlowNode_ColorGradient::CFlowNode_ColorGradient(SActivationInfo* pActivationInformation)
  23.         : m_pTexture(NULL)
  24. {
  25. }
  26.  
  27. CFlowNode_ColorGradient::~CFlowNode_ColorGradient()
  28. {
  29.         SAFE_RELEASE(m_pTexture);
  30. }
  31.  
  32. void CFlowNode_ColorGradient::GetConfiguration(SFlowNodeConfig& config)
  33. {
  34.         config.pInputPorts = inputPorts;
  35.         config.SetCategory(EFLN_ADVANCED);
  36. }
  37.  
  38. void CFlowNode_ColorGradient::ProcessEvent(EFlowEvent event, SActivationInfo* pActivationInformation)
  39. {
  40.         if (!gEnv->pRenderer)
  41.         {
  42.                 return;
  43.         }
  44.  
  45.         //Preload texture
  46.         if (event == IFlowNode::eFE_PrecacheResources && m_pTexture == nullptr)
  47.         {
  48.                 const string texturePath = GetPortString(pActivationInformation, eInputPorts_TexturePath);
  49.                 const uint32 COLORCHART_TEXFLAGS = FT_NOMIPS | FT_DONT_STREAM | FT_STATE_CLAMP;
  50.                 m_pTexture = gEnv->pRenderer->EF_LoadTexture(texturePath.c_str(), COLORCHART_TEXFLAGS);
  51.         }
  52.  
  53.         if (event == IFlowNode::eFE_Activate && IsPortActive(pActivationInformation, eIP_Trigger))
  54.         {
  55.                 const string texturePath = GetPortString(pActivationInformation, eInputPorts_TexturePath);
  56.                 const float timeToFade = GetPortFloat(pActivationInformation, eInputPorts_TransitionTime);
  57.                 CCryAction::GetCryAction()->GetColorGradientManager()->TriggerFadingColorGradient(texturePath, timeToFade);
  58.         }
  59. }
  60.  
  61. void CFlowNode_ColorGradient::GetMemoryUsage(ICrySizer* pSizer) const
  62. {
  63.         pSizer->Add(*this);
  64. }
  65.  
  66. REGISTER_FLOW_NODE("Image:ColorGradient", CFlowNode_ColorGradient);
  67.  
downloadColorGradientNode.cpp 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