-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--Support multi-color gradient trajectories #1550
--Support multi-color gradient trajectories #1550
Conversation
Interpolate a list of colors (in HSV space) of any length and map them to trajectory vertices; use vertex colors to render trajectory tube.
src/esp/geo/Geo.cpp
Outdated
std::vector<Mn::Vector3> trajColors; | ||
|
||
// temp converter to vector of values in HSV space from RGB color | ||
auto convertClrToHSVArray = [&](const Mn::Color3ub& clr) -> Mn::Vector3 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the [&]
, can't this be a pure a lambda?
src/esp/geo/Geo.cpp
Outdated
vertices.slice(&Vertex::color); | ||
|
||
// temp converter to RGB color from vector of HSV values | ||
auto convertHSVArrayToColor = [&](const Mn::Vector3& hsvVec) -> Mn::Color3ub { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise for this lambda
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. 👍
Interpolate a list of colors (in HSV space) of any length and map them to trajectory vertices; use vertex colors to render trajectory tube.
Motivation and Context
This PR introduces the ability to generate trajectories with color gradients by interpolating a given list of colors (in HSV space) to produce per-trajectory prim ring colors that are then assigned to the vertices of the trajectory. Any number of colors are supported, not just 2.
The existing functionality is still supported, but another functional binding has been added that supports the user specifying a list of Mn::Color3ub values to be used as the color interpolants. NOTE : the existing code supported the user specifying a single Mn::Color4 (which was a float color w/alpha) even though the alpha was ignored for this construct. A discussion should be had on whether we wish to refactor the old mechanism to support Color3ub, dispose of the old method entirely, or leave the old method (to not break existing code).
How Has This Been Tested
Local c++ and python tests pass; Viewer.cpp has been expanded to enable the user to request a single random color or a random number of multiple random colors (up to 5) to illustrate the functionality.
Types of changes
Checklist