Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
SoGLMultiTextureImageElement.h
1 #ifndef COIN_SOGLMULTITEXTUREIMAGEELEMENT_H
2 #define COIN_SOGLMULTITEXTUREIMAGEELEMENT_H
3 
4 /**************************************************************************\
5  * Copyright (c) Kongsberg Oil & Gas Technologies AS
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from
21  * this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 \**************************************************************************/
35 
36 #include <Inventor/elements/SoMultiTextureImageElement.h>
37 #include <cstdlib>
38 
39 class SoGLImage;
40 class SoGLDisplayList;
41 class SoGLMultiTextureImageElementP;
42 
45 
46  SO_ELEMENT_HEADER(SoGLMultiTextureImageElement);
47 public:
48  static void initClass(void);
49 protected:
51 
52 public:
53  virtual void init(SoState * state);
54  virtual void push(SoState * state);
55  virtual void pop(SoState * state,
56  const SoElement * prevTopElement);
57 
58  static void set(SoState * const state, SoNode * const node,
59  const int unit,
60  SoGLImage * image, const Model model,
61  const SbColor & blendColor);
62 
63  static void restore(SoState * state, const int unit);
64 
65  static SoGLImage * get(SoState * state,
66  const int unit,
67  Model & model,
68  SbColor & blendcolor);
69 
70  class GLUnitData {
71  public:
72  GLUnitData() : glimage(NULL) {}
73  GLUnitData(const GLUnitData & org) : glimage(org.glimage) {}
74  SoGLImage * glimage;
75  };
76 
77  static SbBool hasTransparency(SoState * state);
78 
79  protected:
80  virtual SbBool hasTransparency(const int unit = 0) const;
81 
82 private:
83  void updateGL(const int unit);
84  SoGLMultiTextureImageElementP * pimpl;
85 
86  public: // Coin-3 support
87 
88  static void set(SoState * const state, SoNode * const node,
89  SoGLImage * image, const Model model,
90  const SbColor & blendColor) {
91  set(state, node, 0, image, model, blendColor);
92  }
93 
94  static SoGLImage * get(SoState * state, Model & model,
95  SbColor & blendcolor) {
96  return get(state, 0, model, blendcolor);
97  }
98  static int32_t getMaxGLTextureSize(void);
99 };
100 
101 #endif // !COIN_SOGLMULTITEXTUREIMAGEELEMENT_H
The SbColor class contains the red, green and blue components which make up a color value...
Definition: SbColor.h:39
virtual SbBool hasTransparency(const int unit=0) const
Definition: SoMultiTextureImageElement.cpp:291
The SoNode class is the base class for nodes used in scene graphs.
Definition: SoNode.h:56
SoElement is the abstract base class for all elements.
Definition: SoElement.h:43
The SoState class manages the Coin scenegraph traversal state data.
Definition: SoState.h:44
The SoMultiTextureImageElement class is yet to be documented.
Definition: SoMultiTextureImageElement.h:44
Definition: SoGLMultiTextureImageElement.h:70
virtual void init(SoState *state)
FIXME: write doc.
Definition: SoMultiTextureImageElement.cpp:102
The SoGLMultiTextureImageElement is used to control the current GL texture for texture units...
Definition: SoGLMultiTextureImageElement.h:43
The SoGLDisplayList class stores and manages OpenGL display lists.
Definition: SoGLDisplayList.h:43
The SoGLImage class is used to handle OpenGL 2D/3D textures.
Definition: SoGLImage.h:53
virtual void push(SoState *state)
Definition: SoMultiTextureImageElement.cpp:339
static void initClass(void)
Definition: SoMultiTextureImageElement.cpp:85
virtual void pop(SoState *state, const SoElement *prevTopElement)
Definition: SoElement.cpp:584