MeVisLab Resolution Independence API
SoSamplerInfoElement.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_SAMPLER_INFO_ELEMENT_H
14#define SO_SAMPLER_INFO_ELEMENT_H
15
16
18
19#include "SoShaderSystem.h"
20#include <Inventor/elements/SoAccumulatedElement.h>
21#include <climits>
22#include <list>
23
26{
27 public:
28
34
36 SbString name;
38 SbBool valid;
41
43 valid = FALSE;
44 }
45 SbSamplerInfo(const SbString &aName, TextureType aType) {
46 this->valid = TRUE;
47 this->name = aName;
48 this->type = aType;
49 }
50
51 SbBool isValid() const {
52 return valid;
53 }
54
55 int operator==(const SbSamplerInfo &i) const {
56 return (name == i.name);
57 }
58};
59
61class INVENTOR_SHADER_API SoSamplerInfoElement : public SoAccumulatedElement
62{
63 typedef SoAccumulatedElement inherited;
64
65 SO_ELEMENT_HEADER(SoSamplerInfoElement);
66
67 public:
68
70 void init(SoState *state) override;
71
73 static void add(SoState *state, SoNode *node, const SbSamplerInfo &info);
74
76 static void set(SoState *state, SoNode *node, const SbSamplerInfo &info);
77
79 static void clear(SoState *state, SoNode *node);
80
82 static const SbSamplerInfo &get(SoState *state);
83
85 void push(SoState *state) override;
86
87 SoINTERNAL public:
88
90 static void initClass();
91
92 protected:
93
95 std::list<SbSamplerInfo> _info;
96};
97
98#endif // _SO_SAMPLER_INFO_ELEMENT_
#define INVENTOR_SHADER_API
Define class export specifier.
Open Inventor data type and element to store information about a (list of) SbSampler.
SbBool isValid() const
TextureType
Texture type.
int operator==(const SbSamplerInfo &i) const
TextureType type
Texture type.
SbString name
Sampler name.
SbBool valid
Default is invalid.
SbSamplerInfo(const SbString &aName, TextureType aType)
Element stores information about all current sampler nodes.
static void add(SoState *state, SoNode *node, const SbSamplerInfo &info)
Add info about sampler to list.
static void clear(SoState *state, SoNode *node)
Clear list.
void push(SoState *state) override
Override push() method.
static void set(SoState *state, SoNode *node, const SbSamplerInfo &info)
Truncate info list to zero length and set only this info.
static const SbSamplerInfo & get(SoState *state)
Returns last sampler info.
std::list< SbSamplerInfo > _info
sampler info.
static void initClass()
Initialize class with runtime type system.
void init(SoState *state) override
Initialize element.