OpenWalnut  1.5.0dev
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
WDataTexture3D Class Reference

This class allows simple creation of WGETexture3D by using a specified grid and value-set. More...

#include <WDataTexture3D.h>

+ Inheritance diagram for WDataTexture3D:
+ Collaboration diagram for WDataTexture3D:

Public Member Functions

 WDataTexture3D (std::shared_ptr< WValueSetBase > valueSet, std::shared_ptr< WGridRegular3D > grid)
 Constructor. More...
 
virtual ~WDataTexture3D ()
 Destructor. More...
 
virtual WBoundingBox getBoundingBox () const
 Returns the texture's bounding box. More...
 
- Public Member Functions inherited from WGETexture< TextureType >
 WGETexture (double scale=1.0, double min=0.0)
 Default constructor. More...
 
 WGETexture (WGEImage::SPtr image, double scale=1.0, double min=0.0)
 Creates texture from given image. More...
 
 WGETexture (osg::Image *image, double scale=1.0, double min=0.0)
 Creates texture from given image. More...
 
 WGETexture (const WGETexture< TextureType > &texture, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 Copy the texture. More...
 
virtual ~WGETexture ()
 Destructor. More...
 
WPropString name () const
 Returns the name property of the texture. More...
 
WPropInt sortIndex () const
 The sorting index in the colormapper's texture list. More...
 
WPropDouble minimum () const
 Get the minimum in the de-scaled value space. More...
 
WPropDouble scale () const
 Get the scaling factor for de-scaling the texture. More...
 
WPropDouble alpha () const
 Returns the alpha property. More...
 
WPropBool clipZero () const
 Clip the values assumed to be zero. More...
 
WPropDouble thresholdLower () const
 Returns the threshold property. More...
 
WPropDouble thresholdUpper () const
 Returns the threshold property. More...
 
WPropBool thresholdEnabled () const
 Returns the property responsible for enabling threshold based clipping. More...
 
WPropBool interpolation () const
 Returns the interpolation property. More...
 
WPropSelection colormap () const
 Returns the colormap property. More...
 
WPropBool active () const
 Returns the active property. More...
 
WPropInterval window () const
 Returns the window level definition for the colormap. More...
 
WPropBool windowEnabled () const
 Returns the property responsible for enabling window based interval scaling. More...
 
WPropMatrix4X4 transformation () const
 Returns the texture transformation matrix. More...
 
void bind (osg::ref_ptr< osg::Node > node, size_t unit=0)
 Binds the texture to the specified node and texture unit. More...
 
std::shared_ptr< WPropertiesgetProperties () const
 Return a pointer to the properties object of the dataset. More...
 
std::shared_ptr< WPropertiesgetInformationProperties () const
 Return a pointer to the information properties object of the dataset. More...
 
virtual void applyUniforms (std::string prefix, osg::StateSet *states) const
 Applies some custom uniforms to the specified state-set which directly relate to this texture. More...
 
void setFilterMinMag (osg::Texture::FilterMode mode)
 For all the lazy guys to set the filter MIN and MAG at once. More...
 
void setWrapSTR (osg::Texture::WrapMode mode)
 For all the lazy guys to set the wrapping for s,t and r directions at once. More...
 
virtual void copyPropertiesExceptTransformation (osg::ref_ptr< WGETexture< TextureType > > const &from)
 Copy the values of all properties except the texture transformation into the properties of this texture. More...
 

Protected Member Functions

virtual void create ()
 Creates the texture data. More...
 
- Protected Member Functions inherited from WGETexture< TextureType >
virtual void handleUpdate ()
 Handles all property updates. More...
 
virtual void updateCallback (osg::StateAttribute *state)
 This method implements an update callback which updates the texture image if needed and several other properties like texture matrix. More...
 

Private Member Functions

template<typename T >
osg::ref_ptr< osg::Image > createTexture (T *source, int components=1)
 Creates a properly sized osg::Image from the specified source data. More...
 

Private Attributes

std::shared_ptr< WValueSetBasem_valueSet
 The value set from which the texture gets created. More...
 
WBoundingBox m_boundingBox
 The bounding box of the underlying grid. More...
 
std::shared_mutex m_creationLock
 The lock for securing createTexture. More...
 

Additional Inherited Members

- Public Types inherited from WGETexture< TextureType >
typedef osg::ref_ptr< WGETexture< TextureType > > RPtr
 Convenience type for OSG reference pointer on WGETextures. More...
 
typedef osg::ref_ptr< WGETexture< TextureType > > SPtr
 Convenience type for OSG reference pointer on WGETextures. More...
 
- Static Public Member Functions inherited from WGETexture< TextureType >
static WPVBaseTypes::PV_INT getUnsetSortIndex ()
 Get the index used to refer to an unset sort index. More...
 
- Static Public Attributes inherited from WGETexture< TextureType >
static std::size_t const MAX_NUMBER_OF_TEXTURES = 8
 We support only 8 textures because some known hardware does not support more texture coordinates. More...
 
static std::size_t const MAX_TEXTURE_DIMENSION = 2048
 The maximum texture dimension. More...
 
- Static Protected Member Functions inherited from WGETexture< TextureType >
static void initTextureSize (osg::Texture1D *texture, int width, int height, int depth)
 Initialize the size of the texture properly according to real texture type (1D,2D,3D). More...
 
static void initTextureSize (osg::Texture2D *texture, int width, int height, int depth)
 Initialize the size of the texture properly according to real texture type (1D,2D,3D). More...
 
static void initTextureSize (osg::Texture3D *texture, int width, int height, int depth)
 Initialize the size of the texture properly according to real texture type (1D,2D,3D). More...
 

Detailed Description

This class allows simple creation of WGETexture3D by using a specified grid and value-set.

One advantage: the first call to the texture's update callback ensures texture creation. It is not created earlier.

Definition at line 96 of file WDataTexture3D.h.

Constructor & Destructor Documentation

◆ WDataTexture3D()

WDataTexture3D::WDataTexture3D ( std::shared_ptr< WValueSetBase valueSet,
std::shared_ptr< WGridRegular3D grid 
)

Constructor.

Creates the texture. Just run it after graphics engine was initialized.

Parameters
valueSetthe value set to use
gridthe grid to use

Definition at line 32 of file WDataTexture3D.cpp.

References WMatrixFixed< double, 4, 4 >::identity(), WGETexture< TextureType >::initTextureSize(), WGETexture< TextureType >::scale(), WGETexture< TextureType >::thresholdLower(), WGETexture< TextureType >::thresholdUpper(), WGETexture< TextureType >::transformation(), WGETexture< TextureType >::window(), and WMatrixFixed< double, 4, 4 >::zero().

+ Here is the call graph for this function:

◆ ~WDataTexture3D()

WDataTexture3D::~WDataTexture3D ( )
virtual

Destructor.

Definition at line 78 of file WDataTexture3D.cpp.

Member Function Documentation

◆ create()

void WDataTexture3D::create ( )
protectedvirtual

Creates the texture data.

This method creates the texture during the first update traversal using the value set and grid.

Reimplemented from WGETexture< TextureType >.

Definition at line 83 of file WDataTexture3D.cpp.

References m_valueSet.

◆ createTexture()

template<typename T >
osg::ref_ptr< osg::Image > WDataTexture3D::createTexture ( T *  source,
int  components = 1 
)
private

Creates a properly sized osg::Image from the specified source data.

Parameters
sourcethe source data
componentsnumber of components
Template Parameters
Tthe type of source data
Returns

Definition at line 180 of file WDataTexture3D.h.

References wlog::debug(), wlog::error(), m_creationLock, WGETexture< TextureType >::minimum(), WGETexture< TextureType >::scale(), and WDataTexture3DScalers::scaleInterval().

+ Here is the call graph for this function:

◆ getBoundingBox()

WBoundingBox WDataTexture3D::getBoundingBox ( ) const
virtual

Returns the texture's bounding box.

This is const. Although there exists the transformation() property, it is an information property and can't be changed. This represents the underlying grid.

Returns
the bounding box.

Reimplemented from WGETexture< TextureType >.

Definition at line 177 of file WDataTexture3D.cpp.

References m_boundingBox.

Member Data Documentation

◆ m_boundingBox

WBoundingBox WDataTexture3D::m_boundingBox
private

The bounding box of the underlying grid.

Definition at line 135 of file WDataTexture3D.h.

Referenced by getBoundingBox().

◆ m_creationLock

std::shared_mutex WDataTexture3D::m_creationLock
private

The lock for securing createTexture.

Definition at line 140 of file WDataTexture3D.h.

Referenced by createTexture().

◆ m_valueSet

std::shared_ptr< WValueSetBase > WDataTexture3D::m_valueSet
private

The value set from which the texture gets created.

Definition at line 130 of file WDataTexture3D.h.

Referenced by create().


The documentation for this class was generated from the following files: