mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 05:02:34 +00:00
Added shaders from i-mic-fps, preload shaders if cyberarm_engine/opengl has been required.
This commit is contained in:
28
assets/shaders/vertex/g_buffer.glsl
Normal file
28
assets/shaders/vertex/g_buffer.glsl
Normal file
@@ -0,0 +1,28 @@
|
||||
# version 330 core
|
||||
|
||||
layout(location = 0) in vec3 inPosition;
|
||||
layout(location = 1) in vec3 inColor;
|
||||
layout(location = 2) in vec3 inNormal;
|
||||
layout(location = 3) in vec3 inUV;
|
||||
|
||||
uniform mat4 projection, view, model;
|
||||
uniform int hasTexture;
|
||||
uniform vec3 cameraPos;
|
||||
|
||||
out vec3 outPosition, outColor, outNormal, outUV;
|
||||
out vec3 outFragPos, outViewPos, outCameraPos;
|
||||
flat out int outHasTexture;
|
||||
|
||||
void main() {
|
||||
// projection * view * model * position
|
||||
outPosition = inPosition;
|
||||
outColor = inColor;
|
||||
outNormal= normalize(transpose(inverse(mat3(model))) * inNormal);
|
||||
outUV = inUV;
|
||||
outHasTexture = hasTexture;
|
||||
outCameraPos = cameraPos;
|
||||
|
||||
outFragPos = vec3(model * vec4(inPosition, 1.0));
|
||||
|
||||
gl_Position = projection * view * model * vec4(inPosition, 1.0);
|
||||
}
|
||||
17
assets/shaders/vertex/lighting.glsl
Normal file
17
assets/shaders/vertex/lighting.glsl
Normal file
@@ -0,0 +1,17 @@
|
||||
#version 330 core
|
||||
@include "light_struct"
|
||||
|
||||
layout (location = 0) in vec3 inPosition;
|
||||
layout (location = 1) in vec2 inTexCoords;
|
||||
|
||||
uniform sampler2D diffuse, position, texcoord, normal, depth;
|
||||
uniform Light light[1];
|
||||
|
||||
out vec2 outTexCoords;
|
||||
flat out Light outLight[1];
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(inPosition.x, inPosition.y, inPosition.z, 1.0);
|
||||
outTexCoords = inTexCoords;
|
||||
outLight = light;
|
||||
}
|
||||
Reference in New Issue
Block a user