#include <vltxfunction.h>
Public Member Functions | |
| vlTxFunction (vlColor4f const &color=vlColor4f(1.0, 1.0, 1.0, 1.0), std::string const &name="noname") | |
| Default constructor. | |
| virtual | ~vlTxFunction () |
| Default destructor. | |
| bool | addPoint (float const x, float const y) |
| Add a point to the map. | |
| bool | addPoint (vlPoint2f const &point) |
| Add a point to the map. | |
| bool | removePoint (float const x) |
| Remove point nearest to the given point from the map. | |
| std::vector< vlPoint2f > | points () const |
| Returns the points which make up the map. | |
| std::vector< float > | lookUpTable () const |
| Get the look up table. | |
| const std::vector< float > & | lookUpTableRef () const |
| Get a const reference to the look up table. | |
| std::string | name () const |
| Get the name for this transfer function. | |
| void | setAutoUpdate (bool autoUpdate=true) |
| Set auto update - if true, table is automatically updated when points are add/removed. | |
| bool | setTableWidth (uint32 width) |
| Set the new width for the look up table. | |
| void | setActive (bool active=true) |
| Sets the active/inactive state of the map. | |
| void | setEditable (bool editable=true) |
| Sets the editable/non-editable state of the map. | |
| bool | isActive () const |
| Returns true if the map is active. | |
| bool | isEditable () const |
| Returns true if the map is editable. | |
| void | print () |
| prints the map to cout | |
| vlTxFunction & | operator= (vlTxFunction const &other) |
| Overloading operator =. | |
| void | clear () |
| Clears all the transfer function points. | |
Protected Member Functions | |
| bool | initialize () |
| Initializes the class to default values. | |
| bool | updateTable (bool force=false) |
| Creates the LUT from map points stored in m_mapPoints. | |
| void | clearPoints () |
| Clears the map points and re-initializes them. | |
| bool | createRamp (unsigned int startPos, unsigned int endPos, float startVal, float endVal) |
| This creates a ramp from startPos to endPos (range 0-tableWidth) with values from startVal to endVal. | |
| bool | createRamp (float startPos, float endPos, float startVal, float endVal) |
| This creates a ramp from startPos to endPos (range 0.0-1.0) with values from startVal to endVal. | |
| bool | createLevel (unsigned int startPos, unsigned int endPos, float levelVal) |
| This sets values between (and including) startPos and endPos to levelVal. | |
Static Protected Attributes | |
| const uint16 | defaultTableWidth = 256 |
Private Attributes | |
| std::vector< float > | m_lookUpTable |
| The actual Look Up Table. | |
| std::vector< vlPoint2f > | m_mapPoints |
| Stores the map as points - the LUT is created from these points. | |
| bool | m_updateTable |
| This bit is set when points are added/removed and reset when table is updated. | |
| bool | m_autoUpdate |
| If true, any change in points will reflect on the stored map. | |
| bool | m_active |
| When false, the values in the transfer function will be all set to zero. | |
| bool | m_editable |
| If false, points add/remove will not work. | |
| vlColor4f | m_color |
| Color associated with the map. | |
| std::string | m_name |
| A name for the transfer function. | |
To use this transfer function, declare a transfer function with a color and a name. Initially, the transfer function will have just two points (0,0) and (1,1). Now you can add more points using addPoint() and remove points using removePoints(). Internally, only these points are stored. The transfer function also has the ability to give a look up table of floats (like the one OpenGL expects). A call to getTable() will check if points were changed, and if so, it will generate a look up table based on the current set of points. The width of the table can be adjusted using setTableWidth(). The default width of the table is 256. The LUT can also be automatically updated as points are added/removed/changed. This can be done by calling setAutoUpdate(true).
Definition at line 56 of file vltxfunction.h.
|
||||||||||||
|
Definition at line 32 of file vltxfunction.cpp. References initialize(), and name. |
|
|
Definition at line 45 of file vltxfunction.cpp. |
|
|
Definition at line 70 of file vltxfunction.h. References addPoint(), vlCouple< T >::x(), and vlCouple< T >::y(). |
|
||||||||||||
|
Points have to be in the range (0.0-1.0, 0.0-1.0). The first coordinate is the position and the second is the value.
Definition at line 215 of file vltxfunction.cpp. References m_active, m_autoUpdate, m_editable, m_lookUpTable, m_mapPoints, m_updateTable, updateTable(), vlPoint2f, x, and y. Referenced by addPoint(). |
|
|
There will be only two map points 0.0 and 1.0 Definition at line 450 of file vltxfunction.cpp. References clearPoints(), and m_editable. |
|
|
There will be only two map points 0.0 and 1.0 Definition at line 461 of file vltxfunction.cpp. References m_autoUpdate, m_editable, m_mapPoints, m_updateTable, updateTable(), and vlPoint2f. Referenced by clear(). |
|
||||||||||||||||
|
This is done in m_lookUpTable irrespective of the map being active or not. The same effect (of levelling) can be done using CreateRamp(). This is a little bit faster than CreateRamp() function to make a level.
Definition at line 614 of file vltxfunction.cpp. References m_lookUpTable. |
|
||||||||||||||||||||
|
This ramp is created in m_lookUpTable irrespective of the map being active or not.
Definition at line 543 of file vltxfunction.cpp. References m_lookUpTable. |
|
||||||||||||||||||||
|
This ramp is created in m_lookUpTable irrespective of the map being active or not.
Definition at line 489 of file vltxfunction.cpp. References m_lookUpTable. Referenced by updateTable(). |
|
|
Definition at line 120 of file vltxfunction.cpp. References defaultTableWidth, m_lookUpTable, m_mapPoints, setActive(), setAutoUpdate(), setEditable(), updateTable(), and vlPoint2f. Referenced by vlTxFunction(). |
|
|
Definition at line 83 of file vltxfunction.cpp. References m_active. |
|
|
Definition at line 89 of file vltxfunction.cpp. References m_editable. |
|
|
Definition at line 59 of file vltxfunction.cpp. References m_lookUpTable. |
|
|
Definition at line 64 of file vltxfunction.cpp. References m_lookUpTable. |
|
|
Definition at line 70 of file vltxfunction.cpp. References m_name. |
|
|
Definition at line 100 of file vltxfunction.cpp. References m_active, m_autoUpdate, m_color, m_editable, m_lookUpTable, and m_mapPoints. |
|
|
Definition at line 52 of file vltxfunction.cpp. References m_mapPoints. |
|
|
Definition at line 652 of file vltxfunction.cpp. References m_lookUpTable. |
|
|
Definition at line 299 of file vltxfunction.cpp. References m_active, m_autoUpdate, m_editable, m_lookUpTable, m_mapPoints, m_updateTable, updateTable(), and x. |
|
|
i.e. this map will be used for any rendering calls henceforth.
Definition at line 155 of file vltxfunction.cpp. References m_active. Referenced by initialize(). |
|
|
Definition at line 76 of file vltxfunction.cpp. References m_autoUpdate. Referenced by initialize(). |
|
|
the following edit operations will affect the map.
Definition at line 200 of file vltxfunction.cpp. References m_editable. Referenced by initialize(). |
|
|
Definition at line 176 of file vltxfunction.cpp. References m_lookUpTable, m_updateTable, and updateTable(). |
|
|
Definition at line 397 of file vltxfunction.cpp. References createRamp(), m_mapPoints, m_updateTable, vlCouple< T >::x(), and vlCouple< T >::y(). Referenced by addPoint(), clearPoints(), initialize(), removePoint(), and setTableWidth(). |
|
|
Definition at line 142 of file vltxfunction.h. Referenced by initialize(). |
|
|
Definition at line 159 of file vltxfunction.h. Referenced by addPoint(), isActive(), operator=(), removePoint(), and setActive(). |
|
|
Definition at line 156 of file vltxfunction.h. Referenced by addPoint(), clearPoints(), operator=(), removePoint(), and setAutoUpdate(). |
|
|
Definition at line 165 of file vltxfunction.h. Referenced by operator=(). |
|
|
Definition at line 162 of file vltxfunction.h. Referenced by addPoint(), clear(), clearPoints(), isEditable(), operator=(), removePoint(), and setEditable(). |
|
|
Definition at line 147 of file vltxfunction.h. Referenced by addPoint(), createLevel(), createRamp(), initialize(), lookUpTable(), lookUpTableRef(), operator=(), print(), removePoint(), and setTableWidth(). |
|
|
Definition at line 150 of file vltxfunction.h. Referenced by addPoint(), clearPoints(), initialize(), operator=(), points(), removePoint(), and updateTable(). |
|
|
Definition at line 168 of file vltxfunction.h. Referenced by name(). |
|
|
Definition at line 153 of file vltxfunction.h. Referenced by addPoint(), clearPoints(), removePoint(), setTableWidth(), and updateTable(). |
1.3.3