1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-18 13:12:50 +00:00
OpenMW/apps/openmw/mwrender/groundcover.hpp
Bo Svensson 8358418555
set the correct program link parameters (#3110)
* shadermanager.hpp setProgramTemplate

* shadermanager.hpp

* shadermanager.cpp setProgramTemplate

* shadervisitor.hpp setProgramTemplate

* shadervisitor.cpp setProgramTemplate

* scenemanager.cpp setProgramTemplate

* scenemanager.hpp setProgramTemplate

* renderingmanager.cpp

* groundcover.cpp setProgramTemplate

* groundcover.hpp

* groundcover.cpp

* shadervisitor.cpp

* util.cpp

* lightmanager.cpp

* scenemanager.cpp

* scenemanager.hpp

* lightmanager.cpp

* lightmanager.cpp

* lightmanager.cpp

* scenemanager.hpp [ci skip]

* water.cpp

* groundcover.cpp

* shadermanager.hpp
2021-09-29 15:40:37 +02:00

46 lines
1.6 KiB
C++

#ifndef OPENMW_MWRENDER_GROUNDCOVER_H
#define OPENMW_MWRENDER_GROUNDCOVER_H
#include <components/terrain/quadtreeworld.hpp>
#include <components/resource/scenemanager.hpp>
#include <components/esm/loadcell.hpp>
#include <osg/Program>
namespace MWRender
{
typedef std::tuple<osg::Vec2f, float> GroundcoverChunkId; // Center, Size
class Groundcover : public Resource::GenericResourceManager<GroundcoverChunkId>, public Terrain::QuadTreeWorld::ChunkManager
{
public:
Groundcover(Resource::SceneManager* sceneManager, float density);
~Groundcover() = default;
osg::ref_ptr<osg::Node> getChunk(float size, const osg::Vec2f& center, unsigned char lod, unsigned int lodFlags, bool activeGrid, const osg::Vec3f& viewPoint, bool compile) override;
unsigned int getNodeMask() override;
void reportStats(unsigned int frameNumber, osg::Stats* stats) const override;
struct GroundcoverEntry
{
ESM::Position mPos;
float mScale;
GroundcoverEntry(const ESM::CellRef& ref) : mPos(ref.mPos), mScale(ref.mScale)
{}
};
private:
Resource::SceneManager* mSceneManager;
float mDensity;
osg::ref_ptr<osg::StateSet> mStateset;
osg::ref_ptr<osg::Program> mProgramTemplate;
typedef std::map<std::string, std::vector<GroundcoverEntry>> InstanceMap;
osg::ref_ptr<osg::Node> createChunk(InstanceMap& instances, const osg::Vec2f& center);
void collectInstances(InstanceMap& instances, float size, const osg::Vec2f& center);
};
}
#endif