00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #ifndef _OSGRENDEROPTIONSBASE_H_
00055 #define _OSGRENDEROPTIONSBASE_H_
00056 #ifdef __sgi
00057 #pragma once
00058 #endif
00059
00060
00061 #include <OSGConfig.h>
00062 #include <OSGSystemDef.h>
00063
00064 #include <OSGBaseTypes.h>
00065 #include <OSGRefPtr.h>
00066 #include <OSGCoredNodePtr.h>
00067
00068 #include <OSGAttachment.h>
00069
00070 #include <OSGBoolFields.h>
00071 #include <OSGGLenumFields.h>
00072 #include <OSGBoolFields.h>
00073 #include <OSGBoolFields.h>
00074 #include <OSGBoolFields.h>
00075 #include <OSGBoolFields.h>
00076 #include <OSGBoolFields.h>
00077 #include <OSGBoolFields.h>
00078 #include <OSGBoolFields.h>
00079 #include <OSGInt32Fields.h>
00080 #include <OSGUInt32Fields.h>
00081 #include <OSGBoolFields.h>
00082 #include <OSGReal32Fields.h>
00083 #include <OSGReal32Fields.h>
00084 #include <OSGUInt32Fields.h>
00085 #include <OSGBoolFields.h>
00086 #include <OSGBoolFields.h>
00087 #include <OSGBoolFields.h>
00088 #include <OSGReal32Fields.h>
00089 #include <OSGUInt32Fields.h>
00090 #include <OSGBoolFields.h>
00091
00092 #include <OSGRenderOptionsFields.h>
00093
00094 OSG_BEGIN_NAMESPACE
00095
00096 class RenderOptions;
00097 class BinaryDataHandler;
00098
00100
00101 class OSG_SYSTEMLIB_DLLMAPPING RenderOptionsBase : public Attachment
00102 {
00103 private:
00104
00105 typedef Attachment Inherited;
00106
00107
00108 public:
00109
00110 typedef RenderOptionsPtr Ptr;
00111
00112 enum
00113 {
00114 StatisticFieldId = Inherited::NextFieldId,
00115 PolygonModeFieldId = StatisticFieldId + 1,
00116 TwoSidedLightingFieldId = PolygonModeFieldId + 1,
00117 SpecTexLightingFieldId = TwoSidedLightingFieldId + 1,
00118 SortTransFieldId = SpecTexLightingFieldId + 1,
00119 ZWriteTransFieldId = SortTransFieldId + 1,
00120 LocalLightsFieldId = ZWriteTransFieldId + 1,
00121 CorrectTwoSidedLightingFieldId = LocalLightsFieldId + 1,
00122 OcclusionCullingFieldId = CorrectTwoSidedLightingFieldId + 1,
00123 OcclusionCullingModeFieldId = OcclusionCullingFieldId + 1,
00124 OcclusionCullingPixelsFieldId = OcclusionCullingModeFieldId + 1,
00125 AntialiasingFieldId = OcclusionCullingPixelsFieldId + 1,
00126 AntialiasingDistanceFieldId = AntialiasingFieldId + 1,
00127 AntialiasingScaleFieldId = AntialiasingDistanceFieldId + 1,
00128 AntialiasingTriggerFieldId = AntialiasingScaleFieldId + 1,
00129 FrustumCullingFieldId = AntialiasingTriggerFieldId + 1,
00130 BackfaceCullingFieldId = FrustumCullingFieldId + 1,
00131 SmallFeatureCullingFieldId = BackfaceCullingFieldId + 1,
00132 SmallFeaturePixelsFieldId = SmallFeatureCullingFieldId + 1,
00133 SmallFeatureThresholdFieldId = SmallFeaturePixelsFieldId + 1,
00134 FirstFrameFieldId = SmallFeatureThresholdFieldId + 1,
00135 NextFieldId = FirstFrameFieldId + 1
00136 };
00137
00138 static const OSG::BitVector StatisticFieldMask;
00139 static const OSG::BitVector PolygonModeFieldMask;
00140 static const OSG::BitVector TwoSidedLightingFieldMask;
00141 static const OSG::BitVector SpecTexLightingFieldMask;
00142 static const OSG::BitVector SortTransFieldMask;
00143 static const OSG::BitVector ZWriteTransFieldMask;
00144 static const OSG::BitVector LocalLightsFieldMask;
00145 static const OSG::BitVector CorrectTwoSidedLightingFieldMask;
00146 static const OSG::BitVector OcclusionCullingFieldMask;
00147 static const OSG::BitVector OcclusionCullingModeFieldMask;
00148 static const OSG::BitVector OcclusionCullingPixelsFieldMask;
00149 static const OSG::BitVector AntialiasingFieldMask;
00150 static const OSG::BitVector AntialiasingDistanceFieldMask;
00151 static const OSG::BitVector AntialiasingScaleFieldMask;
00152 static const OSG::BitVector AntialiasingTriggerFieldMask;
00153 static const OSG::BitVector FrustumCullingFieldMask;
00154 static const OSG::BitVector BackfaceCullingFieldMask;
00155 static const OSG::BitVector SmallFeatureCullingFieldMask;
00156 static const OSG::BitVector SmallFeaturePixelsFieldMask;
00157 static const OSG::BitVector SmallFeatureThresholdFieldMask;
00158 static const OSG::BitVector FirstFrameFieldMask;
00159
00160
00161 static const OSG::BitVector MTInfluenceMask;
00162
00163
00167 static FieldContainerType &getClassType (void);
00168 static UInt32 getClassTypeId (void);
00169
00171
00175 virtual FieldContainerType &getType (void);
00176 virtual const FieldContainerType &getType (void) const;
00177
00178 virtual UInt32 getContainerSize(void) const;
00179
00181
00185 SFBool *getSFStatistic (void);
00186 SFGLenum *getSFPolygonMode (void);
00187 SFBool *getSFTwoSidedLighting(void);
00188 SFBool *getSFSpecTexLighting(void);
00189 SFBool *getSFSortTrans (void);
00190 SFBool *getSFZWriteTrans (void);
00191 SFBool *getSFLocalLights (void);
00192 SFBool *getSFCorrectTwoSidedLighting(void);
00193 SFBool *getSFOcclusionCulling(void);
00194 SFInt32 *getSFOcclusionCullingMode(void);
00195 SFUInt32 *getSFOcclusionCullingPixels(void);
00196 SFBool *getSFAntialiasing (void);
00197 SFReal32 *getSFAntialiasingDistance(void);
00198 SFReal32 *getSFAntialiasingScale(void);
00199 SFUInt32 *getSFAntialiasingTrigger(void);
00200 SFBool *getSFFrustumCulling (void);
00201 SFBool *getSFBackfaceCulling(void);
00202 SFBool *getSFSmallFeatureCulling(void);
00203 SFReal32 *getSFSmallFeaturePixels(void);
00204 SFUInt32 *getSFSmallFeatureThreshold(void);
00205 SFBool *getSFFirstFrame (void);
00206
00207 bool &getStatistic (void);
00208 const bool &getStatistic (void) const;
00209 GLenum &getPolygonMode (void);
00210 const GLenum &getPolygonMode (void) const;
00211 bool &getTwoSidedLighting(void);
00212 const bool &getTwoSidedLighting(void) const;
00213 bool &getSpecTexLighting(void);
00214 const bool &getSpecTexLighting(void) const;
00215 bool &getSortTrans (void);
00216 const bool &getSortTrans (void) const;
00217 bool &getZWriteTrans (void);
00218 const bool &getZWriteTrans (void) const;
00219 bool &getLocalLights (void);
00220 const bool &getLocalLights (void) const;
00221 bool &getCorrectTwoSidedLighting(void);
00222 const bool &getCorrectTwoSidedLighting(void) const;
00223 bool &getOcclusionCulling(void);
00224 const bool &getOcclusionCulling(void) const;
00225 Int32 &getOcclusionCullingMode(void);
00226 const Int32 &getOcclusionCullingMode(void) const;
00227 UInt32 &getOcclusionCullingPixels(void);
00228 const UInt32 &getOcclusionCullingPixels(void) const;
00229 bool &getAntialiasing (void);
00230 const bool &getAntialiasing (void) const;
00231 Real32 &getAntialiasingDistance(void);
00232 const Real32 &getAntialiasingDistance(void) const;
00233 Real32 &getAntialiasingScale(void);
00234 const Real32 &getAntialiasingScale(void) const;
00235 UInt32 &getAntialiasingTrigger(void);
00236 const UInt32 &getAntialiasingTrigger(void) const;
00237 bool &getFrustumCulling (void);
00238 const bool &getFrustumCulling (void) const;
00239 bool &getBackfaceCulling(void);
00240 const bool &getBackfaceCulling(void) const;
00241 bool &getSmallFeatureCulling(void);
00242 const bool &getSmallFeatureCulling(void) const;
00243 Real32 &getSmallFeaturePixels(void);
00244 const Real32 &getSmallFeaturePixels(void) const;
00245 UInt32 &getSmallFeatureThreshold(void);
00246 const UInt32 &getSmallFeatureThreshold(void) const;
00247 bool &getFirstFrame (void);
00248 const bool &getFirstFrame (void) const;
00249
00251
00255 void setStatistic ( const bool &value );
00256 void setPolygonMode ( const GLenum &value );
00257 void setTwoSidedLighting( const bool &value );
00258 void setSpecTexLighting( const bool &value );
00259 void setSortTrans ( const bool &value );
00260 void setZWriteTrans ( const bool &value );
00261 void setLocalLights ( const bool &value );
00262 void setCorrectTwoSidedLighting( const bool &value );
00263 void setOcclusionCulling( const bool &value );
00264 void setOcclusionCullingMode( const Int32 &value );
00265 void setOcclusionCullingPixels( const UInt32 &value );
00266 void setAntialiasing ( const bool &value );
00267 void setAntialiasingDistance( const Real32 &value );
00268 void setAntialiasingScale( const Real32 &value );
00269 void setAntialiasingTrigger( const UInt32 &value );
00270 void setFrustumCulling ( const bool &value );
00271 void setBackfaceCulling( const bool &value );
00272 void setSmallFeatureCulling( const bool &value );
00273 void setSmallFeaturePixels( const Real32 &value );
00274 void setSmallFeatureThreshold( const UInt32 &value );
00275 void setFirstFrame ( const bool &value );
00276
00278
00283
00287 virtual UInt32 getBinSize (const BitVector &whichField);
00288 virtual void copyToBin ( BinaryDataHandler &pMem,
00289 const BitVector &whichField);
00290 virtual void copyFromBin( BinaryDataHandler &pMem,
00291 const BitVector &whichField);
00292
00293
00295
00299 static RenderOptionsPtr create (void);
00300 static RenderOptionsPtr createEmpty (void);
00301
00304
00308 virtual FieldContainerPtr shallowCopy (void) const;
00309
00311
00312 protected:
00313
00314
00318 SFBool _sfStatistic;
00319 SFGLenum _sfPolygonMode;
00320 SFBool _sfTwoSidedLighting;
00321 SFBool _sfSpecTexLighting;
00322 SFBool _sfSortTrans;
00323 SFBool _sfZWriteTrans;
00324 SFBool _sfLocalLights;
00325 SFBool _sfCorrectTwoSidedLighting;
00326 SFBool _sfOcclusionCulling;
00327 SFInt32 _sfOcclusionCullingMode;
00328 SFUInt32 _sfOcclusionCullingPixels;
00329 SFBool _sfAntialiasing;
00330 SFReal32 _sfAntialiasingDistance;
00331 SFReal32 _sfAntialiasingScale;
00332 SFUInt32 _sfAntialiasingTrigger;
00333 SFBool _sfFrustumCulling;
00334 SFBool _sfBackfaceCulling;
00335 SFBool _sfSmallFeatureCulling;
00336 SFReal32 _sfSmallFeaturePixels;
00337 SFUInt32 _sfSmallFeatureThreshold;
00338 SFBool _sfFirstFrame;
00339
00341
00345 RenderOptionsBase(void);
00346 RenderOptionsBase(const RenderOptionsBase &source);
00347
00349
00353 virtual ~RenderOptionsBase(void);
00354
00356
00360 #if !defined(OSG_FIXED_MFIELDSYNC)
00361 void executeSyncImpl( RenderOptionsBase *pOther,
00362 const BitVector &whichField);
00363
00364 virtual void executeSync( FieldContainer &other,
00365 const BitVector &whichField);
00366 #else
00367 void executeSyncImpl( RenderOptionsBase *pOther,
00368 const BitVector &whichField,
00369 const SyncInfo &sInfo );
00370
00371 virtual void executeSync( FieldContainer &other,
00372 const BitVector &whichField,
00373 const SyncInfo &sInfo);
00374
00375 virtual void execBeginEdit (const BitVector &whichField,
00376 UInt32 uiAspect,
00377 UInt32 uiContainerSize);
00378
00379 void execBeginEditImpl (const BitVector &whichField,
00380 UInt32 uiAspect,
00381 UInt32 uiContainerSize);
00382
00383 virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00384 #endif
00385
00387
00388 private:
00389
00390 friend class FieldContainer;
00391
00392 static FieldDescription *_desc[];
00393 static FieldContainerType _type;
00394
00395
00396
00397 void operator =(const RenderOptionsBase &source);
00398 };
00399
00400
00401
00402
00403
00404
00405 typedef RenderOptionsBase *RenderOptionsBaseP;
00406
00407 typedef osgIF<RenderOptionsBase::isNodeCore,
00408 CoredNodePtr<RenderOptions>,
00409 FieldContainer::attempt_to_create_CoredNodePtr_on_non_NodeCore_FC
00410 >::_IRet RenderOptionsNodePtr;
00411
00412 typedef RefPtr<RenderOptionsPtr> RenderOptionsRefPtr;
00413
00414 OSG_END_NAMESPACE
00415
00416 #define OSGRENDEROPTIONSBASE_HEADER_CVSID "@(#)$Id: OSGRenderOptionsBase.h,v 1.7 2007/07/03 09:16:10 yjung Exp $"
00417
00418 #endif