MeVisLab Toolbox Reference
SoMLSampler.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef SO_MLSAMPLER_H
14 #define SO_MLSAMPLER_H
15 
16 
18 
19 #include "SoShaderSystem.h"
22 #include <SoSFMLImage.h>
23 
24 
26 SoEXTENDER class INVENTOR_SHADER_API SoMLSampler : public SoImageSampler
27 {
28  typedef SoImageSampler inherited;
29 
30  SO_NODE_ABSTRACT_HEADER(SoMLSampler);
31 
32  public:
33 
36 
38  SoSFUInt32 startT;
39 
41  SoSFUInt32 startU;
42 
43  SoEXTENDER public:
44 
46  void GLRender(SoGLRenderAction *action) override;
47 
49  void updateParameter(SoUniformParameterBase *uniformBase, SoState *state) override;
50 
51  SoINTERNAL public:
52 
54  static void initClass();
55 
56  protected:
57 
60 
61 
64 
67 
69  ~SoMLSampler() override;
70 
72  GLenum MLToGLDataType(const MLDataType &dType);
73 
77 
79  void texConfigChanged(SoField* field) override;
80 
82  void imageChanged() override;
83  void imageChangedCB(SoField* field);
84 
86  virtual void calcSubImgProps(XVImageSize &subImgPosition, XVImageSize &subImgSize) = 0;
87 
89  virtual void getTextureDataFromImage(const XVImageSize &pos, const XVImageSize &size);
90 
91 };
92 
93 #endif // _SO_ML_SAMPLER_
Inventor element storing ML image properties in the OpenInventor state.
TextureType
Texture type.
The abstract Inventor class SoImageSampler.
Abstract base class for sampler nodes that handle ML images.
Definition: SoMLSampler.h:27
MLuint8 * loadAndReformatSubImg(const XVImageSize &pos, const XVImageSize &size)
Load ML image and reformat memory to be suitable for OpenGL texturing.
void imageChangedCB(SoField *field)
SoSFMLImage image
ML image connector.
Definition: SoMLSampler.h:35
static void initClass()
Initialize class with runtime type system.
SbSamplerInfo::TextureType _internTexFormat
Value points to internal texture format.
Definition: SoMLSampler.h:59
SbMLImageProperties _imgProps
ML image properties.
Definition: SoMLSampler.h:63
virtual void getTextureDataFromImage(const XVImageSize &pos, const XVImageSize &size)
Extract the texture data from the input ML image and store it in the textureData buffer.
void updateParameter(SoUniformParameterBase *uniformBase, SoState *state) override
Assigns or updates the parameter's value.
~SoMLSampler() override
Destructor.
GLenum MLToGLDataType(const MLDataType &dType)
Return OpenGL data type for given ML data type. Returns GL_NONE for unknown ML data types.
void imageChanged() override
Called when the ML images has changed.
virtual void calcSubImgProps(XVImageSize &subImgPosition, XVImageSize &subImgSize)=0
Calculate position and size of used sub image by evaluation of fields.
void texConfigChanged(SoField *field) override
Called when texture configuration (e.g. filter mode) has changed.
void GLRender(SoGLRenderAction *action) override
Set ML image properties in state.
SoMLSampler()
Constructor.
SoSFUInt32 startU
Origin of the image in U dimension. Default is 0.
Definition: SoMLSampler.h:41
SoSFUInt32 startT
Origin of the image in T dimension. Default is 0.
Definition: SoMLSampler.h:38
The SoSFMLImage field is the interface used by Inventor Nodes to access image data (in the current im...
Definition: SoSFMLImage.h:70
Abstract Open Inventor base class for sampler nodes.
Definition: SoSampler.h:30
Base class for uniform shader parameters.
SoSFMLImage - field interface to ML images and related classes.
Definition: SoSFMLImage.h:32
MLint32 MLDataType
MLDataType.
Definition: mlTypeDefs.h:684
unsigned char MLuint8
Definition: mlTypeDefs.h:115