mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-04 10:40:09 -06:00
Polish RenderableCartesianAxes - documentation, examples, and make fading work correctly (#3478)
* Make `RenderableCartesianAxes` fade and fix opacity setting * Update existing documentation of cartesian axes * Add example with custom colros and parent node * Apply suggestions from code review Co-authored-by: Alexander Bock <alexander.bock@liu.se> * Include earth asset instead of using string identifer --------- Co-authored-by: Alexander Bock <alexander.bock@liu.se>
This commit is contained in:
@@ -65,9 +65,9 @@ namespace {
|
||||
//
|
||||
// To add the axes, create a scene graph node with the RenderableCartesianAxes
|
||||
// renderable and add it as a child to the other scene graph node, i.e. specify the
|
||||
// other node as the Parent of the node with this renderable. Also, the axes have to
|
||||
// other node as the `Parent` of the node with this renderable. Also, the axes have to
|
||||
// be scaled to match the parent object for the axes to be visible in the scene, for
|
||||
// example using a StaticScale.
|
||||
// example using a [StaticScale](#base_scale_static).
|
||||
struct [[codegen::Dictionary(RenderableCartesianAxes)]] Parameters {
|
||||
// [[codegen::verbatim(XColorInfo.description)]]
|
||||
std::optional<glm::vec3> xColor [[codegen::color()]];
|
||||
@@ -95,6 +95,9 @@ RenderableCartesianAxes::RenderableCartesianAxes(const ghoul::Dictionary& dictio
|
||||
, _zColor(ZColorInfo, glm::vec3(0.f, 0.f, 1.f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
{
|
||||
const Parameters p = codegen::bake<Parameters>(dictionary);
|
||||
|
||||
addProperty(Fadeable::_opacity);
|
||||
|
||||
_xColor = p.xColor.value_or(_xColor);
|
||||
_xColor.setViewOption(properties::Property::ViewOptions::Color);
|
||||
addProperty(_xColor);
|
||||
@@ -195,6 +198,7 @@ void RenderableCartesianAxes::render(const RenderData& data, RendererTasks&) {
|
||||
_program->setUniform("xColor", _xColor);
|
||||
_program->setUniform("yColor", _yColor);
|
||||
_program->setUniform("zColor", _zColor);
|
||||
_program->setUniform("opacity", opacity());
|
||||
|
||||
// Changes GL state:
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
Reference in New Issue
Block a user