source: GTP/trunk/Lib/Vis/Preprocessing/src/VssTree.h @ 863

Revision 863, 19.4 KB checked in by mattausch, 18 years ago (diff)

working on preprocessor integration
added iv stuff

Line 
1// ================================================================
2// $Id$
3// ****************************************************************
4//
5// Initial coding by
6/**
7   @author Jiri Bittner
8*/
9
10#ifndef __VSSTREE_H__
11#define __VSSTREE_H__
12
13// Standard headers
14#include <iomanip>
15#include <vector>
16#include <functional>
17#include <stack>
18
19
20// User headers
21#include "VssRay.h"
22#include "AxisAlignedBox3.h"
23#include "Statistics.h"
24#include "Ray.h"
25
26namespace GtpVisibilityPreprocessor {
27
28#define USE_KDNODE_VECTORS 1
29#define _RSS_STATISTICS
30#define _RSS_TRAVERSAL_STATISTICS
31
32
33
34// --------------------------------------------------------------
35// Static statistics for kd-tree search
36// --------------------------------------------------------------
37class VssStatistics :
38  public StatisticsBase
39{
40public: 
41  // total number of nodes
42  int nodes;
43  // number of splits along each of the axes
44  int splits[7];
45  // totals number of rays
46  int rays;
47  // initial size of the pvs
48  int initialPvsSize;
49  // total number of query domains
50  int queryDomains;
51  // total number of ray references
52  int rayRefs;
53
54  // max depth nodes
55  int maxDepthNodes;
56  // max depth nodes
57  int minPvsNodes;
58  int minRaysNodes;
59  // max ray contribution nodes
60  int maxRayContribNodes;
61  // max depth nodes
62  int minSizeNodes;
63  int maxCostRatioNodes;
64
65  // max number of rays per node
66  int maxRayRefs;
67  // number of dynamically added ray refs
68  int addedRayRefs;
69  // number of dynamically removed ray refs
70  int removedRayRefs;
71 
72  // Constructor
73  VssStatistics() {
74    Reset();
75  }
76
77  int Nodes() const {return nodes;}
78  int Interior() const { return nodes/2; }
79  int Leaves() const { return (nodes/2) + 1; }
80
81  void Reset() {
82    nodes = 0;
83    for (int i=0; i<7; i++)
84      splits[i] = 0;
85    rays = queryDomains = 0;
86    rayRefs = 0;
87    maxDepthNodes = 0;
88    minPvsNodes = 0;
89    minRaysNodes = 0;
90    maxRayRefs = 0;
91    addedRayRefs = removedRayRefs = 0;
92        initialPvsSize = 0;
93        maxRayContribNodes = 0;
94        minSizeNodes = 0;
95        maxCostRatioNodes = 0;
96  }
97
98 
99  void
100  Print(ostream &app) const;
101
102  friend ostream &operator<<(ostream &s, const VssStatistics &stat) {
103    stat.Print(s);
104    return s;
105  }
106 
107};
108
109
110
111
112class VssTreeInterior;
113
114
115// --------------------------------------------------------------
116// KD-tree node - abstract class
117// --------------------------------------------------------------
118class VssTreeNode
119{
120public:
121
122#define USE_FIXEDPOINT_T 0
123
124  struct RayInfo
125  {
126        // pointer to the actual ray
127        VssRay *mRay;
128       
129        // endpoints  - do we need them?
130#if USE_FIXEDPOINT_T
131        short mMinT, mMaxT;
132#else
133        float mMinT, mMaxT;
134#endif
135       
136        RayInfo():mRay(NULL) {}
137       
138        RayInfo(VssRay *r):mRay(r), mMinT(0),
139#if USE_FIXEDPOINT_T
140#define FIXEDPOINT_ONE 0x7FFE
141                                           //                     mMaxT(0xFFFF)
142                                           mMaxT(FIXEDPOINT_ONE)
143#else
144          mMaxT(1.0f)
145#endif
146        {}
147       
148        RayInfo(VssRay *r,
149                        const float _min,
150                        const float _max
151                        ):mRay(r) {
152          SetMinT(_min);
153          SetMaxT(_max);
154        }
155       
156        RayInfo(VssRay *r,
157                        const short _min,
158                        const float _max
159                        ):mRay(r), mMinT(_min) {
160          SetMaxT(_max);
161        }
162       
163        RayInfo(VssRay *r,
164                        const float _min,
165                        const short _max
166                        ):mRay(r), mMaxT(_max) {
167          SetMinT(_min);
168        }
169
170        enum {
171          SOURCE_RAY = 0,
172          TERMINATION_RAY,
173          PASSING_RAY,
174          CONTAINED_RAY
175        };
176       
177        int GetRayClass() const {
178               
179          bool startsBefore = GetMinT() > 0.0f;
180          bool terminatesAfter = GetMaxT() < 1.0f;
181               
182          if (startsBefore && terminatesAfter)
183                return PASSING_RAY;
184
185          if (!startsBefore && !terminatesAfter)
186                return CONTAINED_RAY;
187               
188          if (!startsBefore)
189                return SOURCE_RAY;
190               
191          return TERMINATION_RAY;
192        }
193       
194        friend bool operator<(const RayInfo &a, const RayInfo &b) {
195          return a.mRay < b.mRay;
196        }
197 
198       
199        float ExtrapOrigin(const int axis) const {
200          return mRay->GetOrigin(axis) + GetMinT()*mRay->GetDir(axis);
201        }
202       
203        float ExtrapTermination(const int axis) const {
204          return mRay->GetOrigin(axis) + GetMaxT()*mRay->GetDir(axis);
205        }
206
207        Vector3 Extrap(const float t) const {
208          return mRay->Extrap(t);
209        }
210       
211#if USE_FIXEDPOINT_T
212        float GetMinT () const { return mMinT/(float)(FIXEDPOINT_ONE); }
213        float GetMaxT () const { return mMaxT/(float)(FIXEDPOINT_ONE); }
214       
215        void SetMinT (const float t) {
216          mMinT = (short) (t*(float)(FIXEDPOINT_ONE));
217        }
218       
219        void SetMaxT (const float t) {
220          mMaxT = (short) (t*(float)(FIXEDPOINT_ONE));
221          mMaxT++;
222          //      if (mMaxT!=0xFFFF)
223          //    mMaxT++;
224        }
225#else
226        float GetMinT () const { return mMinT; }
227        float GetMaxT () const { return mMaxT; }
228       
229        void SetMinT (const float t) { mMinT = t; }
230        void SetMaxT (const float t) { mMaxT = t; }
231#endif
232
233
234        int ComputeRayIntersection(const int axis,
235                                                           const float position,
236                                                           float &t
237                                                           ) const {
238               
239#if 1
240          // intersect the ray with the plane
241          float denom = mRay->GetDir(axis);
242   
243          if (fabs(denom) < 1e-20)
244                //if (denom == 0.0f)
245                return (mRay->GetOrigin(axis) > position) ? 1 : -1;
246   
247          t = (position - mRay->GetOrigin(axis))/denom;
248
249          if (t < GetMinT())
250                return (denom > 0) ? 1 : -1;
251
252          if (t > GetMaxT())
253                return (denom > 0) ? -1 : 1;
254
255          return 0;
256#else
257          // subbdivision based only on the origin
258          t = 0;
259          float rpos = mRay->GetOrigin(axis);
260          return (rpos < position) ? -1 : 1;
261
262#endif
263        }
264
265
266  };
267
268
269  typedef vector<RayInfo> RayInfoContainer;
270       
271  enum { EInterior, ELeaf };
272
273  /////////////////////////////////
274  // The actual data goes here
275 
276  // link to the parent
277  VssTreeInterior *parent;
278
279  enum {SPLIT_X=0, SPLIT_Y, SPLIT_Z, SPLIT_DIRX, SPLIT_DIRY, SPLIT_DIRZ};
280 
281  // splitting axis
282  char axis;
283       
284  // depth
285  unsigned char depth;
286 
287  //  short depth;
288  //
289  /////////////////////////////////
290 
291  inline VssTreeNode(VssTreeInterior *p);
292
293 
294  virtual ~VssTreeNode() {};
295  virtual int Type() const  = 0;
296 
297
298  bool IsLeaf() const { return axis == -1; }
299 
300  virtual void Print(ostream &s) const = 0;
301
302  virtual int GetAccessTime() {
303    return 0x7FFFFFF;
304  }
305
306 
307       
308};
309
310// --------------------------------------------------------------
311// KD-tree node - interior node
312// --------------------------------------------------------------
313class VssTreeInterior :
314  public VssTreeNode
315{
316public:
317  // plane in local modelling coordinates
318  float position;
319
320  // pointers to children
321  VssTreeNode *back, *front;
322
323  // the bbox of the node
324  AxisAlignedBox3 bbox;
325
326  // the bbox of the node
327  AxisAlignedBox3 dirBBox;
328 
329  // data for caching
330  long accesses;
331  long lastAccessTime;
332 
333  VssTreeInterior(VssTreeInterior *p):VssTreeNode(p),
334                                                                          back(NULL),
335                                                                          front(NULL),
336                                                                          accesses(0),
337                                                                          lastAccessTime(-1)
338  { }
339
340  virtual int GetAccessTime() {
341    return lastAccessTime;
342  }
343
344  void SetupChildLinks(VssTreeNode *b, VssTreeNode *f) {
345    back = b;
346    front = f;
347    b->parent = f->parent = this;
348  }
349
350  void ReplaceChildLink(VssTreeNode *oldChild, VssTreeNode *newChild) {
351    if (back == oldChild)
352      back = newChild;
353    else
354      front = newChild;
355  }
356
357  virtual int Type() const  { return EInterior; }
358 
359  virtual ~VssTreeInterior() {
360    if (back)
361      delete back;
362    if (front)
363      delete front;
364  }
365 
366  virtual void Print(ostream &s) const {
367    if (axis == 0)
368      s<<"x ";
369    else
370      if (axis == 1)
371                s<<"y ";
372      else
373                s<<"z ";
374    s<<position<<" ";
375    back->Print(s);
376    front->Print(s);
377  }
378
379 
380       
381  int ComputeRayIntersection(const RayInfo &rayData,
382                                                         float &t
383                                                         ) {
384        return rayData.ComputeRayIntersection(axis, position, t);
385  }
386
387};
388
389
390// --------------------------------------------------------------
391// KD-tree node - leaf node
392// --------------------------------------------------------------
393class VssTreeLeaf :
394  public VssTreeNode
395{
396private:
397  int mPvsSize;
398public:
399  static int mailID;
400  int mailbox;
401 
402  RayInfoContainer rays;
403  int mPassingRays;
404       
405  bool mValidPvs;
406  float mEntropyImportance;
407 
408       
409  VssTreeLeaf(VssTreeInterior *p,
410                          const int nRays
411                          ):VssTreeNode(p), rays(), mPvsSize(0), mPassingRays(0), mValidPvs(false) {
412    rays.reserve(nRays);
413  }
414 
415  virtual ~VssTreeLeaf() { }
416
417  virtual int Type() const  { return ELeaf; }
418
419  virtual void Print(ostream &s) const {
420    s<<endl<<"L: r="<<(int)rays.size()<<endl;
421  };
422 
423  void AddRay(const RayInfo &data) {
424        mValidPvs = false;
425    rays.push_back(data);
426    data.mRay->Ref();
427        if (data.GetRayClass() == RayInfo::PASSING_RAY)
428          mPassingRays++;
429  }
430       
431  int GetPvsSize() const {
432        return mPvsSize;
433  }
434
435  void SetPvsSize(const int s) {
436        mPvsSize = s;
437        mValidPvs = true;
438  }
439
440  void
441  UpdatePvsSize();
442
443  float
444  ComputePvsEntropy();
445 
446  float
447  ComputeRayLengthEntropy();
448 
449  float
450  ComputeRayTerminationEntropy();
451 
452  void
453  ComputeEntropyImportance();
454
455  void Mail() { mailbox = mailID; }
456  static void NewMail() { mailID++; }
457  bool Mailed() const { return mailbox == mailID; }
458 
459  bool Mailed(const int mail) {
460    return mailbox >= mailID + mail;
461  }
462
463  float GetAvgRayContribution() const {
464        return GetPvsSize()/((float)rays.size() + Limits::Small);
465  }
466
467  float GetImportance() const;
468 
469  float GetSqrRayContribution() const {
470        return sqr(GetPvsSize()/((float)rays.size() + Limits::Small));
471  }
472 
473  // comparator for the
474  struct less_contribution : public
475  binary_function<const VssTreeLeaf *, const VssTreeLeaf *, bool> {
476       
477        bool operator()(const VssTreeLeaf * a, const VssTreeLeaf *b) {
478          return a->GetAvgRayContribution() < b->GetAvgRayContribution();
479        }
480  };
481 
482  struct greater_contribution : public
483  binary_function<const VssTreeLeaf *, const VssTreeLeaf *, bool> {
484       
485        bool operator()(const VssTreeLeaf * a, const VssTreeLeaf *b) {
486          return a->GetAvgRayContribution() > b->GetAvgRayContribution();
487        }
488  };
489 
490  friend bool GreaterContribution(const VssTreeLeaf * a, const VssTreeLeaf *b) {
491        return a->GetAvgRayContribution() > b->GetAvgRayContribution();
492  }
493 
494};
495
496// Inline functions
497inline
498VssTreeNode::VssTreeNode(VssTreeInterior *p):
499  parent(p), axis(-1), depth(p ? p->depth + 1 : 0) {}
500
501
502
503// ---------------------------------------------------------------
504// Main LSDS search class
505// ---------------------------------------------------------------
506class VssTree
507{
508  struct TraversalData
509  { 
510    VssTreeNode *node;
511    AxisAlignedBox3 bbox;
512    int depth;
513    float priority;
514   
515    TraversalData() {}
516
517    TraversalData(VssTreeNode *n, const float p):
518      node(n), priority(p)
519    {}
520
521    TraversalData(VssTreeNode *n,
522                                  const AxisAlignedBox3 &b,
523                                  const int d):
524      node(n), bbox(b), depth(d) {}
525   
526               
527    // comparator for the
528    struct less_priority : public
529    binary_function<const TraversalData, const TraversalData, bool> {
530                       
531      bool operator()(const TraversalData a, const TraversalData b) {
532                return a.priority < b.priority;
533      }
534     
535    };
536
537    //    ~TraversalData() {}
538    //    TraversalData(const TraversalData &s):node(s.node), bbox(s.bbox), depth(s.depth) {}
539   
540    friend bool operator<(const TraversalData &a,
541                                                  const TraversalData &b) {
542      //      return a.node->queries.size() < b.node->queries.size();
543      VssTreeLeaf *leafa = (VssTreeLeaf *) a.node;
544      VssTreeLeaf *leafb = (VssTreeLeaf *) b.node;
545#if 0
546          return
547                leafa->rays.size()*a.bbox.GetVolume()
548                <
549                leafb->rays.size()*b.bbox.GetVolume();
550#endif
551#if 0
552          return
553                leafa->GetPvsSize()*a.bbox.GetVolume()
554                <
555                leafb->GetPvsSize()*b.bbox.GetVolume();
556#endif
557#if 0
558          return
559                leafa->GetPvsSize()
560                <
561                leafb->GetPvsSize();
562#endif
563#if 0
564          return
565                leafa->GetPvsSize()/(leafa->rays.size()+1)
566                >
567                leafb->GetPvsSize()/(leafb->rays.size()+1);
568#endif
569#if 1
570          return
571                leafa->GetPvsSize()*leafa->rays.size()
572                <
573                leafb->GetPvsSize()*leafb->rays.size();
574#endif
575    }
576  };
577 
578  // simplified data for ray traversal only...
579
580  struct RayTraversalData {
581   
582    VssTreeNode::RayInfo rayData;
583    VssTreeNode *node;
584   
585    RayTraversalData() {}
586    RayTraversalData(VssTreeNode *n,
587                                         const VssTreeNode::RayInfo &data):
588      rayData(data), node(n) {}
589  };
590       
591public:
592  /////////////////////////////
593  // The core pointer
594  VssTreeNode *root;
595 
596  /////////////////////////////
597  // Basic properties
598
599  // total number of nodes of the tree
600  int nodes;
601  // axis aligned bounding box of the scene
602  AxisAlignedBox3 bbox;
603
604  // axis aligned bounding box of directions
605  AxisAlignedBox3 dirBBox;
606 
607  /////////////////////////////
608  // Construction parameters
609
610  // epsilon used for the construction
611  float epsilon;
612
613  // ratio between traversal and intersection costs
614  float ct_div_ci;
615  // max depth of the tree
616  int termMaxDepth;
617  // minimal ratio of the volume of the cell and the query volume
618  float termMinSize;
619
620  // minimal pvs per node to still get subdivided
621  int termMinPvs;
622
623  // minimal ray number per node to still get subdivided
624  int termMinRays;
625       
626  // maximal cost ration to subdivide a node
627  float termMaxCostRatio;
628       
629  // maximal contribution per ray to subdivide the node
630  float termMaxRayContribution;
631
632       
633  // randomized construction
634  bool randomize;
635 
636  // type of the splitting to use fo rthe tree construction
637  enum {ESplitRegular, ESplitHeuristic, ESplitHybrid };
638  int splitType;
639
640  bool mSplitUseOnlyDrivingAxis;
641 
642  // use ray space subdivision instead of view space subdivision
643  bool mUseRss;
644
645  // interleave directional and spatial splits based on their costs
646  // if false directional splits are only performed after spatial splits
647  bool mInterleaveDirSplits;
648
649  // depth at which directional splits are performed if mInterleaveDirSplits is false
650  int mDirSplitDepth;
651 
652  // maximal size of the box on which the refdir splitting can be performed
653  // (relative to the scene bbox
654  float refDirBoxMaxSize;
655 
656  // maximum alovable memory in MB
657  float maxTotalMemory;
658
659  // maximum alovable memory for static kd tree in MB
660  float maxStaticMemory;
661
662  // this is used during the construction depending
663  // on the type of the tree and queries...
664  float maxMemory;
665
666
667  // minimal acess time for collapse
668  int accessTimeThreshold;
669
670  // minimal depth at which to perform collapse
671  int minCollapseDepth;
672
673 
674  // reusable array of split candidates
675  vector<SortableEntry> *splitCandidates;
676  /////////////////////////////
677
678  VssStatistics stat;
679       
680 
681  VssTree();
682  virtual ~VssTree();
683
684  virtual void
685  Construct(
686                        VssRayContainer &rays,
687                        AxisAlignedBox3 *forcedBoundingBox = NULL
688                        );
689       
690  // incemental construction
691  virtual void UpdateRays(VssRayContainer &remove,
692                                                  VssRayContainer &add
693                                                  );
694
695  virtual void AddRays(
696                                           VssRayContainer &add
697                                           )
698  {
699        VssRayContainer remove;
700        UpdateRays(remove, add);
701  }
702
703 
704       
705  VssTreeNode *
706  Locate(const Vector3 &v);
707       
708  VssTreeNode *
709  SubdivideNode(VssTreeLeaf *leaf,
710                                const AxisAlignedBox3 &box,
711                                AxisAlignedBox3 &backBox,
712                                AxisAlignedBox3 &frontBox
713                                );
714       
715  VssTreeNode *
716  Subdivide(const TraversalData &tdata);
717       
718  int
719  SelectPlane(VssTreeLeaf *leaf,
720                          const AxisAlignedBox3 &box,
721                          float &position,
722                          int &raysBack,
723                          int &raysFront,
724                          int &pvsBack,
725                          int &pvsFront
726                          );
727
728  void
729  SortSplitCandidates(
730                                          VssTreeLeaf *node,
731                                          const int axis
732                                          );
733       
734 
735  // return memory usage in MB
736  float GetMemUsage() const {
737    return
738      (sizeof(VssTree) +
739       stat.Leaves()*sizeof(VssTreeLeaf) +
740       stat.Interior()*sizeof(VssTreeInterior) +
741       stat.rayRefs*sizeof(VssTreeNode::RayInfo))/(1024.0f*1024.0f);
742  }
743       
744  float GetRayMemUsage() const {
745    return
746      stat.rays*(sizeof(VssRay))/(1024.0f*1024.0f);
747  }
748 
749
750  float
751  BestCostRatio(
752                                VssTreeLeaf *node,
753                                int &axis,
754                                float &position,
755                                int &raysBack,
756                                int &raysFront,
757                                int &pvsBack,
758                                int &pvsFront
759                                );
760       
761  float
762  EvalCostRatio(
763                                VssTreeLeaf *node,
764                                const int axis,
765                                const float position,
766                                int &raysBack,
767                                int &raysFront,
768                                int &pvsBack,
769                                int &pvsFront
770                                );
771
772  float
773  EvalCostRatioHeuristic(
774                                                 VssTreeLeaf *node,
775                                                 const int axis,
776                                                 float &position,
777                                                 int &raysBack,
778                                                 int &raysFront,
779                                                 int &pvsBack,
780                                                 int &pvsFront
781                                                 );
782
783  float
784  GetCostRatio(
785                           VssTreeLeaf *leaf,
786                           const int axis,
787                           const float position,
788                           const int raysBack,
789                           const int raysFront,
790                           const int pvsBack,
791                           const int pvsFront
792                           );
793
794  AxisAlignedBox3 GetBBox(const VssTreeNode *node) const {
795    if (node->parent == NULL)
796      return bbox;
797
798    if (!node->IsLeaf())
799      return ((VssTreeInterior *)node)->bbox;
800
801    if (node->parent->axis >= 3)
802      return node->parent->bbox;
803     
804    AxisAlignedBox3 box(node->parent->bbox);
805    if (node->parent->front == node)
806      box.SetMin(node->parent->axis, node->parent->position);
807    else
808      box.SetMax(node->parent->axis, node->parent->position);
809    return box;
810  }
811
812  AxisAlignedBox3 GetDirBBox(const VssTreeNode *node) const {
813
814    if (node->parent == NULL)
815      return dirBBox;
816   
817    if (!node->IsLeaf() )
818      return ((VssTreeInterior *)node)->dirBBox;
819
820    if (node->parent->axis < 3)
821      return node->parent->dirBBox;
822   
823    AxisAlignedBox3 dBBox(node->parent->dirBBox);
824
825    if (node->parent->front == node)
826      dBBox.SetMin(node->parent->axis - 3, node->parent->position);
827    else
828      dBBox.SetMax(node->parent->axis - 3, node->parent->position);
829    return dBBox;
830  }
831 
832  int
833  ReleaseMemory(const int time);
834
835  int
836  CollapseSubtree(VssTreeNode *node, const int time);
837
838  void
839  CountAccess(VssTreeInterior *node, const long time) {
840    node->accesses++;
841    node->lastAccessTime = time;
842  }
843
844  VssTreeNode *
845  SubdivideLeaf(
846                                VssTreeLeaf *leaf
847                                );
848
849  void
850  RemoveRay(VssRay *ray,
851                        vector<VssTreeLeaf *> *affectedLeaves,
852                        const bool removeAllScheduledRays
853                        );
854
855  //  void
856  //  AddRay(VssRay *ray);
857  void
858  AddRay(VssTreeNode::RayInfo &info);
859 
860  void
861  TraverseInternalNode(
862                                           RayTraversalData &data,
863                                           stack<RayTraversalData> &tstack);
864
865  void
866  EvaluateLeafStats(const TraversalData &data);
867
868
869  int
870  GetRootPvsSize() const {
871        return GetPvsSize(bbox);
872  }
873 
874  int
875  GetPvsSize(const AxisAlignedBox3 &box) const;
876
877  void
878  GetRayContributionStatistics(
879                                                           float &minRayContribution,
880                                                           float &maxRayContribution,
881                                                           float &avgRayContribution
882                                                           );
883
884  int
885  GenerateRays(const float ratioPerLeaf,
886                           SimpleRayContainer &rays);
887
888  int
889  GenerateRays(const int numberOfRays,
890                           const int numberOfLeaves,
891                           SimpleRayContainer &rays);
892               
893  float
894  GetAvgPvsSize();
895
896  int
897  UpdateSubdivision();
898
899  bool
900  TerminationCriteriaSatisfied(VssTreeLeaf *leaf);
901
902  void
903  CollectLeaves(vector<VssTreeLeaf *> &leaves);
904
905  bool
906  ClipRay(
907                  VssTreeNode::RayInfo &rayInfo,
908                  const AxisAlignedBox3 &box
909                  );
910
911  VssTreeNode *GetRoot() const { return root; }
912
913  bool
914  ValidLeaf(VssTreeLeaf *leaf) const;
915
916  void
917  GenerateLeafRays(VssTreeLeaf *leaf,
918                                   const int numberOfRays,
919                                   SimpleRayContainer &rays);
920
921  int
922  CollectRays(VssRayContainer &rays,
923                          const int number);
924
925  int
926  CollectRays(VssRayContainer &rays);
927 
928};
929
930};
931
932#endif // __LSDS_KDTREE_H__
933
Note: See TracBrowser for help on using the repository browser.