DYTSrouce/src/scene/OEScene.h
2025-01-09 08:32:05 +08:00

52 lines
1.3 KiB
C++

#pragma once
#include <osg/Switch>
#include <osg/TextureCubeMap>
#include <osgText/Text>
#include <osgEarth/ModelNode>
#include <osgEarth/Sky>
#include <osgEarth/LogarithmicDepthBuffer>
//#include "scene/SkyDome.h"
#include "common/SpdLogger.h"
#include "config.h"
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();
}
osgEarth::MapNode* GetMapNode(void) const {
dyt_check(earthMapNode_.valid());
return earthMapNode_;
}
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_;
};