00001 00005 #include "Group.h" 00006 #include "BoundingBox.h" 00007 using namespace std; 00008 00009 Group::Group() 00010 { 00011 } 00012 00013 Group::~Group() 00014 { 00015 } 00016 00017 void Group::addObject(Object* object) 00018 { 00019 objects.push_back(object); 00020 } 00021 00022 void Group::preprocess() 00023 { 00024 Object*const* begin = &objects[0]; 00025 Object*const* end = &objects[0]+objects.size(); 00026 while (begin != end) 00027 (*begin++)->preprocess(); 00028 } 00029 00030 void Group::getBounds(BoundingBox& bbox) const 00031 { 00032 Object*const* begin = &objects[0]; 00033 Object*const* end = &objects[0]+objects.size(); 00034 while (begin != end) 00035 (*begin++)->getBounds(bbox); 00036 } 00037 00038 void Group::intersect(HitRecord& hit, const RenderContext& context, const Ray& ray) const 00039 { 00040 Object*const* begin = &objects[0]; 00041 Object*const* end = &objects[0]+objects.size(); 00042 while (begin != end) 00043 (*begin++)->intersect(hit, context, ray); 00044 }