22 #include <osgUtil/CullVisitor>
24 #include <osg/BoundingBox>
25 #include <osg/BoundingSphere>
29 #include <matrix/vlMath.h>
50 , myDynamicLightsFlag(true)
51 , myDynamicOceanFlag(true)
52 , myCameraAboveWater(true)
54 , myCameraResolution( 1.0 )
55 , myTerrainRadius( 1.0 )
56 , myScalingFlag( true )
57 , myClampedPixelSize( 1.0 )
58 , myLodScaleFactor( 1.0 )
59 , myCoordinateSystemChanged( false )
61 , myDynamicWaterVisibilityEnable(true)
62 , myDynamicWaterVisibilityMax(75.)
64 , myTerrainMagnificationHighLodAngle(DtDeg2Rad(15))
65 , myTerrainMagnificationScaleFactor(1.)
66 , myCameraVelocity( 0, 0, 0 )
68 , myIncludeLightPoints(true)
69 , myCurrentScaleFactor(1.0)
70 , myIndirectDistScaleEnabled(false)
71 , myIndirectDistScale(1.0)
72 , myChannelLodScale(1.0f)
73 , myFocusPointEnabled(false)
84 myLodScaleFactor = sf;
90 return myLodScaleFactor;
96 myCameraResolution = factor;
102 return myCameraResolution;
107 myCameraVelocity = osg::Vec3d(x,y,z);
113 return myCameraVelocity;
119 myTerrainRadius = rad;
125 myAltitude2D = altitude;
143 myModelSet = modelSet;
149 return myTerrainRadius;
167 mySkyFlag = renderSky;
180 myDynamicLightsFlag = enabled;
186 return myDynamicLightsFlag;
192 myDynamicOceanFlag = enabled;
198 return myDynamicOceanFlag;
204 myCameraAboveWater = aboveWater;
210 return myCameraAboveWater;
216 myScalingFlag = scaling;
222 return myScalingFlag;
228 myCoordinateSystemChanged = changed;
234 return myCoordinateSystemChanged;
241 myModelScaler = scaler;
246 return myModelScaler;
251 const osg::Node& node )
const
253 if ( myModelScaler.valid() )
255 return myModelScaler->calculateScale( *
this, camera, node );
269 myClampedPixelSize = d;
275 return myClampedPixelSize;
283 myDynamicWaterVisibilityEnable = enable;
289 return myDynamicWaterVisibilityEnable;
296 myDynamicWaterVisibilityMax = visMax;
303 return myDynamicWaterVisibilityMax;
310 myTerrainMagnificationScaleFactor = factor;
317 return myTerrainMagnificationScaleFactor;
328 myTerrainMagnificationHighLodAngle = radians;
337 return myTerrainMagnificationHighLodAngle;
343 myIncludeLightPoints = flag;
349 return myIncludeLightPoints;
356 return myCurrentScaleFactor;
363 myCurrentScaleFactor = currentScaleFactor;
369 myIndirectDistScaleEnabled = enabled;
375 return myIndirectDistScaleEnabled;
381 myIndirectDistScale = scale;
387 return myIndirectDistScale;
393 myChannelLodScale = scale;
399 return myChannelLodScale;
406 myFocusPoints = points;
413 return myFocusPoints;
420 myFocusPointEnabled = enable;
427 return myFocusPointEnabled;
470 : myFixedPixelSize( 1.0 )
486 myFixedPixelSize = d;
491 return myFixedPixelSize;
496 myLength = length; myWidth = width; myHeight = height;
516 double& scaleFactorX,
double& scaleFactorY,
double& scaleFactorZ)
const
519 visitor.clampedPixelSize( sphere.center(), info->
terrainRadius() );
522 calculateScaleFactors( sphere, *info, scaleFactorX,
523 scaleFactorY, scaleFactorZ );
527 double& scaleFactorX,
double& scaleFactorY,
double& scaleFactorZ)
const
529 scaleFactorX = scaleFactorY = scaleFactorZ = 1.0;
532 double curPixels = myWidth / metersPerPixel;
536 scaleFactorX = myFixedPixelSize / curPixels;
541 scaleFactorY = scaleFactorX;
double myAltitude2D
Definition: DtOsgCullVisitorParameters.h:438
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:411
void setDynamicWaterVisibilityMax(double visMax)
Set the maximum value to which water visibility will be set when dynamic water visibility is enabled...
Definition: DtOsgCullVisitorParameters.h:294
float myCurrentScaleFactor
Definition: DtOsgCullVisitorParameters.h:455
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:404
bool myScaleZ
Definition: DtOsgCullVisitorParameters.h:583
bool myFocusPointEnabled
Definition: DtOsgCullVisitorParameters.h:461
Object used to calculate fixed scale of object based on how many pixels on screen it should take up...
Definition: DtOsgCullVisitorParameters.h:466
double fixedPixelSize() const
Definition: DtOsgCullVisitorParameters.h:489
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:239
double myLodScaleFactor
Definition: DtOsgCullVisitorParameters.h:435
bool myDynamicOceanFlag
Definition: DtOsgCullVisitorParameters.h:441
void setSkyRendering(bool renderSky)
Set whether the sky is being rendered.
Definition: DtOsgCullVisitorParameters.h:165
void setClampedPixelSize(double d)
Set the clamped pixel size calculated when using DtOsgFixedScaleParameters. This is ust used to pass ...
Definition: DtOsgCullVisitorParameters.h:267
double myTerrainRadius
Definition: DtOsgCullVisitorParameters.h:437
double altitude2D() const
Return the (implied) 2D altitude.
Definition: DtOsgCullVisitorParameters.h:129
double clampedPixelSize() const
Retrieve the clamped pixel size set in setClampedPixelSize.
Definition: DtOsgCullVisitorParameters.h:273
void setCameraResolution(double factor)
Set the zoom factor that effects LODing.
Definition: DtOsgCullVisitorParameters.h:94
bool myCameraAboveWater
Definition: DtOsgCullVisitorParameters.h:442
#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:190
Definition: featureContext.h:37
osg::ref_ptr< DtModelScaler > myModelScaler
Definition: DtOsgCullVisitorParameters.h:449
float myIndirectDistScale
Definition: DtOsgCullVisitorParameters.h:457
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:308
void setIndirectDistanceScaleEnabled(bool enabled)
Set if the distance for culling instanced data is enabled.
Definition: DtOsgCullVisitorParameters.h:367
DtOsgCullVisitorParameters()
CTOR.
Definition: DtOsgCullVisitorParameters.h:47
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:361
bool myIndirectDistScaleEnabled
Definition: DtOsgCullVisitorParameters.h:456
double length() const
Definition: DtOsgCullVisitorParameters.h:499
double terrainRadius() const
Get the terrain radius.
Definition: DtOsgCullVisitorParameters.h:147
double calculateModelScale(const osg::Camera &camera, const osg::Node &node) const
calculate the model scale using the registered XR scaler.
Definition: DtOsgCullVisitorParameters.h:250
Contains makVrv::DtIndirectModelScalingAlgorithm enumeration.
void setLodScaleFactor(double sf)
Set the LOD scale factor that affects LODing and paging; this is the product of the channels LOD scal...
Definition: DtOsgCullVisitorParameters.h:82
DtIndirectModelScalingAlgorithm
Definition: DtIndirectModelScalingAlgorithm.h:14
DtOsgFixedScaleParameters()
Definition: DtOsgCullVisitorParameters.h:469
bool scaleZ() const
Definition: DtOsgCullVisitorParameters.h:575
osg::Vec3d myCameraVelocity
Definition: DtOsgCullVisitorParameters.h:452
double myCameraResolution
Definition: DtOsgCullVisitorParameters.h:436
void setFocusPointEnabled(bool enable)
set the focust point enabled flag. If enabled the focus point distances and angles are used to calcul...
Definition: DtOsgCullVisitorParameters.h:418
bool cameraAboveWater() const
Get whether the camera is above water.
Definition: DtOsgCullVisitorParameters.h:208
void setScaleX(bool b)
Definition: DtOsgCullVisitorParameters.h:550
void setCameraVelocity(double x, double y, double z)
Set the camera velocity.
Definition: DtOsgCullVisitorParameters.h:105
float myTerrainMagnificationScaleFactor
Definition: DtOsgCullVisitorParameters.h:450
void setTerrainRadius(double rad)
Set the terrain radius.
Definition: DtOsgCullVisitorParameters.h:117
virtual ~DtOsgFixedScaleParameters()
Definition: DtOsgCullVisitorParameters.h:480
DtModelScaler * findModelScaler() const
Definition: DtOsgCullVisitorParameters.h:244
void setDynamicLights(bool enabled)
Set whether dynamic lights are enabled.
Definition: DtOsgCullVisitorParameters.h:178
bool scaleX() const
Definition: DtOsgCullVisitorParameters.h:555
const osg::Vec3d & cameraVelocity() const
Get the camera velocity.
Definition: DtOsgCullVisitorParameters.h:111
bool scaling() const
Get whether scalable groups should be scaled by distance.
Definition: DtOsgCullVisitorParameters.h:220
unsigned int myModelSet
Definition: DtOsgCullVisitorParameters.h:453
double lodScaleFactor() const
Return the current LOD scale factor.
Definition: DtOsgCullVisitorParameters.h:88
void setDimensions(double length, double width, double height)
Definition: DtOsgCullVisitorParameters.h:494
void setTerrainMagnificationHighLodAngle(float radians)
Set the angle used when paging in high LOD tiles, the angle (radians) represents the half angle...
Definition: DtOsgCullVisitorParameters.h:326
Contains makVrv::DtObserverObject class.
void setCoordinateSystemChanged(bool changed)
Set whether the coordinate system changed this frame.
Definition: DtOsgCullVisitorParameters.h:226
unsigned int modelSet() const
Get the model set currently being rendered.
Definition: DtOsgCullVisitorParameters.h:135
bool dynamicLights() const
Get whether dynamic lights rendering is enabled.
Definition: DtOsgCullVisitorParameters.h:184
The osg cull vistor parameters class provides additional culling and intersector parameters for choos...
Definition: DtOsgCullVisitorParameters.h:42
void setDynamicWaterVisibilityEnable(bool enable)
Set dynamic water visibility, based on altitude. Water visibility will be scaled from its specified v...
Definition: DtOsgCullVisitorParameters.h:281
float myChannelLodScale
Definition: DtOsgCullVisitorParameters.h:460
float indirectDistanceScale() const
Get the distance for culling instanced data.
Definition: DtOsgCullVisitorParameters.h:385
void setOrthoCulling(bool ortho)
Set whether the culling should be doing in orthographic mode.
Definition: DtOsgCullVisitorParameters.h:153
double cameraResolution() const
Get the zoom factor.
Definition: DtOsgCullVisitorParameters.h:100
bool myDynamicWaterVisibilityEnable
Definition: DtOsgCullVisitorParameters.h:447
Contains the declaration of the makVrv::DtModelScaler class.
bool myIncludeLightPoints
Definition: DtOsgCullVisitorParameters.h:454
double myClampedPixelSize
Definition: DtOsgCullVisitorParameters.h:445
bool includeLightPoints() const
get the flag for including light points in this cull visitor traversal. If false then light points wi...
Definition: DtOsgCullVisitorParameters.h:347
bool dynamicOcean() const
Get whether a dynamic ocean rendering is enabled.
Definition: DtOsgCullVisitorParameters.h:196
void setScaling(bool scaling)
Set whether scalable groups should be scaled by distance.
Definition: DtOsgCullVisitorParameters.h:214
bool mySkyFlag
Definition: DtOsgCullVisitorParameters.h:439
bool indirectDistanceScaleEnabled() const
True if the distance for culling instanced data is enabled.
Definition: DtOsgCullVisitorParameters.h:373
double myDynamicWaterVisibilityMax
Definition: DtOsgCullVisitorParameters.h:448
double height() const
Definition: DtOsgCullVisitorParameters.h:509
void calculateScaleFactors(const osg::BoundingSphere &sphere, const DtOsgCullVisitorParameters &info, double &scaleFactorX, double &scaleFactorY, double &scaleFactorZ) const
Definition: DtOsgCullVisitorParameters.h:526
bool coordinateSystemChanged() const
Get whether the coordinate system changed this frame.
Definition: DtOsgCullVisitorParameters.h:232
void setChannelLodScale(float scale)
set the channel lod scale. This is only the channel configuration value and not the view magnificatio...
Definition: DtOsgCullVisitorParameters.h:391
void calculateScaleFactors(const osgUtil::CullVisitor &visitor, const osg::BoundingSphere &sphere, DtOsgCullVisitorParameters *info, double &scaleFactorX, double &scaleFactorY, double &scaleFactorZ) const
Definition: DtOsgCullVisitorParameters.h:514
double myWidth
Definition: DtOsgCullVisitorParameters.h:582
bool scaleY() const
Definition: DtOsgCullVisitorParameters.h:565
bool orthoCulling() const
Get whether the culling is to be done in 2D orthographic mode.
Definition: DtOsgCullVisitorParameters.h:159
bool myCoordinateSystemChanged
Definition: DtOsgCullVisitorParameters.h:446
float terrainMagnificationHighLodAngle() const
Get the viewing angle within which high LOD tiles will be used ex. rad angle=0.26179 = 15 degrees...
Definition: DtOsgCullVisitorParameters.h:335
bool myScalingFlag
Definition: DtOsgCullVisitorParameters.h:444
double dynamicWaterVisibilityMax() const
Get the maximum value to which water visibility will be set when dynamic water visibility is enabled...
Definition: DtOsgCullVisitorParameters.h:301
bool skyRendering() const
Get whether the sky is being rendered.
Definition: DtOsgCullVisitorParameters.h:172
bool dynamicWaterVisibilityEnable() const
Get whether dynamic water is enabled.
Definition: DtOsgCullVisitorParameters.h:287
void setModelSet(unsigned int modelSet)
Set the model set currently being rendered.
Definition: DtOsgCullVisitorParameters.h:141
std::vector< osg::Vec3d > myFocusPoints
Definition: DtOsgCullVisitorParameters.h:458
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:341
void setFixedPixelSize(double d)
Definition: DtOsgCullVisitorParameters.h:484
void setScaleZ(bool b)
Definition: DtOsgCullVisitorParameters.h:570
bool myDynamicLightsFlag
Definition: DtOsgCullVisitorParameters.h:440
float channelLodScale()
get the channel lod scale. This is only the channel configuration value and not the view magnificatio...
Definition: DtOsgCullVisitorParameters.h:397
float myTerrainMagnificationHighLodAngle
Definition: DtOsgCullVisitorParameters.h:451
float terrainMagnificationScaleFactor() const
Get the amount that any view magnification value is reduced by when determining the distance to a pag...
Definition: DtOsgCullVisitorParameters.h:315
void setIndirectDistanceScale(float scale)
Set the distance for culling instanced data.
Definition: DtOsgCullVisitorParameters.h:379
double width() const
Definition: DtOsgCullVisitorParameters.h:504
void setScaleXY(bool b)
Definition: DtOsgCullVisitorParameters.h:560
bool focusPointEnabled()
get the focust point enabled flag. If enabled the focus point distances and angles are used to calcul...
Definition: DtOsgCullVisitorParameters.h:425
void setAltitude2D(double altitude)
Set the (implied) altitude when orthoCulling.
Definition: DtOsgCullVisitorParameters.h:123
bool myOrthoFlag
Definition: DtOsgCullVisitorParameters.h:443
void setCameraAboveWater(bool aboveWater)
Set whether the camera is above water.
Definition: DtOsgCullVisitorParameters.h:202
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:354
double myFixedPixelSize
Definition: DtOsgCullVisitorParameters.h:581