-
Notifications
You must be signed in to change notification settings - Fork 0
/
NormalMappingProgram.cpp
31 lines (25 loc) · 1.12 KB
/
NormalMappingProgram.cpp
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
#include "NormalMappingProgram.h"
#include "FileHelper.h"
#include "Resource.h"
NormalMappingProgram::NormalMappingProgram(Recipe & recipe) : TextureShaderProgram(recipe)
{
}
NormalMappingProgram NormalMappingProgram::create()
{
return NormalMappingProgram(
Recipe()
.addShader(Shader::compile(Shader::VertexShader, FileHelper::loadTextFile("shaders/Transform.glsl")))
.addShader(Shader::compile(Shader::VertexShader, FileHelper::loadTextFile("shaders/NormalMap.vert")))
.addShader(Shader::compile(Shader::FragmentShader, FileHelper::loadTextFile("shaders/Transform.glsl")))
.addShader(Shader::compile(Shader::FragmentShader, FileHelper::loadTextFile("shaders/SimpleIlluminationModel.glsl")))
.addShader(Shader::compile(Shader::FragmentShader, FileHelper::loadTextFile("shaders/NormalMap.frag")))
);
}
void NormalMappingProgram::onPreDraw(const Model & model) const {
TextureShaderProgram::onPreDraw(model);
this->initTexture(2, "in_texNormal", model.getNormalTexture());
}
void NormalMappingProgram::onPostDraw(const Model & model) const {
this->uninitTexture(2, "in_texNormal");
TextureShaderProgram::onPostDraw(model);
}