A WIP 3D game engine in C++ using OpenGL
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

62 lines
1.1 KiB

#version 330 core
out vec4 LFragment;
in vec2 theTexCoord;
in vec3 Normal;
in vec3 FragPos;
//uniform vec3 objectColour;
//uniform vec3 lightColour;
uniform int lighting_emit;
//uniform vec3 lightPosition;
uniform vec3 cameraPosition;
uniform sampler2D texture_diffuse1;
struct Material {
sampler2D texture_diffuse1;
sampler2D texture_diffuse2;
sampler2D texture_diffuse3;
sampler2D texture_specular1;
sampler2D texture_specular2;
sampler2D texture_specular3;
vec3 ambient;
vec3 diffuse;
vec3 specular;
float shininess;
};
#define DIRECTIONAL_LIGHT 0
#define POINT_LIGHT 1
#define SPOT_LIGHT 2
struct Light {
int type;
vec3 direction;
vec3 position;
float angle_cutoff;
float outer_angle_cutoff;
vec3 ambient;
vec3 diffuse;
vec3 specular;
bool attenuate;
vec3 attenuation;
};
#define MAX_LIGHTS 10
uniform Light lights[MAX_LIGHTS];
uniform int num_lights;
uniform Material material;
// uniform Light light;
void main()
{
LFragment = vec4(texture(material.texture_diffuse1, theTexCoord));
if (LFragment.a < 0.1)
discard;
}