1 #pragma once 2 #include "roadpatch.h" 3 #include "aabb_space_partitioning.h" 4 #include "optional.h" 5 6 class ROADSTRIP 7 { 8 public: ROADSTRIP()9 ROADSTRIP() : closed(false) {} 10 11 bool ReadFrom(std::istream & openfile, std::ostream & error_output); 12 13 bool Collide( 14 const MATHVECTOR<float,3> & origin, 15 const MATHVECTOR<float,3> & direction, 16 float seglen, 17 MATHVECTOR<float,3> & outtri, 18 const BEZIER * & colpatch, 19 MATHVECTOR<float,3> & normal) const; 20 21 void Reverse(); 22 GetPatchList()23 const std::list <ROADPATCH> & GetPatchList() const {return patches;} 24 GetPatchList()25 std::list <ROADPATCH> & GetPatchList() {return patches;} 26 27 /*void CreateRacingLine( 28 SCENENODE * parentnode, 29 TEXTURE_GL & racingline_texture, 30 std::ostream & error_output);*/ 31 GetClosed()32 bool GetClosed() const 33 { 34 return closed; 35 } 36 37 ///either returns a const BEZIER * to the roadpatch at the given (positive or negative) offset from the supplied bezier (looping around if necessary) or does not return a value if the bezier is not found in this roadstrip. 38 optional <const BEZIER *> FindBezierAtOffset(const BEZIER * bezier, int offset=0) const; 39 40 private: 41 std::list <ROADPATCH> patches; 42 AABB_SPACE_PARTITIONING_NODE <ROADPATCH *> aabb_part; 43 bool closed; 44 45 void GenerateSpacePartitioning(); 46 }; 47