cangine
Loading...
Searching...
No Matches
Classes | Namespaces | Macros
shader.hpp File Reference
#include <iostream>
#include <fstream>
#include <sstream>
#include "../engine/exception.hpp"
Include dependency graph for shader.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  cangine::Shader
 Wraps a compiled and linked OpenGL shader program. More...
 
struct  cangine::Shader::SourceTag
 

Namespaces

namespace  cangine
 

Macros

#define CANGINE_DEFAULT_VERT_SRC   R"(#version 330 corelayout (location = 0) in vec3 aPos;layout (location = 1) in vec4 aColor;layout (location = 2) in vec2 uv;out vec4 ColorOut;out vec2 vUv;void main(){ gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0); ColorOut = aColor; vUv = uv;})"
 
#define CANGINE_DEFAULT_FRAG_SRC   R"(#version 330 coreout vec4 FragColor;in vec4 ColorOut;in vec2 vUv;uniform sampler2D uTexture;uniform bool uUseTexture;uniform bool uMono;void main(){ if (uUseTexture) { if (uMono) { float alpha = texture(uTexture, vUv).r; FragColor = vec4(ColorOut.rgb, alpha * ColorOut.a); } else { vec4 t = texture(uTexture, vUv) * ColorOut; FragColor = t; } } else { FragColor = ColorOut; }})"
 

Macro Definition Documentation

◆ CANGINE_DEFAULT_FRAG_SRC

#define CANGINE_DEFAULT_FRAG_SRC   R"(#version 330 coreout vec4 FragColor;in vec4 ColorOut;in vec2 vUv;uniform sampler2D uTexture;uniform bool uUseTexture;uniform bool uMono;void main(){ if (uUseTexture) { if (uMono) { float alpha = texture(uTexture, vUv).r; FragColor = vec4(ColorOut.rgb, alpha * ColorOut.a); } else { vec4 t = texture(uTexture, vUv) * ColorOut; FragColor = t; } } else { FragColor = ColorOut; }})"

◆ CANGINE_DEFAULT_VERT_SRC

#define CANGINE_DEFAULT_VERT_SRC   R"(#version 330 corelayout (location = 0) in vec3 aPos;layout (location = 1) in vec4 aColor;layout (location = 2) in vec2 uv;out vec4 ColorOut;out vec2 vUv;void main(){ gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0); ColorOut = aColor; vUv = uv;})"