VR-Vantage 3.1 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ssAtmosphericTable.h
Go to the documentation of this file.
1 
3 // Copyright JRM Enterprises, Inc. 2004
4 // All rights reserved.
5 //
6 // This code is the intellectual property of JRM Enterprises, Inc.
7 // It may not be used or released as source or compiled binary form
8 // without the prior written consent of JRM Enterprises, Inc.
9 //
10 // Original Author: Ken George Date: July 2004
12 
13 #ifndef _ssAtmosphericTable_
14 #define _ssAtmosphericTable_
15 
16 
17 #include "ssSensor.h"
18 //#include "ssBuffer.h"
19 
20 #define BNN_MUMODE 2 // [0=Default, 1=Linear, 2=Exponential] Mu sampling mode. NOTE: Mode 1 is not yet supported in shaders!!!!
21 #define BNN_VMODE 1 // [0=dot(solar,view), 1=dot(solar_azimuth, view_azimuth)] V-sampling mode.
22 #define BNN_NR 3.0 // [unitless>=0.001] Increases altitude sampling density at low altitude (All modes)
23 #define BNN_NMU 5.2 // [unitless>=0.001] Increases mu sampling density away from horizon (Default mu mode only)
24 #define BNN_NV 2.0 // [unitless>=1] Increases sampling around v=1 (All modes)
25 #define BNN_NMUSEGS 8 // [>0] Number of segments in linear-mu mode.
26 #define BNN_RHO0 0.1 // [unitless 0.05-1] is relative sampling density for mu regions away from horizon or source.
27 #define BNN_RHOH 0.3 // [unitless 0-0.95] is relative sampling density peak for mu region near horizon
28 #define BNN_RHOS 0.5 // [unitless 0-0.95] is relative sampling density peak for mu region around source direction
29 #define BNN_DEVH 0.1 // [unitless 0.01-2] is width of sampling density curve for mu region near horizon
30 #define BNN_DEVS 0.05 // [unitless 0.01-2] is width of sampling density curve for mu region around source direction
31 
32 #define MAXFLOAT 65000.0f
33 #define NUM_IRRLUT_COMPONENTS 5
34 
35 #ifndef SKYDOME_RANGE
36 #define SKYDOME_RANGE 1100000.0 /* //195000.0 //!< the skydome range. See also ciScenario.h and ciEnvironment.h */
37 #endif
38 
39 #ifndef REFRACTK
40 #define REFRACTK 1.0 /* 1.0182 */
41 #endif
42 
43 #ifndef SHADER_LOLIM
44 #define SHADER_LOLIM 1.0E-15
45 #endif
46 
48 // class: ssAtmosphericTable
49 //
50 // description: class for the sensor atmospheric maps
51 // Note all spectral values are defined by a sensor resolution or metin
52 // This class is not part of the API and is accessed thru ssEnvironment.
53 //
55 {
56 public:
57 
59  // BNN LUT SETTINGS
60 
61  typedef struct
62  {
63  int mumode; // [0=Default, 1=Linear, 2=Exponential] Mu sampling mode.
64  int vmode; // [0=dot(solar,view), 1=dot(solar_azimuth, view_azimuth)] V-sampling mode.
65  double nr; // [unitless>=0.001] Increases altitude sampling density at low altitude (All modes)
66  double nmu; // [unitless>=0.001] Increases mu sampling density away from horizon (Default mu mode)
67  double nv; // [unitless>=1] Increases sampling around v=1 (All modes)
68 
69  // ------------- PARAMS FOR LINEAR & EXPONENTIAL MU MODES -----------
70  int nmusegs; // [>0] Number of segments in linear-mu mode.
71  double rho0; // [unitless 0.05-1] is relative sampling density for mu regions away from horizon or source.
72  double rhoh; // [unitless 0-0.95] is relative sampling density peak for mu region near horizon
73  double rhos; // [unitless 0-0.95] is relative sampling density peak for mu region around source direction
74  double devh; // [unitless 0.01-2] is width of sampling density curve for mu region near horizon
75  double devs; // [unitless 0.01-2] is width of sampling density curve for mu region around source direction
76  } BNNLUTPARMS; // Set of parameters which govern polar ATM LUT sampling.
77 
79 
80 
82  // ssAtmosphericTable
87 
89  //~ssAtmosphericTable
94 
96  //initializeAtm
103  bool initializeAtm(METIN* metin, ssSensor* sensor);
104 
105 
107  //setATMflags
120  void setATMflags(bool useSun, bool useBothSunMoon, double sensorAltitude, bool spectralMode, bool atmEnable, bool scatterEnable,
121  bool multiScatterEnable, bool roundEarthEnable, bool useODLimit);
122 
124  //makeSensorAtmosphericData
130 
132  // ssAtmosphericTable::makePolarATMLUTs
133  //
134  // description: Creates the following tables:
135  // polarXmitData indexed by {sensorAlt, objAngle, wavelength_index} = transmission to maxrange.
136  // polarPradData indexed by {sensorAlt, objAngle, wavelength_index} = thermal and MS path radiance to maxrange.
137  // polarScatData indexed by {sensorAlt, objAngle, viewSourceAzimuth, wavelength_index} = solar + lunar single-scattering radiance to maxrange.
138  // polarMradData indexed by {sensorAlt, objAngle, wavelength_index} = solar + lunar multiple-scattering radiance to maxrange.
139  // sourceAngles and Main Source type (sun, moon) are computed from METIN ephemeris.
140  //
141  //
142  void makePolarATMLUTs();
143 
145  //makeLightSourceData
149  void makeLightSourceData();
150 
152  // ssAtmosphericTable::makeBathymetryData
153  //
154  // description: Updates the acoustic sea layer data
155  //
156  void makeBathymetryData();
157 
159  // ssAtmosphericTable::makeAcousticPathData
160  //
161  // description: Updates the acoustic path data
162  //
163  void makeAcousticPathData();
164 
166  // ssAtmosphericTable::substituteRefractionRadiusRatio
167  //
168  // description: If we are in (passband) radar mode:
169  // 1. Add multiple scattering contributions into single scattering data elements
170  // 2. Replace multiple scattering data element with effective earth radius ratio
171  // for given {sensor alt, object alt, ground range} combination.
172  // If constEratio=true, refractive earth radius ratio will be set to 4/3 for all paths.
173  //
174  void substituteRefractionRadiusRatio(bool constEratio);
175 
176 
178  //makeLightSourceDataSigSim
184 
186  //updateSunDiskRadiance
191  void updateSunDiskRadiance();
192 
194  //updateMoonDiskRadiance
199  void updateMoonDiskRadiance();
200 
202  //updateManMadeLightData
209  void updateManMadeLightData(bool forceUpdate = false);
210 
212  //getAtmospherics
220  void getAtmospherics(double sensorAltitude, double objAltitude, double objRange, bool transOnly = false);
221 
222 
224  //getNumberWavelengths
229  unsigned int getNumberWavelengths();
230 
232  //getNumberMetinWavelengths
237  unsigned int getNumberMetinWavelengths();
238 
240  //getNumberLayers
245  unsigned int getNumberLayers();
246 
248  //setNumberLayers
253  void setNumberLayers(unsigned int layers);
254 
256  //getNumberObjectAltitudes
261  unsigned int getNumberObjectAltitudes();
262 
264  //setNumberObjectAltitudes
269  void setNumberObjectAltitudes(unsigned int alts);
270 
272  //getNumberObjectAngles
277  unsigned int getNumberObjectAngles();
278 
280  //setNumberObjectAngles
285  void setNumberObjectAngles(unsigned int angles);
286 
288  //getNumberSensorAltitudes
293  unsigned int getNumberSensorAltitudes();
294 
296  //setNumberSensorAltitudes
301  void setNumberSensorAltitudes(unsigned int alts);
302 
304  //getNumberSamplesPerLayer
309  unsigned int getNumberSamplesPerLayer();
310 
312  //setNumberSamplesPerLayer
317  void setNumberSamplesPerLayer(unsigned int alts);
318 
320  //getNumberScatAngles
325  unsigned int getNumberScatAngles();
326 
328  //setNumberScatAngles
333  void setNumberScatAngles(unsigned int angles);
334 
336  //getMaxAltitude
341  double getMaxAltitude();
342 
344  //setMaxAltitude
349  void setMaxAltitude(double max);
350 
352  //setPowAltitude
357  void setPowAltitude(double p);
358 
360  //getPowAltitude
365  double getPowAltitude();
366 
368  //getNumberTextureRanges
373  unsigned int getNumberTextureRanges();
374 
376  //setNumberTextureRanges
381  void setNumberTextureRanges(unsigned int ranges);
382 
384  //getMaxRange
389  double getMaxRange();
390 
392  //setMaxRange
397  void setMaxRange(double max);
398 
400  //setPowRange
405  void setPowRange(double p);
406 
408  //getPowRange
413  double getPowRange();
414 
416  //setPowDensity
421  void setPowDensity(double p);
422 
424  //getPowDensity
429  double getPowDensity();
430 
431 
433  //getNumberComponents
438  unsigned int getNumberComponents();
439 
441  //setUseSun
448  void setUseSun(bool flag);
449 
451  //getUseSun
458  bool getUseSun();
459 
461  //setUseBothSunMoon
467  void setUseBothSunMoon(bool flag);
468 
470  //getUseBothSunMoon
476  bool getUseBothSunMoon();
477 
479  //getSensorAltitude
484  double getSensorAltitude();
485 
487  //setSensorAltitude
493  void setSensorAltitude(double alt);
494 
496  //getSpectralMode
501  bool getSpectralMode();
502 
504  //getScatterEnable
509  bool getScatterEnable();
510 
512  //getAtmEnable
517  bool getAtmEnable();
518 
520  //getMultiScatterEnable
525  bool getMultiScatterEnable();
526 
528  //getRoundEarth
533  bool getRoundEarth();
534 
536  //getUseODLimit
541  bool getUseODLimit();
542 
544  //getMaxRadiance
549  double getMaxRadiance();
550 
552  //setMaxRadiance
557  void setMaxRadiance(double maxRadiance);
558 
560  //getUpdateTime
566 
568  //setUpdateTime
573  void setUpdateTime(JRMTIME time);
574 
576  //timeChanged
583  bool timeChanged(JRMTIME time, double buffer_hrs = LOLIM);
584 
586  //*getAltitudePtr
591  double* getAltitudePtr();
592 
594  //*getObjAltPtr
599  double* getObjAltPtr();
600 
602  //*getSensAltPtr
607  double* getSensAltPtr();
608 
610  //*getRangePtr
615  double* getRangePtr();
616 
618  //*getScatAnglePtr
623  double* getScatAnglePtr();
624 
626  //*getMetinAtmosphericsData
631  void getMetinAtmosphericsData(double** Trans, double** AbsorbTrans, double** PathRad, double** ScatRad, double** MScatRad);
632 
634  //*getSensorAtmosphericsData
639  void getSensorAtmosphericsData(double** Trans, double** AbsorbTrans, double** PathRad, double** ScatRad, double** MScatRad);
640 
642  //*getObjectScatData
647  double* getObjectScatData();
648 
650  //*getObjectAmbientUpwelling
655  double* getObjectAmbientUpwelling();
656 
658  //*getObjAmbientDownwelling
663  double* getObjectAmbientDownwelling();
664 
666  //*getAtmosphericData
672  float* getAtmosphericData(bool spectralMode);
673 
675  //makeScatteringData
679  void makeScatteringData(bool useSun = true, bool includeSky = true, bool includeEarth = true, bool includeStars = true);
680 
682  //makeScatteringDataSigSim
686  int makeScatteringDataSigSim(bool useSun = true, bool includeStars = true);
687 
689  //*getAmbientLightSourceData
695  double* getAmbientLightSourceData(unsigned int altitude = 0);
696 
698  //*getDownwellLightSourceData
704  double* getDownwellLightSourceData(unsigned int altitude = 0);
705 
707  //*getUpwellLightSourceData
713  double* getUpwellLightSourceData(unsigned int altitude = 0);
714 
716  //*getDirectLightSourceData
722  double *getDirectLightSourceData(unsigned int altitude = 0);
723 
725  //*getLightSourceData
730  float* getLightSourceData();
731 
733  //getSunDiskRadiance
739  float* getSunDiskRadiance();
740 
742  //getMoonDiskRadiance
748  float* getMoonDiskRadiance();
749 
751  // getNumberManMadeLights
752  // description: gets the number of man-made light sources
754 
756  //getManMadeLightData
764  float* getManMadeLightData();
765 
767  //getIrradiance
774  void getIrradiance(double altitude, double* downwellIrradiance, double* upwellIrradiance, double* directIrradiance, bool useSun = true, bool includeSky = true, bool includeEarth = true, bool includeAmbient = true);
775 
777  //computeDiffuseIrradiance
782  void computeDiffuseIrradiance(double altitude, bool includeSky, bool includeSunMoon, bool includeEarthshine);
783 
784 
786  //computeDiffuseSolarLunar
791  void computeDiffuseSolarLunar(double altitude);
792 
793  void computeDiffuseLightSigSim(double altitude, bool includeSun, bool includeMoon, bool includeSky, bool includeEarth, long startindex, long endindex);
794 
795 
797  //computeDiffuseEarthshine
802  void computeDiffuseEarthshine(double altitude);
803 
804 
806  //computeDiffuseSky
811  void computeDiffuseSky(double altitude);
812 
814  //setAtmExtinctionScale
819  void setAtmExtinctionScale(float scale);
820 
822  //getAtmExtinctionScale
827  float getAtmExtinctionScale();
828 
830  //setAtmAmbientLightScale
835  void setAtmAmbientLightScale(float scale);
836 
838  //getAtmAmbientLightScale
843  float getAtmAmbientLightScale();
844 
846  //setAtmSkyScale
851  void setAtmSkyScale(float scale);
852 
854  //getAtmSkyScale
859  float getAtmSkyScale();
860 
862  //getRefractiveProfile
867  void getRefractiveProfile(double& n0, double& h0);
868 
869 
871  //isDirty
876  bool isDirty();
877 
879  //setDirty
883  void setDirty();
884 
886  //clrDirty
890  void clrDirty();
891 
893  //getSensorPtr
898 
900  //setOriginalCode
904  void setOriginalCode(bool onoff);
905 
907  //getOriginalCode
911  bool getOriginalCode();
912 
914  //setModRad
918  void setModRad(bool onoff);
919 
921  //getModRad
925  bool getModRad();
926 
928  // writeATMLUT
929  /*
930  * description: Writes the sensor atmospheric data table to disk
931  *
932  */
933  int writeATMLUT(char* cacheDirectory, char* statefile);
934 
936  // readATMLUT
937  /*
938  * description: Reads a sensor atmospheric data table from disk
939  *
940  */
941  int readATMLUT(char* cacheDirectory, char* statefile);
942 
944  // rescaleATMLUT
945  /*
946  * description: Rescales a sensor atmospheric data table in memory
947  *
948  */
949  int rescaleATMLUT(double oldMaxRad, double newMaxRad);
950 
952  // writeENVLUT
953  //
954  // description: Writes the light source irradiance data table to disk
955  //
956  //
957  //
958  int writeENVLUT(char* cacheDirectory, char* statefile);
959 
961  // ssAtmosphericTable::readENVLUT
962  //
963  // description: Reads a light source irradiance data table from disk
964  //
965  //
966  //
967  int readENVLUT(char* cacheDirectory, char* statefile);
968 
970  // ssAtmosphericTable::rescaleENVLUT
971  //
972  // description: Rescales the light source irradiance data table in memory
973  //
974  //
975  //
976  int rescaleENVLUT(double oldMaxRad, double newMaxRad);
977 
979  //getLUTTODInterval
984  double getLUTTODInterval();
985 
987  //setLUTTODInterval
992 
996 
997 
1004 
1013 
1025 
1034 
1044 
1049 
1060 
1072 
1077 
1088 
1100 
1109 
1121 
1130 
1139 
1152 
1161 
1170 
1182 
1186 
1189 
1193 
1196 
1203 
1208 
1211 
1216 
1219 
1224 
1227 
1232 
1235 
1240 
1247 
1253 
1259 
1262 
1269 
1272 
1279 
1282 
1289 
1292 
1300 
1304 
1311 
1314 
1318 
1321 
1325 
1328 
1336 
1339 
1352 
1361 
1411 
1425 
1483 


Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)