VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgUtils.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <osg/Quat>
13 #include <osg/Texture2DArray>
14 #include <osg/Depth>
15 #include <osg/Camera>
16 #include <osg/MatrixTransform>
17 #include <osg/Geometry>
18 
21 
22 namespace makVrv
23 {
24  class DtGlSimpleTexture;
25 
28  class DtOsgDebugFrustum : public osg::Referenced
29  {
30  public:
31  DtOsgDebugFrustum(const osg::Vec4 & color);
32  void updateDebugFrustum(osg::Vec3d * frustumVertices);
33 
36  };
37 
41  {
42  public:
44  static void makeRotate(osg::Quat& q, const double& angle, const double& x, const double& y, const double& z);
45 
49  static void quatMult(osg::Quat& lhs, const osg::Quat& rhs);
50 
52  static osg::Camera * CreateTextureQuadOverlay(DtGlSimpleTexture * texture,
53  float x, float y, float w, float h);
54 
56  static osg::Camera * CreateTextureQuadOverlay(osg::Texture * texture,
57  float x, float y, float w, float h);
58 
60  static osg::Camera * CreateTextureQuadOverlay(const std::string& shader_root, osg::Texture2DArray * textureArray,
61  float x, float y, float w, float h);
62 
64  static osg::MatrixTransform * create_axis_primitive();
65 
68  static osg::Matrix getOrthoMatrix(bool useReverseZ, double left, double right, double bottom, double top, double zNear, double zFar);
69 
72  static osg::Matrixd oglRevDepthOrtho(double left, double right, double bottom,
73  double top, double zNear, double zFar);
74 
78  static bool getRevZProjectionMatrixAsFrustum(const osg::Matrix& mat, double& left,
79  double& right, double& bottom, double& top, double& zNear, double& zFar);
80 
84  static bool getRevPerspective(const osg::Matrix& mat, double& fovy,
85  double& aspectRatio, double& zNear, double& zFar);
86 
90  static osg::Matrix makeRevFrustum(double left, double right,
91  double bottom, double top, double zNear, double zFar);
92 
96  static osg::Matrix makeRevPerspective(double fovy, double aspectRatio,
97  double zNear, double zFar);
98 
100  static void getYPR(const osg::Matrix& m, double& yaw, double& pitch, double& roll);
101 
103  static void osgPolytopeToFrustum(const osg::Polytope& polytope, Frustum_64& frustum);
104 
108  static void computeOsgCameraFrustumPlanes(std::vector<osg::Vec4d>& planes, const osg::Camera* camera);
109 
111  static void debugDumpShaderState(osg::State* state);
112 
114  static void debugDumpUniformState(const osg::Node* node);
115 
117 
118  static osg::Vec2 rotateVec2( const osg::Vec2& v, double rad );
120 
122  static osg::Vec2 translateVec2( const osg::Vec2& v, const osg::Vec2& translation );
123 
125  static osg::Vec2 scaleVec2( const osg::Vec2& v, double s );
126 
128  static osg::Vec2 scaleVec2( const osg::Vec2& v, double xScale, double yScale );
130 
132  static bool clipLine( double xMin, double xMax, double yMin, double yMax,
133  double x0src, double y0src, double x1src, double y1src,
134  double &x0clip, double &y0clip, double &x1clip, double &y1clip );
135 
137  static void clipPolygon( double xMin, double xMax, double yMin, double yMax,
138  std::vector<osg::Vec2>& vertices );
139 
140  };
141 }
142 
Diagonal crossing liens.
Definition: DtTacticalGraphicUtilities.h:93
void updateDebugFrustum(osg::Vec3d *frustumVertices)
Contains makVrv::DtOsgShaderFilesCache class.
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Wrapper for OpenGL Texture.
Definition: DtGlSimpleTexture.h:35
osg::ref_ptr< osg::MatrixTransform > myTransform
Definition: DtOsgUtils.h:34
Camera forward declarations.
DT_DLL_vrfutil double angle(double vec1[3], double vec2[3])
helper class, random osg debug helpers and math
Definition: DtOsgUtils.h:40
osg::ref_ptr< osg::Geometry > myGeometry
Definition: DtOsgUtils.h:35
DtOsgDebugFrustum(const osg::Vec4 &color)
helper for visualizing debug frustra
Definition: DtOsgUtils.h:28
Template for 32/64 bit bit frustums.
Definition: DtCamera.h:148

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)