Main Page | Class Hierarchy | Class List | File List | Class Members

objectcontainer.h

00001 /* ************************************************************************* 00002 objectcontainer.h - description 00003 ------------------- 00004 begin : Wed Oct 16 2002 00005 copyright : (C) 2002 by Micha Riser 00006 email : mriser@gmx.net 00007 00008 $Id: objectcontainer_8h-source.html,v 1.1 2005/02/04 21:02:27 micha Exp $ 00009 00010 ************************************************************************* */ 00011 00012 /* ************************************************************************* 00013 * * 00014 * This program is free software; you can redistribute it and/or modify * 00015 * it under the terms of the GNU General Public License as published by * 00016 * the Free Software Foundation; either version 2 of the License, or * 00017 * (at your option) any later version. * 00018 * * 00019 ************************************************************************* */ 00020 #ifndef OBJECTCONTAINER_H 00021 #define OBJECTCONTAINER_H 00022 00023 #include<vector> 00024 00025 #include "types.h" 00026 #include "object3d.h" 00027 #include "intersection.h" 00028 00034 class ObjectContainer: public Object3D { 00035 00036 friend class IntersectionHeap; 00037 00038 public: // Constructors and destructor 00039 00041 ObjectContainer(); 00042 00044 virtual ~ObjectContainer(); 00045 00046 private: 00047 ObjectContainer& operator=(const ObjectContainer&); 00048 00049 protected: 00050 00054 class ObjectList; 00055 ObjectContainer(const Object3D& o, ObjectList* l); 00056 00059 ObjectContainer(const ObjectContainer& c); 00060 00061 public: // Public methods 00062 00066 void close(); 00067 00068 // overwrite in SurfacePatch3D 00069 void prepareToRender(); 00070 00071 protected: // Type definitions 00072 typedef std::vector<SurfacePatch3D*> spvector; 00073 00074 protected: // Constants 00075 static const unsigned int MAX_MEMBERS_COUNT = 31; 00076 static const unsigned int MIN_MEMBERS_COUNT = 7; 00077 00078 static long ObjectContainer_count; 00079 static long ObjectContainer_list_size[MAX_MEMBERS_COUNT]; 00080 00081 protected: // Protected inner classes 00082 00085 class ObjectList { 00086 00087 public: // Public attributes 00089 SurfacePatch3D* list[MAX_MEMBERS_COUNT]; 00091 ObjectList *inverse; 00093 int count; 00095 CNTREF listsize; 00096 00097 public: // Constructor and destructor 00098 ObjectList(); 00099 ~ObjectList(); 00100 00101 private: 00102 ObjectList(const ObjectList&); 00103 ObjectList& operator=(const ObjectList&); 00104 }; 00105 00106 #ifndef WRONG_INNER_CLASSES_ACCESS 00107 protected: // Protected attributes 00108 #else 00109 public: // should be protected but gcc 2.95 does not allow outer classes to access private inner members 00110 #endif 00111 00112 ObjectList* objects; 00113 spvector* collector_list; 00114 bool isclosed; 00115 bool isprepared; 00116 00117 protected: // Protected methods 00120 virtual void calculateBoundingBox(); 00121 00124 virtual ObjectContainer* getEmptyContainer() = 0; 00125 00126 private: 00127 void split(); 00128 // helper functions for splitting 00129 static bool xAxisLess(const SurfacePatch3D* o1, const SurfacePatch3D* o2); 00130 static bool yAxisLess(const SurfacePatch3D* o1, const SurfacePatch3D* o2); 00131 static bool zAxisLess(const SurfacePatch3D* o1, const SurfacePatch3D* o2); 00132 static DBL calcArea(const Vector3&); 00133 }; 00134 00135 #endif 00136 00137

Generated on Thu Jan 27 12:16:05 2005 for raytracer.kdevelop by doxygen 1.3.8