microwerx icon

what i sent in a packet

microwerx | PRO | 01/13/18 08:45:47 PM UTC | 0 ⭐ | 664 👁️ | Never ⏰ | []
text |

4.04 KB

|

None

|

0 👍

/

0 👎

	class CoronaJob
	{
	public:
		enum class Type
		{
			REF,
			REF_CubeMap,
			Sky,
			VIZ,
			GEN
		};
 		CoronaJob() { }
		CoronaJob(const string & name, Type jobtype, int arg1 = 0, int arg2 = 0);
		~CoronaJob();
 		void EnableHQ() { isHQ = true; }
		void DisableHQ() { isHQ = false; }
		inline bool IsHQ() const { return isHQ; }
 		inline void SetMaxRayDepth(int depth) { maxRayDepth = clamp(depth, 1, 50); }
		inline void SetPassLimit(int limit) { passLimit = clamp(limit, 1, 100); }
 		inline void SetIgnoreCache(bool state) { ignoreCache = state; }
 		void EnableHDR() { isHDR = true; }
		void DisableHDR() { isHDR = false; }
		inline bool IsHDR() const { return isHDR; }
 		inline bool IsReady() const { return state == State::Ready; }
		inline bool IsRunning() const { return state == State::Running; }
		inline bool IsFinished() const { return state == State::Finished; }
 		inline bool IsREF() const { return type == Type::REF; }
		inline bool IsREF_CubeMap() const { return type == Type::REF_CubeMap; }
		inline bool IsSky() const { return type == Type::Sky; }
		inline bool IsGEN() const { return type == Type::GEN; }
		inline bool IsVIZ() const { return type == Type::VIZ; }
 		inline void SetImageDimensions(int w, int h) { imageWidth = clamp(w, 0, 8192); imageHeight = clamp(h, 0, 8192); }
 		inline double GetElapsedTime() const { return elapsedTime; }
 		inline const string & GetOutputPath() const { if (isHQ) return hq_output_path_ppm; else return output_path_ppm; }
		inline const string & GetName() const { return scene_name; }
 		inline int GetGENLightIndex() const { if (IsGEN()) return recvLight; return -1; }
		inline int GetVIZSendLightIndex() const { if (IsVIZ()) return sendLight; return -1; }
		inline int GetVIZRecvLightIndex() const { if (IsVIZ()) return recvLight; return -1; }
 		void Start(CoronaSceneFile & coronaScene, SimpleSceneGraph & ssg);
		void CopySPH(const Sph4f & sph);
		void CopySPHToSph4f(Sph4f & sph);
		const int GetCoronaRetval() const { return lastCoronaRetval; }
		const int GetConvertRetval() const { return lastConvertRetval; }
 		string MakeCoronaCommandLine();
		string MakeConvertCommandLine();
 		static string MakeREFName(const string &prefix, bool isCubeMap, bool isHDR = false, bool isHQ = false, bool ks = false, int MaxRayDepth = 5, int PassLimit = 1);
		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);
		static string MakeGENName(const string &prefix, int recvLightIndex, bool isHDR = false, bool isHQ = false, bool ks = false, int MaxRayDepth = 5, int PassLimit = 1);
		static string MakeHIERName(const string &prefix, int sendLightIndex, int MaxDegrees);
 		inline bool IsJobFinished() const { return finished; }
		inline void MarkJobFinished() { finished = true; }
		inline void MarkJobUnfinished() { finished = false; working = false; }
		inline bool IsJobWorking() const { return working; }
		inline void MarkJobWorking() { working = true; }
 		string & ToString() const;
		void FromString(const string & str);
	private:
		enum class State
		{
			Error = -1,
			Ready = 0,
			Running,
			Finished,
		};
		State state = State::Ready;
		Type type = Type::REF;
		string scene_name;
		string scene_path;
		string output_path_exr;
		string output_path_ppm;		// the ppm is created using ImageMagick's convert command
		string output_path_png;
		string hq_output_path_exr;
		string hq_output_path_ppm;	// the ppm is created using ImageMagick's convert command
		string conf_path;
		string hq_conf_path;
 		float sph[121*4];
 		int imageWidth = 1280;
		int imageHeight = 720;
		int maxRayDepth = 5;
		int passLimit = 1;
		bool ignoreCache = false;
 		double elapsedTime;
		bool finished = false;
		bool working = false;
 		bool isHQ = false;
		bool isHDR = false;
 		// If GEN, then recvLight is the
		int sendLight = -1;
		int recvLight = -1;
 		int lastCoronaRetval = 0;
		int lastConvertRetval = 0;
 		bool Run();
	};

Comments