2014-10-08 15:17:31 +00:00
|
|
|
#ifndef OPENCS_RENDER_TERRAINSTORAGE_H
|
|
|
|
#define OPENCS_RENDER_TERRAINSTORAGE_H
|
|
|
|
|
2019-10-02 11:04:15 +00:00
|
|
|
#include <array>
|
|
|
|
|
2014-10-08 15:17:31 +00:00
|
|
|
#include <components/esmterrain/storage.hpp>
|
|
|
|
|
|
|
|
#include "../../model/world/data.hpp"
|
|
|
|
|
|
|
|
namespace CSVRender
|
|
|
|
{
|
2019-09-11 09:59:15 +00:00
|
|
|
class LandCache;
|
2014-10-08 15:17:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief A bridge between the terrain component and OpenCS's terrain data storage.
|
|
|
|
*/
|
|
|
|
class TerrainStorage : public ESMTerrain::Storage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TerrainStorage(const CSMWorld::Data& data);
|
2019-10-02 11:04:15 +00:00
|
|
|
std::array<float, ESM::Land::LAND_SIZE * ESM::Land::LAND_SIZE> mAlteredHeight;
|
2019-09-11 09:59:15 +00:00
|
|
|
void setAlteredHeight(int inCellX, int inCellY, float heightMap);
|
|
|
|
void resetHeights();
|
|
|
|
float getSumOfAlteredAndTrueHeight(int cellX, int cellY, int inCellX, int inCellY);
|
|
|
|
float* getAlteredHeight(int inCellX, int inCellY);
|
|
|
|
|
2014-10-08 15:17:31 +00:00
|
|
|
private:
|
|
|
|
const CSMWorld::Data& mData;
|
|
|
|
|
2019-03-19 21:19:26 +00:00
|
|
|
virtual osg::ref_ptr<const ESMTerrain::LandObject> getLand (int cellX, int cellY) override;
|
|
|
|
virtual const ESM::LandTexture* getLandTexture(int index, short plugin) override;
|
2014-10-08 15:17:31 +00:00
|
|
|
|
2019-09-11 09:59:15 +00:00
|
|
|
/// Draws temporarily altered land (transient change support)
|
|
|
|
void fillVertexBuffers (int lodLevel, float size, const osg::Vec2f& center,
|
|
|
|
osg::ref_ptr<osg::Vec3Array> positions,
|
|
|
|
osg::ref_ptr<osg::Vec3Array> normals,
|
|
|
|
osg::ref_ptr<osg::Vec4ubArray> colours) override;
|
|
|
|
|
2019-03-19 21:19:26 +00:00
|
|
|
virtual void getBounds(float& minX, float& maxX, float& minY, float& maxY) override;
|
2014-10-08 15:17:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|