DYTSrouce/src/scene/OEScene.h

59 lines
1.5 KiB
C
Raw Normal View History

2025-01-04 04:12:51 +00:00
#pragma once
#include <osg/Switch>
#include <osg/TextureCubeMap>
#include <osgText/Text>
#include <osgEarth/ModelNode>
#include <osgEarth/Sky>
#include <osgEarth/LogarithmicDepthBuffer>
2025-01-18 14:36:28 +00:00
#include <osgViewer/Viewer>
2025-01-04 04:12:51 +00:00
//#include "scene/SkyDome.h"
2025-01-09 00:32:05 +00:00
#include "common/SpdLogger.h"
#include "config.h"
2025-01-12 17:35:51 +00:00
#include "scene/ui/OESceneUI.h"
2025-01-09 00:32:05 +00:00
2025-01-04 04:12:51 +00:00
class OsgView;
class OEScene : public osg::Referenced {
public:
OEScene();
void InitEventHandle(OsgView* view);
2025-01-13 17:33:51 +00:00
void InitEventHandle(osgViewer::View* view);
2025-01-04 04:12:51 +00:00
void AttachView(OsgView* view);
2025-01-18 14:36:28 +00:00
void AttachView(osgViewer::Viewer* view);
2025-01-04 04:12:51 +00:00
void DetachView(OsgView* view);
osg::ref_ptr<osg::TextureCubeMap> LoadCubeMapTextures(const std::string& dir);
inline osg::Vec4f IntColor(unsigned r, unsigned g, unsigned b, unsigned a = 255) {
float div = 1.f / 255.f;
return osg::Vec4f(div * (float)r, div * (float)g, div * float(b), div * (float)a);
}
osg::Group* GetData();
inline osg::Group* GetScene(void) {
return earthMapNode_.get();
}
2025-01-09 00:32:05 +00:00
osgEarth::MapNode* GetMapNode(void) const {
dyt_check(earthMapNode_.valid());
return earthMapNode_;
}
2025-01-04 04:12:51 +00:00
void AddToScene(osg::Node* node);
2025-01-12 17:35:51 +00:00
OESceneUI* GetOrCreateSceneUI();
2025-01-04 04:12:51 +00:00
private:
osg::ref_ptr<osg::Node> earthRootNode_;
osg::ref_ptr<osgEarth::MapNode> earthMapNode_;
osg::ref_ptr<osg::Group> entityRoot_;
osg::ref_ptr<osgEarth::SkyNode> skyDome_;
std::unique_ptr<osgEarth::Util::LogarithmicDepthBuffer> logarithmicDepthBuffer_;
2025-01-12 17:35:51 +00:00
osg::ref_ptr<OESceneUI> sceneUI_;
2025-01-04 04:12:51 +00:00
};