mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Cleanup in shader gouraud_light_instanced.vs
This commit is contained in:
		
							parent
							
								
									7bd14bfaf7
								
							
						
					
					
						commit
						876f9d5a99
					
				
					 1 changed files with 0 additions and 11 deletions
				
			
		| 
						 | 
					@ -14,14 +14,12 @@ const vec3 LIGHT_FRONT_DIR = vec3(0.6985074, 0.1397015, 0.6985074);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define INTENSITY_AMBIENT    0.3
 | 
					#define INTENSITY_AMBIENT    0.3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | 
					 | 
				
			||||||
// vertex attributes
 | 
					// vertex attributes
 | 
				
			||||||
in vec3 v_position;
 | 
					in vec3 v_position;
 | 
				
			||||||
in vec3 v_normal;
 | 
					in vec3 v_normal;
 | 
				
			||||||
// instance attributes
 | 
					// instance attributes
 | 
				
			||||||
in vec3 i_offset;
 | 
					in vec3 i_offset;
 | 
				
			||||||
in vec2 i_scales;
 | 
					in vec2 i_scales;
 | 
				
			||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// x = tainted, y = specular;
 | 
					// x = tainted, y = specular;
 | 
				
			||||||
varying vec2 intensity;
 | 
					varying vec2 intensity;
 | 
				
			||||||
| 
						 | 
					@ -29,29 +27,20 @@ varying vec2 intensity;
 | 
				
			||||||
void main()
 | 
					void main()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // First transform the normal into camera space and normalize the result.
 | 
					    // First transform the normal into camera space and normalize the result.
 | 
				
			||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | 
					 | 
				
			||||||
    vec3 eye_normal = normalize(gl_NormalMatrix * v_normal);
 | 
					    vec3 eye_normal = normalize(gl_NormalMatrix * v_normal);
 | 
				
			||||||
//    vec3 eye_normal = normalize(gl_NormalMatrix * gl_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.
 | 
					    // 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. We also need to clamp the result to the [0,1] range.
 | 
					    // Since these two are normalized the cosine is the dot product. We also need to clamp the result to the [0,1] range.
 | 
				
			||||||
    float NdotL = max(dot(eye_normal, LIGHT_TOP_DIR), 0.0);
 | 
					    float NdotL = max(dot(eye_normal, LIGHT_TOP_DIR), 0.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    intensity.x = INTENSITY_AMBIENT + NdotL * LIGHT_TOP_DIFFUSE;
 | 
					    intensity.x = INTENSITY_AMBIENT + NdotL * LIGHT_TOP_DIFFUSE;
 | 
				
			||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | 
					 | 
				
			||||||
    vec4 world_position = vec4(v_position * vec3(vec2(i_scales.x), i_scales.y) + i_offset, 1.0);
 | 
					    vec4 world_position = vec4(v_position * vec3(vec2(i_scales.x), i_scales.y) + i_offset, 1.0);
 | 
				
			||||||
    vec3 eye_position = (gl_ModelViewMatrix * world_position).xyz;
 | 
					    vec3 eye_position = (gl_ModelViewMatrix * world_position).xyz;
 | 
				
			||||||
//    vec3 eye_position = (gl_ModelViewMatrix * gl_Vertex).xyz;
 | 
					 | 
				
			||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | 
					 | 
				
			||||||
    intensity.y = LIGHT_TOP_SPECULAR * pow(max(dot(-normalize(eye_position), reflect(-LIGHT_TOP_DIR, eye_normal)), 0.0), LIGHT_TOP_SHININESS);
 | 
					    intensity.y = LIGHT_TOP_SPECULAR * pow(max(dot(-normalize(eye_position), reflect(-LIGHT_TOP_DIR, eye_normal)), 0.0), LIGHT_TOP_SHININESS);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Perform the same lighting calculation for the 2nd light source (no specular applied).
 | 
					    // Perform the same lighting calculation for the 2nd light source (no specular applied).
 | 
				
			||||||
    NdotL = max(dot(eye_normal, LIGHT_FRONT_DIR), 0.0);
 | 
					    NdotL = max(dot(eye_normal, LIGHT_FRONT_DIR), 0.0);
 | 
				
			||||||
    intensity.x += NdotL * LIGHT_FRONT_DIFFUSE;
 | 
					    intensity.x += NdotL * LIGHT_FRONT_DIFFUSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | 
					 | 
				
			||||||
    gl_Position = gl_ProjectionMatrix * vec4(eye_position, 1.0);
 | 
					    gl_Position = gl_ProjectionMatrix * vec4(eye_position, 1.0);
 | 
				
			||||||
//    gl_Position = ftransform();
 | 
					 | 
				
			||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue