13 #include <osg/Texture2DArray>
16 #include <osg/MatrixTransform>
17 #include <osg/Geometry>
18 #include <osg/BoundingBox>
20 #include <osgEarth/MapNode>
21 #include <osgEarth/DecalLayer>
22 #include <osgEarth/FeatureSource>
49 #define COVERAGE_MAPPING_VALUE_CRATER 11
50 #define COVERAGE_MAPPING_VALUE_SCRAPE 11
51 #define COVERAGE_MAPPING_VALUE_DITCH 11
53 class DtGlSimpleTexture;
54 class DtDynamicTerrainGeometry;
55 class DtDynamicTerrainChange;
56 class DtDynamicTerrainSphere;
76 float x,
float y,
float w,
float h);
79 static osg::Camera* CreateTextureQuadOverlay(osg::Texture* texture,
80 float x,
float y,
float w,
float h);
83 static osg::Camera* CreateTextureQuadOverlay(
const std::string& shader_root, osg::Texture2DArray* textureArray,
84 float x,
float y,
float w,
float h);
137 DtTerrainDeformationNone = 0,
138 DtTerrainDeformationBerm = 1,
139 DtTerrainDeformationDitch = 2,
140 DtTerrainDeformationTankScrape = 3,
141 DtTerrainDeformationHill = 4
156 static void makeRotate(osg::Quat& q,
const double&
angle,
const double& x,
const double& y,
const double& z);
159 static osg::Matrixf toOsgRotation(
const DtTaitBryan& orientation);
164 static void quatMult(osg::Quat& lhs,
const osg::Quat& rhs);
167 static osg::MatrixTransform * create_axis_primitive();
174 static osg::Matrix getOrthoMatrix(
bool useReverseZ,
double left,
double right,
175 double bottom,
double top,
double zNear,
double zFar);
179 static osg::Matrix getProjMatrix(
bool useReverseZ,
double left,
double right,
180 double bottom,
double top,
double zNear,
double zFar);
183 static osg::Matrixd getRevZOrthoMatrix(
double left,
double right,
double bottom,
184 double top,
double zNear,
double zFar);
188 static bool getRevZPerspectiveMatrixAsFrustum(
const osg::Matrix& mat,
double& left,
189 double& right,
double& bottom,
double& top,
double& zNear,
double& zFar);
193 static bool getRevZOrthoMatrixAsFrustum(
const osg::Matrix& orthoMat,
double& left,
194 double& right,
double& bottom,
double& top,
double& zNear,
double& zFar);
198 static bool getRevZPerspective(
const osg::Matrix& mat,
double& fovy,
199 double& aspectRatio,
double& zNear,
double& zFar);
203 static osg::Matrix makeRevZPerspective(
double fovy,
double aspectRatio,
204 double zNear,
double zFar);
207 static void getYPR(
const osg::Matrix& m,
double& yaw,
double& pitch,
double& roll);
210 static void osgPolytopeToFrustum(
Frustum_64& frustum,
const osg::Polytope& polytope,
bool hasNearFar);
213 static void debugDumpShaderState(osg::State* state);
216 static void debugDumpUniformState(
const osg::Node* node);
220 static osg::Vec2 rotateVec2(
const osg::Vec2& v,
double rad );
224 static osg::Vec2 translateVec2(
const osg::Vec2& v,
const osg::Vec2& translation );
227 static osg::Vec2 scaleVec2(
const osg::Vec2& v,
double s );
230 static osg::Vec2 scaleVec2(
const osg::Vec2& v,
double xScale,
double yScale );
234 static bool clipLine(
double xMin,
double xMax,
double yMin,
double yMax,
235 double x0src,
double y0src,
double x1src,
double y1src,
236 double &x0clip,
double &y0clip,
double &x1clip,
double &y1clip );
239 static void clipPolygon(
double xMin,
double xMax,
double yMin,
double yMax,
240 std::vector<osg::Vec2>& vertices );
243 template <
class VecType>
static VecType
DtModPerLoVec3(
const VecType& in,
double min,
double max )
246 double per = max - min;
248 for(
int i = 0; i < 3; ++i )
250 if( min <= in[i] && in[i] < max )
256 result[i] = fmod( in[i] - min, per );
258 if( result[i] < 0.0 )
275 static bool insideTriangulate(
const std::vector<osg::Vec2>& contour, std::vector<int>& results );
277 static osg::Matrixd calculateRevZProjectionMatrix(
double left,
double right
278 ,
double bottom,
double top
279 ,
double zNear,
double zFar);
281 static osg::Matrixd calculateOrthoMatrix(
double left,
double right
282 ,
double bottom,
double top
283 ,
double zNear,
double zFar);
285 static osg::Matrixd calculateRevZProjectionMatrixWithRevZAsNegativeOneForRttCamera(
double left,
double right
286 ,
double bottom,
double top
287 ,
double zNear,
double zFar);
290 static void dynamicTerrainLineToFeature(
const DtDynamicTerrainLine* line, osgEarth::Feature* feature,
301 OSMBuildingInfo(osgEarth::MetadataNode* metadataNode,
const std::set<int>& objectIndexList) :
302 myMetadataNode(metadataNode),
303 myObjectIndexList(objectIndexList)
313 typedef std::map<osgEarth::MetadataNode*, DtOsgUtils::OSMBuildingInfo>
MetadaNodeMap;
324 myMetadataNode(metadataNode),
325 myObjectIndex(objectIndex)
339 myPosition(position),
340 myModelDefinition(modelDefinition)
356 static void hideGeometries(
osg::ref_ptr<osgEarth::MapNode> mapNode, osg::BoundingSphere bs,
const std::set<long long>& FidList, std::vector<DtOsgUtils::FidMetadataNode>& dataList);
368 static bool addCraterState(
378 unsigned coverageMappingValue,
381 osgEarth::GeoExtent& out_feature_extent,
382 std::string& craterModelDefinition,
383 int minInvalidateLod = -1);
388 static bool addLinearStateDeformation(
398 unsigned coverageMappingValue,
401 osgEarth::GeoExtent& out_feature_extent);
406 static bool addTankScrapeState(
416 unsigned coverageMappingValue,
419 osgEarth::GeoExtent& out_feature_extent,
420 double start_angle = 0.0,
421 int minInvalidateLod = -1);
424 static std::string osmFidStringFromList(std::set<long long>& osmFidList);
427 static void osmFidStringToList(
const std::string& osmFidString, std::set<long long>& osmFidList);
430 static int getObjectID(
unsigned int instance, osg::TextureBuffer* tbo);
434 static bool snipTriangle(
const std::vector<osg::Vec2>& contour,
int u,
int v,
int w,
int n,
int *V );
436 static bool insideTriangle(
float Ax,
float Ay,
float Bx,
float By,
float Cx,
float Cy,
float Px,
float Py );
438 static float triangulateAreaSize(
const std::vector<osg::Vec2> &contour );
static VecType DtModPerLoVec3(const VecType &in, double min, double max)
Definition: DtOsgUtils.h:243
void updateDebugFrustum(osg::Vec3d *frustumVertices)
static const std::string CRATER_HEADING
Definition: DtOsgUtils.h:96
static const std::string EffectMapTextureUniformName
Definition: DtOsgUtils.h:117
static const std::string CRATER_MAJOR_AXIS
Definition: DtOsgUtils.h:94
Contains makVrv::DtDynamicTerrainLine class.
static const std::string EffectMapTextureMatrixUniformName
Definition: DtOsgUtils.h:118
Contains makVrv::DtOsgShaderUtils class.
DtDynamicTerrainRasterLibrary This class is used to managed rasters and out-the-window images appl...
Definition: DtDynamicTerrainRasterLibrary.h:95
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: DtOsgUtils.h:336
DtIntersector is an abstract class that provides the interface for requesting intersections with the ...
Definition: DtIntersector.h:25
static const std::string TerrainDamageDestroyed
Definition: DtOsgUtils.h:111
Definition: terrainCraterGeometry.h:26
Wrapper for OpenGL Texture.
Definition: DtGlSimpleTexture.h:36
static const std::string CRATER_MINOR_AXIS
Definition: DtOsgUtils.h:95
Definition: terrainCraterGeometry.h:23
static const std::string TerrainDamageSlight
Definition: DtOsgUtils.h:109
Definition: terrainCraterGeometry.h:24
static const std::string TrackModelDefinitionSchema
Definition: DtOsgUtils.h:119
std::map< long long, osg::BoundingBoxd > Fid2DebrisMapType
map of FID and bounding sphere debris
Definition: DtOsgUtils.h:334
static const std::string TERRAIN_DEFORMATION_LANDCOVER_OVERRIDE
Definition: DtOsgUtils.h:130
static const std::string TRACKS_TERRAIN_TIME
Definition: DtOsgUtils.h:115
osg::ref_ptr< osg::MatrixTransform > myTransform
Definition: DtOsgUtils.h:67
std::map< osgEarth::MetadataNode *, DtOsgUtils::OSMBuildingInfo > MetadaNodeMap
map between a metadataNode and OSM object indexes (used to display/hide buildings) ...
Definition: DtOsgUtils.h:313
static const std::string TrackPointAParameterName
Definition: DtOsgUtils.h:123
static const std::string TrackDepthParameterName
Definition: DtOsgUtils.h:122
Camera forward declarations.
static const std::string TERRAIN_DEFORMATION_ENUM
Definition: DtOsgUtils.h:129
DtCraterEffect
Definition: DtOsgUtils.h:146
static const std::string TrackSoilTypeParameterName
Definition: DtOsgUtils.h:121
osgEarth::MetadataNode * myMetadataNode
Definition: DtOsgUtils.h:307
Definition: DtOsgUtils.h:71
static const std::string CRATER_RADIUS
Definition: DtOsgUtils.h:106
OSMBuildingInfo(osgEarth::MetadataNode *metadataNode, const std::set< int > &objectIndexList)
Definition: DtOsgUtils.h:301
Structure to map a pair between a MetadataNode and list of OSM object index This class is used to tra...
Definition: DtOsgUtils.h:298
static const std::string TrackPointBParameterName
Definition: DtOsgUtils.h:124
DtDynamicTerrainLine is used to represent a collection of vertices for a linear dynamic terrain objec...
Definition: DtDynamicTerrainLine.h:24
static const std::string TrackSegmentSpacingParameterName
Definition: DtOsgUtils.h:126
static const std::string TERRAIN_DEFORMATION_WIDTH
Definition: DtOsgUtils.h:131
DT_DLL_vrfutil double angle(double vec1[3], double vec2[3])
helper class, random osg debug helpers and math
Definition: DtOsgUtils.h:89
static const std::string TerrainDamageModerate
Definition: DtOsgUtils.h:110
std::string myModelDefinition
Definition: DtOsgUtils.h:345
static const std::string CRATER_EFFECT_ENUM
Definition: DtOsgUtils.h:97
static const std::string CRATER_TYPE
Definition: DtOsgUtils.h:100
Definition: terrainCraterGeometry.h:25
osg::ref_ptr< osg::Geometry > myGeometry
Definition: DtOsgUtils.h:68
Definition: terrainCraterGeometry.h:27
static const std::string CRATER_SOIL_TYPE
Definition: DtOsgUtils.h:98
DtTerrainDeformation
Definition: DtOsgUtils.h:135
std::vector< DebrisPositionStruct > DebrisPositionListType
list of position / debris model definition
Definition: DtOsgUtils.h:349
static const std::string CRATER_DEPTH
Definition: DtOsgUtils.h:99
static const std::string TRACKS_LINE_WIDTH
Definition: DtOsgUtils.h:114
DtOsgDebugFrustum(const osg::Vec4 &color)
DtDynamicTerrainSphere is used to represent a sphere of impact for a dynamic terrain event...
Definition: DtDynamicTerrainSphere.h:21
std::set< int > myObjectIndexList
List of OSM object index under the associated MetadataNode.
Definition: DtOsgUtils.h:309
Command which can be given to the dynamic terrain system to perform some change. This class is a simp...
Definition: DtDynamicTerrainChange.h:42
static const std::string COMMAND_UID
Definition: DtOsgUtils.h:104
static const std::string MODELDEFINITION_PROPS
Definition: DtOsgUtils.h:101
std::map< std::string, DtOsgUtils::MetadaNodeMap > ChangeIdMetadaNodeMap
map between a crater change ID and MetadaNodeMap changes (hidden OSM buildings)
Definition: DtOsgUtils.h:316
DebrisPositionStruct(const DtVector &position, const std::string &modelDefinition)
Definition: DtOsgUtils.h:338
static const std::string TrackTypeParameterName
Definition: DtOsgUtils.h:120
helper for visualizing debug frustra
Definition: DtOsgUtils.h:61
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
DtVector myPosition
Definition: DtOsgUtils.h:344
static const std::string TERRAIN_DEFORMATION_RESOLUTION
Definition: DtOsgUtils.h:133
static const std::string TERRAIN_DEFORMATION_HEIGHT
Definition: DtOsgUtils.h:132
static const std::string TrackTexureParameterName
Definition: DtOsgUtils.h:125
static const std::string TerrainDamageName
Definition: DtOsgUtils.h:108
Definition: dfadData.h:59