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

SoTextureCombineElement.h
00001 #ifndef COIN_SOTEXTURECOMBINEELEMENT_H
00002 #define COIN_SOTEXTURECOMBINEELEMENT_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/elements/SoTextureImageElement.h>
00029 #include <Inventor/SbVec2s.h>
00030 #include <Inventor/SbVec3s.h>
00031 #include <Inventor/SbColor4f.h>
00032 
00033 class SoState;
00034 class SoTextureCombineElementP;
00035 
00036 class COIN_DLL_API SoTextureCombineElement : public SoElement {
00037   typedef SoElement inherited;
00038 
00039   SO_ELEMENT_HEADER(SoTextureCombineElement);
00040 public:
00041   static void initClass(void);
00042 protected:
00043   virtual ~SoTextureCombineElement();
00044 
00045 public:
00046 
00047   enum Source {
00048     PRIMARY_COLOR = 0x8577,
00049     TEXTURE = 0x1702,
00050     CONSTANT = 0x8576,
00051     PREVIOUS =  0x8578
00052   };
00053   enum Operand {
00054     SRC_COLOR = 0x0300,
00055     ONE_MINUS_SRC_COLOR = 0x0301, 
00056     SRC_ALPHA = 0x0302,
00057     ONE_MINUS_SRC_ALPHA = 0x0303
00058   };
00059   enum Operation {
00060     REPLACE = 0x1E01,
00061     MODULATE = 0x2100,
00062     ADD = 0x0104,
00063     ADD_SIGNED = 0x8574,
00064     SUBTRACT = 0x84E7,
00065     INTERPOLATE = 0x8575,
00066     DOT3_RGB = 0x86AE,
00067     DOT3_RGBA = 0x86AF
00068   };
00069 
00070   virtual void init(SoState * state);
00071 
00072   static void set(SoState * const state, SoNode * const node,
00073                   const int unit,
00074                   const Operation rgboperation,
00075                   const Operation alphaoperation,
00076                   const Source * rgbsource,
00077                   const Source * alphasource,
00078                   const Operand * rgboperand,
00079                   const Operand * alphaoperand,
00080                   const SbColor4f & constantcolor,
00081                   const float rgbscale,
00082                   const float alphascale);
00083 
00084   static SbBool isDefault(SoState * const state,
00085                           const int unit);
00086                        
00087   static void get(SoState * const state,
00088                   const int unit,
00089                   Operation & rgboperation,
00090                   Operation & alphaoperation,
00091                   Source * rgbsource,
00092                   Source * alphasource,
00093                   Operand * rgboperand,
00094                   Operand * alphaoperand,
00095                   SbColor4f & constantcolor,
00096                   float & rgbscale,
00097                   float & alphascale);
00098 
00099   virtual void push(SoState * state);
00100   virtual SbBool matches(const SoElement * elem) const;
00101   SoElement * copyMatchInfo(void) const;
00102 
00103   virtual void setElt(const int unit,
00104                       const uint32_t nodeid,
00105                       const Operation rgboperation,
00106                       const Operation alphaoperation,
00107                       const Source * rgbsource,
00108                       const Source * alphasource,
00109                       const Operand * rgboperand,
00110                       const Operand * alphaoperand,
00111                       const SbColor4f & constantcolor,
00112                       const float rgbscale,
00113                       const float alphascale);
00114 
00115   static void apply(SoState * state, const int unit);
00116 
00117   class UnitData {
00118   public:
00119     uint32_t nodeid;
00120     Source rgbsource[3];
00121     Source alphasource[3];
00122     Operand rgboperand[3];
00123     Operand alphaoperand[3];
00124     Operation rgboperation;
00125     Operation alphaoperation;
00126     SbColor4f constantcolor;
00127     float rgbscale;
00128     float alphascale;
00129   };
00130 
00131 protected:
00132   const UnitData & getUnitData(const int unit) const;
00133 
00134 private:
00135   void setDefaultValues(const int unit);
00136   SoTextureCombineElementP * pimpl;
00137 };
00138 
00139 #endif // !COIN_SOTEXTURECOMBINEELEMENT_H

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

Generated on Fri Dec 11 2015 03:24:56 for Coin by Doxygen 1.7.6.1.