include/scene.h
branchpyrit
changeset 98 64638385798a
parent 95 ca7d4c665531
--- a/include/scene.h	Thu May 15 19:15:57 2008 +0200
+++ b/include/scene.h	Mon May 19 22:59:04 2008 +0200
@@ -76,7 +76,7 @@
 #endif
 
 /**
- * General camera
+ * Standard ray tracing camera
  */
 class Camera
 {
@@ -84,8 +84,12 @@
 	Float F;
 public:
 	Camera(): eye(0,0,10), p(0,0,-1), u(-1,0,0), v(0,1,0), F(2*tan(PI/8)) {};
+
+	/** Position + p,u,v constructor */
 	Camera(const Vector &C, const Vector &ap, const Vector &au, const Vector &av):
 		eye(C), p(ap), u(au), v(av), F(2*tan(PI/8)) {};
+
+	/** Look-at constructor */
 	Camera(const Vector &from, const Vector &lookat, const Vector &up):
 		eye(from), F(2*tan(PI/8))
 	{
@@ -104,21 +108,37 @@
 	const Vector &getu() const { return u; };
 	const Vector &getv() const { return v; };
 	const Float &getF() const { return F; };
+
 	void setEye(const Vector &aeye) { eye = aeye; };
 	void setp(const Vector &ap) { p = ap; };
 	void setu(const Vector &au) { u = au; };
 	void setv(const Vector &av) { v = av; };
+
+	/** set "screen plane" size
+	 * @param[in] F   height of the screen plane */
 	void setF(const Float &aF) { F = aF; };
+
+	/** set camera's angle of view (in radians) */
 	void setAngle(const Float angle) { F = 2*tan(angle/2); };
+
+	/** rotate camera using a quaternion */
 	void rotate(const Quaternion &q);
+
+	/** translate the camera in its direction
+	 * @param[in] fw	size of forward step
+	 * @param[in] left	size of left step
+	 * @param[in] up	size of up step
+	 */
 	void move(const Float fw, const Float left, const Float up);
 
+	/** make the ray from screen sample according the camera's parameters */
 	const Ray makeRay(const Sample &samp) const
 	{
 		Vector dir = normalize(p - (u*samp.x + v*samp.y)*F);
 		return Ray(eye, dir);
 	};
 
+	/** same as makeRay but for ray packet */
 #ifndef NO_SIMD
 	void makeRayPacket(const Sample *samples, RayPacket &rays) const
 	{
@@ -188,6 +208,8 @@
 		pos(Vector(0,0,0)), colour(Colour(1,1,1)), cast_shadows(true) {};
 	Light(const Vector &position, const Colour &acolour):
 		pos(position), colour(acolour), cast_shadows(true) {};
+
+	/** allow shadows from this light */
 	void castShadows(int cast) { cast_shadows = cast; };
 };
 
@@ -206,7 +228,17 @@
 	Float w() const { return H.x-L.x; };
 	Float h() const { return H.y-L.y; };
 	Float d() const { return H.z-L.z; };
+
+	/**
+	 * intersect ray with the bounding box
+	 * @param[in] ray	the ray
+	 * @param[out] a	distance of first intersection
+	 * @param[out] b	distance of second intersection
+	 * @return true if ray intersects bbox
+	 */
 	bool intersect(const Ray &ray, Float &a, Float &b) const;
+
+	/** same as intersect() but for ray packets */
 #ifndef NO_SIMD
 	mfloat4 intersect_packet(const RayPacket &rays, mfloat4 &a, mfloat4 &b) const;
 #endif