Move structs into separate headers, cleanup includes, cleanup forwarders

LTO-timing^2
ζeh Matt 2 years ago
parent 5078b6822a
commit ddf43ec42f
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0

@ -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>

@ -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

@ -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

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

@ -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

@ -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
{

@ -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

@ -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

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

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

@ -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,61 +36,9 @@ 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
* is up to the implementation.

Loading…
Cancel
Save