MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ apply_radial_gradient()

void MayaFlux::Nodes::Network::PointCloudNetwork::apply_radial_gradient ( const glm::vec3 &  center_color,
const glm::vec3 &  edge_color,
const glm::vec3 &  center = glm::vec3(0.0F) 
)

Apply radial color gradient from center.

Parameters
center_colorColor at center
edge_colorColor at maximum distance
centerCenter point for gradient calculation

Definition at line 251 of file PointCloudNetwork.cpp.

255{
256 auto verts = get_vertices();
257 const size_t count = verts.size();
258
259 float max_dist = 0.0F;
260 for (const auto& v : verts)
261 max_dist = std::max(max_dist, glm::length(v.position - center));
262
263 for (size_t i = 0; i < count; ++i) {
264 const float t = max_dist > 0.0F ? glm::length(verts[i].position - center) / max_dist : 0.0F;
265 verts[i].color = glm::mix(center_color, edge_color, t);
266 }
267
268 set_vertices(verts);
269
271 "Applied radial color gradient to {} points", count);
272}
#define MF_DEBUG(comp, ctx,...)
size_t count
void set_vertices(const std::vector< LineVertex > &vertices)
Set all point vertices.
std::vector< LineVertex > get_vertices() const
Get all point vertices.
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
std::vector< double > max(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Maximum value per window.
Definition Analysis.cpp:436

References count, get_vertices(), MF_DEBUG, MayaFlux::Journal::NodeProcessing, MayaFlux::Journal::Nodes, and set_vertices().

+ Here is the call graph for this function: