1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 16:29:55 +00:00

Move structs into separate headers, cleanup includes, cleanup forwarders

This commit is contained in:
ζeh Matt 2022-07-18 19:11:37 +03:00
parent 5078b6822a
commit ddf43ec42f
No known key found for this signature in database
GPG key ID: 18CE582C71A225B0
11 changed files with 113 additions and 62 deletions

View file

@ -12,6 +12,7 @@
#include <components/misc/resourcehelpers.hpp>
#include <components/misc/stringops.hpp>
#include <components/terrain/world.hpp>
#include <components/terrain/view.hpp>
#include <components/esm3/loadcell.hpp>
#include <components/loadinglistener/reporter.hpp>

View file

@ -234,7 +234,8 @@ add_component_dir (translation
)
add_component_dir (terrain
storage world buffercache defs terraingrid material terraindrawable texturemanager chunkmanager compositemaprenderer quadtreeworld quadtreenode viewdata cellborder
storage world buffercache defs terraingrid material terraindrawable texturemanager chunkmanager compositemaprenderer
quadtreeworld quadtreenode viewdata cellborder view heightcull
)
add_component_dir (loadinglistener

View file

@ -0,0 +1,62 @@
#ifndef COMPONENTS_TERRAIN_HEIGHTCULL_H
#define COMPONENTS_TERRAIN_HEIGHTCULL_H
#include <osg/ref_ptr>
#include <osg/Referenced>
#include <limits>
#include <components/sceneutil/nodecallback.hpp>
namespace osg
{
class Node;
class NodeVisitor;
}
namespace Terrain
{
class HeightCullCallback : public SceneUtil::NodeCallback<HeightCullCallback>
{
public:
void setLowZ(float z)
{
mLowZ = z;
}
float getLowZ() const
{
return mLowZ;
}
void setHighZ(float highZ)
{
mHighZ = highZ;
}
float getHighZ() const
{
return mHighZ;
}
void setCullMask(unsigned int mask)
{
mMask = mask;
}
unsigned int getCullMask() const
{
return mMask;
}
void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
if (mLowZ <= mHighZ)
traverse(node, nv);
}
private:
float mLowZ{ -std::numeric_limits<float>::max() };
float mHighZ{ std::numeric_limits<float>::max() };
unsigned int mMask{ ~0u };
};
}
#endif

View file

@ -18,6 +18,7 @@
#include "chunkmanager.hpp"
#include "compositemaprenderer.hpp"
#include "terraindrawable.hpp"
#include "heightcull.hpp"
namespace
{

View file

@ -1,7 +1,6 @@
#ifndef COMPONENTS_TERRAIN_QUADTREEWORLD_H
#define COMPONENTS_TERRAIN_QUADTREEWORLD_H
#include "world.hpp"
#include "terraingrid.hpp"
#include <mutex>
@ -10,6 +9,8 @@
namespace osg
{
class NodeVisitor;
class Group;
class Stats;
}
namespace Terrain

View file

@ -8,7 +8,10 @@
#include <components/sceneutil/positionattitudetransform.hpp>
#include "chunkmanager.hpp"
#include "compositemaprenderer.hpp"
#include "view.hpp"
#include "storage.hpp"
#include "heightcull.hpp"
namespace Terrain
{

View file

@ -7,8 +7,20 @@
#include "world.hpp"
namespace osg
{
class Group;
class Stats;
}
namespace Resource
{
class ResourceSystem;
}
namespace Terrain
{
class Storage;
/// @brief Simple terrain implementation that loads cells in a grid, with no LOD. Only requested cells are loaded.
class TerrainGrid : public Terrain::World

View file

@ -0,0 +1,25 @@
#ifndef COMPONENTS_TERRAIN_VIEW_H
#define COMPONENTS_TERRAIN_VIEW_H
#include <osg/ref_ptr>
#include <osg/Referenced>
#include <osg/Vec3f>
namespace Terrain
{
/**
* @brief A View is a collection of rendering objects that are visible from a given camera/intersection.
* The base View class is part of the interface for usage in conjunction with preload feature.
*/
class View : public osg::Referenced
{
public:
virtual ~View() {}
/// Reset internal structure so that the next addition to the view will override the previous frame's contents.
virtual void reset() = 0;
};
}
#endif

View file

@ -6,7 +6,7 @@
#include <osg/Node>
#include "world.hpp"
#include "view.hpp"
namespace Terrain
{

View file

@ -10,6 +10,7 @@
#include "texturemanager.hpp"
#include "chunkmanager.hpp"
#include "compositemaprenderer.hpp"
#include "heightcull.hpp"
namespace Terrain
{

View file

@ -5,8 +5,6 @@
#include <osg/Referenced>
#include <osg/Vec3f>
#include <atomic>
#include <limits>
#include <memory>
#include <set>
@ -19,8 +17,6 @@ namespace osg
{
class Group;
class Stats;
class Node;
class Object;
}
namespace Resource
@ -40,60 +36,8 @@ namespace Terrain
class TextureManager;
class ChunkManager;
class CompositeMapRenderer;
class HeightCullCallback : public SceneUtil::NodeCallback<HeightCullCallback>
{
public:
void setLowZ(float z)
{
mLowZ = z;
}
float getLowZ() const
{
return mLowZ;
}
void setHighZ(float highZ)
{
mHighZ = highZ;
}
float getHighZ() const
{
return mHighZ;
}
void setCullMask(unsigned int mask)
{
mMask = mask;
}
unsigned int getCullMask() const
{
return mMask;
}
void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
if (mLowZ <= mHighZ)
traverse(node, nv);
}
private:
float mLowZ{-std::numeric_limits<float>::max()};
float mHighZ{std::numeric_limits<float>::max()};
unsigned int mMask{~0u};
};
/**
* @brief A View is a collection of rendering objects that are visible from a given camera/intersection.
* The base View class is part of the interface for usage in conjunction with preload feature.
*/
class View : public osg::Referenced
{
public:
virtual ~View() {}
/// Reset internal structure so that the next addition to the view will override the previous frame's contents.
virtual void reset() = 0;
};
class View;
class HeightCullCallback;
/**
* @brief The basic interface for a terrain world. How the terrain chunks are paged and displayed