-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFramebuffer.h
More file actions
69 lines (63 loc) · 2.69 KB
/
Copy pathFramebuffer.h
File metadata and controls
69 lines (63 loc) · 2.69 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright 2022, University of Freiburg
// Author: Joel Stanciu (joelstanciu@outlook.de)
#ifndef FRAMEBUFFER_H_
#define FRAMEBUFFER_H_
#include <cstddef>
#include <climits>
#include <cfloat>
#include <vector>
#include <utility>
/*
This class represents a data structure which contains
important information about the a pixels 2D Space, in the Terminal,
which are contained inside of a 3D calculated Object
*/
class Framebuffer {
public:
// ____________________________________________________________________________
// Constructor
Framebuffer(size_t width, size_t height);
// ____________________________________________________________________________
// Destructor
~Framebuffer();
// ____________________________________________________________________________
// Initializes a Frame into the data structure, containing its correspondend
// depth and color value. A new Frame gets only placed inside of the
// data structure when its depth is greater then the previus/standard frame
// inside of this structure. By this the impression of 3Dimensionality
// is being produced while constantly iterating over all pixels without
// destroying relevant information on the depth
void initFrame(size_t pX, size_t pY, float depth, size_t color);
// ____________________________________________________________________________
// Getter for the Depth value at the given x and y Point on the screen
float getDepth(size_t pX, size_t pY);
// ____________________________________________________________________________
// Getter for the Color value at the given x and y Point on the screen
size_t getColor(size_t pX, size_t pY);
// ____________________________________________________________________________
// Resets the data structure to its standard value
// By that each depth value will be set to FLOAT_MAX
// and each color value will be set to INT_MAX
void reset();
// ____________________________________________________________________________
// Getter for the Width representing a dimension of the size of the data
// structure. Most likely the Width of the Terminal
size_t getWidth() {
return width_;
}
// ____________________________________________________________________________
// Getter for the Height representing a demnsion of the size of the data
// strucutre. Most likely the Height of the Teriminal
size_t getHeight() {
return height_;
}
// ____________________________________________________________________________
private:
size_t width_;
size_t height_;
std::vector<std::vector<float>> depth_;
std::vector<std::vector<size_t>> color_;
std::vector<std::vector<float>> depth_uninitialized_;
std::vector<std::vector<size_t>> color_uninitialized_;
};
#endif // FRAMEBUFFER_H_