implement heightmap overlay for navigation

This commit is contained in:
2019-01-17 12:02:03 +01:00
parent ca9ed74108
commit a2b2ef52c3
2 changed files with 122 additions and 2 deletions

View File

@@ -14,6 +14,23 @@
#define NANORT_ENABLE_PARALLEL_BUILD
#include "nanort.h"
class NodeHeightmapOverlay : public NodeBorder
{
NodeBorder* m_picker{ nullptr };
bool dragging = false;
public:
glm::vec2 m_value{ 0.5f, 0.5f };
glm::vec2 m_old_value{ 0.f };
std::function<void(Node* target, glm::vec2 value)> on_value_changed;
virtual Node* clone_instantiate() const override;
virtual void clone_finalize(Node* dest) const override;
virtual void init() override;
void set_value(float x, float y);
virtual kEventResult handle_event(Event* e) override;
virtual void draw() override;
virtual void handle_resize(glm::vec2 old_size, glm::vec2 new_size) override;
};
class NodePanelGrid : public Node
{
public:
@@ -35,6 +52,7 @@ public:
NodeButton* m_render;
NodeButton* m_commit;
HeightmapPlane m_hm_plane;
NodeHeightmapOverlay* m_hm_preview_nav;
Sphere m_sphere;
Image m_hm_image;
Texture2D m_texture;