2021-12-25 02:15:50 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <lol/lol.hpp>
|
|
|
|
|
|
|
|
inline float Map(const glm::vec2& from, const glm::vec2& to, float val)
|
|
|
|
{
|
|
|
|
return (val - from.x) * (to.y - to.x) / (from.y - from.x) + to.x;
|
|
|
|
}
|
|
|
|
|
|
|
|
class Topology : public lol::Drawable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Topology(const glm::vec2& size, const glm::uvec2& subdivision);
|
|
|
|
~Topology();
|
|
|
|
|
2021-12-25 14:01:15 +00:00
|
|
|
void PreRender(const lol::CameraBase& camera) override;
|
2021-12-25 02:15:50 +00:00
|
|
|
|
|
|
|
inline float* GetTopology() const { return (float*)image.GetPixels(); };
|
|
|
|
inline const glm::uvec2& GetSize() const { return image.GetDimensions(); };
|
|
|
|
void MakeTexture();
|
|
|
|
|
|
|
|
private:
|
|
|
|
lol::Image image;
|
|
|
|
lol::Texture* texture;
|
2021-12-25 14:01:15 +00:00
|
|
|
|
|
|
|
float offset = 0.0f;
|
2021-12-25 02:15:50 +00:00
|
|
|
};
|