Advertisement
microwerx

what i sent in a packet

Jan 13th, 2018
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. class CoronaJob
  2. {
  3. public:
  4. enum class Type
  5. {
  6. REF,
  7. REF_CubeMap,
  8. Sky,
  9. VIZ,
  10. GEN
  11. };
  12.  
  13. CoronaJob() { }
  14. CoronaJob(const string & name, Type jobtype, int arg1 = 0, int arg2 = 0);
  15. ~CoronaJob();
  16.  
  17. void EnableHQ() { isHQ = true; }
  18. void DisableHQ() { isHQ = false; }
  19. inline bool IsHQ() const { return isHQ; }
  20.  
  21. inline void SetMaxRayDepth(int depth) { maxRayDepth = clamp(depth, 1, 50); }
  22. inline void SetPassLimit(int limit) { passLimit = clamp(limit, 1, 100); }
  23.  
  24. inline void SetIgnoreCache(bool state) { ignoreCache = state; }
  25.  
  26. void EnableHDR() { isHDR = true; }
  27. void DisableHDR() { isHDR = false; }
  28. inline bool IsHDR() const { return isHDR; }
  29.  
  30. inline bool IsReady() const { return state == State::Ready; }
  31. inline bool IsRunning() const { return state == State::Running; }
  32. inline bool IsFinished() const { return state == State::Finished; }
  33.  
  34. inline bool IsREF() const { return type == Type::REF; }
  35. inline bool IsREF_CubeMap() const { return type == Type::REF_CubeMap; }
  36. inline bool IsSky() const { return type == Type::Sky; }
  37. inline bool IsGEN() const { return type == Type::GEN; }
  38. inline bool IsVIZ() const { return type == Type::VIZ; }
  39.  
  40. inline void SetImageDimensions(int w, int h) { imageWidth = clamp(w, 0, 8192); imageHeight = clamp(h, 0, 8192); }
  41.  
  42. inline double GetElapsedTime() const { return elapsedTime; }
  43.  
  44. inline const string & GetOutputPath() const { if (isHQ) return hq_output_path_ppm; else return output_path_ppm; }
  45. inline const string & GetName() const { return scene_name; }
  46.  
  47. inline int GetGENLightIndex() const { if (IsGEN()) return recvLight; return -1; }
  48. inline int GetVIZSendLightIndex() const { if (IsVIZ()) return sendLight; return -1; }
  49. inline int GetVIZRecvLightIndex() const { if (IsVIZ()) return recvLight; return -1; }
  50.  
  51. void Start(CoronaSceneFile & coronaScene, SimpleSceneGraph & ssg);
  52. void CopySPH(const Sph4f & sph);
  53. void CopySPHToSph4f(Sph4f & sph);
  54. const int GetCoronaRetval() const { return lastCoronaRetval; }
  55. const int GetConvertRetval() const { return lastConvertRetval; }
  56.  
  57. string MakeCoronaCommandLine();
  58. string MakeConvertCommandLine();
  59.  
  60. static string MakeREFName(const string &prefix, bool isCubeMap, bool isHDR = false, bool isHQ = false, bool ks = false, int MaxRayDepth = 5, int PassLimit = 1);
  61. static string MakeVIZName(const string &prefix, int srcLightIndex, int recvLightIndex, bool isHDR = false, bool isHQ = false, bool ks = false, int MaxRayDepth = 5, int PassLimit = 1);
  62. static string MakeGENName(const string &prefix, int recvLightIndex, bool isHDR = false, bool isHQ = false, bool ks = false, int MaxRayDepth = 5, int PassLimit = 1);
  63. static string MakeHIERName(const string &prefix, int sendLightIndex, int MaxDegrees);
  64.  
  65. inline bool IsJobFinished() const { return finished; }
  66. inline void MarkJobFinished() { finished = true; }
  67. inline void MarkJobUnfinished() { finished = false; working = false; }
  68. inline bool IsJobWorking() const { return working; }
  69. inline void MarkJobWorking() { working = true; }
  70.  
  71. string & ToString() const;
  72. void FromString(const string & str);
  73. private:
  74. enum class State
  75. {
  76. Error = -1,
  77. Ready = 0,
  78. Running,
  79. Finished,
  80. };
  81. State state = State::Ready;
  82. Type type = Type::REF;
  83. string scene_name;
  84. string scene_path;
  85. string output_path_exr;
  86. string output_path_ppm; // the ppm is created using ImageMagick's convert command
  87. string output_path_png;
  88. string hq_output_path_exr;
  89. string hq_output_path_ppm; // the ppm is created using ImageMagick's convert command
  90. string conf_path;
  91. string hq_conf_path;
  92.  
  93. float sph[121*4];
  94.  
  95. int imageWidth = 1280;
  96. int imageHeight = 720;
  97. int maxRayDepth = 5;
  98. int passLimit = 1;
  99. bool ignoreCache = false;
  100.  
  101. double elapsedTime;
  102. bool finished = false;
  103. bool working = false;
  104.  
  105. bool isHQ = false;
  106. bool isHDR = false;
  107.  
  108. // If GEN, then recvLight is the
  109. int sendLight = -1;
  110. int recvLight = -1;
  111.  
  112. int lastCoronaRetval = 0;
  113. int lastConvertRetval = 0;
  114.  
  115. bool Run();
  116. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement