mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Move structs into separate headers, cleanup includes, cleanup forwarders
This commit is contained in:
parent
5078b6822a
commit
ddf43ec42f
11 changed files with 113 additions and 62 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include <components/misc/resourcehelpers.hpp>
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
#include <components/misc/stringops.hpp>
|
#include <components/misc/stringops.hpp>
|
||||||
#include <components/terrain/world.hpp>
|
#include <components/terrain/world.hpp>
|
||||||
|
#include <components/terrain/view.hpp>
|
||||||
#include <components/esm3/loadcell.hpp>
|
#include <components/esm3/loadcell.hpp>
|
||||||
#include <components/loadinglistener/reporter.hpp>
|
#include <components/loadinglistener/reporter.hpp>
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,8 @@ add_component_dir (translation
|
||||||
)
|
)
|
||||||
|
|
||||||
add_component_dir (terrain
|
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
|
add_component_dir (loadinglistener
|
||||||
|
|
62
components/terrain/heightcull.hpp
Normal file
62
components/terrain/heightcull.hpp
Normal 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
|
|
@ -18,6 +18,7 @@
|
||||||
#include "chunkmanager.hpp"
|
#include "chunkmanager.hpp"
|
||||||
#include "compositemaprenderer.hpp"
|
#include "compositemaprenderer.hpp"
|
||||||
#include "terraindrawable.hpp"
|
#include "terraindrawable.hpp"
|
||||||
|
#include "heightcull.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef COMPONENTS_TERRAIN_QUADTREEWORLD_H
|
#ifndef COMPONENTS_TERRAIN_QUADTREEWORLD_H
|
||||||
#define COMPONENTS_TERRAIN_QUADTREEWORLD_H
|
#define COMPONENTS_TERRAIN_QUADTREEWORLD_H
|
||||||
|
|
||||||
#include "world.hpp"
|
|
||||||
#include "terraingrid.hpp"
|
#include "terraingrid.hpp"
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
@ -10,6 +9,8 @@
|
||||||
namespace osg
|
namespace osg
|
||||||
{
|
{
|
||||||
class NodeVisitor;
|
class NodeVisitor;
|
||||||
|
class Group;
|
||||||
|
class Stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Terrain
|
namespace Terrain
|
||||||
|
|
|
@ -8,7 +8,10 @@
|
||||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||||
#include "chunkmanager.hpp"
|
#include "chunkmanager.hpp"
|
||||||
#include "compositemaprenderer.hpp"
|
#include "compositemaprenderer.hpp"
|
||||||
|
#include "view.hpp"
|
||||||
#include "storage.hpp"
|
#include "storage.hpp"
|
||||||
|
#include "heightcull.hpp"
|
||||||
|
|
||||||
namespace Terrain
|
namespace Terrain
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,20 @@
|
||||||
|
|
||||||
#include "world.hpp"
|
#include "world.hpp"
|
||||||
|
|
||||||
|
namespace osg
|
||||||
|
{
|
||||||
|
class Group;
|
||||||
|
class Stats;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Resource
|
||||||
|
{
|
||||||
|
class ResourceSystem;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Terrain
|
namespace Terrain
|
||||||
{
|
{
|
||||||
|
class Storage;
|
||||||
|
|
||||||
/// @brief Simple terrain implementation that loads cells in a grid, with no LOD. Only requested cells are loaded.
|
/// @brief Simple terrain implementation that loads cells in a grid, with no LOD. Only requested cells are loaded.
|
||||||
class TerrainGrid : public Terrain::World
|
class TerrainGrid : public Terrain::World
|
||||||
|
|
25
components/terrain/view.hpp
Normal file
25
components/terrain/view.hpp
Normal 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
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <osg/Node>
|
#include <osg/Node>
|
||||||
|
|
||||||
#include "world.hpp"
|
#include "view.hpp"
|
||||||
|
|
||||||
namespace Terrain
|
namespace Terrain
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "texturemanager.hpp"
|
#include "texturemanager.hpp"
|
||||||
#include "chunkmanager.hpp"
|
#include "chunkmanager.hpp"
|
||||||
#include "compositemaprenderer.hpp"
|
#include "compositemaprenderer.hpp"
|
||||||
|
#include "heightcull.hpp"
|
||||||
|
|
||||||
namespace Terrain
|
namespace Terrain
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
#include <osg/Referenced>
|
#include <osg/Referenced>
|
||||||
#include <osg/Vec3f>
|
#include <osg/Vec3f>
|
||||||
|
|
||||||
#include <atomic>
|
|
||||||
#include <limits>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
@ -19,8 +17,6 @@ namespace osg
|
||||||
{
|
{
|
||||||
class Group;
|
class Group;
|
||||||
class Stats;
|
class Stats;
|
||||||
class Node;
|
|
||||||
class Object;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Resource
|
namespace Resource
|
||||||
|
@ -40,61 +36,9 @@ namespace Terrain
|
||||||
class TextureManager;
|
class TextureManager;
|
||||||
class ChunkManager;
|
class ChunkManager;
|
||||||
class CompositeMapRenderer;
|
class CompositeMapRenderer;
|
||||||
|
class View;
|
||||||
class HeightCullCallback : public SceneUtil::NodeCallback<HeightCullCallback>
|
class 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;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The basic interface for a terrain world. How the terrain chunks are paged and displayed
|
* @brief The basic interface for a terrain world. How the terrain chunks are paged and displayed
|
||||||
* is up to the implementation.
|
* is up to the implementation.
|
||||||
|
|
Loading…
Reference in a new issue