summaryrefslogtreecommitdiff
path: root/hw6/include/brdfSample.h
diff options
context:
space:
mode:
author53hornet <53hornet@gmail.com>2019-02-02 23:33:15 -0500
committer53hornet <53hornet@gmail.com>2019-02-02 23:33:15 -0500
commitdb072ad4dc181eca5a1458656b130beb43f475bf (patch)
treea3c03c7f5497cb70503e2486662fa85cfb53415a /hw6/include/brdfSample.h
downloadcsci427-master.tar.xz
csci427-master.zip
Diffstat (limited to 'hw6/include/brdfSample.h')
-rw-r--r--hw6/include/brdfSample.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/hw6/include/brdfSample.h b/hw6/include/brdfSample.h
new file mode 100644
index 0000000..eeaeb32
--- /dev/null
+++ b/hw6/include/brdfSample.h
@@ -0,0 +1,77 @@
+/******************************************************************/
+/* This file is part of the homework assignments for CSCI-427/527 */
+/* at The College of William & Mary and authored by Pieter Peers. */
+/* No part of this file, whether altered or in original form, can */
+/* be distributed or used outside the context of CSCI-427/527 */
+/* without consent of either the College of William & Mary or */
+/* Pieter Peers. */
+/******************************************************************/
+#ifndef _BRDFSAMPLE_H_
+#define _BRDFSAMPLE_H_
+
+#include "vec3d.h"
+#include "color.h"
+#include "transformation3d.h"
+#include <ostream>
+
+class brdfSample {
+ public:
+ //////////////////
+ // Constructors //
+ //////////////////
+ brdfSample(void);
+ brdfSample(const vec3d& out, const float pdf, const color& reflectance);
+ brdfSample(const brdfSample& bs);
+
+ ///////////////
+ // Operators //
+ ///////////////
+ brdfSample& operator=(const brdfSample& bs);
+
+ brdfSample operator*(float pdf) const;
+ brdfSample& operator*=(float pdf);
+
+
+ ////////////////
+ // Inspectors //
+ ////////////////
+ const vec3d& exitantDirection(void) const;
+ float pdf(void) const;
+ const color& reflectance(void) const;
+
+ /////////////
+ // Methods //
+ /////////////
+ brdfSample& transform(const transformation3d& t);
+ brdfSample& inverseTransform(const transformation3d& t);
+
+ /////////////
+ // Friends //
+ /////////////
+ friend void swap(brdfSample& a, brdfSample& b) { a._swap(b); }
+
+ friend brdfSample transform(const brdfSample& s, const transformation3d& t) { brdfSample result(s); return result.transform(t); }
+ friend brdfSample inverseTransform(const brdfSample& s, const transformation3d& t) { brdfSample result(s); return result.inverseTransform(t); }
+
+ friend std::ostream& operator<<(std::ostream& s, const brdfSample& bs)
+ {
+ s << "BrdfSample: -> " << bs._out << " with PDF: " << bs._pdf << ", and reflectance: " << bs._reflectance;
+ return s;
+ }
+
+ private:
+ /////////////////////
+ // Private Methods //
+ /////////////////////
+ void _swap(brdfSample& bs);
+ void _assign(const brdfSample& bs);
+
+ //////////////////////////
+ // Private Data Members //
+ //////////////////////////
+ vec3d _out;
+ float _pdf;
+ color _reflectance;
+};
+
+#endif /* _BRDFSAMPLE_H_ */