-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtexture.h
74 lines (60 loc) · 1.84 KB
/
texture.h
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
70
71
72
73
74
#ifndef TEXTURE_H
#define TEXTURE_H
#include <stdio.h>//tmp
#include <vector>
#include <map>
#include <GL/glu.h>
#include "texload.h"
#include "vec2.h"
/* Probability distributions */
class Probability_Distribution_Function {
protected:
typedef long integer;
typedef double real;
public:
virtual real operator()(const real x) const = 0;
};
class Gauss : public Probability_Distribution_Function {
private:
real mu, sigma; // Parameters
real A, B; // Implementation commodities
public:
Gauss();
Gauss(const real u = 0.0, const real s = 1.0);
real operator()(const real x) const;
};
class Gamma : public Probability_Distribution_Function {
private:
integer alpha, theta; // Parameters
real A, B; // Implementation commodities
public:
Gamma();
Gamma(const integer a, const integer t);
real operator()(const real x) const;
};
/* Texture */
class Texture {
private:
typedef double real;
bool isPowerOfTwo(const GLint size) const;
void eval1DProbDistrib(const Probability_Distribution_Function& P,
std::vector<real>& function,
const int first, const int size) const;
void filterImageBorders(std::vector<GLfloat>& image, const int pixel_size,
const int width, const int height) const;
void buildMipmaps(const Probability_Distribution_Function& P,
const GLint symmetry, const int filter_type) const;
std::vector<GLsizei> dimensions;
public:
enum imageformat {SGI_ALPHA, SGI_RGB, SGI_RGBA};
enum textureformat {ALPHA, RGB, RGBA};
enum filtertype {NO_FILTER, CIRCULAR_GAUSSIAN_FILTER};
Texture();
Texture(char* file_name, const int image_format = SGI_RGB,
const int texture_format = RGB);
Texture(const Probability_Distribution_Function& P,
const GLint symmetry, const std::vector<GLsizei>& dims,
const int filter_type = NO_FILTER);
GLuint name;
};
#endif // TEXTURE_H