| 1 |
{ -*- buffer-read-only: t -*- } |
| 2 |
{ DON'T EDIT -- this file was automatically generated from "source/bump_mapping_steep_parallax_shadowing.vs" } |
| 3 |
'/* Steep parallax with self-shading bump mapping shader effect.' + LineEnding + |
| 4 |
' This is added right after bump_mapping.vs and bump_mapping_parallax.vs.' + LineEnding + |
| 5 |
' Included by EnableShaderBumpMapping in ../castlerendererinternalshader.pas unit.' + LineEnding + |
| 6 |
'*/' + LineEnding + |
| 7 |
'' + LineEnding + |
| 8 |
'varying vec3 castle_light_direction_tangent_space;' + LineEnding + |
| 9 |
'' + LineEnding + |
| 10 |
'/* Note that there''s no need to protect castle_LightSource0Position' + LineEnding + |
| 11 |
' from redeclaring, which is usually a problem when' + LineEnding + |
| 12 |
' no "separate compilation units" are available (on OpenGLES).' + LineEnding + |
| 13 |
' In this particular case, using bump mapping forces Phong shading,' + LineEnding + |
| 14 |
' and then lights are calculated in the fragment shader.' + LineEnding + |
| 15 |
' The declaration below is in vertex shader, so it never conflicts. */' + LineEnding + |
| 16 |
'#ifdef GL_ES' + LineEnding + |
| 17 |
'uniform mediump vec3 castle_LightSource0Position;' + LineEnding + |
| 18 |
'#else' + LineEnding + |
| 19 |
'uniform vec3 castle_LightSource0Position;' + LineEnding + |
| 20 |
'#endif' + LineEnding + |
| 21 |
'' + LineEnding + |
| 22 |
'void PLUG_bump_mapping_parallax_tangent_space_calculations(' + LineEnding + |
| 23 |
' const in vec4 vertex_eye, const in mat3 eye_to_tangent_space)' + LineEnding + |
| 24 |
'{' + LineEnding + |
| 25 |
' vec3 light_dir = castle_LightSource0Position;' + LineEnding + |
| 26 |
'#ifdef CASTLE_LIGHT0_POSITIONAL' + LineEnding + |
| 27 |
' light_dir -= vec3(vertex_eye);' + LineEnding + |
| 28 |
'#endif' + LineEnding + |
| 29 |
' light_dir = normalize(light_dir);' + LineEnding + |
| 30 |
' castle_light_direction_tangent_space = eye_to_tangent_space * light_dir;' + LineEnding + |
| 31 |
'}' + LineEnding + |
| 32 |
'' |