-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
134 additions
and
9 deletions.
There are no files selected for viewing
Submodule HighMap
updated
5 files
+ − | doc/images/ex_zeroed_edges.png | |
+2 −0 | examples/ex_zeroed_edges/CMakeLists.txt | |
+15 −0 | examples/ex_zeroed_edges/ex_zeroed_edges.cpp | |
+21 −0 | include/highmap/op.hpp | |
+29 −0 | src/op/boundaries.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General | ||
* Public License. The full license is in the file LICENSE, distributed with | ||
* this software. */ | ||
#include "macrologger.h" | ||
|
||
#include "hesiod/control_node.hpp" | ||
|
||
namespace hesiod::cnode | ||
{ | ||
|
||
ZeroedEdges::ZeroedEdges(std::string id) : gnode::Node(id) | ||
{ | ||
this->node_type = "ZeroedEdges"; | ||
this->category = category_mapping.at(this->node_type); | ||
|
||
this->add_port(gnode::Port("input", gnode::direction::in, dtype::dHeightMap)); | ||
this->add_port(gnode::Port("dr", | ||
gnode::direction::in, | ||
dtype::dHeightMap, | ||
gnode::optional::yes)); | ||
|
||
this->add_port( | ||
gnode::Port("output", gnode::direction::out, dtype::dHeightMap)); | ||
this->update_inner_bindings(); | ||
} | ||
|
||
void ZeroedEdges::update_inner_bindings() | ||
{ | ||
LOG_DEBUG("inner bindings [%s]", this->id.c_str()); | ||
this->set_p_data("output", (void *)&(this->value_out)); | ||
} | ||
|
||
void ZeroedEdges::compute() | ||
{ | ||
LOG_DEBUG("computing node [%s]", this->id.c_str()); | ||
|
||
hmap::HeightMap *p_input_hmap = static_cast<hmap::HeightMap *>( | ||
(void *)this->get_p_data("input")); | ||
hmap::HeightMap *p_input_dr = static_cast<hmap::HeightMap *>( | ||
(void *)this->get_p_data("dr")); | ||
|
||
this->value_out = *p_input_hmap; | ||
|
||
if (!p_input_dr) | ||
hmap::transform( | ||
this->value_out, | ||
[](hmap::Array &z, hmap::Vec2<float> shift, hmap::Vec2<float> scale) | ||
{ hmap::zeroed_edges(z, nullptr, shift, scale); }); | ||
|
||
else | ||
hmap::transform(this->value_out, | ||
*p_input_dr, | ||
[](hmap::Array &z, | ||
hmap::Array &dr, | ||
hmap::Vec2<float> shift, | ||
hmap::Vec2<float> scale) | ||
{ hmap::zeroed_edges(z, &dr, shift, scale); }); | ||
|
||
this->value_out.smooth_overlap_buffers(); | ||
} | ||
|
||
} // namespace hesiod::cnode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General | ||
* Public License. The full license is in the file LICENSE, distributed with | ||
* this software. */ | ||
#include "macrologger.h" | ||
|
||
#include "hesiod/gui.hpp" | ||
#include "hesiod/view_node.hpp" | ||
|
||
namespace hesiod::vnode | ||
{ | ||
|
||
ViewZeroedEdges::ViewZeroedEdges(std::string id) | ||
: ViewNode(), hesiod::cnode::ZeroedEdges(id) | ||
{ | ||
this->set_p_control_node((gnode::Node *)this); | ||
this->set_preview_port_id("output"); | ||
} | ||
|
||
bool ViewZeroedEdges::render_settings() | ||
{ | ||
bool has_changed = false; | ||
has_changed |= this->render_settings_header(); | ||
|
||
has_changed |= this->render_settings_footer(); | ||
return has_changed; | ||
} | ||
|
||
void ViewZeroedEdges::serialize_save(cereal::JSONOutputArchive &) | ||
{ | ||
// empty | ||
} | ||
|
||
void ViewZeroedEdges::serialize_load(cereal::JSONInputArchive &) | ||
{ | ||
// empty | ||
} | ||
|
||
} // namespace hesiod::vnode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters