rayzor

diff src/scene.cc @ 6:a68dbf80d547

finally showing something ... :)
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 07 Apr 2014 06:04:11 +0300
parents 5fcf72837b69
children d94a69933a71
line diff
     1.1 --- a/src/scene.cc	Sun Apr 06 02:43:24 2014 +0300
     1.2 +++ b/src/scene.cc	Mon Apr 07 06:04:11 2014 +0300
     1.3 @@ -4,6 +4,7 @@
     1.4  Scene::Scene()
     1.5  {
     1.6  	name = 0;
     1.7 +	active_cam = 0;
     1.8  }
     1.9  
    1.10  Scene::~Scene()
    1.11 @@ -39,6 +40,76 @@
    1.12  	return name ? name : "<unknown>";
    1.13  }
    1.14  
    1.15 +void Scene::add_object(Object *obj)
    1.16 +{
    1.17 +	objects.push_back(obj);
    1.18 +}
    1.19 +
    1.20 +void Scene::add_light(Light *lt)
    1.21 +{
    1.22 +	lights.push_back(lt);
    1.23 +}
    1.24 +
    1.25 +void Scene::add_camera(Camera *cam)
    1.26 +{
    1.27 +	cameras.push_back(cam);
    1.28 +}
    1.29 +
    1.30 +
    1.31 +int Scene::get_object_count() const
    1.32 +{
    1.33 +	return (int)objects.size();
    1.34 +}
    1.35 +
    1.36 +int Scene::get_light_count() const
    1.37 +{
    1.38 +	return (int)lights.size();
    1.39 +}
    1.40 +
    1.41 +int Scene::get_camera_count() const
    1.42 +{
    1.43 +	return (int)cameras.size();
    1.44 +}
    1.45 +
    1.46 +
    1.47 +Object *Scene::get_object(int idx)
    1.48 +{
    1.49 +	return objects[idx];
    1.50 +}
    1.51 +
    1.52 +const Object *Scene::get_object(int idx) const
    1.53 +{
    1.54 +	return objects[idx];
    1.55 +}
    1.56 +
    1.57 +Light *Scene::get_light(int idx)
    1.58 +{
    1.59 +	return lights[idx];
    1.60 +}
    1.61 +
    1.62 +const Light *Scene::get_light(int idx) const
    1.63 +{
    1.64 +	return lights[idx];
    1.65 +}
    1.66 +
    1.67 +Camera *Scene::get_camera(int idx)
    1.68 +{
    1.69 +	return cameras[idx];
    1.70 +}
    1.71 +
    1.72 +const Camera *Scene::get_camera(int idx) const
    1.73 +{
    1.74 +	return cameras[idx];
    1.75 +}
    1.76 +
    1.77  void Scene::draw() const
    1.78  {
    1.79 +	if(active_cam) {
    1.80 +		// TODO
    1.81 +	}
    1.82 +
    1.83 +	int nobj = get_object_count();
    1.84 +	for(int i=0; i<nobj; i++) {
    1.85 +		objects[i]->draw();
    1.86 +	}
    1.87  }