mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-24 22:26:37 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			70 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			GLSL
		
	
	
	
	
	
			
		
		
	
	
			70 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
 | |
| 
 | |
| #define PER_PIXEL_LIGHTING 1
 | |
| 
 | |
| #include "lib/core/vertex.h.glsl"
 | |
| 
 | |
| #if @diffuseMap
 | |
| varying vec2 diffuseMapUV;
 | |
| #endif
 | |
| 
 | |
| #if @emissiveMap
 | |
| varying vec2 emissiveMapUV;
 | |
| #endif
 | |
| 
 | |
| #if @normalMap
 | |
| varying vec2 normalMapUV;
 | |
| varying vec4 passTangent;
 | |
| #endif
 | |
| 
 | |
| varying float euclideanDepth;
 | |
| varying float linearDepth;
 | |
| 
 | |
| varying vec3 passViewPos;
 | |
| varying vec3 passNormal;
 | |
| 
 | |
| #include "lib/light/lighting.glsl"
 | |
| #include "lib/view/depth.glsl"
 | |
| 
 | |
| #include "compatibility/vertexcolors.glsl"
 | |
| #include "compatibility/shadows_vertex.glsl"
 | |
| 
 | |
| void main(void)
 | |
| {
 | |
|     gl_Position = modelToClip(gl_Vertex);
 | |
| 
 | |
|     vec4 viewPos = modelToView(gl_Vertex);
 | |
|     gl_ClipVertex = viewPos;
 | |
|     euclideanDepth = length(viewPos.xyz);
 | |
|     linearDepth = getLinearDepth(gl_Position.z, viewPos.z);
 | |
| 
 | |
| #if @diffuseMap
 | |
|     diffuseMapUV = (gl_TextureMatrix[@diffuseMapUV] * gl_MultiTexCoord@diffuseMapUV).xy;
 | |
| #endif
 | |
| 
 | |
| #if @emissiveMap
 | |
|     emissiveMapUV = (gl_TextureMatrix[@emissiveMapUV] * gl_MultiTexCoord@emissiveMapUV).xy;
 | |
| #endif
 | |
| 
 | |
| #if @normalMap
 | |
|     normalMapUV = (gl_TextureMatrix[@normalMapUV] * gl_MultiTexCoord@normalMapUV).xy;
 | |
|     passTangent = gl_MultiTexCoord7.xyzw;
 | |
| #endif
 | |
| 
 | |
|     passColor = gl_Color;
 | |
|     passViewPos = viewPos.xyz;
 | |
|     passNormal = gl_Normal.xyz;
 | |
| 
 | |
| #if @shadows_enabled
 | |
|     vec3 viewNormal = normalize((gl_NormalMatrix * gl_Normal).xyz);
 | |
|     setupShadowCoords(viewPos, viewNormal);
 | |
| #endif
 | |
| }
 |