MeVisLab Resolution Independence API
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"
21#include <Inventor/elements/SoMLImageElement.h>
22#include <SoSFMLImage.h>
23
24
27{
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
63 SbMLImageProperties _imgProps;
64
67
69 ~SoMLSampler() override;
70
72 GLenum MLToGLDataType(const MLDataType &dType);
73
76 MLuint8 *loadAndReformatSubImg(const XVImageSize &pos, const XVImageSize &size);
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_
#define INVENTOR_SHADER_API
Define class export specifier.
TextureType
Texture type.
The abstract Inventor class SoImageSampler.
Abstract base class for sampler nodes that handle ML images.
Definition SoMLSampler.h:27
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.
MLuint8 * loadAndReformatSubImg(const XVImageSize &pos, const XVImageSize &size)
Load ML image and reformat memory to be suitable for OpenGL texturing.
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
Base class for uniform shader parameters.
SoSFMLImage - field interface to ML images and related classes.
Definition SoSFMLImage.h:32