LCOV - code coverage report
Current view: top level - maps/random/rmgen - environment.js (source / functions) Hit Total Coverage
Test: lcov.info Lines: 2 22 9.1 %
Date: 2023-04-02 12:52:40 Functions: 0 20 0.0 %

          Line data    Source code
       1             : /**
       2             :  * @file The environment settings govern the appearance of the Sky, Fog, Water and Post-Processing effects.
       3             :  */
       4             : 
       5           6 : var g_Environment = {
       6             :         "SkySet": "default", // textures for the skybox, subdirectory name of art/textures/skies
       7             :         "SunColor": { "r": 1.03162, "g": 0.99521, "b": 0.865752, "a": 0 }, // all rgb from 0 to 1
       8             :         "SunElevation": 0.7, // 0 to 2pi
       9             :         "SunRotation": -0.909, // 0 to 2pi
      10             :         "AmbientColor": { "r": 0.364706, "g": 0.376471, "b": 0.419608, "a": 0 },
      11             :         "Water": {
      12             :                 "WaterBody": {
      13             :                         "Type": "ocean", // Subdirectory name of art/textures/animated/water
      14             :                         "Color": { "r": 0.3, "g": 0.35, "b": 0.7, "a": 0 },
      15             :                         "Tint": { "r": 0.28, "g": 0.3, "b": 0.59, "a": 0 },
      16             :                         "Height": undefined, // TODO: default shouldn't be set in ExportMap
      17             :                         "Waviness": 8, // typically from 0 to 10
      18             :                         "Murkiness": 0.45, // 0 to 1, amount of tint to blend in with the refracted color
      19             :                         "WindAngle": 0.0 // 0 to 2pi, direction of waves
      20             :                 }
      21             :         },
      22             :         "Fog": {
      23             :                 "FogFactor": 0.0,
      24             :                 "FogThickness": 0.5,
      25             :                 "FogColor": { "r": 0.8, "g": 0.8, "b": 0.8, "a": 0 }
      26             :         },
      27             :         "Postproc": {
      28             :                 "Brightness": 0.0,
      29             :                 "Contrast": 1.0,
      30             :                 "Saturation": 1.0,
      31             :                 "Bloom": 0.2,
      32             :                 "PostprocEffect": "default" // "default", "hdr" or "DOF"
      33             :         }
      34             : };
      35             : 
      36             : /**
      37             :  * Camera location in case there are no player entities.
      38             :  */
      39           6 : var g_Camera = {
      40             :         "Position": { "x": 256, "y": 150, "z": 256 },
      41             :         "Rotation": 0,
      42             :         "Declination": 0.523599
      43             : };
      44             : 
      45             : ////////////////////////////////////////////////////////////////////////////
      46             : // Sun, Sky and Terrain
      47             : ////////////////////////////////////////////////////////////////////////////
      48             : 
      49             : function setSkySet(set)
      50             : {
      51           0 :         g_Environment.SkySet = set;
      52             : }
      53             : 
      54             : function setSunColor(r, g, b)
      55             : {
      56           0 :         g_Environment.SunColor = { "r" : r, "g" : g, "b" : b, "a" : 0 };
      57             : }
      58             : 
      59             : function setSunElevation(e)
      60             : {
      61           0 :         g_Environment.SunElevation = e;
      62             : }
      63             : 
      64             : function setSunRotation(r)
      65             : {
      66           0 :         g_Environment.SunRotation = r;
      67             : }
      68             : 
      69             : function setAmbientColor(r, g, b)
      70             : {
      71           0 :         g_Environment.AmbientColor = { "r" : r, "g" : g, "b" : b, "a" : 0 };
      72             : }
      73             : 
      74             : ////////////////////////////////////////////////////////////////////////////
      75             : // Water
      76             : ////////////////////////////////////////////////////////////////////////////
      77             : 
      78             : function setWaterColor(r, g, b)
      79             : {
      80           0 :         g_Environment.Water.WaterBody.Color = { "r" : r, "g" : g, "b" : b, "a" : 0 };
      81             : }
      82             : 
      83             : function setWaterTint(r, g, b)
      84             : {
      85           0 :         g_Environment.Water.WaterBody.Tint = { "r" : r, "g" : g, "b" : b, "a" : 0 };
      86             : }
      87             : 
      88             : function setWaterHeight(h)
      89             : {
      90           0 :         g_Environment.Water.WaterBody.Height = h;
      91             : }
      92             : 
      93             : function setWaterWaviness(w)
      94             : {
      95           0 :         g_Environment.Water.WaterBody.Waviness = w;
      96             : }
      97             : 
      98             : function setWaterMurkiness(m)
      99             : {
     100           0 :         g_Environment.Water.WaterBody.Murkiness = m;
     101             : }
     102             : 
     103             : function setWaterType(m)
     104             : {
     105           0 :         g_Environment.Water.WaterBody.Type = m;
     106             : }
     107             : 
     108             : function setWindAngle(m)
     109             : {
     110           0 :         g_Environment.Water.WaterBody.WindAngle = m;
     111             : }
     112             : 
     113             : ////////////////////////////////////////////////////////////////////////////
     114             : // Fog (numerical arguments between 0 and 1)
     115             : ////////////////////////////////////////////////////////////////////////////
     116             : 
     117             : function setFogFactor(s)
     118             : {
     119           0 :         g_Environment.Fog.FogFactor = s / 100.0;
     120             : }
     121             : 
     122             : function setFogThickness(thickness)
     123             : {
     124           0 :         g_Environment.Fog.FogThickness = thickness;
     125             : }
     126             : 
     127             : function setFogColor(r, g, b)
     128             : {
     129           0 :         g_Environment.Fog.FogColor = { "r" : r, "g" : g, "b" : b, "a" : 0 };
     130             : }
     131             : 
     132             : ////////////////////////////////////////////////////////////////////////////
     133             : // Post Processing (numerical arguments between 0 and 1)
     134             : ////////////////////////////////////////////////////////////////////////////
     135             : 
     136             : function setPPBrightness(s)
     137             : {
     138           0 :         g_Environment.Postproc.Brightness = s - 0.5;
     139             : }
     140             : 
     141             : function setPPContrast(s)
     142             : {
     143           0 :         g_Environment.Postproc.Contrast = s + 0.5;
     144             : }
     145             : 
     146             : function setPPSaturation(s)
     147             : {
     148           0 :         g_Environment.Postproc.Saturation = s * 2;
     149             : }
     150             : 
     151             : function setPPBloom(s)
     152             : {
     153           0 :         g_Environment.Postproc.Bloom = (1 - s) * 0.2;
     154             : }
     155             : 
     156             : function setPPEffect(s)
     157             : {
     158           0 :         g_Environment.Postproc.PostprocEffect = s;
     159             : }

Generated by: LCOV version 1.14