69 lines
1.6 KiB
C++
69 lines
1.6 KiB
C++
/**
|
|
This file is a part of our_dick
|
|
Copyright (C) 2022 rexy712
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef OUR_DICK_GRAPHICS_WIP_BASE_SHADER_HPP
|
|
#define OUR_DICK_GRAPHICS_WIP_BASE_SHADER_HPP
|
|
|
|
namespace wip::gfx::base_shader{
|
|
|
|
static constexpr char vertex_shader_text[] =
|
|
R"glsl(
|
|
#version 430 core
|
|
|
|
layout (location = 0) in vec3 position;
|
|
layout (location = 1) in vec2 tex_coords;
|
|
|
|
|
|
layout (std140) uniform mvp_matrix{
|
|
mat4 vp_mat;
|
|
mat4 model_mat;
|
|
};
|
|
|
|
out VS_OUT{
|
|
vec2 tex_coords;
|
|
}vs_out;
|
|
|
|
const vec4 vertices[6] = vec4[](vec4(0,1,0,1), vec4(0,0,0,1), vec4(1,0,0,1), vec4(1,0,0,1), vec4(1,1,0,1), vec4(0,1,0,1));
|
|
|
|
void main(){
|
|
gl_Position = vp_mat * model_mat * vec4(position, 1);
|
|
vs_out.tex_coords = tex_coords;
|
|
}
|
|
)glsl";
|
|
|
|
static constexpr char fragment_shader_text[] =
|
|
R"glsl(
|
|
#version 430 core
|
|
|
|
in VS_OUT{
|
|
vec2 tex_coords;
|
|
}fs_in;
|
|
|
|
out vec4 frag_color;
|
|
|
|
uniform sampler2D diffuse_texture;
|
|
|
|
void main(){
|
|
frag_color = texture(diffuse_texture, fs_in.tex_coords);;
|
|
}
|
|
)glsl";
|
|
|
|
}
|
|
|
|
#endif
|