clray
diff src/scene.cc @ 54:6a30f27fa1e6
separated the OpenGL visualization and added a CPU raytracing mode
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 10 Sep 2010 16:47:00 +0100 |
parents | 54a96b738afe |
children | 3d13924b22e6 |
line diff
1.1 --- a/src/scene.cc Sun Sep 05 16:43:55 2010 +0100 1.2 +++ b/src/scene.cc Fri Sep 10 16:47:00 2010 +0100 1.3 @@ -109,11 +109,27 @@ 1.4 return true; 1.5 } 1.6 1.7 +bool Scene::add_light(const Light <) 1.8 +{ 1.9 + try { 1.10 + lights.push_back(lt); 1.11 + } 1.12 + catch(...) { 1.13 + return false; 1.14 + } 1.15 + return true; 1.16 +} 1.17 + 1.18 int Scene::get_num_meshes() const 1.19 { 1.20 return (int)meshes.size(); 1.21 } 1.22 1.23 +int Scene::get_num_lights() const 1.24 +{ 1.25 + return (int)lights.size(); 1.26 +} 1.27 + 1.28 int Scene::get_num_faces() const 1.29 { 1.30 if(num_faces >= 0) { 1.31 @@ -137,6 +153,38 @@ 1.32 return kdtree_nodes(kdtree); 1.33 } 1.34 1.35 +Mesh **Scene::get_meshes() 1.36 +{ 1.37 + if(meshes.empty()) { 1.38 + return 0; 1.39 + } 1.40 + return &meshes[0]; 1.41 +} 1.42 + 1.43 +const Mesh * const *Scene::get_meshes() const 1.44 +{ 1.45 + if(meshes.empty()) { 1.46 + return 0; 1.47 + } 1.48 + return &meshes[0]; 1.49 +} 1.50 + 1.51 +Light *Scene::get_lights() 1.52 +{ 1.53 + if(lights.empty()) { 1.54 + return 0; 1.55 + } 1.56 + return &lights[0]; 1.57 +} 1.58 + 1.59 +const Light *Scene::get_lights() const 1.60 +{ 1.61 + if(lights.empty()) { 1.62 + return 0; 1.63 + } 1.64 + return &lights[0]; 1.65 +} 1.66 + 1.67 Material *Scene::get_materials() 1.68 { 1.69 if(matlib.empty()) {