From 61b6806a62baa89db93f5270e5f7907ffbb73764 Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Tue, 9 Feb 2016 20:23:00 -0500 Subject: [PATCH] Allow toggling of cell markers --- apps/opencs/view/render/cellmarker.cpp | 14 ++++++++++++++ apps/opencs/view/render/cellmarker.hpp | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/apps/opencs/view/render/cellmarker.cpp b/apps/opencs/view/render/cellmarker.cpp index 17bb05440..e8772a586 100644 --- a/apps/opencs/view/render/cellmarker.cpp +++ b/apps/opencs/view/render/cellmarker.cpp @@ -7,6 +7,17 @@ #include #include +#include "mask.hpp" + +CSVRender::CellMarkerTag::CellMarkerTag(CellMarker *marker) +: TagBase(Mask_CellMarker), mMarker(marker) +{} + +CSVRender::CellMarker *CSVRender::CellMarkerTag::getCellMarker() const +{ + return mMarker; +} + void CSVRender::CellMarker::buildMarker() { const int characterSize = 20; @@ -50,6 +61,9 @@ CSVRender::CellMarker::CellMarker( mMarkerNode->setAutoScaleToScreen(true); mMarkerNode->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); + mMarkerNode->setUserData(new CellMarkerTag(this)); + mMarkerNode->setNodeMask(Mask_CellMarker); + mCellNode->addChild(mMarkerNode); buildMarker(); diff --git a/apps/opencs/view/render/cellmarker.hpp b/apps/opencs/view/render/cellmarker.hpp index 4ac9d86b0..08c7e0608 100644 --- a/apps/opencs/view/render/cellmarker.hpp +++ b/apps/opencs/view/render/cellmarker.hpp @@ -1,6 +1,8 @@ #ifndef OPENCS_VIEW_CELLMARKER_H #define OPENCS_VIEW_CELLMARKER_H +#include "tagbase.hpp" + #include #include "../../model/world/cellcoordinates.hpp" @@ -13,6 +15,21 @@ namespace osg namespace CSVRender { + class CellMarker; + + class CellMarkerTag : public TagBase + { + private: + + CellMarker *mMarker; + + public: + + CellMarkerTag(CellMarker *marker); + + CellMarker *getCellMarker() const; + }; + /// \brief Marker to display cell coordinates. class CellMarker {