MeVisLab Toolbox Reference
SoMFShaderObject.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_MFSHADER_OBJECT_H
14 #define SO_MFSHADER_OBJECT_H
15 
16 
18 
19 #include "SoShaderSystem.h"
20 #include <Inventor/fields/SoSubField.h>
21 
22 class SoShaderObject;
23 class SoNode;
24 
26 class INVENTOR_SHADER_API SoMFShaderObject : public SoMField
27 {
28  typedef SoMField inherited;
29 
30  SO_MFIELD_HEADER(SoMFShaderObject, SoShaderObject *, SoShaderObject *);
31 
32  public:
33 
35  void addShader(SoShaderObject *shader);
36 
38  void insertShader(SoShaderObject *shader, int newShaderIndex);
39 
41  SoShaderObject *getShader(int index) const;
42 
44  SoNodeList getShaderList() const;
45 
47  int findShader(const SoShaderObject *shader) const;
48 
50  int getNumShaders() const;
51 
53  void removeShader(int index);
54 
56  void removeShader(SoShaderObject *shader) {
57  removeShader(findShader(shader));
58  }
59 
62 
64  void replaceShader(int index, SoShaderObject *newShader);
65 
67  void replaceShader(SoShaderObject *oldShader, SoShaderObject *newShader) {
68  replaceShader(findShader(oldShader), newShader);
69  }
70 
71  SoINTERNAL public:
72 
74  static void initClass();
75 
77  void fixCopy(SbBool copyConnections) override;
78 
80  SbBool referencesCopy() const override;
81 
82  private:
83 
85  void countWriteRefs(SoOutput *out) const override;
86 
89  void setVal(int index, SoShaderObject *newValue);
90 };
91 
92 #endif // _SO_MF_SHADER_OBJECT_
Open Inventor multiple field managing a list of shader objects.
void addShader(SoShaderObject *shader)
Add vertex or fragment shader.
SoNodeList getShaderList() const
Return list of managed shaders.
void replaceShader(int index, SoShaderObject *newShader)
Replace shader at given index with new one.
static void initClass()
Initialize class with runtime type system.
void replaceShader(SoShaderObject *oldShader, SoShaderObject *newShader)
Replace shader with new one using given pointer.
void removeShader(int index)
Remove shader at given index.
void removeAllShaders()
Remove all shaders from the field.
void removeShader(SoShaderObject *shader)
Remove shader using given pointer.
void insertShader(SoShaderObject *shader, int newShaderIndex)
Insert shader at given index.
SoShaderObject * getShader(int index) const
Get shader at given index.
int getNumShaders() const
Return number of shaders managed by the field.
int findShader(const SoShaderObject *shader) const
Find shader using given pointer.
void fixCopy(SbBool copyConnections) override
Update a copied field to use the copy of each node if there is one.
SbBool referencesCopy() const override
Override this to also check the stored nodes.
Abstract Open Inventor node for vertex or fragment shader nodes.