Leviathan  0.8.0.0
Leviathan game engine
Leviathan::GUIOverlayRenderer Class Referencefinal

#include <GUIOverlayRenderer.h>

+ Inheritance diagram for Leviathan::GUIOverlayRenderer:

Public Member Functions

 GUIOverlayRenderer ()
 
bool check (const bs::ct::Camera &camera) override
 
void render (const bs::ct::Camera &camera) override
 
void initialize (const bs::Any &data) override
 
void destroy () override
 
void UpdateShownOverlays (uint64_t target, const std::vector< bs::SPtr< bs::ct::Texture >> &overlays)
 

Detailed Description

Definition at line 15 of file GUIOverlayRenderer.h.

Constructor & Destructor Documentation

◆ GUIOverlayRenderer()

GUIOverlayRenderer::GUIOverlayRenderer ( )

Definition at line 13 of file GUIOverlayRenderer.cpp.

13  :
14  bs::RendererExtension(bs::RenderLocation::Overlay, 1)
15 {}

Member Function Documentation

◆ check()

bool Leviathan::GUIOverlayRenderer::check ( const bs::ct::Camera &  camera)
inlineoverride

Definition at line 19 of file GUIOverlayRenderer.h.

20  {
21  return GetOverlaysOnCamera(camera) != nullptr;
22  }

◆ destroy()

void GUIOverlayRenderer::destroy ( )
override

Definition at line 33 of file GUIOverlayRenderer.cpp.

34 {
35  QuadParamsSet.reset();
36  ScreenQuad.reset();
37  QuadMaterial.reset();
38  FullScreenOverlays.clear();
39 }

◆ initialize()

void GUIOverlayRenderer::initialize ( const bs::Any &  data)
override

Definition at line 17 of file GUIOverlayRenderer.cpp.

18 {
19  const auto& initData = bs::any_cast_ref<GUIOverlayInitializationData>(data);
20 
21  ScreenQuad = initData.ScreenQuad;
22  QuadMaterial = initData.QuadMaterial;
23 
24  if(QuadMaterial->getNumTechniques() < 1) {
25  LOG_FATAL("No techniques in overlay material");
26  return;
27  }
28 
29  QuadParamsSet = QuadMaterial->createParamsSet(0);
30  LOG_INFO("Initialized GUIOverlayRenderer");
31 }
#define LOG_INFO(x)
Definition: Define.h:88
#define LOG_FATAL(x)
Definition: Define.h:92

◆ render()

void GUIOverlayRenderer::render ( const bs::ct::Camera &  camera)
override

Definition at line 41 of file GUIOverlayRenderer.cpp.

42 {
43  const auto* overlays = GetOverlaysOnCamera(camera);
44 
45  if(!overlays)
46  return;
47 
48  auto& rapi = bs::ct::RenderAPI::instance();
49 
50  bs::ct::gRendererUtility().setPass(QuadMaterial);
51 
52  bs::ct::gRendererUtility().setPassParams(QuadParamsSet);
53 
54  for(const auto& texture : *overlays) {
55 
56  QuadMaterial->setTexture("image", texture);
57  QuadParamsSet->update(QuadMaterial->_getInternalParams());
58 
59  bs::ct::gRendererUtility().draw(ScreenQuad);
60  }
61 }

◆ UpdateShownOverlays()

void Leviathan::GUIOverlayRenderer::UpdateShownOverlays ( uint64_t  target,
const std::vector< bs::SPtr< bs::ct::Texture >> &  overlays 
)
inline
Parameters
targetis the identifier for the bs::RenderTarget, currently the pointer to the core version

Definition at line 31 of file GUIOverlayRenderer.h.

33  {
34  LOG_INFO("shown overlay count (on: " + std::to_string(target) +
35  "): " + std::to_string(overlays.size()));
36  FullScreenOverlays[target] = overlays;
37  }
#define LOG_INFO(x)
Definition: Define.h:88

The documentation for this class was generated from the following files: