1
0
Fork 0

ALS road shader: Allow to reverse traffic direction

This commit is contained in:
Thorsten Renk 2017-03-09 14:07:20 +02:00
parent bfc6a014bb
commit 5181edd8cf
3 changed files with 12 additions and 0 deletions

View file

@ -21,6 +21,7 @@
<snow_thickness_factor><use>/environment/surface/snow-thickness-factor</use></snow_thickness_factor> <snow_thickness_factor><use>/environment/surface/snow-thickness-factor</use></snow_thickness_factor>
<road-traffic-enabled><use>/sim/rendering/osm/road-traffic-enabled</use></road-traffic-enabled> <road-traffic-enabled><use>/sim/rendering/osm/road-traffic-enabled</use></road-traffic-enabled>
<road-traffic-density><use>/sim/rendering/osm/road-traffic-density</use></road-traffic-density> <road-traffic-density><use>/sim/rendering/osm/road-traffic-density</use></road-traffic-density>
<road-traffic-direction><use>/sim/rendering/osm/road-traffic-direction</use></road-traffic-direction>
<road-light-factor><use>/environment/lightmap-factor</use></road-light-factor> <road-light-factor><use>/environment/lightmap-factor</use></road-light-factor>
</parameters> </parameters>
@ -486,6 +487,14 @@
</value> </value>
</uniform> </uniform>
<uniform>
<name>road_traffic_direction</name>
<type>int</type>
<value>
<use>road-traffic-direction</use>
</value>
</uniform>
<!-- road illumination --> <!-- road illumination -->
<uniform> <uniform>

View file

@ -35,6 +35,7 @@ uniform int refl_enabled;
uniform int refl_type; uniform int refl_type;
uniform int refl_map; uniform int refl_map;
uniform int grain_texture_enabled; uniform int grain_texture_enabled;
uniform int road_traffic_direction;
uniform int rain_enabled; uniform int rain_enabled;
uniform int road_traffic_enabled; uniform int road_traffic_enabled;
uniform int cloud_shadow_flag; uniform int cloud_shadow_flag;
@ -333,6 +334,7 @@ void main (void)
{ {
float cSign = 1.0; float cSign = 1.0;
if (roadCoords.s > 0.5) {cSign = -1.0;} if (roadCoords.s > 0.5) {cSign = -1.0;}
cSign *= road_traffic_direction;
float total_traffic_density = road_traffic_density * rtype_traffic_density; float total_traffic_density = road_traffic_density * rtype_traffic_density;

View file

@ -371,6 +371,7 @@ Started September 2000 by David Megginson, david@megginson.com
<osm> <osm>
<road-traffic-enabled type="bool">true</road-traffic-enabled> <road-traffic-enabled type="bool">true</road-traffic-enabled>
<road-traffic-density type="float">1.0</road-traffic-density> <road-traffic-density type="float">1.0</road-traffic-density>
<road-traffic-direction type="int">1</road-traffic-direction>
</osm> </osm>
<scenery-path-suffix> <scenery-path-suffix>