Skip to content

Commit

Permalink
1、修改距离地面太近穿地的问题
Browse files Browse the repository at this point in the history
2、增加视域分析接口,功能还未添加
  • Loading branch information
ytyisme committed Apr 9, 2021
1 parent 4ad1244 commit f6deb13
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
2 changes: 1 addition & 1 deletion LoadMap/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int main(int argc, char *argv[])



auto pScene = GetSceneCore()->GetSceneGraphManager()->CreateSceneGraph(ISceneGraph::SCENEGRAPH_USER);
auto pScene = GetSceneCore()->GetSceneGraphManager()->CreateSceneGraph(ISceneGraph::SCENEGRAPH_3D);
//pScene->GetMap()->GetSpaceEnv()->SetMilkywayVisible(false);
// for(auto one:pScene->GetMap()->GetMapLayers())
// {
Expand Down
10 changes: 3 additions & 7 deletions Plot/Map/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
#include <osgEarth/Lighting>

#if OSGEARTH_VERSION_GREATER_OR_EQUAL(3,0,0)
#include <osgEarth/LogarithmicDepthBuffer>
#include <osgEarth/AutoClipPlaneHandler>
#else
#include <osgEarthUtil/LogarithmicDepthBuffer>
#include <osgEarthUtil/AutoClipPlaneHandler>
#endif

#include <osgEarth/GLUtils>

#include <Satellite/Date.h>
Expand Down Expand Up @@ -458,13 +457,10 @@ void CMap::InitMap()
#if OSGEARTH_VERSION_GREATER_OR_EQUAL(3,0,0)
m_pMap3DNode->open();
#endif
osgEarth::Util::LogarithmicDepthBuffer buffer;
buffer.setUseFragDepth(true);
buffer.install(m_pMap3DNode.get());

m_pSpaceEnv = new CSpaceEnv(m_pSceneGraph);
osg::Camera* pCamera = dynamic_cast<IOsgViewPoint*>(m_pSceneGraph->GetMainWindow()->GetMainViewPoint())
->GetOsgView()->getCamera();
pCamera->addCullCallback(new osgEarth::Util::AutoClipPlaneCullCallback(m_pMap3DNode));
m_pSpaceEnv->SetMainCamara(pCamera);
m_pSpaceEnv->Init();

Expand Down
4 changes: 2 additions & 2 deletions SceneCore/SceneGraph/MyEarthManipulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ void CMyEarthManipulator::ChangeMap(MapType emType)
case MAP_3D:
getSettings()->setThrowingEnabled(true);
getSettings()->setThrowDecayRate(0.009);
getSettings()->setMinMaxDistance(1,DBL_MAX);
getSettings()->setMinMaxDistance(100,DBL_MAX);
getSettings()->setLockAzimuthWhilePanning(false);
getSettings()->setTerrainAvoidanceEnabled(true);
break;
case MAP_2D:
getSettings()->setMinMaxDistance(10,m_dMaxDistance);
getSettings()->setMinMaxDistance(100,m_dMaxDistance);
auto vp = getViewpoint();
if(AdjustViewPoint(vp))
{
Expand Down
6 changes: 4 additions & 2 deletions Tool/Analysis/Analysis.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ TEMPLATE = lib
include($$PWD/../Tool.pri)

HEADERS += \
AnalysisTool.h
AnalysisTool.h \
ViewAnalysis.h

SOURCES += \
AnalysisTool.cpp
AnalysisTool.cpp \
ViewAnalysis.cpp
1 change: 1 addition & 0 deletions Tool/Analysis/AnalysisTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ ITool *CreateTool(ISceneGraph *pSceneGraph, const std::string &sInterfaceName)

bool QueryInterface(std::string& sInterfaceName)
{
sInterfaceName = "IViewAnalysis";
return(false);
}
10 changes: 10 additions & 0 deletions Tool/Analysis/ViewAnalysis.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "ViewAnalysis.h"

bool CViewAnalysis::InitTool()
{
return(true);
}

void CViewAnalysis::ReleaseTool()
{
}
18 changes: 18 additions & 0 deletions Tool/Analysis/ViewAnalysis.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef CVIEWANALYSIS_H
#define CVIEWANALYSIS_H

#include "../IToolBase.h"
class CViewAnalysis:public IToolBase
{
public:
public:
CViewAnalysis(ISceneGraph* pSceneGraph,CToolSelector*pToolSelector):IToolBase(pSceneGraph,pToolSelector){}

/**
* @brief 初始化工具
*/
bool InitTool();
void ReleaseTool();
};

#endif // CVIEWANALYSIS_H

0 comments on commit f6deb13

Please sign in to comment.