Inviwo 0.9.12-pre
Inviwo documentation
|
data structure managing multiple TFPrimitives More...
#include <tfprimitiveset.h>
Public Types | |
using | transform_t = TFPrimitive& (*)(TFPrimitive*) |
using | const_transform_t = const TFPrimitive& (*)(const TFPrimitive*) |
using | iterator |
using | const_iterator |
Public Member Functions | |
TFPrimitiveSet (const std::vector< TFPrimitiveData > &values={}, TFPrimitiveSetType type=TFPrimitiveSetType::Relative) | |
TFPrimitiveSet (const TFPrimitiveSet &rhs) | |
TFPrimitiveSet (TFPrimitiveSet &&rhs) noexcept=default | |
TFPrimitiveSet & | operator= (const TFPrimitiveSet &rhs) |
TFPrimitiveSet & | operator= (TFPrimitiveSet &&rhs) noexcept |
void | setType (TFPrimitiveSetType type) |
TFPrimitiveSetType | getType () const |
dvec2 | getRange () const |
size_t | size () const |
bool | empty () const |
TFPrimitive & | operator[] (size_t i) |
const TFPrimitive & | operator[] (size_t i) const |
TFPrimitive & | get (size_t i) |
const TFPrimitive & | get (size_t i) const |
TFPrimitive & | front () |
const TFPrimitive & | front () const |
TFPrimitive & | back () |
const TFPrimitive & | back () const |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
std::vector< TFPrimitiveData > | get () const |
std::vector< TFPrimitiveData > | getUnsorted () const |
void | set (const_iterator begin, const_iterator end) |
std::pair< std::vector< double >, std::vector< vec4 > > | getVectors () const |
std::pair< std::vector< float >, std::vector< vec4 > > | getVectorsf () const |
std::vector< double > | getPositions () const |
std::vector< float > | getPositionsf () const |
std::vector< vec4 > | getColors () const |
TFPrimitive & | add (const TFPrimitive &primitive) |
TFPrimitive & | add (double pos, const vec4 &color) |
TFPrimitive & | add (double pos, double alpha) |
TFPrimitive & | add (const dvec2 &pos) |
TFPrimitive & | add (const TFPrimitiveData &data) |
void | add (const std::vector< TFPrimitiveData > &primitives) |
bool | remove (const TFPrimitive &primitive) |
void | clear () |
void | setPosition (std::span< TFPrimitive * > primitives, double pos) |
virtual void | onTFPrimitiveChange (const TFPrimitive &p) override |
virtual void | serialize (Serializer &s) const override |
virtual void | deserialize (Deserializer &d) override |
virtual void | interpolateAndStoreColors (std::span< vec4 > data) const |
bool | contains (const TFPrimitive *primitive) const |
Public Member Functions inherited from inviwo::Serializable | |
Public Member Functions inherited from inviwo::Observable< TFPrimitiveSetObserver > | |
Observable (const Observable< TFPrimitiveSetObserver > &other) | |
Observable (Observable< TFPrimitiveSetObserver > &&other) noexcept | |
Observable< TFPrimitiveSetObserver > & | operator= (const Observable< TFPrimitiveSetObserver > &other) |
Observable< TFPrimitiveSetObserver > & | operator= (Observable< TFPrimitiveSetObserver > &&other) noexcept |
void | addObserver (TFPrimitiveSetObserver *observer) |
void | removeObserver (TFPrimitiveSetObserver *observer) |
virtual void | startBlockingNotifications () override final |
virtual void | stopBlockingNotifications () override final |
Public Member Functions inherited from inviwo::ObservableInterface | |
Public Member Functions inherited from inviwo::TFPrimitiveObserver | |
Public Member Functions inherited from inviwo::Observer | |
Observer (const Observer &other) | |
Observer (Observer &&other) | |
Observer & | operator= (Observer &&other) |
Observer & | operator= (const Observer &other) |
virtual | ~Observer () |
void | removeObservation (ObservableInterface *observable) |
void | removeObservations () |
Protected Member Functions | |
TFPrimitive & | add (std::unique_ptr< TFPrimitive > primitive) |
bool | remove (std::vector< std::unique_ptr< TFPrimitive > >::iterator it) |
void | sort () |
vec4 | interpolateColor (double t) const |
virtual std::string_view | serializationKey () const |
virtual std::string_view | serializationItemKey () const |
Protected Member Functions inherited from inviwo::TFPrimitiveSetObservable | |
void | notifyTFPrimitiveAdded (const TFPrimitiveSet &set, TFPrimitive &p) |
void | notifyTFPrimitiveRemoved (const TFPrimitiveSet &set, TFPrimitive &p) |
void | notifyTFPrimitiveChanged (const TFPrimitiveSet &set, const TFPrimitive &p) |
void | notifyTFTypeChanged (const TFPrimitiveSet &set, TFPrimitiveSetType type) |
void | notifyTFMaskChanged (const TFPrimitiveSet &set, dvec2 mask) |
Protected Member Functions inherited from inviwo::Observable< TFPrimitiveSetObserver > | |
void | forEachObserver (C callback) |
Protected Member Functions inherited from inviwo::ObservableInterface | |
void | addObservationHelper (Observer *observer) |
void | removeObservationHelper (Observer *observer) |
Protected Member Functions inherited from inviwo::Observer | |
void | addObservation (ObservableInterface *observable) |
Protected Attributes | |
std::vector< std::unique_ptr< TFPrimitive > > | values_ |
std::vector< TFPrimitive * > | sorted_ |
Protected Attributes inherited from inviwo::Observer | |
std::unordered_set< ObservableInterface * > | observables_ |
Friends | |
IVW_CORE_API bool | operator== (const TFPrimitiveSet &lhs, const TFPrimitiveSet &rhs) |
IVW_CORE_API bool | operator!= (const TFPrimitiveSet &lhs, const TFPrimitiveSet &rhs) |
data structure managing multiple TFPrimitives
TFPrimitive & inviwo::TFPrimitiveSet::add | ( | const dvec2 & | pos | ) |
Add a TFPrimitive at pos.x where pos.y is used as alpha and the color is interpolated from existing TFPrimitives before and after the given position
pos | pos.x refers to the position of the TFPrimitive, pos.y will be mapped to alpha |
RangeException | if TF type is relative and pos.x is outside [0,1] |
void inviwo::TFPrimitiveSet::add | ( | const std::vector< TFPrimitiveData > & | primitives | ) |
Add multiple TFPrimitives
primitives | vector of primitives to be added |
RangeException | if TF type is relative and any of the given points is outside [0,1] |
TFPrimitive & inviwo::TFPrimitiveSet::add | ( | const TFPrimitive & | primitive | ) |
Add a TFPrimitive
primitive | TFPrimitive to be added |
RangeException | if TF type is relative and the primitive position is outside [0,1] |
TFPrimitive & inviwo::TFPrimitiveSet::add | ( | const TFPrimitiveData & | data | ) |
Add a TFPrimitive
data | Primitive to be added |
RangeException | if TF type is relative and position of point is outside [0,1] |
TFPrimitive & inviwo::TFPrimitiveSet::add | ( | double | pos, |
const vec4 & | color ) |
Add a TFPrimitive
pos | refers to the position of the TFPrimitive |
color | color of the TFPrimitive including alpha |
RangeException | if TF type is relative and pos is outside [0,1] |
TFPrimitive & inviwo::TFPrimitiveSet::add | ( | double | pos, |
double | alpha ) |
Add a TFPrimitive at pos with alpha. The color is interpolated from existing TFPrimitives before and after the given position
pos | position of the TFPrimitive, |
alpha | alpha value of the TFPrimitive |
RangeException | if TF type is relative and pos is outside [0,1] |
|
overridevirtual |
Implements inviwo::Serializable.
std::vector< vec4 > inviwo::TFPrimitiveSet::getColors | ( | ) | const |
Access TFPrimitives colors as a vector which can be used, e.g., for setting uniforms of a shader.
std::vector< double > inviwo::TFPrimitiveSet::getPositions | ( | ) | const |
Access TFPrimitives positions as a vector which can be used, e.g., for setting uniforms of a shader.
std::vector< float > inviwo::TFPrimitiveSet::getPositionsf | ( | ) | const |
Access TFPrimitives positions as a vector which can be used, e.g., for setting uniforms of a shader.
dvec2 inviwo::TFPrimitiveSet::getRange | ( | ) | const |
returns the range of the TF. For a relative TF this will return [0,1]. In case of an absolute TF the range between first and last TF primitive is returned. If there are no primitives in the TF [0,1] will be returned.
std::pair< std::vector< double >, std::vector< vec4 > > inviwo::TFPrimitiveSet::getVectors | ( | ) | const |
Access TFPrimitives as pair of vectors which can be used, e.g., for setting uniforms of a shader.
std::pair< std::vector< float >, std::vector< vec4 > > inviwo::TFPrimitiveSet::getVectorsf | ( | ) | const |
Access TFPrimitives as pair of vectors which can be used, e.g., for setting uniforms of a shader.
|
virtual |
Interpolate the color between all neighboring pairs of TFPrimitives and write the result to dataArray. The range of all TFPrimitives is [0,1] when TF type is relative
data | write interpolated colors into data |
Reimplemented in inviwo::TransferFunction.
|
protected |
Interpolate the color between TFPrimitives at position t and return the respective color and opacity (rgba). The range of all TFPrimitives is [0,1] when TF type is relative
t | sampling position, if TF type is relative and t is outside the range [0,1] it is clamped to [0,1] |
|
overridevirtual |
Reimplemented from inviwo::TFPrimitiveObserver.
bool inviwo::TFPrimitiveSet::remove | ( | const TFPrimitive & | primitive | ) |
Removes a primitive from the set
|
overridevirtual |
Implements inviwo::Serializable.
void inviwo::TFPrimitiveSet::set | ( | const_iterator | begin, |
const_iterator | end ) |
Set/update the list of TFPrimitives from given range