Main Page Modules Class Hierarchy Alphabetical List Compound List File List Compound Members

# 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-2003 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 <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    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   };
    00052
    00053   enum Wrap {
    00054     REPEAT = SoTextureImageElement::REPEAT,
    00055     CLAMP = SoTextureImageElement::CLAMP
    00056   };
    00057
    00058   SoSFString filename;
    00059   SoSFImage image;
    00060   SoSFEnum wrapS;
    00061   SoSFEnum wrapT;
    00062   SoSFEnum model;
    00063   SoSFColor blendColor;
    00064
    00065   virtual void doAction(SoAction * action);
    00066   virtual void GLRender(SoGLRenderAction * action);
    00067   virtual void callback(SoCallbackAction * action);
    00068   virtual void rayPick(SoRayPickAction * action);
    00069
    00070   static SbBool readImage(const SbString & fname, int & w, int & h, int & nc,
    00071                           unsigned char *& bytes);
    00072 protected:
    00073   virtual ~SoTexture2();
    00074
    00075   virtual SbBool readInstance(SoInput * in, unsigned short flags);
    00076   virtual void notify(SoNotList * list);
    00077   int getReadStatus(void);
    00078   void setReadStatus(int s);
    00079
    00080 private:
    00081   SbBool loadFilename(void);
    00082   static void filenameSensorCB(void *, SoSensor *);
    00083
    00084   SoTexture2P * pimpl;
    00085 };
    00086
    00087 #endif // !COIN_SOTEXTURE2_H