fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Cluster / Base / OSGRenderNode.h
blob0a4825bd58ab3b7b869eb672dc899f7010632694
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002,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 _CLUSTERNODE_H_
40 #define _CLUSTERNODE_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGClusterDef.h"
46 #include "OSGBinaryDataHandler.h"
47 #include "OSGWindow.h"
49 OSG_BEGIN_NAMESPACE
51 /*! \ingroup GrpClusterBase
52 \ingroup GrpLibOSGCluster
55 class OSG_CLUSTER_DLLMAPPING RenderNode
57 /*========================== PUBLIC =================================*/
59 public:
61 /*---------------------------------------------------------------------*/
62 /*! \name Constructors */
63 /*! \{ */
65 RenderNode( Real32 invisibleFaceCost = 1.0 / 15000000,
66 Real32 visibleFaceCost = 1.0 / 10000000,
67 Real32 drawPixelCost = 1.0 / 120000000,
68 Real32 readPixelCost = 1.0 / 20000000,
69 Real32 writePixelCost = 1.0 / 20000000,
70 const std::string &vendor = "Unknown",
71 const std::string &renderer = "Unknown");
72 RenderNode(const RenderNode &source);
74 /*! \} */
75 /*---------------------------------------------------------------------*/
76 /*! \name Destructor */
77 /*! \{ */
79 virtual ~RenderNode(void);
81 /*! \} */
82 /*---------------------------------------------------------------------*/
83 /*! \name Get */
84 /*! \{ */
86 Real32 getVisibleFaceCost (void) const;
87 Real32 getInvisibleFaceCost(void) const;
88 Real32 getDrawPixelCost (void) const;
89 Real32 getReadPixelCost (void) const;
90 Real32 getWritePixelCost (void) const;
91 std::string getVendor (void) const;
92 std::string getRenderer (void) const;
94 /*! \} */
95 /*---------------------------------------------------------------------*/
96 /*! \name Set */
97 /*! \{ */
99 void setVisibleFaceCost ( Real32 value);
100 void setInvisibleFaceCost( Real32 value);
101 void setDrawPixelCost ( Real32 value);
102 void setReadPixelCost ( Real32 value);
103 void setWritePixelCost ( Real32 value);
104 void setGroup (const RenderNode *begin,
105 const RenderNode *end);
106 void setVendor (const std::string &value);
107 void setRenderer (const std::string &value);
109 /*! \} */
110 /*---------------------------------------------------------------------*/
111 /*! \name performance analysis */
112 /*! \{ */
114 void determinePerformance(Window *prt );
115 Real32 estimatePerformance (Real32 invisibleFaces,
116 Real32 visibleFaces,
117 Real32 pixel ) const;
119 /*! \} */
120 /*---------------------------------------------------------------------*/
121 /*! \name load/store */
122 /*! \{ */
124 void copyToBin (BinaryDataHandler &handle);
125 void copyFromBin(BinaryDataHandler &handle);
127 /*! \} */
128 /*---------------------------------------------------------------------*/
129 /*! \name Assignment */
130 /*! \{ */
132 RenderNode & operator =(const RenderNode &source);
134 /*! \} */
135 /*---------------------------------------------------------------------*/
136 /*! \name dump */
137 /*! \{ */
139 void dump(void) const;
141 /*! \} */
142 /*========================= PROTECTED ===============================*/
144 protected:
146 /*---------------------------------------------------------------------*/
147 /*! \name Fields */
148 /*! \{ */
150 Real32 _visibleFaceCost;
151 Real32 _invisibleFaceCost;
152 Real32 _drawPixelCost;
153 Real32 _readPixelCost;
154 Real32 _writePixelCost;
155 std::string _vendor;
156 std::string _renderer;
158 /*! \} */
159 /*---------------------------------------------------------------------*/
160 /*! \name helper */
161 /*! \{ */
163 double runFaceBench ( float w,int size );
164 double runRasterBench( void );
166 /*! \} */
167 /*========================== PRIVATE ================================*/
169 private:
171 /*---------------------------------------------------------------------*/
172 /*! \name helper */
173 /*! \{ */
175 static RenderNode *_predefined[];
176 static StaticInitFuncWrapper RenderNodeInitCleanup;
178 static bool registerCleanup(void);
179 static bool cleanPredefined(void);
181 /*! \} */
182 /*---------------------------------------------------------------------*/
185 OSG_END_NAMESPACE
187 #include "OSGRenderNode.inl"
189 #endif /* _CLUSTERNODE_H_ */