erebus

diff liberebus/src/scene.cc @ 43:ed18af9da8f7

first attempt at separating direct from indirect failed miserably
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 11 Jun 2014 16:38:11 +0300
parents 9d6368850fe1
children c4d48a21bc4a
line diff
     1.1 --- a/liberebus/src/scene.cc	Tue Jun 10 16:15:08 2014 +0300
     1.2 +++ b/liberebus/src/scene.cc	Wed Jun 11 16:38:11 2014 +0300
     1.3 @@ -111,6 +111,31 @@
     1.4  	return active_cam;
     1.5  }
     1.6  
     1.7 +std::list<ObjectInstance> Scene::gen_light_list() const
     1.8 +{
     1.9 +	std::list<ObjectInstance> list;
    1.10 +
    1.11 +	for(auto n : nodes) {
    1.12 +		int nobj = n->get_num_objects();
    1.13 +		for(int i=0; i<nobj; i++) {
    1.14 +			Object *o = n->get_object(i);
    1.15 +			if(o->get_type() != ObjType::geom) {
    1.16 +				continue;
    1.17 +			}
    1.18 +			GeomObject *go = (GeomObject*)o;
    1.19 +
    1.20 +			if(go->mtl.get_attrib_value("emissive") > 0.0) {
    1.21 +				ObjectInstance inst;
    1.22 +				inst.obj = go;
    1.23 +				inst.node = n;
    1.24 +
    1.25 +				list.push_back(inst);
    1.26 +			}
    1.27 +		}
    1.28 +	}
    1.29 +	return std::move(list);
    1.30 +}
    1.31 +
    1.32  void Scene::update(long msec)
    1.33  {
    1.34  	root->update(msec);