forked from gameprogcpp/code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGBuffer.h
More file actions
42 lines (37 loc) · 1.01 KB
/
GBuffer.h
File metadata and controls
42 lines (37 loc) · 1.01 KB
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
// ----------------------------------------------------------------
// From Game Programming in C++ by Sanjay Madhav
// Copyright (C) 2017 Sanjay Madhav. All rights reserved.
//
// Released under the BSD License
// See LICENSE in root directory for full details.
// ----------------------------------------------------------------
#pragma once
#include <vector>
class GBuffer
{
public:
// Different types of data stored in the G-buffer
enum Type
{
EDiffuse = 0,
ENormal,
EWorldPos,
NUM_GBUFFER_TEXTURES
};
GBuffer();
~GBuffer();
// Create/destroy the G-buffer
bool Create(int width, int height);
void Destroy();
// Get the texture for a specific type of data
class Texture* GetTexture(Type type);
// Get the framebuffer object ID
unsigned int GetBufferID() const { return mBufferID; }
// Setup all the G-buffer textures for sampling
void SetTexturesActive();
private:
// Textures associated with G-buffer
std::vector<class Texture*> mTextures;
// Frame buffer object ID
unsigned int mBufferID;
};