mmh, there was something missing for assignment 3
authorRoland Hieber <rhieber@gaffel.ibr.cs.tu-bs.de>
Mon, 25 Jan 2010 23:12:30 +0000 (00:12 +0100)
committerRoland Hieber <rhieber@gaffel.ibr.cs.tu-bs.de>
Mon, 25 Jan 2010 23:12:30 +0000 (00:12 +0100)
Light.cxx [new file with mode: 0644]
Light.hxx [new file with mode: 0644]
PhongShader.cxx [new file with mode: 0644]
PhongShader.hxx [new file with mode: 0644]
PointLight.cxx [new file with mode: 0644]
PointLight.hxx [new file with mode: 0644]
SpotLight.cxx [new file with mode: 0644]
SpotLight.hxx [new file with mode: 0644]

diff --git a/Light.cxx b/Light.cxx
new file mode 100644 (file)
index 0000000..ee29a71
--- /dev/null
+++ b/Light.cxx
@@ -0,0 +1,26 @@
+#include "Light.hxx"
+
+Light::Light(Scene* scene)
+  : m_scene(scene)
+{
+}
+
+Light::~Light()
+{
+}
+
+Light::Light()
+  : m_scene(0)
+{
+}
+
+Light::Light(const Light& l)
+{
+  operator=(l);
+}
+
+Light&
+Light::operator=(const Light& )
+{
+  return *this;
+}
diff --git a/Light.hxx b/Light.hxx
new file mode 100644 (file)
index 0000000..a152693
--- /dev/null
+++ b/Light.hxx
@@ -0,0 +1,25 @@
+#ifndef LIGHT_HXX
+#define LIGHT_HXX
+
+#include "Vec3f.hxx"
+#include "Ray.hxx"
+
+// forward declaration
+class Scene;
+
+class Light
+{
+public:
+  Light(Scene* scene);
+  virtual ~Light();
+  
+  virtual bool Illuminate(Ray& shadowray, Vec3f& intensity) = 0;
+protected:
+  Scene* m_scene;
+
+private:
+  Light();
+  Light(const Light& );
+  Light& operator=(const Light& );
+};
+#endif
diff --git a/PhongShader.cxx b/PhongShader.cxx
new file mode 100644 (file)
index 0000000..4f4d065
--- /dev/null
@@ -0,0 +1,35 @@
+#include "PhongShader.hxx"
+
+PhongShader::PhongShader(Scene* scene,
+                        const Vec3f& am_c,
+                        const Vec3f& di_c,
+                        const Vec3f& sp_c,
+                        float ka,
+                        float kd,
+                        float ks,
+                        float ke)
+  : Shader(scene),
+    m_ambient_color(am_c),
+    m_diffuse_color(di_c),
+    m_specular_color(sp_c),
+    m_ka(ka),
+    m_kd(kd),
+    m_ks(ks),
+    m_ke(ke)
+{
+}
+
+PhongShader::PhongShader()
+  : Shader(0)
+{
+}
+
+PhongShader::~PhongShader()
+{
+}
+
+Vec3f
+PhongShader::Shade(Ray& ray)
+{
+  return Vec3f();
+}
diff --git a/PhongShader.hxx b/PhongShader.hxx
new file mode 100644 (file)
index 0000000..b83e670
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef PHONGSHADER_HXX
+#define PHONGSHADER_HXX
+
+#include "Shader.hxx"
+
+class PhongShader : public Shader
+{
+public:
+  PhongShader(Scene* scene,
+             const Vec3f& ambient_color,
+             const Vec3f& diffuse_color,
+             const Vec3f& specular_color,
+             float ka,
+             float kd,
+             float ks,
+             float ke);
+  virtual ~PhongShader();
+  
+  virtual Vec3f Shade(Ray& ray);
+private:
+  PhongShader();
+  
+  Vec3f m_ambient_color, m_diffuse_color, m_specular_color;
+  float m_ka, m_kd, m_ks, m_ke;
+};
+#endif
diff --git a/PointLight.cxx b/PointLight.cxx
new file mode 100644 (file)
index 0000000..1ce5f0b
--- /dev/null
@@ -0,0 +1,40 @@
+#include "PointLight.hxx"
+
+PointLight::PointLight(Scene* scene, const Vec3f& pos, const Vec3f& intensity)
+  : Light(scene),
+    m_pos(pos),
+    m_intensity(intensity)
+{
+}
+
+PointLight::~PointLight()
+{
+}
+
+PointLight::PointLight()
+  : Light(0),
+    m_pos(Vec3f()),
+    m_intensity(Vec3f())
+{
+}
+
+bool
+PointLight::Illuminate(Ray& ray, Vec3f& intensity)
+{
+
+  return false;
+}
+
+const Vec3f&
+PointLight::position() const
+{
+  return m_pos;
+}
+
+const Vec3f&
+PointLight::intensity() const
+{
+  return m_intensity;
+}
+
+
diff --git a/PointLight.hxx b/PointLight.hxx
new file mode 100644 (file)
index 0000000..b086116
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef POINTLIGHT_HXX
+#define POINTLIGHT_HXX
+
+#include "Light.hxx"
+
+class PointLight : public Light
+{
+public:
+  PointLight(Scene* scene, const Vec3f& pos, const Vec3f& intensity);
+  virtual ~PointLight();
+
+  virtual bool Illuminate(Ray& ray, Vec3f& intensity);
+
+  const Vec3f& position() const;
+  const Vec3f& intensity() const;
+
+private:
+  PointLight();
+  // origin
+  Vec3f m_pos;
+  // emission ( red, green, blue )
+  Vec3f m_intensity;
+};
+#endif
diff --git a/SpotLight.cxx b/SpotLight.cxx
new file mode 100644 (file)
index 0000000..8ec7cf6
--- /dev/null
@@ -0,0 +1,48 @@
+#include "SpotLight.hxx"
+
+SpotLight::SpotLight(Scene* scene,
+                    const Vec3f& pos,
+                    const Vec3f& dir,
+                    const Vec3f& intensity,
+                    float alpha_min,
+                    float alpha_max)
+  : Light(scene),
+    m_pos(pos),
+    m_dir(dir),
+    m_intensity(intensity),
+    m_alpha_min(alpha_min),
+    m_alpha_max(alpha_max)
+{
+}
+
+SpotLight::~SpotLight()
+{
+}
+
+SpotLight::SpotLight()
+  : Light(0),
+    m_pos(Vec3f()),
+    m_dir(Vec3f()),
+    m_intensity(Vec3f()),
+    m_alpha_min(0.0f),
+    m_alpha_max(0.0f)
+{
+}
+
+bool
+SpotLight::Illuminate(Ray& ray, Vec3f& intensity)
+{
+  return false;
+}
+
+const Vec3f&
+SpotLight::position() const
+{
+  return m_pos;
+}
+
+const Vec3f&
+SpotLight::direction() const
+{
+  return m_dir;
+}
diff --git a/SpotLight.hxx b/SpotLight.hxx
new file mode 100644 (file)
index 0000000..ed404d8
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef SPOTLIGHT_HXX
+#define SPOTLIGHT_HXX
+
+#include "Light.hxx"
+
+class SpotLight : public Light
+{
+public:
+  SpotLight(Scene* scene, const Vec3f& pos, const Vec3f& dir, const Vec3f& intensity, float alpha_min, float alpha_max);
+  virtual ~SpotLight();
+
+  virtual bool Illuminate(Ray& ray, Vec3f& intensity);
+  
+  const Vec3f& position() const;
+  const Vec3f& direction() const;
+private:
+  SpotLight();
+
+  // position and direction
+  Vec3f m_pos, m_dir;
+  // emission (red, green, blue)
+  Vec3f m_intensity;
+  // opening angles
+  float m_alpha_min, m_alpha_max;
+};
+#endif
This page took 0.033531 seconds and 4 git commands to generate.