mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Renamed shaders
This commit is contained in:
		
							parent
							
								
									e4f767b2ed
								
							
						
					
					
						commit
						ac8a6fccbe
					
				
					 7 changed files with 15 additions and 16 deletions
				
			
		
							
								
								
									
										31
									
								
								resources/shaders/toolpaths_lines.fs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								resources/shaders/toolpaths_lines.fs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
#version 110
 | 
			
		||||
 | 
			
		||||
// normalized values for (-0.6/1.31, 0.6/1.31, 1./1.31)
 | 
			
		||||
const vec3 LIGHT_TOP_DIR = vec3(-0.4574957, 0.4574957, 0.7624929);
 | 
			
		||||
const vec3 LIGHT_FRONT_DIR = vec3(0.0, 0.0, 1.0);
 | 
			
		||||
 | 
			
		||||
// x = ambient, y = top diffuse, z = front diffuse, w = global
 | 
			
		||||
uniform vec4 light_intensity;
 | 
			
		||||
uniform vec3 uniform_color;
 | 
			
		||||
 | 
			
		||||
varying vec3 eye_position;
 | 
			
		||||
varying vec3 eye_normal;
 | 
			
		||||
 | 
			
		||||
float intensity;
 | 
			
		||||
 | 
			
		||||
void main()
 | 
			
		||||
{
 | 
			
		||||
    vec3 normal = normalize(eye_normal);
 | 
			
		||||
 | 
			
		||||
    // Compute the cos of the angle between the normal and lights direction. The light is directional so the direction is constant for every vertex.
 | 
			
		||||
    // Since these two are normalized the cosine is the dot product. Take the abs value to light the lines no matter in which direction the normal points.
 | 
			
		||||
    float NdotL = abs(dot(normal, LIGHT_TOP_DIR));
 | 
			
		||||
 | 
			
		||||
    intensity = light_intensity.x + NdotL * light_intensity.y;
 | 
			
		||||
 | 
			
		||||
    // Perform the same lighting calculation for the 2nd light source.
 | 
			
		||||
    NdotL = abs(dot(normal, LIGHT_FRONT_DIR));
 | 
			
		||||
    intensity += NdotL * light_intensity.z;    
 | 
			
		||||
 | 
			
		||||
    gl_FragColor = vec4(uniform_color * light_intensity.w * intensity, 1.0);
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue