fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Cluster / Window / SortFirst / OSGTileGeometryLoad.h
blob4535443a23ac6cf944d637d962f236738c0e0a3a
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSG_TILE_GEOMETRY_LOAD_H_
40 #define _OSG_TILE_GEOMETRY_LOAD_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGClusterDef.h"
46 #include "OSGGeometry.h"
47 #include "OSGCamera.h"
48 #include "OSGViewport.h"
50 #include <vector>
52 OSG_BEGIN_NAMESPACE
54 #define FACE_DISTRIBUTION_SAMPLING_COUNT 8
56 /*! \ingroup GrpClusterWindowBalancer
57 \ingroup GrpLibOSGCluster
58 \includebasedoc
61 class OSG_CLUSTER_DLLMAPPING TileGeometryLoad
63 /*========================== PUBLIC =================================*/
65 public:
67 /*---------------------------------------------------------------------*/
68 /*! \name Constructors */
69 /*! \{ */
71 TileGeometryLoad(UInt32 nodeId,bool useFaceDistribution=false);
72 TileGeometryLoad(const TileGeometryLoad &source);
74 /*! \} */
75 /*---------------------------------------------------------------------*/
76 /*! \name Destructor */
77 /*! \{ */
79 virtual ~TileGeometryLoad(void);
81 /*! \} */
82 /*---------------------------------------------------------------------*/
83 /*! \name load calculation */
84 /*! \{ */
86 void updateView ( Matrix &viewing,
87 Matrix &projection,
88 Real32 near,
89 UInt32 width,
90 UInt32 height );
91 void updateGeometry ( );
92 bool checkRegion ( Int32 min[2],
93 Int32 max[2] );
94 bool isVisible ( ) const;
96 /*! \} */
97 /*---------------------------------------------------------------------*/
98 /*! \name Set */
99 /*! \{ */
101 void setValid(bool s);
103 /*! \} */
104 /*---------------------------------------------------------------------*/
105 /*! \name Get */
106 /*! \{ */
108 Node * getNode() const;
109 const Int32 * getMin();
110 const Int32 * getMax();
111 UInt32 getFaces();
112 Real32 getVisibleFraction( const Int32 wmin[2],
113 const Int32 wmax[2],
114 Int32 viswmin[2],
115 Int32 viswmax[2] );
116 bool getVisibleArea ( const Int32 wmin[2],
117 const Int32 wmax[2],
118 Int32 viswmin[2],
119 Int32 viswmax[2] );
121 bool isInvalid(void);
123 /*! \} */
124 /*---------------------------------------------------------------------*/
125 /*! \name your_operators */
126 /*! \{ */
128 /*! \} */
129 /*---------------------------------------------------------------------*/
130 /*! \name Assignment */
131 /*! \{ */
133 TileGeometryLoad& operator = (const TileGeometryLoad &source);
135 /*! \} */
136 /*---------------------------------------------------------------------*/
137 /*! \name Comparison */
138 /*! \{ */
140 bool operator < (const TileGeometryLoad &other) const;
141 //bool operator == (const TileGeometryLoad &other) const;
142 //bool operator != (const TileGeometryLoad &other) const;
144 /*! \} */
145 /*---------------------------------------------------------------------*/
146 /*! \name Dump */
147 /*! \{ */
149 void dump(void);
151 /*! \} */
152 /*========================= PROTECTED ===============================*/
154 protected:
156 /*---------------------------------------------------------------------*/
157 /*! \name utilities */
158 /*! \{ */
160 Real32 getFaceDistribution(UInt32 dir,Real32 cut);
162 /*! \} */
164 /*---------------------------------------------------------------------*/
165 /*! \name Members */
166 /*! \{ */
168 UInt32 _nodeId;
169 Geometry *_geometry;
170 UInt32 _faces;
171 Int32 _min[2];
172 Int32 _max[2];
173 std::vector<std::vector<Real32> > _faceDistribution;
174 UInt32 _faceDistDirX;
175 UInt32 _faceDistDirY;
176 bool _visible;
177 bool _useFaceDistribution;
178 Real32 _areaSize;
179 bool _valid;
181 /*! \} */
183 /*---------------------------------------------------------------------*/
184 /*! \name static elements */
185 /*! \{ */
187 static std::vector<Plane> _directions;
189 /*! \} */
191 /*========================== PRIVATE ================================*/
193 private:
196 OSG_END_NAMESPACE
198 #include "OSGTileGeometryLoad.inl"
200 #endif /* OSG_TILE_GEOMETRY_LOAD_H */