26 #include <osgUtil/CullVisitor>
28 #include <osg/BoundingBox>
29 #include <osg/BoundingSphere>
33 #include <matrix/vlMath.h>
54 , myDynamicLightsFlag(true)
55 , myDynamicOceanFlag(true)
56 , myOceanSeaLevelRenderBias(0.0f)
57 , myCameraAboveWater(true)
59 , myCameraResolution( 1.0 )
60 , myTerrainRadius( 1.0 )
61 , myScalingFlag( true )
62 , myClampedPixelSize( 1.0 )
63 , myEntityLodScaleFactor( 1.0f )
64 , myTerrainLodScaleFactor( 1.0f )
65 , myCoordinateSystemChanged( false )
67 , myDynamicWaterVisibilityEnable(true)
68 , myDynamicWaterVisibilityMax(75.)
70 , myTerrainMagnificationScaleFactor(1.)
71 , myCameraVelocity( 0, 0, 0 )
73 , myIncludeLightPoints(true)
74 , myCurrentScaleFactor(1.0)
75 , myIndirectDistScaleEnabled(false)
76 , myIndirectDistScale(1.0)
77 , myChannelLodScale(1.0f)
87 myTerrainLodScaleFactor = sf;
93 return myTerrainLodScaleFactor;
102 myEntityLodScaleFactor = lodDistanceScale;
108 return myEntityLodScaleFactor;
114 myCameraResolution = factor;
120 return myCameraResolution;
125 myCameraVelocity = osg::Vec3d(x,y,z);
131 return myCameraVelocity;
137 myTerrainRadius = rad;
143 myAltitude2D = altitude;
161 myModelSet = modelSet;
167 return myTerrainRadius;
184 myLodCenterSettings = settings;
189 return myLodCenterSettings;
195 mySkyFlag = renderSky;
208 myDynamicLightsFlag = enabled;
214 return myDynamicLightsFlag;
220 myDynamicOceanFlag = enabled;
226 return myDynamicOceanFlag;
232 myOceanSeaLevelRenderBias = meters;
238 return myOceanSeaLevelRenderBias;
244 myCameraAboveWater = aboveWater;
250 return myCameraAboveWater;
256 myScalingFlag = scaling;
262 return myScalingFlag;
268 myCoordinateSystemChanged = changed;
274 return myCoordinateSystemChanged;
281 myModelScaler = scaler;
286 return myModelScaler;
291 const osg::Node& node )
const
293 if ( myModelScaler.valid() )
295 return myModelScaler->calculateScale( *
this, camera, node );
309 myClampedPixelSize = d;
315 return myClampedPixelSize;
323 myDynamicWaterVisibilityEnable = enable;
329 return myDynamicWaterVisibilityEnable;
336 myDynamicWaterVisibilityMax = visMax;
343 return myDynamicWaterVisibilityMax;
350 myTerrainMagnificationScaleFactor = factor;
357 return myTerrainMagnificationScaleFactor;
363 myIncludeLightPoints = flag;
369 return myIncludeLightPoints;
376 return myCurrentScaleFactor;
383 myCurrentScaleFactor = currentScaleFactor;
389 myIndirectDistScaleEnabled = enabled;
395 return myIndirectDistScaleEnabled;
401 myIndirectDistScale = scale;
407 return myIndirectDistScale;
413 myChannelLodScale = scale;
419 return myChannelLodScale;
426 myFocusPoints = points;
433 return myFocusPoints;
439 mySensorMask = sensorMask;
492 : myFixedPixelSize( 1.0 )
508 myFixedPixelSize = d;
513 return myFixedPixelSize;
518 myLength =
length; myWidth = width; myHeight = height;
538 double& scaleFactorX,
double& scaleFactorY,
double& scaleFactorZ)
const
541 visitor.clampedPixelSize( sphere.center(), info->
terrainRadius() );
544 calculateScaleFactors( sphere, *info, scaleFactorX,
545 scaleFactorY, scaleFactorZ );
549 double& scaleFactorX,
double& scaleFactorY,
double& scaleFactorZ)
const
551 scaleFactorX = scaleFactorY = scaleFactorZ = 1.0;
554 double curPixels = myWidth / metersPerPixel;
558 scaleFactorX = myFixedPixelSize / curPixels;
563 scaleFactorY = scaleFactorX;
double myAltitude2D
Definition: DtOsgCullVisitorParameters.h:458
std::vector< osg::Vec3d > & focusPoints()
get the focus points. These are used to calculate the terrain intersections which are then used to li...
Definition: DtOsgCullVisitorParameters.h:431
void setDynamicWaterVisibilityMax(double visMax)
Set the maximum value to which water visibility will be set when dynamic water visibility is enabled...
Definition: DtOsgCullVisitorParameters.h:334
float myCurrentScaleFactor
Definition: DtOsgCullVisitorParameters.h:475
void setFocusPoints(std::vector< osg::Vec3d > &points)
set the focus points. These are used to calculate the terrain intersections which are then used to li...
Definition: DtOsgCullVisitorParameters.h:424
bool myScaleZ
Definition: DtOsgCullVisitorParameters.h:605
Object used to calculate fixed scale of object based on how many pixels on screen it should take up...
Definition: DtOsgCullVisitorParameters.h:488
double fixedPixelSize() const
Definition: DtOsgCullVisitorParameters.h:511
void setModelScaler(DtModelScaler *scaler)
Set the XR scaler to use. This will not typically be called by users to change the XR Node Scaler...
Definition: DtOsgCullVisitorParameters.h:279
bool myDynamicOceanFlag
Definition: DtOsgCullVisitorParameters.h:461
double length(const dvec3 &theVec)
Definition: DtVecUtils.h:20
void setSkyRendering(bool renderSky)
Set whether the sky is being rendered.
Definition: DtOsgCullVisitorParameters.h:193
void setClampedPixelSize(double d)
Set the clamped pixel size calculated when using DtOsgFixedScaleParameters. This is ust used to pass ...
Definition: DtOsgCullVisitorParameters.h:307
double myTerrainRadius
Definition: DtOsgCullVisitorParameters.h:457
double altitude2D() const
Return the (implied) 2D altitude.
Definition: DtOsgCullVisitorParameters.h:147
double clampedPixelSize() const
Retrieve the clamped pixel size set in setClampedPixelSize.
Definition: DtOsgCullVisitorParameters.h:313
void setTerrainLodScaleFactor(float sf)
Set the LOD scale factor that affects LODing and paging of terrain visuals.
Definition: DtOsgCullVisitorParameters.h:85
void setCameraResolution(double factor)
Set the zoom factor that effects LODing.
Definition: DtOsgCullVisitorParameters.h:112
bool myCameraAboveWater
Definition: DtOsgCullVisitorParameters.h:463
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
The DtModelScaler prepares the data from the osg camera, osg node, and cull visitor parameters and th...
Definition: DtModelScaler.h:32
void setDynamicOcean(bool enabled)
Set whether a dynamic ocean rendering is enabled.
Definition: DtOsgCullVisitorParameters.h:218
Definition: featureContext.h:36
osg::ref_ptr< DtModelScaler > myModelScaler
Definition: DtOsgCullVisitorParameters.h:470
Contains makVrv:DtOsgNodeTraversalFlags class.
void setEntityLodScaleFactor(float lodDistanceScale)
Set the LOD scale factor that affects LODing and culling of entities NOTE: The 'lod scale factor' is ...
Definition: DtOsgCullVisitorParameters.h:100
float myIndirectDistScale
Definition: DtOsgCullVisitorParameters.h:477
void setTerrainMagnificationScaleFactor(float factor)
Set the amount that any view magnification value is reduced by when determining the distance to a pag...
Definition: DtOsgCullVisitorParameters.h:348
void setIndirectDistanceScaleEnabled(bool enabled)
Set if the distance for culling instanced data is enabled.
Definition: DtOsgCullVisitorParameters.h:387
float myTerrainLodScaleFactor
Definition: DtOsgCullVisitorParameters.h:453
DtOsgCullVisitorParameters()
CTOR.
Definition: DtOsgCullVisitorParameters.h:51
void setCurrentTraversalScaleFactor(float currentScaleFactor)
set the scale factor for the current place in the cull visitor traversal. this is used by the light p...
Definition: DtOsgCullVisitorParameters.h:381
bool myIndirectDistScaleEnabled
Definition: DtOsgCullVisitorParameters.h:476
double length() const
Definition: DtOsgCullVisitorParameters.h:521
double terrainRadius() const
Get the terrain radius.
Definition: DtOsgCullVisitorParameters.h:165
double calculateModelScale(const osg::Camera &camera, const osg::Node &node) const
calculate the model scale using the registered XR scaler.
Definition: DtOsgCullVisitorParameters.h:290
Contains makVrv::DtIndirectModelScalingAlgorithm enumeration.
float myOceanSeaLevelRenderBias
Definition: DtOsgCullVisitorParameters.h:462
DtIndirectModelScalingAlgorithm
Definition: DtIndirectModelScalingAlgorithm.h:15
DtOsgFixedScaleParameters()
Definition: DtOsgCullVisitorParameters.h:491
bool scaleZ() const
Definition: DtOsgCullVisitorParameters.h:597
osg::Vec3d myCameraVelocity
Definition: DtOsgCullVisitorParameters.h:472
double myCameraResolution
Definition: DtOsgCullVisitorParameters.h:456
void setSensorCullMask(uint32_t sensorMask)
set the type of the currently active sensor
Definition: DtOsgCullVisitorParameters.h:437
bool cameraAboveWater() const
Get whether the camera is above water.
Definition: DtOsgCullVisitorParameters.h:248
void setScaleX(bool b)
Definition: DtOsgCullVisitorParameters.h:572
void setCameraVelocity(double x, double y, double z)
Set the camera velocity.
Definition: DtOsgCullVisitorParameters.h:123
float myTerrainMagnificationScaleFactor
Definition: DtOsgCullVisitorParameters.h:471
void setTerrainRadius(double rad)
Set the terrain radius.
Definition: DtOsgCullVisitorParameters.h:135
virtual ~DtOsgFixedScaleParameters()
Definition: DtOsgCullVisitorParameters.h:502
DtModelScaler * findModelScaler() const
Definition: DtOsgCullVisitorParameters.h:284
float channelLodScale() const
get the channel lod scale. This is only the channel configuration value and not the view magnificatio...
Definition: DtOsgCullVisitorParameters.h:417
Definition: DtObserverObject.h:71
void setDynamicLights(bool enabled)
Set whether dynamic lights are enabled.
Definition: DtOsgCullVisitorParameters.h:206
bool scaleX() const
Definition: DtOsgCullVisitorParameters.h:577
DtModelSetId myModelSet
Definition: DtOsgCullVisitorParameters.h:473
const osg::Vec3d & cameraVelocity() const
Get the camera velocity.
Definition: DtOsgCullVisitorParameters.h:129
bool scaling() const
Get whether scalable groups should be scaled by distance.
Definition: DtOsgCullVisitorParameters.h:260
float myEntityLodScaleFactor
Definition: DtOsgCullVisitorParameters.h:454
uint32_t mySensorMask
Definition: DtOsgCullVisitorParameters.h:479
void setDimensions(double length, double width, double height)
Definition: DtOsgCullVisitorParameters.h:516
float terrainLodScaleFactor() const
Return the current LOD scale factor for terrain visuals.
Definition: DtOsgCullVisitorParameters.h:91
Contains makVrv::DtObserverObject class declaration.
void setCoordinateSystemChanged(bool changed)
Set whether the coordinate system changed this frame.
Definition: DtOsgCullVisitorParameters.h:266
const DtObserverObject::DtLodCenterSettings & lodCenterSettings() const
Definition: DtOsgCullVisitorParameters.h:187
bool dynamicLights() const
Get whether dynamic lights rendering is enabled.
Definition: DtOsgCullVisitorParameters.h:212
The osg cull vistor parameters class provides additional culling and intersector parameters for choos...
Definition: DtOsgCullVisitorParameters.h:46
void setDynamicWaterVisibilityEnable(bool enable)
Set dynamic water visibility, based on altitude. Water visibility will be scaled from its specified v...
Definition: DtOsgCullVisitorParameters.h:321
float oceanSeaLevelRenderBias() const
Returns the ocean sea level rendering bias in meters.
Definition: DtOsgCullVisitorParameters.h:236
DtObserverObject::DtLodCenterSettings myLodCenterSettings
Definition: DtOsgCullVisitorParameters.h:483
float myChannelLodScale
Definition: DtOsgCullVisitorParameters.h:481
float indirectDistanceScale() const
Get the distance for culling instanced data.
Definition: DtOsgCullVisitorParameters.h:405
void setLodCenterSettings(const DtObserverObject::DtLodCenterSettings &settings)
Definition: DtOsgCullVisitorParameters.h:182
void setOrthoCulling(bool ortho)
Set whether the culling should be doing in orthographic mode.
Definition: DtOsgCullVisitorParameters.h:171
double cameraResolution() const
Get the zoom factor.
Definition: DtOsgCullVisitorParameters.h:118
bool myDynamicWaterVisibilityEnable
Definition: DtOsgCullVisitorParameters.h:468
Contains the declaration of the makVrv::DtModelScaler class.
bool myIncludeLightPoints
Definition: DtOsgCullVisitorParameters.h:474
double myClampedPixelSize
Definition: DtOsgCullVisitorParameters.h:466
bool includeLightPoints() const
get the flag for including light points in this cull visitor traversal. If false then light points wi...
Definition: DtOsgCullVisitorParameters.h:367
bool dynamicOcean() const
Get whether a dynamic ocean rendering is enabled.
Definition: DtOsgCullVisitorParameters.h:224
Contains the DtObserverModeManager class declaration.
void setScaling(bool scaling)
Set whether scalable groups should be scaled by distance.
Definition: DtOsgCullVisitorParameters.h:254
bool mySkyFlag
Definition: DtOsgCullVisitorParameters.h:459
bool indirectDistanceScaleEnabled() const
True if the distance for culling instanced data is enabled.
Definition: DtOsgCullVisitorParameters.h:393
double myDynamicWaterVisibilityMax
Definition: DtOsgCullVisitorParameters.h:469
double height() const
Definition: DtOsgCullVisitorParameters.h:531
void calculateScaleFactors(const osg::BoundingSphere &sphere, const DtOsgCullVisitorParameters &info, double &scaleFactorX, double &scaleFactorY, double &scaleFactorZ) const
Definition: DtOsgCullVisitorParameters.h:548
bool coordinateSystemChanged() const
Get whether the coordinate system changed this frame.
Definition: DtOsgCullVisitorParameters.h:272
void setChannelLodScale(float scale)
set the channel lod scale. This is only the channel configuration value and not the view magnificatio...
Definition: DtOsgCullVisitorParameters.h:411
void calculateScaleFactors(const osgUtil::CullVisitor &visitor, const osg::BoundingSphere &sphere, DtOsgCullVisitorParameters *info, double &scaleFactorX, double &scaleFactorY, double &scaleFactorZ) const
Definition: DtOsgCullVisitorParameters.h:536
double myWidth
Definition: DtOsgCullVisitorParameters.h:604
void setModelSet(DtModelSetId modelSet)
Set the model set currently being rendered.
Definition: DtOsgCullVisitorParameters.h:159
bool scaleY() const
Definition: DtOsgCullVisitorParameters.h:587
bool orthoCulling() const
Get whether the culling is to be done in 2D orthographic mode.
Definition: DtOsgCullVisitorParameters.h:177
bool myCoordinateSystemChanged
Definition: DtOsgCullVisitorParameters.h:467
float entityLodScaleFactor() const
Return the current LOD scale factor for entities.
Definition: DtOsgCullVisitorParameters.h:106
bool myScalingFlag
Definition: DtOsgCullVisitorParameters.h:465
double dynamicWaterVisibilityMax() const
Get the maximum value to which water visibility will be set when dynamic water visibility is enabled...
Definition: DtOsgCullVisitorParameters.h:341
bool skyRendering() const
Get whether the sky is being rendered.
Definition: DtOsgCullVisitorParameters.h:200
bool dynamicWaterVisibilityEnable() const
Get whether dynamic water is enabled.
Definition: DtOsgCullVisitorParameters.h:327
std::vector< osg::Vec3d > myFocusPoints
Definition: DtOsgCullVisitorParameters.h:478
DtModelSetId
Definition: DtModelSetEnums.h:19
void setIncludeLightPoints(bool flag)
set the flag for including light points in this cull visitor traversal. If false then light points wi...
Definition: DtOsgCullVisitorParameters.h:361
void setOceanSeaLevelRenderBias(float meters)
Sets the ocean sea level rendering bias in meters.
Definition: DtOsgCullVisitorParameters.h:230
void setFixedPixelSize(double d)
Definition: DtOsgCullVisitorParameters.h:506
void setScaleZ(bool b)
Definition: DtOsgCullVisitorParameters.h:592
bool myDynamicLightsFlag
Definition: DtOsgCullVisitorParameters.h:460
uint32_t getSensorCullMask()
get the currently set sensor mask
Definition: DtOsgCullVisitorParameters.h:443
float terrainMagnificationScaleFactor() const
Get the amount that any view magnification value is reduced by when determining the distance to a pag...
Definition: DtOsgCullVisitorParameters.h:355
void setIndirectDistanceScale(float scale)
Set the distance for culling instanced data.
Definition: DtOsgCullVisitorParameters.h:399
double width() const
Definition: DtOsgCullVisitorParameters.h:526
void setScaleXY(bool b)
Definition: DtOsgCullVisitorParameters.h:582
DtModelSetId modelSet() const
Get the model set currently being rendered.
Definition: DtOsgCullVisitorParameters.h:153
static const unsigned int FlagVisibleSensorOn
scene camera will have one of these in it's cull mask DtOsgModelInstance provides setSensorMask to se...
Definition: DtOsgNodeTraversalFlags.h:69
void setAltitude2D(double altitude)
Set the (implied) altitude when orthoCulling.
Definition: DtOsgCullVisitorParameters.h:141
Contains various enum classes relating to model sets.
bool myOrthoFlag
Definition: DtOsgCullVisitorParameters.h:464
void setCameraAboveWater(bool aboveWater)
Set whether the camera is above water.
Definition: DtOsgCullVisitorParameters.h:242
float currentTraversalScaleFactor()
get the scale factor for the current place in the cull visitor traversal. this is used by the light p...
Definition: DtOsgCullVisitorParameters.h:374
double myFixedPixelSize
Definition: DtOsgCullVisitorParameters.h:603