1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002,2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _CLUSTERNODE_H_
40 #define _CLUSTERNODE_H_
45 #include "OSGClusterDef.h"
46 #include "OSGBinaryDataHandler.h"
47 #include "OSGWindow.h"
51 /*! \ingroup GrpClusterBase
52 \ingroup GrpLibOSGCluster
55 class OSG_CLUSTER_DLLMAPPING RenderNode
57 /*========================== PUBLIC =================================*/
61 /*---------------------------------------------------------------------*/
62 /*! \name Constructors */
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
);
75 /*---------------------------------------------------------------------*/
76 /*! \name Destructor */
79 virtual ~RenderNode(void);
82 /*---------------------------------------------------------------------*/
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;
95 /*---------------------------------------------------------------------*/
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
);
110 /*---------------------------------------------------------------------*/
111 /*! \name performance analysis */
114 void determinePerformance(Window
*prt
);
115 Real32
estimatePerformance (Real32 invisibleFaces
,
117 Real32 pixel
) const;
120 /*---------------------------------------------------------------------*/
121 /*! \name load/store */
124 void copyToBin (BinaryDataHandler
&handle
);
125 void copyFromBin(BinaryDataHandler
&handle
);
128 /*---------------------------------------------------------------------*/
129 /*! \name Assignment */
132 RenderNode
& operator =(const RenderNode
&source
);
135 /*---------------------------------------------------------------------*/
139 void dump(void) const;
142 /*========================= PROTECTED ===============================*/
146 /*---------------------------------------------------------------------*/
150 Real32 _visibleFaceCost
;
151 Real32 _invisibleFaceCost
;
152 Real32 _drawPixelCost
;
153 Real32 _readPixelCost
;
154 Real32 _writePixelCost
;
156 std::string _renderer
;
159 /*---------------------------------------------------------------------*/
163 double runFaceBench ( float w
,int size
);
164 double runRasterBench( void );
167 /*========================== PRIVATE ================================*/
171 /*---------------------------------------------------------------------*/
175 static RenderNode
*_predefined
[];
176 static StaticInitFuncWrapper RenderNodeInitCleanup
;
178 static bool registerCleanup(void);
179 static bool cleanPredefined(void);
182 /*---------------------------------------------------------------------*/
187 #include "OSGRenderNode.inl"
189 #endif /* _CLUSTERNODE_H_ */