From b9e80543b1e2b640768bbbe4ffcb7d9734034e69 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan <stuart_d_buchanan@yahoo.co.uk> Date: Sun, 21 Aug 2011 21:43:27 +0100 Subject: [PATCH 1/2] Lighting update for c172p. 1) Add keyboard shortcuts for the panel lighting (to make life easier in the dark. 2) Add lighting to the EGT gauge. --- Aircraft/c172p/Instruments/EGT/EGT.xml | 11 +++-- Aircraft/c172p/c172-help.xml | 4 ++ Aircraft/c172p/c172p-set.xml | 58 ++++++++++++++++++-------- 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/Aircraft/c172p/Instruments/EGT/EGT.xml b/Aircraft/c172p/Instruments/EGT/EGT.xml index ea0bb1a8e..fdaa1e46c 100644 --- a/Aircraft/c172p/Instruments/EGT/EGT.xml +++ b/Aircraft/c172p/Instruments/EGT/EGT.xml @@ -33,11 +33,14 @@ <animation> <type>material</type> <object-name>egt</object-name> + <object-name>Needle</object-name> + <object-name>Bug</object-name> + <object-name>Face</object-name> <emission> - <red-prop>sim/model/instrument-lighting/emission/red</red-prop> - <green-prop>sim/model/instrument-lighting/emission/green</green-prop> - <blue-prop>sim/model/instrument-lighting/emission/blue</blue-prop> - <factor-prop>controls/lighting/instruments-norm</factor-prop> + <red>1.0</red> + <green>0.2</green> + <blue>0.0</blue> + <factor-prop>sim/model/material/instruments/factor</factor-prop> </emission> </animation> diff --git a/Aircraft/c172p/c172-help.xml b/Aircraft/c172p/c172-help.xml index bf13aadac..996c18d27 100644 --- a/Aircraft/c172p/c172-help.xml +++ b/Aircraft/c172p/c172-help.xml @@ -4,6 +4,10 @@ <name>Ctrl-c</name> <desc>Panel hotspots and labels</desc> </key> + <key> + <name>l/L</name> + <desc>Increase/decrease panel lighting</desc> + </key> <line/> <line>_________Engine Start Checklist_________</line> <line>Mixture: Rich</line> diff --git a/Aircraft/c172p/c172p-set.xml b/Aircraft/c172p/c172p-set.xml index 88621ed1c..0b7e7e874 100644 --- a/Aircraft/c172p/c172p-set.xml +++ b/Aircraft/c172p/c172p-set.xml @@ -241,23 +241,47 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net </payload> <input> - <keyboard> - <key n="115"> - <name>s</name> - <desc>Toggle Starter Switch</desc> - <binding> - <command>property-assign</command> - <property>/controls/switches/starter</property> - <value >1</value> - </binding> - <mod-up> - <binding> - <command>property-assign</command> - <property>/controls/switches/starter</property> - <value>0</value> - </binding> - </mod-up> - </key> + <keyboard> + <key n="76"> + <name>L</name> + <desc>Decrease Panel lighting</desc> + <binding> + <command>property-adjust</command> + <property>controls/lighting/instruments-norm</property> + <step>-0.1</step> + <min>0</min> + <max>1.0</max> + <wrap>0</wrap> + </binding> + </key> + <key n="108"> + <name>l</name> + <desc>Increase Panel lighting</desc> + <binding> + <command>property-adjust</command> + <property>controls/lighting/instruments-norm</property> + <step>0.1</step> + <min>0</min> + <max>1.0</max> + <wrap>0</wrap> + </binding> + </key> + <key n="115"> + <name>s</name> + <desc>Toggle Starter Switch</desc> + <binding> + <command>property-assign</command> + <property>/controls/switches/starter</property> + <value >1</value> + </binding> + <mod-up> + <binding> + <command>property-assign</command> + <property>/controls/switches/starter</property> + <value>0</value> + </binding> + </mod-up> + </key> </keyboard> </input> From 74a9f8e1a6597bb03e0a84b9ebe78806591fcef2 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan <stuart_d_buchanan@yahoo.co.uk> Date: Sun, 21 Aug 2011 22:09:04 +0100 Subject: [PATCH 2/2] Extend visibility range of 3d clouds to /sim/rendering/clouds3d-vis-range --- Effects/cloud.eff | 8 ++++++++ Shaders/3dcloud.vert | 14 ++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Effects/cloud.eff b/Effects/cloud.eff index bb6d3c31e..8ac147507 100644 --- a/Effects/cloud.eff +++ b/Effects/cloud.eff @@ -4,6 +4,9 @@ <parameters> <texture n ="0"> </texture> + <range> + <use>/sim/rendering/clouds3d-vis-range</use> + </range> </parameters> <technique n="10"> <predicate> @@ -63,6 +66,11 @@ <type>sampler-2d</type> <value type="int">0</value> </uniform> + <uniform> + <name>range</name> + <type>float</type> + <value><use>range</use></value> + </uniform> <vertex-program-two-side>true</vertex-program-two-side> </pass> </technique> diff --git a/Shaders/3dcloud.vert b/Shaders/3dcloud.vert index 6caaf7134..e69a4b7c5 100644 --- a/Shaders/3dcloud.vert +++ b/Shaders/3dcloud.vert @@ -3,6 +3,8 @@ varying float fogFactor; +uniform float range; // From /sim/rendering/clouds3d-vis-range + attribute vec3 usrAttr1; attribute vec3 usrAttr2; @@ -40,26 +42,30 @@ void main(void) // Determine a lighting normal based on the vertex position from the // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker. float n = dot(normalize(-gl_LightSource[0].position.xyz), - normalize(vec3(gl_ModelViewMatrix * vec4(- gl_Position.xyz,0.0)))); + normalize(vec3(gl_ModelViewMatrix * vec4(- gl_Position.x, - gl_Position.y, - gl_Position.z,0.0)))); // Determine the position - used for fog and shading calculations vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position); float fogCoord = abs(ecPosition.z); + + // Determine fractional height of vertex from 0 at the bottom, and 1 at mid-height. + // Used to determine shading. float fract = smoothstep(0.0, cloud_height, gl_Position.z + cloud_height); // Final position of the sprite gl_Position = gl_ModelViewProjectionMatrix * gl_Position; -// Determine the shading of the sprite based on its vertical position and position relative to the sun. + // Determine the shading of the sprite based on its vertical position and position relative to the sun. n = min(smoothstep(-0.5, 0.0, n), fract); -// Determine the shading based on a mixture from the backlight to the front + + // Determine the shading based on a mixture from the backlight to the front vec4 backlight = gl_LightSource[0].diffuse * shade; gl_FrontColor = mix(backlight, gl_LightSource[0].diffuse, n); gl_FrontColor += gl_FrontLightModelProduct.sceneColor; // As we get within 100m of the sprite, it is faded out. Equally at large distances it also fades out. - gl_FrontColor.a = min(smoothstep(10.0, 100.0, fogCoord), 1.0 - smoothstep(15000.0, 20000.0, fogCoord)); + gl_FrontColor.a = min(smoothstep(10.0, 100.0, fogCoord), 1.0 - smoothstep(range*0.8, range, fogCoord)); gl_BackColor = gl_FrontColor; // Fog doesn't affect clouds as much as other objects.