Шейдер лампочки
This commit is contained in:
		
							parent
							
								
									bdc16665b7
								
							
						
					
					
						commit
						8ba3851a6b
					
				@ -2,10 +2,11 @@
 | 
			
		||||
 | 
			
		||||
layout(std140, binding = 1) uniform Material
 | 
			
		||||
{
 | 
			
		||||
    vec3 ka;
 | 
			
		||||
    vec3 kd;
 | 
			
		||||
    vec3 ks;
 | 
			
		||||
    float p;
 | 
			
		||||
    vec3 base_color;
 | 
			
		||||
    float roughness;
 | 
			
		||||
    float metallic;
 | 
			
		||||
    float specular;
 | 
			
		||||
    vec3 emitted;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
in vec3 pos_local;
 | 
			
		||||
@ -16,8 +17,8 @@ layout(std140, binding = 4) uniform gamma
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
layout (location = 1) out vec3 gNormal;
 | 
			
		||||
layout (location = 3) out vec4 gAmbientSpecular;
 | 
			
		||||
layout (location = 4) out uvec3 gID;
 | 
			
		||||
layout (location = 5) out vec3 gEmittedColor;
 | 
			
		||||
 | 
			
		||||
uniform float angle;
 | 
			
		||||
uniform vec3 direction;
 | 
			
		||||
@ -28,7 +29,7 @@ void main()
 | 
			
		||||
{   
 | 
			
		||||
    float cosA = dot(normalize(pos_local), normalize(direction));
 | 
			
		||||
    if (degrees(acos(cosA)) <= angle)
 | 
			
		||||
        gAmbientSpecular.rgb = pow(ka, vec3(inv_gamma));
 | 
			
		||||
        gEmittedColor = pow(base_color, vec3(inv_gamma));
 | 
			
		||||
    else
 | 
			
		||||
        discard;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user