23 #include <osgUtil/CullVisitor>
25 #include <osg/BoundingBox>
26 #include <osg/BoundingSphere>
30 #include <matrix/vlMath.h>
51 , myDynamicLightsFlag(true)
52 , myDynamicOceanFlag(true)
53 , myCameraAboveWater(true)
55 , myCameraResolution( 1.0 )
56 , myTerrainRadius( 1.0 )
57 , myScalingFlag( true )
58 , myClampedPixelSize( 1.0 )
59 , myLodScaleFactor( 1.0 )
60 , myCoordinateSystemChanged( false )
62 , myDynamicWaterVisibilityEnable(true)
63 , myDynamicWaterVisibilityMax(75.)
65 , myTerrainMagnificationHighLodAngle(DtDeg2Rad(15))
66 , myTerrainMagnificationScaleFactor(1.)
67 , myCameraVelocity( 0, 0, 0 )
69 , myIncludeLightPoints(true)
70 , myCurrentScaleFactor(1.0)
71 , myIndirectDistScaleEnabled(false)
72 , myIndirectDistScale(1.0)
73 , myChannelLodScale(1.0f)
74 , myFocusPointEnabled(false)
85 myLodScaleFactor = sf;
91 return myLodScaleFactor;
97 myCameraResolution = factor;
103 return myCameraResolution;
108 myCameraVelocity = osg::Vec3d(x,y,z);
114 return myCameraVelocity;
120 myTerrainRadius = rad;
126 myAltitude2D = altitude;
144 myModelSet = modelSet;
150 return myTerrainRadius;
168 mySkyFlag = renderSky;
181 myDynamicLightsFlag = enabled;
187 return myDynamicLightsFlag;
193 myDynamicOceanFlag = enabled;
199 return myDynamicOceanFlag;
205 myCameraAboveWater = aboveWater;
211 return myCameraAboveWater;
217 myScalingFlag = scaling;
223 return myScalingFlag;
229 myCoordinateSystemChanged = changed;
235 return myCoordinateSystemChanged;
242 myModelScaler = scaler;
247 return myModelScaler;
252 const osg::Node& node )
const
254 if ( myModelScaler.valid() )
256 return myModelScaler->calculateScale( *
this, camera, node );
270 myClampedPixelSize = d;
276 return myClampedPixelSize;
284 myDynamicWaterVisibilityEnable = enable;
290 return myDynamicWaterVisibilityEnable;
297 myDynamicWaterVisibilityMax = visMax;
304 return myDynamicWaterVisibilityMax;
311 myTerrainMagnificationScaleFactor = factor;
318 return myTerrainMagnificationScaleFactor;
329 myTerrainMagnificationHighLodAngle = radians;
338 return myTerrainMagnificationHighLodAngle;
344 myIncludeLightPoints = flag;
350 return myIncludeLightPoints;
357 return myCurrentScaleFactor;
364 myCurrentScaleFactor = currentScaleFactor;
370 myIndirectDistScaleEnabled = enabled;
376 return myIndirectDistScaleEnabled;
382 myIndirectDistScale = scale;
388 return myIndirectDistScale;
394 myChannelLodScale = scale;
400 return myChannelLodScale;
407 myFocusPoints = points;
414 return myFocusPoints;
421 myFocusPointEnabled = enable;
428 return myFocusPointEnabled;
471 : myFixedPixelSize( 1.0 )
487 myFixedPixelSize = d;
492 return myFixedPixelSize;
497 myLength =
length; myWidth = width; myHeight = height;
517 double& scaleFactorX,
double& scaleFactorY,
double& scaleFactorZ)
const
520 visitor.clampedPixelSize( sphere.center(), info->
terrainRadius() );
523 calculateScaleFactors( sphere, *info, scaleFactorX,
524 scaleFactorY, scaleFactorZ );
528 double& scaleFactorX,
double& scaleFactorY,
double& scaleFactorZ)
const
530 scaleFactorX = scaleFactorY = scaleFactorZ = 1.0;
533 double curPixels = myWidth / metersPerPixel;
537 scaleFactorX = myFixedPixelSize / curPixels;
542 scaleFactorY = scaleFactorX;
double myAltitude2D
Definition: DtOsgCullVisitorParameters.h:439
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:412
void setDynamicWaterVisibilityMax(double visMax)
Set the maximum value to which water visibility will be set when dynamic water visibility is enabled...
Definition: DtOsgCullVisitorParameters.h:295
float myCurrentScaleFactor
Definition: DtOsgCullVisitorParameters.h:456
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:405
bool myScaleZ
Definition: DtOsgCullVisitorParameters.h:584
bool myFocusPointEnabled
Definition: DtOsgCullVisitorParameters.h:462
Object used to calculate fixed scale of object based on how many pixels on screen it should take up...
Definition: DtOsgCullVisitorParameters.h:467
double fixedPixelSize() const
Definition: DtOsgCullVisitorParameters.h:490
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:240
double myLodScaleFactor
Definition: DtOsgCullVisitorParameters.h:436
bool myDynamicOceanFlag
Definition: DtOsgCullVisitorParameters.h:442
void setSkyRendering(bool renderSky)
Set whether the sky is being rendered.
Definition: DtOsgCullVisitorParameters.h:166
void setClampedPixelSize(double d)
Set the clamped pixel size calculated when using DtOsgFixedScaleParameters. This is ust used to pass ...
Definition: DtOsgCullVisitorParameters.h:268
double myTerrainRadius
Definition: DtOsgCullVisitorParameters.h:438
double altitude2D() const
Return the (implied) 2D altitude.
Definition: DtOsgCullVisitorParameters.h:130
double clampedPixelSize() const
Retrieve the clamped pixel size set in setClampedPixelSize.
Definition: DtOsgCullVisitorParameters.h:274
void setCameraResolution(double factor)
Set the zoom factor that effects LODing.
Definition: DtOsgCullVisitorParameters.h:95
bool myCameraAboveWater
Definition: DtOsgCullVisitorParameters.h:443
#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:191
Definition: featureContext.h:37
osg::ref_ptr< DtModelScaler > myModelScaler
Definition: DtOsgCullVisitorParameters.h:450
float myIndirectDistScale
Definition: DtOsgCullVisitorParameters.h:458
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:309
void setIndirectDistanceScaleEnabled(bool enabled)
Set if the distance for culling instanced data is enabled.
Definition: DtOsgCullVisitorParameters.h:368
DtOsgCullVisitorParameters()
CTOR.
Definition: DtOsgCullVisitorParameters.h:48
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:362
bool myIndirectDistScaleEnabled
Definition: DtOsgCullVisitorParameters.h:457
double length() const
Definition: DtOsgCullVisitorParameters.h:500
double terrainRadius() const
Get the terrain radius.
Definition: DtOsgCullVisitorParameters.h:148
double calculateModelScale(const osg::Camera &camera, const osg::Node &node) const
calculate the model scale using the registered XR scaler.
Definition: DtOsgCullVisitorParameters.h:251
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:83
DtIndirectModelScalingAlgorithm
Definition: DtIndirectModelScalingAlgorithm.h:14
DtOsgFixedScaleParameters()
Definition: DtOsgCullVisitorParameters.h:470
bool scaleZ() const
Definition: DtOsgCullVisitorParameters.h:576
osg::Vec3d myCameraVelocity
Definition: DtOsgCullVisitorParameters.h:453
double myCameraResolution
Definition: DtOsgCullVisitorParameters.h:437
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:419
bool cameraAboveWater() const
Get whether the camera is above water.
Definition: DtOsgCullVisitorParameters.h:209
void setScaleX(bool b)
Definition: DtOsgCullVisitorParameters.h:551
void setCameraVelocity(double x, double y, double z)
Set the camera velocity.
Definition: DtOsgCullVisitorParameters.h:106
float myTerrainMagnificationScaleFactor
Definition: DtOsgCullVisitorParameters.h:451
void setTerrainRadius(double rad)
Set the terrain radius.
Definition: DtOsgCullVisitorParameters.h:118
virtual ~DtOsgFixedScaleParameters()
Definition: DtOsgCullVisitorParameters.h:481
DtModelScaler * findModelScaler() const
Definition: DtOsgCullVisitorParameters.h:245
void setDynamicLights(bool enabled)
Set whether dynamic lights are enabled.
Definition: DtOsgCullVisitorParameters.h:179
bool scaleX() const
Definition: DtOsgCullVisitorParameters.h:556
DtModelSetId myModelSet
Definition: DtOsgCullVisitorParameters.h:454
const osg::Vec3d & cameraVelocity() const
Get the camera velocity.
Definition: DtOsgCullVisitorParameters.h:112
bool scaling() const
Get whether scalable groups should be scaled by distance.
Definition: DtOsgCullVisitorParameters.h:221
double lodScaleFactor() const
Return the current LOD scale factor.
Definition: DtOsgCullVisitorParameters.h:89
void setDimensions(double length, double width, double height)
Definition: DtOsgCullVisitorParameters.h:495
void setTerrainMagnificationHighLodAngle(float radians)
Set the angle used when paging in high LOD tiles, the angle (radians) represents the half angle...
Definition: DtOsgCullVisitorParameters.h:327
Contains makVrv::DtObserverObject class.
void setCoordinateSystemChanged(bool changed)
Set whether the coordinate system changed this frame.
Definition: DtOsgCullVisitorParameters.h:227
bool dynamicLights() const
Get whether dynamic lights rendering is enabled.
Definition: DtOsgCullVisitorParameters.h:185
The osg cull vistor parameters class provides additional culling and intersector parameters for choos...
Definition: DtOsgCullVisitorParameters.h:43
void setDynamicWaterVisibilityEnable(bool enable)
Set dynamic water visibility, based on altitude. Water visibility will be scaled from its specified v...
Definition: DtOsgCullVisitorParameters.h:282
float myChannelLodScale
Definition: DtOsgCullVisitorParameters.h:461
float indirectDistanceScale() const
Get the distance for culling instanced data.
Definition: DtOsgCullVisitorParameters.h:386
void setOrthoCulling(bool ortho)
Set whether the culling should be doing in orthographic mode.
Definition: DtOsgCullVisitorParameters.h:154
double cameraResolution() const
Get the zoom factor.
Definition: DtOsgCullVisitorParameters.h:101
bool myDynamicWaterVisibilityEnable
Definition: DtOsgCullVisitorParameters.h:448
Contains the declaration of the makVrv::DtModelScaler class.
bool myIncludeLightPoints
Definition: DtOsgCullVisitorParameters.h:455
double myClampedPixelSize
Definition: DtOsgCullVisitorParameters.h:446
bool includeLightPoints() const
get the flag for including light points in this cull visitor traversal. If false then light points wi...
Definition: DtOsgCullVisitorParameters.h:348
bool dynamicOcean() const
Get whether a dynamic ocean rendering is enabled.
Definition: DtOsgCullVisitorParameters.h:197
void setScaling(bool scaling)
Set whether scalable groups should be scaled by distance.
Definition: DtOsgCullVisitorParameters.h:215
bool mySkyFlag
Definition: DtOsgCullVisitorParameters.h:440
bool indirectDistanceScaleEnabled() const
True if the distance for culling instanced data is enabled.
Definition: DtOsgCullVisitorParameters.h:374
double myDynamicWaterVisibilityMax
Definition: DtOsgCullVisitorParameters.h:449
double height() const
Definition: DtOsgCullVisitorParameters.h:510
void calculateScaleFactors(const osg::BoundingSphere &sphere, const DtOsgCullVisitorParameters &info, double &scaleFactorX, double &scaleFactorY, double &scaleFactorZ) const
Definition: DtOsgCullVisitorParameters.h:527
bool coordinateSystemChanged() const
Get whether the coordinate system changed this frame.
Definition: DtOsgCullVisitorParameters.h:233
void setChannelLodScale(float scale)
set the channel lod scale. This is only the channel configuration value and not the view magnificatio...
Definition: DtOsgCullVisitorParameters.h:392
void calculateScaleFactors(const osgUtil::CullVisitor &visitor, const osg::BoundingSphere &sphere, DtOsgCullVisitorParameters *info, double &scaleFactorX, double &scaleFactorY, double &scaleFactorZ) const
Definition: DtOsgCullVisitorParameters.h:515
double myWidth
Definition: DtOsgCullVisitorParameters.h:583
DT_DLL_VRVCORE double length(const makVrv::DtCoordinateSystem &, const std::vector< DtVector > &vertices)
Returns the total distance of a segmented line defined by the provided vector of vertices. Coordinates are in local database coordinates. The coordinate system is used to convert between the local database coordinates and geocentric. All distance is in 2D – the Z value is ignored.
void setModelSet(DtModelSetId modelSet)
Set the model set currently being rendered.
Definition: DtOsgCullVisitorParameters.h:142
bool scaleY() const
Definition: DtOsgCullVisitorParameters.h:566
bool orthoCulling() const
Get whether the culling is to be done in 2D orthographic mode.
Definition: DtOsgCullVisitorParameters.h:160
bool myCoordinateSystemChanged
Definition: DtOsgCullVisitorParameters.h:447
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:336
bool myScalingFlag
Definition: DtOsgCullVisitorParameters.h:445
double dynamicWaterVisibilityMax() const
Get the maximum value to which water visibility will be set when dynamic water visibility is enabled...
Definition: DtOsgCullVisitorParameters.h:302
bool skyRendering() const
Get whether the sky is being rendered.
Definition: DtOsgCullVisitorParameters.h:173
bool dynamicWaterVisibilityEnable() const
Get whether dynamic water is enabled.
Definition: DtOsgCullVisitorParameters.h:288
std::vector< osg::Vec3d > myFocusPoints
Definition: DtOsgCullVisitorParameters.h:459
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:342
void setFixedPixelSize(double d)
Definition: DtOsgCullVisitorParameters.h:485
void setScaleZ(bool b)
Definition: DtOsgCullVisitorParameters.h:571
bool myDynamicLightsFlag
Definition: DtOsgCullVisitorParameters.h:441
float channelLodScale()
get the channel lod scale. This is only the channel configuration value and not the view magnificatio...
Definition: DtOsgCullVisitorParameters.h:398
float myTerrainMagnificationHighLodAngle
Definition: DtOsgCullVisitorParameters.h:452
float terrainMagnificationScaleFactor() const
Get the amount that any view magnification value is reduced by when determining the distance to a pag...
Definition: DtOsgCullVisitorParameters.h:316
void setIndirectDistanceScale(float scale)
Set the distance for culling instanced data.
Definition: DtOsgCullVisitorParameters.h:380
double width() const
Definition: DtOsgCullVisitorParameters.h:505
void setScaleXY(bool b)
Definition: DtOsgCullVisitorParameters.h:561
DtModelSetId modelSet() const
Get the model set currently being rendered.
Definition: DtOsgCullVisitorParameters.h:136
bool focusPointEnabled()
get the focust point enabled flag. If enabled the focus point distances and angles are used to calcul...
Definition: DtOsgCullVisitorParameters.h:426
void setAltitude2D(double altitude)
Set the (implied) altitude when orthoCulling.
Definition: DtOsgCullVisitorParameters.h:124
Contains various enum classes relating to model sets.
bool myOrthoFlag
Definition: DtOsgCullVisitorParameters.h:444
void setCameraAboveWater(bool aboveWater)
Set whether the camera is above water.
Definition: DtOsgCullVisitorParameters.h:203
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:355
double myFixedPixelSize
Definition: DtOsgCullVisitorParameters.h:582