mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 09:56:38 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			62 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			GLSL
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			GLSL
		
	
	
	
	
	
| #version 120
 | |
| 
 | |
| #if @useUBO
 | |
|     #extension GL_ARB_uniform_buffer_object : require
 | |
| #endif
 | |
| 
 | |
| #if @useGPUShader4
 | |
|     #extension GL_EXT_gpu_shader4: require
 | |
| #endif
 | |
| 
 | |
| uniform mat4 projectionMatrix;
 | |
| 
 | |
| varying vec2 uv;
 | |
| varying float euclideanDepth;
 | |
| varying float linearDepth;
 | |
| 
 | |
| #define PER_PIXEL_LIGHTING (@normalMap || @forcePPL)
 | |
| 
 | |
| #if !PER_PIXEL_LIGHTING
 | |
| centroid varying vec3 passLighting;
 | |
| centroid varying vec3 shadowDiffuseLighting;
 | |
| #endif
 | |
| varying vec3 passViewPos;
 | |
| varying vec3 passNormal;
 | |
| 
 | |
| #include "vertexcolors.glsl"
 | |
| #include "shadows_vertex.glsl"
 | |
| 
 | |
| #include "lighting.glsl"
 | |
| #include "depth.glsl"
 | |
| 
 | |
| void main(void)
 | |
| {
 | |
|     gl_Position = projectionMatrix * (gl_ModelViewMatrix * gl_Vertex);
 | |
| 
 | |
|     vec4 viewPos = (gl_ModelViewMatrix * gl_Vertex);
 | |
|     gl_ClipVertex = viewPos;
 | |
|     euclideanDepth = length(viewPos.xyz);
 | |
|     linearDepth = getLinearDepth(gl_Position.z, viewPos.z);
 | |
| 
 | |
| #if (!PER_PIXEL_LIGHTING || @shadows_enabled)
 | |
|     vec3 viewNormal = normalize((gl_NormalMatrix * gl_Normal).xyz);
 | |
| #endif
 | |
| 
 | |
|     passColor = gl_Color;
 | |
|     passNormal = gl_Normal.xyz;
 | |
|     passViewPos = viewPos.xyz;
 | |
| 
 | |
| #if !PER_PIXEL_LIGHTING
 | |
|     vec3 diffuseLight, ambientLight;
 | |
|     doLighting(viewPos.xyz, viewNormal, diffuseLight, ambientLight, shadowDiffuseLighting);
 | |
|     passLighting = getDiffuseColor().xyz * diffuseLight + getAmbientColor().xyz * ambientLight + getEmissionColor().xyz;
 | |
|     clampLightingResult(passLighting);
 | |
|     shadowDiffuseLighting *= getDiffuseColor().xyz;
 | |
| #endif
 | |
| 
 | |
|     uv = gl_MultiTexCoord0.xy;
 | |
| 
 | |
| #if (@shadows_enabled)
 | |
|     setupShadowCoords(viewPos, viewNormal);
 | |
| #endif
 | |
| }
 |