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

SoTextureImageElement.h

00001 #ifndef COIN_SOTEXTUREIMAGEELEMENT_H
00002 #define COIN_SOTEXTUREIMAGEELEMENT_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) by Kongsberg Oil & Gas Technologies.
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public License
00011  *  ("GPL") version 2 as published by the Free Software Foundation.
00012  *  See the file LICENSE.GPL at the root directory of this source
00013  *  distribution for additional information about the GNU GPL.
00014  *
00015  *  For using Coin with software that can not be combined with the GNU
00016  *  GPL, and for taking advantage of the additional benefits of our
00017  *  support services, please contact Kongsberg Oil & Gas Technologies
00018  *  about acquiring a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <Inventor/elements/SoReplacedElement.h>
00028 #include <Inventor/SbVec2s.h>
00029 #include <Inventor/SbVec3s.h>
00030 #include <Inventor/SbColor.h>
00031 
00032 class SoState;
00033 
00034 class COIN_DLL_API SoTextureImageElement : public SoReplacedElement {
00035   typedef SoReplacedElement inherited;
00036 
00037   SO_ELEMENT_HEADER(SoTextureImageElement);
00038 public:
00039   static void initClass(void);
00040 protected:
00041   virtual ~SoTextureImageElement();
00042 
00043 public:
00044   enum Model {
00045     // These should match GL_BLEND, GL_MODULATE and GL_DECAL for SGI
00046     // Inventor compatibility (these are also used by SoTexture2 and
00047     // SoTexture3).
00048     BLEND = 0x0be2,
00049     MODULATE = 0x2100,
00050     DECAL = 0x2101,
00051     REPLACE = 0x1E01 // must match GL_REPLACE
00052   };
00053 
00054   enum Wrap {
00055     // These should match GL_CLAMP and GL_REPEAT for SGI Inventor
00056     // compatibility (these are also used by SoTexture2 and
00057     // SoTexture3).
00058     CLAMP = 0x2900,
00059     REPEAT = 0x2901,
00060     CLAMP_TO_BORDER = 0x812D
00061   };
00062 
00063   virtual void init(SoState * state);
00064 
00065   static void setDefault(SoState * const state, SoNode * const node);
00066 
00067   static void set(SoState * const state, SoNode * const node,
00068                   const SbVec2s & size, const int numComponents,
00069                   const unsigned char * bytes,
00070                   const int wrapS, const int wrapT,
00071                   const int model, const SbColor & blendColor);
00072   static void set(SoState * const state, SoNode * const node,
00073                   const SbVec3s & size, const int numComponents,
00074                   const unsigned char * bytes,
00075                   const int wrapS, const int wrapT, const int wrapR,
00076                   const int model, const SbColor & blendColor);
00077 
00078   static void set(SoState * const state, SoNode * const node,
00079                   const SbVec2s & size, const int numComponents,
00080                   const unsigned char * bytes,
00081                   const Wrap wrapS, const Wrap wrapT,
00082                   const Model model, const SbColor & blendColor);
00083   static void set(SoState * const state, SoNode * const node,
00084                   const SbVec3s & size, const int numComponents,
00085                   const unsigned char * bytes,
00086                   const Wrap wrapS, const Wrap wrapT, const Wrap wrapR,
00087                   const Model model, const SbColor & blendColor);
00088 
00089   static const unsigned char *get(SoState * const state,
00090                                   SbVec2s & size,
00091                                   int & numComponents,
00092                                   Wrap & wrapS,
00093                                   Wrap & wrapT,
00094                                   Model & model,
00095                                   SbColor & blendColor);
00096   static const unsigned char *get(SoState * const state,
00097                                   SbVec3s & size,
00098                                   int & numComponents,
00099                                   Wrap & wrapS,
00100                                   Wrap & wrapT,
00101                                   Wrap & wrapR,
00102                                   Model & model,
00103                                   SbColor & blendColor);
00104 
00105   static const unsigned char *get(SoState * const state,
00106                                   SbVec2s & size,
00107                                   int & numComponents,
00108                                   int & wrapS,
00109                                   int & wrapT,
00110                                   int & model,
00111                                   SbColor & blendColor);
00112   static const unsigned char *get(SoState * const state,
00113                                   SbVec3s & size,
00114                                   int & numComponents,
00115                                   int & wrapS,
00116                                   int & wrapT,
00117                                   int & wrapR,
00118                                   int & model,
00119                                   SbColor & blendColor);
00120 
00121   static const SbColor &getBlendColor(SoState * const state);
00122   static const unsigned char *getImage(SoState * const state,
00123                                        SbVec2s &size,
00124                                        int &numComponents);
00125   static const unsigned char *getImage(SoState * const state,
00126                                        SbVec3s &size,
00127                                        int &numComponents);
00128   static Model getModel(SoState * const state);
00129   static Wrap getWrapS(SoState * const state);
00130   static Wrap getWrapT(SoState * const state);
00131   static Wrap getWrapR(SoState * const state);
00132 
00133   static SbBool containsTransparency(SoState * const state);
00134 
00135   static const unsigned char *getDefault(SbVec2s & size, int & numComponents);
00136   static const unsigned char *getDefault(SbVec3s & size, int & numComponents);
00137 
00138 protected:
00139   virtual void setElt(const SbVec2s & size, const int numComponents,
00140                       const unsigned char * bytes,
00141                       const Wrap wrapS, const Wrap wrapT,
00142                       const Model model, const SbColor & blendColor);
00143   virtual void setElt(const SbVec3s & size, const int numComponents,
00144                       const unsigned char * bytes,
00145                       const Wrap wrapS, const Wrap wrapT, const Wrap wrapR,
00146                       const Model model, const SbColor & blendColor);
00147 
00148   virtual SbBool hasTransparency(void) const;
00149 
00150   SbVec3s size;
00151   int numComponents;
00152   const unsigned char *bytes;
00153   Wrap wrapS, wrapT, wrapR;
00154   Model model;
00155   SbColor blendColor;
00156 
00157 private:
00158   void setDefaultValues(void);
00159 
00160 };
00161 
00162 #endif // !COIN_SOTEXTUREIMAGEELEMENT_H

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

Generated on Sun May 1 2011 02:58:22 for Coin by Doxygen 1.7.3.