1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-20 15:23:52 +00:00
openmw/apps/opencs/view/render/terrainstorage.hpp

66 lines
2.6 KiB
C++
Raw Normal View History

#ifndef OPENCS_RENDER_TERRAINSTORAGE_H
#define OPENCS_RENDER_TERRAINSTORAGE_H
#include <array>
2022-10-09 10:39:43 +00:00
#include <components/esm3/loadland.hpp>
2022-10-19 17:02:00 +00:00
#include <components/esm3/loadltex.hpp>
2022-01-22 22:52:08 +00:00
#include <components/esm3terrain/storage.hpp>
2022-10-09 10:39:43 +00:00
#include <osg/ref_ptr>
2022-10-09 10:39:43 +00:00
namespace CSMWorld
{
class Data;
}
namespace osg
{
class Vec4ub;
}
namespace CSVRender
{
/**
* @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-09-11 09:59:15 +00:00
void setAlteredHeight(int inCellX, int inCellY, float heightMap);
void resetHeights();
2019-11-20 13:37:00 +00:00
bool useAlteration() const override { return true; }
2019-09-11 09:59:15 +00:00
float getSumOfAlteredAndTrueHeight(int cellX, int cellY, int inCellX, int inCellY);
float* getAlteredHeight(int inCellX, int inCellY);
private:
const CSMWorld::Data& mData;
std::array<float, ESM::Land::LAND_SIZE * ESM::Land::LAND_SIZE> mAlteredHeight;
2022-09-22 18:26:05 +00:00
osg::ref_ptr<const ESMTerrain::LandObject> getLand(int cellX, int cellY) override;
const ESM::LandTexture* getLandTexture(int index, short plugin) override;
void getBounds(float& minX, float& maxX, float& minY, float& maxY) override;
2022-09-22 18:26:05 +00:00
int getThisHeight(int col, int row, const ESM::Land::LandData* heightData) const;
int getLeftHeight(int col, int row, const ESM::Land::LandData* heightData) const;
int getRightHeight(int col, int row, const ESM::Land::LandData* heightData) const;
int getUpHeight(int col, int row, const ESM::Land::LandData* heightData) const;
int getDownHeight(int col, int row, const ESM::Land::LandData* heightData) const;
int getHeightDifferenceToLeft(int col, int row, const ESM::Land::LandData* heightData) const;
int getHeightDifferenceToRight(int col, int row, const ESM::Land::LandData* heightData) const;
int getHeightDifferenceToUp(int col, int row, const ESM::Land::LandData* heightData) const;
int getHeightDifferenceToDown(int col, int row, const ESM::Land::LandData* heightData) const;
bool leftOrUpIsOverTheLimit(
int col, int row, int heightWarningLimit, const ESM::Land::LandData* heightData) const;
bool rightOrDownIsOverTheLimit(
int col, int row, int heightWarningLimit, const ESM::Land::LandData* heightData) const;
void adjustColor(int col, int row, const ESM::Land::LandData* heightData, osg::Vec4ub& color) const override;
float getAlteredHeight(int col, int row) const override;
};
}
#endif