From 1be001a18ca639757ad3fc5b38e468047e365efd Mon Sep 17 00:00:00 2001 From: Benedikt Wolf Date: Fri, 10 Feb 2023 10:37:52 +0100 Subject: [PATCH] Fix wingflex shader to use current effect code. A better way would probably be to just keep the wing flexing part there and then include model-combined, but I couldnt get that to work unfortunately --- Effects/model-wingflex.eff | 2368 ++++++++++++++++--------------- Shaders/model-ALS-wingflex.vert | 90 +- 2 files changed, 1308 insertions(+), 1150 deletions(-) diff --git a/Effects/model-wingflex.eff b/Effects/model-wingflex.eff index 3efa1a36c..862a1b6e7 100644 --- a/Effects/model-wingflex.eff +++ b/Effects/model-wingflex.eff @@ -3,11 +3,29 @@ Effects/model-wingflex Effects/model-default + + + + - - + + 0 + 0.7 + 15.0 + 0.0 + 0.0 + 0.0 + 0.0 + + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + + 0 0 @@ -45,6 +63,8 @@ 0 0.0 0 + 0.0 + 1 0 Aircraft/Generic/Effects/ReflectMaps/reflectmap.png @@ -99,6 +119,7 @@ 0 + 0 0 0 @@ -108,6 +129,8 @@ 0.0 0.0 0.0 0.0 0.0 + 0 + 1.0 0.05 opaque @@ -142,23 +165,8 @@ /sim/rendering/shaders/skydome /environment/surface/wetness /environment/rain-norm - - 0 - 0.7 - 0.0 - 0.0 - 0.0 - 0.0 - 15.0 - - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - + /environment/snow-level-m + /environment/surface/snow-thickness-factor /local-weather/cloud-shadows/cloudpos-x[0] /local-weather/cloud-shadows/cloudpos-y[0] /local-weather/cloud-shadows/cloudpos-x[1] @@ -201,856 +209,827 @@ /local-weather/cloud-shadows/cloudpos-y[19] /local-weather/cloud-shadows/cloud-shadow-flag 0 + /sim/rendering/shaders/landmass + /sim/rendering/shaders/transition - - - - - /sim/rendering/shaders/skydome - /sim/rendering/shaders/model - - - 2.0 - - - - GL_ARB_shader_objects - GL_ARB_shading_language_100 - GL_ARB_vertex_shader - GL_ARB_fragment_shader - - - - - - true - - - material/active - - - material/ambient - - - material/diffuse - - - material/specular - - - material/emissive - - - material/shininess - - - material/color-mode - - - - - blend/active - - - blend/source - - - blend/destination - - - - shade-model - - - cull-face - - - rendering-hint - - - transparent - - - transparent - - - - render-bin/bin-number - - - render-bin/bin-name - - - - - 0 - - texture[0]/image - - - texture[0]/type - - - texture[0]/filter - - - texture[0]/wrap-s - - - texture[0]/wrap-t - - - texture[0]/internal-format - - - - - 1 - noise - - - - 2 - - texture[2]/image - - - texture[2]/type - - - texture[2]/filter - - - texture[2]/wrap-s - - - texture[2]/wrap-t - - - texture[2]/internal-format - - - - - 3 - - texture[3]/image - - - texture[3]/type - - - texture[3]/filter - - - texture[3]/wrap-s - - - texture[3]/wrap-t - - - texture[3]/internal-format - - - - - 4 - - texture[4]/image - - - texture[4]/type - - - texture[4]/filter - - - texture[4]/wrap-s - - - texture[4]/wrap-t - - - texture[4]/internal-format - - - - - 5 - - texture[5]/type - - - - - - - texture[5]/images - - - - - - 6 - - texture[6]/image - - - texture[6]/type - - - texture[6]/filter - - - texture[6]/wrap-s - - - texture[6]/wrap-t - - - texture[6]/internal-format - - - - - 7 - - texture[7]/image - - - texture[7]/type - - - texture[7]/filter - - - texture[7]/wrap-s - - - texture[7]/wrap-t - - - texture[7]/internal-format - - - - - vertex-program-two-side - - - + + + + /sim/rendering/shaders/skydome + /sim/rendering/shaders/model + + + 2.0 + + + + GL_ARB_shader_objects + GL_ARB_shading_language_100 + GL_ARB_vertex_shader + GL_ARB_fragment_shader + + + + + + true + + + material/active + + + material/ambient + + + material/diffuse + + + material/specular + + + material/emissive + + + material/shininess + + + material/color-mode + + + + + blend/active + + + blend/source + + + blend/destination + + + + shade-model + + + cull-face + + + rendering-hint + + + transparent + + + transparent + + + + render-bin/bin-number + + + render-bin/bin-name + + + + + 0 + + texture[0]/image + + + texture[0]/type + + + texture[0]/filter + + + texture[0]/wrap-s + + + texture[0]/wrap-t + + + texture[0]/internal-format + + + + + 1 + noise + + + + 2 + + texture[2]/image + + + texture[2]/type + + + texture[2]/filter + + + texture[2]/wrap-s + + + texture[2]/wrap-t + + + texture[2]/internal-format + + + + + 3 + + texture[3]/image + + + texture[3]/type + + + texture[3]/filter + + + texture[3]/wrap-s + + + texture[3]/wrap-t + + + texture[3]/internal-format + + + + + 4 + + texture[4]/image + + + texture[4]/type + + + texture[4]/filter + + + texture[4]/wrap-s + + + texture[4]/wrap-t + + + texture[4]/internal-format + + + + + 5 + + texture[5]/type + + + + + + + texture[5]/images + + + + + + 6 + + texture[6]/image + + + texture[6]/type + + + texture[6]/filter + + + texture[6]/wrap-s + + + texture[6]/wrap-t + + + texture[6]/internal-format + + + + + 7 + + texture[7]/image + + + texture[7]/type + + + texture[7]/filter + + + texture[7]/wrap-s + + + texture[7]/wrap-t + + + texture[7]/internal-format + + + + + vertex-program-two-side + + + + Shaders/model-ALS-wingflex.vert - Shaders/shadows-include.vert - Shaders/model-ALS-ultra.frag - Shaders/cloud-shadowfunc.frag - Shaders/hazes.frag - Shaders/secondary_lights.frag - Shaders/noise.frag - Shaders/filters-ALS.frag - Shaders/shadows-include.frag - Shaders/clustered-include.frag - - - - BaseTex - sampler-2d - 0 - - - - ReflNoiseTex - sampler-3d - 1 - - - - NormalTex - sampler-2d - 2 - - - - LightMapTex - sampler-2d - 3 - - - - ReflMapTex - sampler-2d - 4 - - - - Environment - sampler-cube - 5 - - - - ReflGradientsTex - sampler-2d - 6 - - - - GrainTex - sampler-2d - 7 - + + Shaders/shadows-include.vert + Shaders/model-ALS-ultra.frag + Shaders/cloud-shadowfunc.frag + Shaders/hazes.frag + Shaders/secondary_lights.frag + Shaders/noise.frag + Shaders/filters-ALS.frag + Shaders/shadows-include.frag + Shaders/clustered-include.frag + - - wingflex_type - int - wingflex-type - + + BaseTex + sampler-2d + 0 + - - wingflex_alpha - float - wingflex-alpha - + + ReflNoiseTex + sampler-3d + 1 + - - wingflex_trailing_alpha - float - wingflex-trailing-alpha - + + NormalTex + sampler-2d + 2 + - - wingsweep_factor - float - wingsweep-factor - - - - wingflex_z - float - wingflex-z - + + LightMapTex + sampler-2d + 3 + - - body_width - float - body-width - + + ReflMapTex + sampler-2d + 4 + - - wing_span - float - wing-span - + + Environment + sampler-cube + 5 + - - rotation_rad - float - rotation-rad - + + ReflGradientsTex + sampler-2d + 6 + - - rotation_x1 - float - rotation-x1 - + + GrainTex + sampler-2d + 7 + - - rotation_y1 - float - rotation-y1 - + + + + nmap_enabled + int + + normalmap-enabled + + - - rotation_z1 - float - rotation-z1 - - - - rotation_x2 - float - rotation-x2 - + + + nmap_dds + int + + normalmap-dds + + - - rotation_y2 - float - rotation-y2 - + + nmap_tile + float + + normalmap-tiling + + - - rotation_z2 - float - rotation-z2 - - - - - - nmap_enabled - int - - normalmap-enabled - - - - - - nmap_dds - int - - normalmap-dds - - - - - nmap_tile - float - - normalmap-tiling - - - - - - - lightmap_enabled - int - - lightmap-enabled - - - - - lightmap_multi - int - - lightmap-multi - - - - - lightmap_r_factor - float - - lightmap-factor[0] - - - - - lightmap_r_color - float-vec3 - - lightmap-color[0] - - - - - lightmap_g_factor - float - - lightmap-factor[1] - - - - - lightmap_g_color - float-vec3 - - lightmap-color[1] - - - - - lightmap_b_factor - float - - lightmap-factor[2] - - - - - lightmap_b_color - float-vec3 - - lightmap-color[2] - - - - - lightmap_a_factor - float - - lightmap-factor[3] - - - - - lightmap_a_color - float-vec3 - - lightmap-color[3] - - + + + + lightmap_enabled + int + + lightmap-enabled + + + + + lightmap_multi + int + + lightmap-multi + + - + + lightmap_r_factor + float + + lightmap-factor[0] + + + + + lightmap_r_color + float-vec3 + + lightmap-color[0] + + + + + lightmap_g_factor + float + + lightmap-factor[1] + + + + + lightmap_g_color + float-vec3 + + lightmap-color[1] + + + + + lightmap_b_factor + float + + lightmap-factor[2] + + + + + lightmap_b_color + float-vec3 + + lightmap-color[2] + + + + + lightmap_a_factor + float + + lightmap-factor[3] + + + + + lightmap_a_color + float-vec3 + + lightmap-color[3] + + + + darkmap_factor float - darkmap-factor + darkmap-factor - - - - - refl_enabled - int - - reflection-enabled - - - - - refl_correction - float - - reflection-correction - - - - - - refl_map - int - - reflect-map-enabled - - - - - refl_dynamic - int - - reflection-dynamic - - - - - - refl_rainbow - float - - reflection-rainbow - - - - - - refl_fresnel - float - - reflection-fresnel - - - - - - refl_noise - float - - reflection-noise - - - - - - dirt_enabled - int - - dirt-enabled - - - - - dirt_multi - int - - dirt-multi - - - - - dirt_r_color - float-vec3 - - dirt-color[0] - - - - - dirt_r_factor - float - - dirt-factor[0] - - - - - dirt_g_color - float-vec3 - - dirt-color[1] - - - - - dirt_g_factor - float - - dirt-factor[1] - - - - - dirt_b_color - float-vec3 - - dirt-color[2] - - - - - dirt_b_factor - float - - dirt-factor[2] - - - + - - - grain_texture_enabled - int - - grain-texture-enabled - - - - - grain_magnification - float - - grain-magnification - - + + + refl_enabled + int + + reflection-enabled + + + + + refl_correction + float + + reflection-correction + + - - - rain_enabled - int - - rain-enabled - - + + + refl_fresnel_factor + float + + reflection-fresnel-factor + + - - - amb_correction - float - - ambient-correction - - - - - hdg - float - - model-hdg - - - - - pitch - float - - model-pitch - - - - - roll - float - - model-roll - - - - - - visibility - float - - visibility - - - - avisibility - float - - avisibility - - - - hazeLayerAltitude - float - - lthickness - - - - scattering - float - - scattering - - - - terminator - float - - terminator - - - - ground_scattering - float - - ground_scattering - - - - terminator - float - - terminator - - - - terrain_alt - float - - terrain_alt - - - - overcast - float - - overcast - - - - eye_alt - float - - eye_alt - - - - cloud_self_shading - float - cloud_self_shading - - - moonlight - float - moonlight - - - air_pollution - float - air_pollution - - - rain_norm - float - rnorm - - - wetness - float - wetness - - - view_pitch_offset - float - view_pitch_offset - - - view_heading_offset - float - view_heading_offset - - - field_of_view - float - view_fov - - - landing_light1_offset - float - landing_light1_offset - - - landing_light2_offset - float - landing_light2_offset - - - landing_light3_offset - float - landing_light3_offset - - - - gamma - float - gamma - - - brightness - float - brightness - - - use_filtering - bool - use_filtering - - - use_night_vision - bool - use_night_vision - - - use_IR_vision - bool - use_IR_vision - - - delta_T - float - delta_T - + + + refl_map + int + + reflect-map-enabled + + + + + + refl_type + int + + reflection-type + + + + + + + refl_dynamic + int + + reflection-dynamic + + + + + + refl_rainbow + float + + reflection-rainbow + + + + + + refl_fresnel + float + + reflection-fresnel + + + + + + refl_noise + float + + reflection-noise + + + + + + dirt_enabled + int + + dirt-enabled + + + + + dirt_multi + int + + dirt-multi + + + + + dirt_r_color + float-vec3 + + dirt-color[0] + + + + + dirt_r_factor + float + + dirt-factor[0] + + + + + dirt_g_color + float-vec3 + + dirt-color[1] + + + + + dirt_g_factor + float + + dirt-factor[1] + + + + + dirt_b_color + float-vec3 + + dirt-color[2] + + + + + dirt_b_factor + float + + dirt-factor[2] + + + + + dirt_modulates_reflection + int + + dirt-modulates-reflection + + + + + dirt_reflection_factor + float + + dirt-reflection-factor + + + + + + + grain_texture_enabled + int + + grain-texture-enabled + + + + + grain_magnification + float + + grain-magnification + + + + + + rain_enabled + int + + rain-enabled + + + + + snow_enabled + int + + snow-enabled + + + + + snowlevel + float + snow_level + + + + snow_thickness_factor + float + snow_thickness_factor + + + + + amb_correction + float + + ambient-correction + + + + + hdg + float + + model-hdg + + + + + pitch + float + + model-pitch + + + + + roll + float + + model-roll + + + + + + visibility + float + + visibility + + + + avisibility + float + + avisibility + + + + hazeLayerAltitude + float + + lthickness + + + + scattering + float + + scattering + + + + terminator + float + + terminator + + + + ground_scattering + float + + ground_scattering + + + + terminator + float + + terminator + + + + terrain_alt + float + + terrain_alt + + + + overcast + float + + overcast + + + + eye_alt + float + + eye_alt + + + + cloud_self_shading + float + cloud_self_shading + + + moonlight + float + moonlight + + + air_pollution + float + air_pollution + + + rain_norm + float + rnorm + + + wetness + float + wetness + + + view_pitch_offset + float + view_pitch_offset + + + view_heading_offset + float + view_heading_offset + + + field_of_view + float + view_fov + + + landing_light1_offset + float + landing_light1_offset + + + landing_light2_offset + float + landing_light2_offset + + + landing_light3_offset + float + landing_light3_offset + + + gamma + float + gamma + + + brightness + float + brightness + + + use_filtering + bool + use_filtering + + + use_night_vision + bool + use_night_vision + + + use_IR_vision + bool + use_IR_vision + + + delta_T + float + delta_T + fact_grey float @@ -1061,270 +1040,437 @@ float fact_black - - - cloudpos1_x - float - cloudpos1_x - - - cloudpos1_y - float - cloudpos1_y - - - cloudpos2_x - float - cloudpos2_x - - - cloudpos2_y - float - cloudpos2_y - - - cloudpos3_x - float - cloudpos3_x - - - cloudpos3_y - float - cloudpos3_y - - - cloudpos4_x - float - cloudpos4_x - - - cloudpos4_y - float - cloudpos4_y - - - cloudpos5_x - float - cloudpos5_x - - - cloudpos5_y - float - cloudpos5_y - - - cloudpos6_x - float - cloudpos6_x - - - cloudpos6_y - float - cloudpos6_y - - - cloudpos7_x - float - cloudpos7_x - - - cloudpos7_y - float - cloudpos7_y - - - cloudpos8_x - float - cloudpos8_x - - - cloudpos8_y - float - cloudpos8_y - - - cloudpos9_x - float - cloudpos9_x - - - cloudpos9_y - float - cloudpos9_y - - - cloudpos10_x - float - cloudpos10_x - - - cloudpos10_y - float - cloudpos10_y - - - cloudpos11_x - float - cloudpos11_x - - - cloudpos11_y - float - cloudpos11_y - - - cloudpos12_x - float - cloudpos12_x - - - cloudpos12_y - float - cloudpos12_y - - - cloudpos13_x - float - cloudpos13_x - - - cloudpos13_y - float - cloudpos13_y - - - cloudpos14_x - float - cloudpos14_x - - - cloudpos14_y - float - cloudpos14_y - - - cloudpos15_x - float - cloudpos15_x - - - cloudpos15_y - float - cloudpos15_y - - - cloudpos16_x - float - cloudpos16_x - - - cloudpos16_y - float - cloudpos16_y - - - cloudpos17_x - float - cloudpos17_x - - - cloudpos17_y - float - cloudpos17_y - - - cloudpos18_x - float - cloudpos18_x - - - cloudpos18_y - float - cloudpos18_y - - - cloudpos19_x - float - cloudpos19_x - - - cloudpos19_y - float - cloudpos19_y - - - cloudpos20_x - float - cloudpos20_x - - - cloudpos20_y - float - cloudpos20_y - - - cloud_shadow_flag - int - cloud_shadow_flag - - - use_searchlight - int - use_searchlight - - - use_landing_light - int - use_landing_light - - - use_alt_landing_light - int - use_alt_landing_light - - - display_xsize - int - display_xsize - - - display_ysize - int - display_ysize - - - darkmap_enabled - int - darkmap-enabled - - - building_flag - int - building-flag - - - - - shadow_tex - sampler-2d - 10 - - - shadows_enabled - bool - - shadows_enabled - - - - sun_atlas_size - int - - sun_atlas_size - - - - - + + quality_level + int + quality_level + + + tquality_level + int + tquality_level + + + + + cloudpos1_x + float + cloudpos1_x + + + cloudpos1_y + float + cloudpos1_y + + + cloudpos2_x + float + cloudpos2_x + + + cloudpos2_y + float + cloudpos2_y + + + cloudpos3_x + float + cloudpos3_x + + + cloudpos3_y + float + cloudpos3_y + + + cloudpos4_x + float + cloudpos4_x + + + cloudpos4_y + float + cloudpos4_y + + + cloudpos5_x + float + cloudpos5_x + + + cloudpos5_y + float + cloudpos5_y + + + cloudpos6_x + float + cloudpos6_x + + + cloudpos6_y + float + cloudpos6_y + + + cloudpos7_x + float + cloudpos7_x + + + cloudpos7_y + float + cloudpos7_y + + + cloudpos8_x + float + cloudpos8_x + + + cloudpos8_y + float + cloudpos8_y + + + cloudpos9_x + float + cloudpos9_x + + + cloudpos9_y + float + cloudpos9_y + + + cloudpos10_x + float + cloudpos10_x + + + cloudpos10_y + float + cloudpos10_y + + + cloudpos11_x + float + cloudpos11_x + + + cloudpos11_y + float + cloudpos11_y + + + cloudpos12_x + float + cloudpos12_x + + + cloudpos12_y + float + cloudpos12_y + + + cloudpos13_x + float + cloudpos13_x + + + cloudpos13_y + float + cloudpos13_y + + + cloudpos14_x + float + cloudpos14_x + + + cloudpos14_y + float + cloudpos14_y + + + cloudpos15_x + float + cloudpos15_x + + + cloudpos15_y + float + cloudpos15_y + + + cloudpos16_x + float + cloudpos16_x + + + cloudpos16_y + float + cloudpos16_y + + + cloudpos17_x + float + cloudpos17_x + + + cloudpos17_y + float + cloudpos17_y + + + cloudpos18_x + float + cloudpos18_x + + + cloudpos18_y + float + cloudpos18_y + + + cloudpos19_x + float + cloudpos19_x + + + cloudpos19_y + float + cloudpos19_y + + + cloudpos20_x + float + cloudpos20_x + + + cloudpos20_y + float + cloudpos20_y + + + cloud_shadow_flag + int + cloud_shadow_flag + + + use_searchlight + int + use_searchlight + + + use_landing_light + int + use_landing_light + + + use_alt_landing_light + int + use_alt_landing_light + + + display_xsize + int + display_xsize + + + display_ysize + int + display_ysize + + + darkmap_enabled + int + darkmap-enabled + + + building_flag + int + building-flag + + + + + + shadow_tex + sampler-2d + 10 + + + shadows_enabled + bool + + shadows_enabled + + + + sun_atlas_size + int + + sun_atlas_size + + + + + + + wingflex_type + int + wingflex-type + + + + wingflex_alpha + float + wingflex-alpha + + + + wingflex_trailing_alpha + float + wingflex-trailing-alpha + + + + wingsweep_factor + float + wingsweep-factor + + + + wingflex_z + float + wingflex-z + + + + body_width + float + body-width + + + + wing_span + float + wing-span + + + + rotation_rad + float + rotation-rad + + + + rotation_x1 + float + rotation-x1 + + + + rotation_y1 + float + rotation-y1 + + + + rotation_z1 + float + rotation-z1 + + + + rotation_x2 + float + rotation-x2 + + + + rotation_y2 + float + rotation-y2 + + + + rotation_z2 + float + rotation-z2 + + + + + + + hdr-geometry + + + + gequal + 1.0 + 0.0 + + + always + 8 + replace + + + 0 + texture[0]/type + texture[0]/image + texture[0]/filter + texture[0]/wrap-s + texture[0]/wrap-t + + + 1 + texture[2]/type + texture[2]/image + texture[2]/filter + texture[2]/wrap-s + texture[2]/wrap-t + + back + + Shaders/HDR/geometry-combined.vert + Shaders/HDR/geometry-combined.frag + Shaders/HDR/gbuffer-include.frag + + + color_tex + sampler-2d + 0 + + + normal_tex + sampler-2d + 1 + + + normalmap_enabled + int + normalmap-enabled + + + normalmap_dds + int + normalmap-dds + + + normalmap_tiling + float + normalmap-tiling + + + + + + + false + diff --git a/Shaders/model-ALS-wingflex.vert b/Shaders/model-ALS-wingflex.vert index ec758816b..ffdf22687 100644 --- a/Shaders/model-ALS-wingflex.vert +++ b/Shaders/model-ALS-wingflex.vert @@ -1,11 +1,15 @@ // -*- mode: C; -*- // Licence: GPL v2 -// based on // © Emilian Huminiuc and Vivian Meazza 2011 -// addition for wingflex mesh distortion by Thorsten Renk 2015 - #version 120 + + +// the file is directly copied from model-combined.eff except the (three) WINGFLEX to END WINGLFEX parts +// and the subsequent gl_Vertex integrations +// I didnt find how to do a more beautiful way (including model-combined and only adding the wingflexer part) +// if you know how to do this, please do :) + varying vec3 rawpos; varying vec3 VNormal; varying vec3 VTangent; @@ -22,7 +26,12 @@ attribute vec3 binormal; uniform float pitch; uniform float roll; uniform float hdg; -uniform int wingflex_type; +uniform int refl_dynamic; +uniform int nmap_enabled; +uniform int shader_qual; + +// WINGFLEX +uniform int wingflex_type; uniform float body_width; uniform float wingflex_alpha; uniform float wingflex_trailing_alpha; @@ -36,33 +45,14 @@ uniform float rotation_x2; uniform float rotation_y2; uniform float rotation_z2; uniform float rotation_rad; -uniform int refl_dynamic; -uniform int nmap_enabled; -uniform int shader_qual; +// END WINGFLEX //////Fog Include/////////// // uniform int fogType; // void fog_Func(int type); //////////////////////////// -void setupShadows(vec4 eyeSpacePos); - -void rotationMatrixPR(in float sinRx, in float cosRx, in float sinRy, in float cosRy, out mat4 rotmat) -{ - rotmat = mat4( cosRy , sinRx * sinRy , cosRx * sinRy, 0.0, - 0.0 , cosRx , -sinRx * cosRx, 0.0, - -sinRy, sinRx * cosRy, cosRx * cosRy , 0.0, - 0.0 , 0.0 , 0.0 , 1.0 ); -} - -void rotationMatrixH(in float sinRz, in float cosRz, out mat4 rotmat) -{ - rotmat = mat4( cosRz, -sinRz, 0.0, 0.0, - sinRz, cosRz, 0.0, 0.0, - 0.0 , 0.0 , 1.0, 0.0, - 0.0 , 0.0 , 0.0, 1.0 ); -} - +// WINGFLEX vec2 calc_deflection(float y){ float distance; float bwh = body_width/2; @@ -85,20 +75,37 @@ vec2 calc_deflection(float y){ vec2 returned = vec2 ( deflection, delta_y ); return returned; } +// END WINGFLEX + +void setupShadows(vec4 eyeSpacePos); + +void rotationMatrixPR(in float sinRx, in float cosRx, in float sinRy, in float cosRy, out mat4 rotmat) +{ + rotmat = mat4( cosRy , sinRx * sinRy , cosRx * sinRy, 0.0, + 0.0 , cosRx , -sinRx * cosRx, 0.0, + -sinRy, sinRx * cosRy, cosRx * cosRy , 0.0, + 0.0 , 0.0 , 0.0 , 1.0 ); +} + +void rotationMatrixH(in float sinRz, in float cosRz, out mat4 rotmat) +{ + rotmat = mat4( cosRz, -sinRz, 0.0, 0.0, + sinRz, cosRz, 0.0, 0.0, + 0.0 , 0.0 , 1.0, 0.0, + 0.0 , 0.0 , 0.0, 1.0 ); +} void main(void) { + // WINGFLEX vec4 vertex = gl_Vertex; - + if ( wingflex_type == 0 ) { - float x_factor = max((abs(vertex.x) - body_width),0); - float y_factor = max(vertex.y,0.0); - - vec2 deflection=calc_deflection(vertex.y); - + vec2 deflection = calc_deflection(vertex.y); + vertex.z += deflection[0]; vertex.y += deflection[1]; - + if(rotation_rad != 0){ vec2 defl1=calc_deflection(rotation_y1); vec2 defl2=calc_deflection(rotation_y2); @@ -136,7 +143,7 @@ void main(void) vertex.y=new_point[1]; vertex.z=new_point[2]; } - + } else if (wingflex_type == 1 ) { float arm_reach = 4.8; @@ -152,14 +159,14 @@ void main(void) // basic flapping motion is linear to arm_reach, then parabolic float intercept_point = 0.1 * arm_reach * arm_reach * flex_factor1; - + if (x_factor < arm_reach) { vertex.z += x_factor/arm_reach * intercept_point; } - else - { + else + { vertex.z += 0.1 * x_factor * x_factor * flex_factor1; } @@ -176,13 +183,16 @@ void main(void) if (vertex.x > 0.0) {sweep_x = - 0.5;} vertex.x+= sweep_x * (1.0 + 0.5 *x_factor) * wingsweep_factor; - - - } + } + // END WINGFLEX + rawpos = vertex.xyz; vec4 ecPosition = gl_ModelViewMatrix * vertex; + //rawpos = gl_Vertex.xyz; + //vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; + //fog_Func(fogType); VNormal = normalize(gl_NormalMatrix * gl_Normal); @@ -240,6 +250,7 @@ void main(void) reflVec = reflVec_stat; } + gl_FrontColor = gl_FrontMaterial.emission + gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient); @@ -247,5 +258,6 @@ void main(void) //gl_Position = ftransform(); gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + setupShadows(ecPosition); }