forked from mortennobel/SimpleRenderEngine
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgamma.cpp
More file actions
69 lines (54 loc) · 1.62 KB
/
Copy pathgamma.cpp
File metadata and controls
69 lines (54 loc) · 1.62 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
#include <iostream>
#include "sre/Texture.hpp"
#include "sre/Renderer.hpp"
#include "sre/Material.hpp"
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/euler_angles.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/transform.hpp>
#include <sre/SDLRenderer.hpp>
#include <sre/impl/GL.hpp>
using namespace sre;
class GammaTest{
public:
GammaTest(){
r.init();
mesh = Mesh::create().withQuad(0.5f)
.build();
camera.setWindowCoordinates();
mat1 = Shader::getUnlit()->createMaterial();
tex = Texture::create().withFile("test_data/gamma-test.png")
.withFilterSampling(false)
.build();
tex2 = Texture::create().withFile("test_data/gamma-small.png")
.withFilterSampling(false)
.withDumpDebug()
.build();
mat1->setTexture(tex2);
r.frameRender = [&](){
render();
};
r.startEventLoop();
}
void render(){
auto rp = RenderPass::create()
.withCamera(camera)
.withClearColor(true,{1,0,0,1})
.build();
rp.draw(mesh,
glm::translate(glm::vec3{(int)(tex->getWidth()*0.5),(int)(tex->getHeight()*0.5),0})*
glm::scale(glm::vec3(tex->getWidth(), tex->getHeight(),1)), mat1);
}
private:
float time;
SDLRenderer r;
Camera camera;
std::shared_ptr<Mesh> mesh;
std::shared_ptr<Material> mat1;
std::shared_ptr<Texture> tex;
std::shared_ptr<Texture> tex2;
};
int main() {
std::make_unique<GammaTest>();
return 0;
}