DYTSrouce/src/scene/OEScene.h

52 lines
1.3 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>
//#include "scene/SkyDome.h"
2025-01-09 00:32:05 +00:00
#include "common/SpdLogger.h"
#include "config.h"
2025-01-04 04:12:51 +00:00
class OsgView;
class OEScene : public osg::Referenced {
public:
OEScene();
void InitEventHandle(OsgView* view);
void AttachView(OsgView* view);
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);
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_;
};