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

SoTexture2.h

00001 #ifndef COIN_SOTEXTURE2_H
00002 #define COIN_SOTEXTURE2_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) 1998-2007 by Systems in Motion.  All rights reserved.
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 Systems in Motion about acquiring
00018  *  a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <Inventor/nodes/SoSubNode.h>
00028 #include <Inventor/fields/SoSFEnum.h>
00029 #include <Inventor/fields/SoSFImage.h>
00030 #include <Inventor/fields/SoSFString.h>
00031 #include <Inventor/fields/SoSFColor.h>
00032 #include <Inventor/elements/SoTextureImageElement.h>
00033 
00034 class SoFieldSensor;
00035 class SoSensor;
00036 class SoTexture2P;
00037 
00038 class COIN_DLL_API SoTexture2 : public SoNode {
00039   typedef SoNode inherited;
00040 
00041   SO_NODE_HEADER(SoTexture2);
00042 
00043 public:
00044   static void initClass(void);
00045   SoTexture2(void);
00046 
00047   enum Model {
00048     MODULATE = SoTextureImageElement::MODULATE,
00049     DECAL = SoTextureImageElement::DECAL,
00050     BLEND = SoTextureImageElement::BLEND,
00051     REPLACE = SoTextureImageElement::REPLACE
00052   };
00053 
00054   enum Wrap {
00055     REPEAT = SoTextureImageElement::REPEAT,
00056     CLAMP = SoTextureImageElement::CLAMP
00057   };
00058 
00059   SoSFString filename;
00060   SoSFImage image;
00061   SoSFEnum wrapS;
00062   SoSFEnum wrapT;
00063   SoSFEnum model;
00064   SoSFColor blendColor;
00065 
00066   virtual void doAction(SoAction * action);
00067   virtual void GLRender(SoGLRenderAction * action);
00068   virtual void callback(SoCallbackAction * action);
00069   virtual void rayPick(SoRayPickAction * action);
00070 
00071   static SbBool readImage(const SbString & fname, int & w, int & h, int & nc,
00072                           unsigned char *& bytes);
00073 protected:
00074   virtual ~SoTexture2();
00075 
00076   virtual SbBool readInstance(SoInput * in, unsigned short flags);
00077   virtual void notify(SoNotList * list);
00078   int getReadStatus(void);
00079   void setReadStatus(int s);
00080 
00081 private:
00082   SbBool loadFilename(void);
00083   static void filenameSensorCB(void *, SoSensor *);
00084 
00085   SoTexture2P * pimpl;
00086 
00087   // This is a hack for Coin-2 to let SoFieldData handle the
00088   // enableCompressedTexture field being part of SoTexture2P, and not
00089   // SoTexture2:
00090   friend class SoFieldData;
00091 };
00092 
00093 #endif // !COIN_SOTEXTURE2_H

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Mon Feb 28 2011 10:11:58 for Coin by Doxygen. 1.7.3