yyparse() now a friend function to Scene, light constructors not taking position arguments any more
git-svn-id: svn://anubis/fart/trunk@104 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
1 parent
c136bda827
commit
6f2851f279
8 files changed
+75
-10
No files matched your search
+4
-4
@@ -2,10 +2,10 @@
|
||||
#include "Light.h"
|
||||
#include "util/Vector.h"
|
||||
|
||||
Light::Light(const Vector & position)
|
||||
: m_diffuse_color(Color::white),
|
||||
m_specular_color(Color::white)
|
||||
Light::Light()
|
||||
{
|
||||
m_position = position;
|
||||
m_position = Vector(0, 0, 0);
|
||||
m_diffuse_color = Color::white;
|
||||
m_specular_color = Color::white;
|
||||
}
|
||||
|
||||
+3
-1
@@ -8,7 +8,9 @@
|
||||
class Light
|
||||
{
|
||||
public:
|
||||
Light(const Vector & position);
|
||||
Light();
|
||||
|
||||
void setPosition(const Vector & position) { m_position = position; }
|
||||
const Vector & getPosition() const { return m_position; }
|
||||
|
||||
void setDiffuseColor(const Color & diffuse)
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
|
||||
#include "PointLight.h"
|
||||
|
||||
PointLight::PointLight(const Vector & position)
|
||||
: Light(position)
|
||||
PointLight::PointLight()
|
||||
: Light()
|
||||
{
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
class PointLight : public Light
|
||||
{
|
||||
public:
|
||||
PointLight(const Vector & position);
|
||||
PointLight();
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
+2
-1
@@ -89,7 +89,8 @@ void Scene::load(const char * filename)
|
||||
shape->setMaterial(m);
|
||||
m_shapes.push_back(shape);
|
||||
|
||||
refptr<Light> light = new PointLight(Vector(2, -1, 2));
|
||||
refptr<Light> light = new PointLight();
|
||||
light->setPosition(Vector(2, -1, 2));
|
||||
m_lights.push_back(light);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ class Scene
|
||||
void setAmbientLight(const Color & al) { m_ambient_light = al; }
|
||||
Transform & getTransform() { return m_transform; }
|
||||
|
||||
friend int yyparse();
|
||||
|
||||
protected:
|
||||
/* private methods */
|
||||
void load(const char * filename);
|
||||
|
||||
Reference in new issue
Block a user