equal
  deleted
  inserted
  replaced
  
    
    
|     63 protected: |     63 protected: | 
|     64 	BBox bbox; |     64 	BBox bbox; | 
|     65 public: |     65 public: | 
|     66 	ShapeList shapes; |     66 	ShapeList shapes; | 
|     67 	Container(): bbox(), shapes() {}; |     67 	Container(): bbox(), shapes() {}; | 
|         |     68 	virtual ~Container() {}; | 
|     68 	virtual void addShape(Shape* aShape); |     69 	virtual void addShape(Shape* aShape); | 
|     69 	//void addShapeNoExtend(Shape* aShape) { shapes.push_back(aShape); }; |     70 	//void addShapeNoExtend(Shape* aShape) { shapes.push_back(aShape); }; | 
|         |     71         virtual Shape *nearest_intersection(const Shape *origin_shape, const Ray &ray, | 
|         |     72 		float &nearest_distance); | 
|     70 	virtual void optimize() {}; |     73 	virtual void optimize() {}; | 
|     71 }; |     74 }; | 
|     72  |     75  | 
|     73 class KdNode |     76 class KdNode | 
|     74 { |     77 { | 
|    103 	KdNode *root; |    106 	KdNode *root; | 
|    104 	bool built; |    107 	bool built; | 
|    105 public: |    108 public: | 
|    106 	KdTree() : Container(), built(false) {}; |    109 	KdTree() : Container(), built(false) {}; | 
|    107 	void addShape(Shape* aShape) { Container::addShape(aShape); built = false; }; |    110 	void addShape(Shape* aShape) { Container::addShape(aShape); built = false; }; | 
|    108 	void optimize(); // build kd-tree |    111 	void build(); | 
|         |    112 	void optimize() { build(); }; | 
|    109 	void save(ostream &str, KdNode *node = NULL); |    113 	void save(ostream &str, KdNode *node = NULL); | 
|         |    114 	void load(istream &str, KdNode *node = NULL); | 
|    110 }; |    115 }; | 
|    111  |    116  | 
|    112 #endif |    117 #endif |