Coin Logo http://www.sim.no/
http://www.coin3d.org/

SoTextureImageElement.h
1 #ifndef COIN_SOTEXTUREIMAGEELEMENT_H
2 #define COIN_SOTEXTUREIMAGEELEMENT_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) by Kongsberg Oil & Gas Technologies.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using Coin with software that can not be combined with the GNU
16  * GPL, and for taking advantage of the additional benefits of our
17  * support services, please contact Kongsberg Oil & Gas Technologies
18  * about acquiring a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 #include <Inventor/elements/SoReplacedElement.h>
28 #include <Inventor/SbVec2s.h>
29 #include <Inventor/SbVec3s.h>
30 #include <Inventor/SbColor.h>
31 
32 class SoState;
33 
34 class COIN_DLL_API SoTextureImageElement : public SoReplacedElement {
36 
37  SO_ELEMENT_HEADER(SoTextureImageElement);
38 public:
39  static void initClass(void);
40 protected:
41  virtual ~SoTextureImageElement();
42 
43 public:
44  enum Model {
45  // These should match GL_BLEND, GL_MODULATE and GL_DECAL for SGI
46  // Inventor compatibility (these are also used by SoTexture2 and
47  // SoTexture3).
48  BLEND = 0x0be2,
49  MODULATE = 0x2100,
50  DECAL = 0x2101,
51  REPLACE = 0x1E01 // must match GL_REPLACE
52  };
53 
54  enum Wrap {
55  // These should match GL_CLAMP and GL_REPEAT for SGI Inventor
56  // compatibility (these are also used by SoTexture2 and
57  // SoTexture3).
58  CLAMP = 0x2900,
59  REPEAT = 0x2901,
60  CLAMP_TO_BORDER = 0x812D
61  };
62 
63  virtual void init(SoState * state);
64 
65  static void setDefault(SoState * const state, SoNode * const node);
66 
67  static void set(SoState * const state, SoNode * const node,
68  const SbVec2s & size, const int numComponents,
69  const unsigned char * bytes,
70  const int wrapS, const int wrapT,
71  const int model, const SbColor & blendColor);
72  static void set(SoState * const state, SoNode * const node,
73  const SbVec3s & size, const int numComponents,
74  const unsigned char * bytes,
75  const int wrapS, const int wrapT, const int wrapR,
76  const int model, const SbColor & blendColor);
77 
78  static void set(SoState * const state, SoNode * const node,
79  const SbVec2s & size, const int numComponents,
80  const unsigned char * bytes,
81  const Wrap wrapS, const Wrap wrapT,
82  const Model model, const SbColor & blendColor);
83  static void set(SoState * const state, SoNode * const node,
84  const SbVec3s & size, const int numComponents,
85  const unsigned char * bytes,
86  const Wrap wrapS, const Wrap wrapT, const Wrap wrapR,
87  const Model model, const SbColor & blendColor);
88 
89  static const unsigned char *get(SoState * const state,
90  SbVec2s & size,
91  int & numComponents,
92  Wrap & wrapS,
93  Wrap & wrapT,
94  Model & model,
95  SbColor & blendColor);
96  static const unsigned char *get(SoState * const state,
97  SbVec3s & size,
98  int & numComponents,
99  Wrap & wrapS,
100  Wrap & wrapT,
101  Wrap & wrapR,
102  Model & model,
103  SbColor & blendColor);
104 
105  static const unsigned char *get(SoState * const state,
106  SbVec2s & size,
107  int & numComponents,
108  int & wrapS,
109  int & wrapT,
110  int & model,
111  SbColor & blendColor);
112  static const unsigned char *get(SoState * const state,
113  SbVec3s & size,
114  int & numComponents,
115  int & wrapS,
116  int & wrapT,
117  int & wrapR,
118  int & model,
119  SbColor & blendColor);
120 
121  static const SbColor &getBlendColor(SoState * const state);
122  static const unsigned char *getImage(SoState * const state,
123  SbVec2s &size,
124  int &numComponents);
125  static const unsigned char *getImage(SoState * const state,
126  SbVec3s &size,
127  int &numComponents);
128  static Model getModel(SoState * const state);
129  static Wrap getWrapS(SoState * const state);
130  static Wrap getWrapT(SoState * const state);
131  static Wrap getWrapR(SoState * const state);
132 
133  static SbBool containsTransparency(SoState * const state);
134 
135  static const unsigned char *getDefault(SbVec2s & size, int & numComponents);
136  static const unsigned char *getDefault(SbVec3s & size, int & numComponents);
137 
138 protected:
139  virtual void setElt(const SbVec2s & size, const int numComponents,
140  const unsigned char * bytes,
141  const Wrap wrapS, const Wrap wrapT,
142  const Model model, const SbColor & blendColor);
143  virtual void setElt(const SbVec3s & size, const int numComponents,
144  const unsigned char * bytes,
145  const Wrap wrapS, const Wrap wrapT, const Wrap wrapR,
146  const Model model, const SbColor & blendColor);
147 
148  virtual SbBool hasTransparency(void) const;
149 
152  const unsigned char *bytes;
153  Wrap wrapS, wrapT, wrapR;
156 
157 private:
158  void setDefaultValues(void);
159 
160 };
161 
162 #endif // !COIN_SOTEXTUREIMAGEELEMENT_H
SbVec3s size
Definition: SoTextureImageElement.h:150
The SbColor class contains the red, green and blue components which make up a color value...
Definition: SbColor.h:30
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:47
SoElement is the abstract base class for all elements.
Definition: SoElement.h:34
Model model
Definition: SoTextureImageElement.h:154
The SoState class manages the Coin scenegraph traversal state data.The SoState class is used by actio...
Definition: SoState.h:35
virtual void init(SoState *state)
Definition: SoReplacedElement.cpp:79
Wrap
Definition: SoTextureImageElement.h:54
The SbVec3s class is a 3 dimensional vector with short integer coordinates.This vector class provides...
Definition: SbVec3s.h:39
const unsigned char * bytes
Definition: SoTextureImageElement.h:152
The SoReplacedElement class is an abstract element superclass.This is the superclass of all elements ...
Definition: SoReplacedElement.h:30
Wrap wrapT
Definition: SoTextureImageElement.h:153
The SoTextureImageElement class is yet to be documented.FIXME: write doc.
Definition: SoTextureImageElement.h:34
Model
Definition: SoTextureImageElement.h:44
int numComponents
Definition: SoTextureImageElement.h:151
SbColor blendColor
Definition: SoTextureImageElement.h:155
The SbVec2s class is a 2 dimensional vector with short integer coordinates.This vector class is used ...
Definition: SbVec2s.h:41

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Fri Sep 9 2016 for Coin by Doxygen 1.8.5.