blob: 8435ac0012e22af52f1fa672e3e5cc99ef9caa94 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// targetmanager.h - BGFX render target manager
//
// Maintains a string-to-entry mapping for any registered
// render targets.
//
//============================================================
#pragma once
#ifndef __DRAWBGFX_TARGET_MANAGER__
#define __DRAWBGFX_TARGET_MANAGER__
#include <map>
#include <string>
#include <bgfx/bgfx.h>
#include "texturemanager.h"
class bgfx_target;
class target_manager {
public:
target_manager(texture_manager& textures) : m_textures(textures), m_guest_width(16), m_guest_height(16) { }
~target_manager();
bgfx_target* create_target(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, bool filter = false);
bgfx_target* create_target(std::string name, void *handle, uint32_t width, uint32_t height);
void update_guest_targets(uint16_t width, uint16_t height);
// Getters
bgfx_target* target(std::string name);
uint16_t guest_width() const { return m_guest_width; }
uint16_t guest_height() const { return m_guest_height; }
private:
bgfx_target* create_target(std::string name);
std::map<std::string, bgfx_target*> m_targets;
texture_manager& m_textures;
uint16_t m_guest_width;
uint16_t m_guest_height;
};
#endif // __DRAWBGFX_TARGET_MANAGER__
|