texture heightmapping test
This commit is contained in:
parent
9ff485588e
commit
60a3e4a038
10 changed files with 170 additions and 246 deletions
25
src/Topology.hpp
Normal file
25
src/Topology.hpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#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();
|
||||
|
||||
void PreRender(const lol::CameraBase& camera) const override;
|
||||
|
||||
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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue