Coin: SoGLMultiTextureImageElement.h Source File

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/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
39class SoGLImage;
40class SoGLDisplayList;
41class SoGLMultiTextureImageElementP;
42
43 class COIN_DLL_API SoGLMultiTextureImageElement : public SoMultiTextureImageElement {
44 typedef SoMultiTextureImageElement inherited;
45
46 SO_ELEMENT_HEADER(SoGLMultiTextureImageElement);
47public:
48 static void initClass(void);
49protected:
50 virtual ~SoGLMultiTextureImageElement();
51
52public:
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
82private:
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
SbColor
The SbColor class contains the red, green and blue components which make up a color value.
Definition SbColor.h:39
SoElement::SoElement
SoElement(void)
Definition SoElement.cpp:534
SoElement::pop
virtual void pop(SoState *state, const SoElement *prevTopElement)
Definition SoElement.cpp:585
SoGLDisplayList
The SoGLDisplayList class stores and manages OpenGL display lists.
Definition SoGLDisplayList.h:43
SoGLImage
The SoGLImage class is used to handle OpenGL 2D/3D textures.
Definition SoGLImage.h:53
SoGLMultiTextureImageElement::SoGLMultiTextureImageElement
SoGLMultiTextureImageElement(void)
Definition SoGLMultiTextureImageElement.cpp:107
SoMultiTextureImageElement::push
virtual void push(SoState *state)
Definition SoMultiTextureImageElement.cpp:340
SoMultiTextureImageElement::init
virtual void init(SoState *state)
Definition SoMultiTextureImageElement.cpp:103
SoMultiTextureImageElement::initClass
static void initClass(void)
Definition SoMultiTextureImageElement.cpp:84
SoMultiTextureImageElement::set
static void set(SoState *const state, SoNode *const node, const int unit, const SbVec2s &size, const int numComponents, const unsigned char *bytes, const Wrap wrapS, const Wrap wrapT, const Model model, const SbColor &blendColor)
FIXME: write doc.
Definition SoMultiTextureImageElement.cpp:123
SoMultiTextureImageElement::hasTransparency
virtual SbBool hasTransparency(const int unit=0) const
Definition SoMultiTextureImageElement.cpp:292
SoMultiTextureImageElement::get
static const unsigned char * get(SoState *const state, const int unit, SbVec2s &size, int &numComponents, Wrap &wrapS, Wrap &wrapT, Model &model, SbColor &blendColor)
FIXME: write doc.
Definition SoMultiTextureImageElement.cpp:168
SoNode
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
SoState
The SoState class manages the Coin scene graph traversal state data.
Definition SoState.h:44