AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
ScalarColorMap.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
20#include <osgSim/ColorRange>
21#include <osgSim/ScalarsToColors>
22#include <osg/ref_ptr>
23#include <agx/PopDisableWarnings.h> // End of disabled warnings.
24
25#include <agxOSG/export.h>
26#include <agxRender/Color.h>
27#include <agx/Referenced.h>
28
29namespace agxOSG
30{
38 {
39 public:
40
58
63
74 agx::Real minScalar,
75 agx::Real maxScalar );
76
87 agx::Real minScalar,
88 agx::Real maxScalar );
89
95 void setColorsFromPreset( ColorRangePreset colorRangePreset );
96
103 osg::Vec4 getColorOSG( agx::Real scalar, bool modifyAlpha = false ) const;
104
111 agx::Vec4f getColor( agx::Real scalar, bool modifyAlpha = false ) const;
112
119 void setMinScalar( agx::Real minScalar );
120
127 void setMaxScalar( agx::Real maxScalar );
128
136 void setScalarInterval( agx::Real minScalar, agx::Real maxScalar );
137
138 /*
139 Manually set the colors used in the interpolation range.
140 \param colorVector - a vector containing the specified colors of the interval.
141 */
142 void setColors( const agxRender::ColorVector& colorVector );
143
148
153
158
162 osg::ref_ptr < osgSim::ColorRange > getOsgColorRange() const;
163
164 protected:
166 void initColorRange( const std::vector<osg::Vec4>& osgColors );
170
171 protected:
175 osg::ref_ptr< osgSim::ColorRange > m_colorRange;
176 };
177}
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXOSG_EXPORT
Class that represents a linear scalar color map that converts a scalar interval to a specified color ...
ColorRangePreset
Enum representation of predefined color ranges than can be set in the class.
void setColors(const agxRender::ColorVector &colorVector)
agxRender::ColorVector getColors() const
osg::ref_ptr< osgSim::ColorRange > getOsgColorRange() const
void setMaxScalar(agx::Real maxScalar)
Set the maximum scalar of the interval.
void setScalarInterval(agx::Real minScalar, agx::Real maxScalar)
Set the scalars of the interval used in the color interpolation.
void initColorRange(const std::vector< osg::Vec4 > &osgColors)
ScalarColorMap()
Default constructor.
agx::Real getMaxScalar() const
ScalarColorMap(ColorRangePreset preset, agx::Real minScalar, agx::Real maxScalar)
Constructor.
agx::Vec4f getColor(agx::Real scalar, bool modifyAlpha=false) const
Get an agx representation of a color value in the map given a scalar inside the interval.
agx::Real getMinScalar() const
void setMinScalar(agx::Real minScalar)
Set the min scalar of the interval.
osg::ref_ptr< osgSim::ColorRange > m_colorRange
ScalarColorMap(const agxRender::ColorVector &colorVector, agx::Real minScalar, agx::Real maxScalar)
Constructor.
agxRender::ColorVector getColorsFromPreset(ColorRangePreset preset)
void setColorsFromPreset(ColorRangePreset colorRangePreset)
Set a range of colors from an available color range preset in the class.
osg::Vec4 getColorOSG(agx::Real scalar, bool modifyAlpha=false) const
Get an osg representation of a color value in the map given a scalar inside the interval.
Base class providing referencing counted objects.
Definition Referenced.h:120
A class holding 4 dimensional vectors and providing basic arithmetic.
Templated vector class.
Definition agx/Vector.h:53
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
double Real
Definition Real.h:42