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

SoCallbackAction.h

00001 #ifndef COIN_SOCALLBACKACTION_H
00002 #define COIN_SOCALLBACKACTION_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 // FIXME: Support getTextureFilename[s]() ? (kintel 20011205)
00028 
00029 #include <Inventor/actions/SoAction.h>
00030 #include <Inventor/actions/SoSubAction.h>
00031 #include <Inventor/elements/SoDecimationTypeElement.h>
00032 #include <Inventor/lists/SbList.h>
00033 #include <Inventor/nodes/SoComplexity.h>
00034 #include <Inventor/nodes/SoDrawStyle.h>
00035 #include <Inventor/nodes/SoLightModel.h>
00036 #include <Inventor/nodes/SoMaterialBinding.h>
00037 #include <Inventor/nodes/SoNormalBinding.h>
00038 #include <Inventor/nodes/SoPickStyle.h>
00039 #include <Inventor/nodes/SoShapeHints.h>
00040 #include <Inventor/nodes/SoTexture2.h>
00041 #include <Inventor/nodes/SoTextureCoordinateBinding.h>
00042 #include <Inventor/nodes/SoUnits.h>
00043 
00044 class SbColor;
00045 class SbMatrix;
00046 class SbVec2f;
00047 class SbVec2s;
00048 class SbVec3f;
00049 class SbVec4f;
00050 class SbViewVolume;
00051 class SoCallbackAction;
00052 class SoCallbackData;
00053 class SoPrimitiveVertex;
00054 class SoShape;
00055 class SbViewportRegion;
00056 
00057 typedef void SoTriangleCB(void * userdata, SoCallbackAction * action,
00058                           const SoPrimitiveVertex * v1,
00059                           const SoPrimitiveVertex * v2,
00060                           const SoPrimitiveVertex * v3);
00061 
00062 typedef void SoLineSegmentCB(void * userdata, SoCallbackAction * action,
00063                              const SoPrimitiveVertex * v1,
00064                              const SoPrimitiveVertex * v2);
00065 
00066 typedef void SoPointCB(void * userdata, SoCallbackAction * action,
00067                        const SoPrimitiveVertex * v);
00068 
00069 
00070 class COIN_DLL_API SoCallbackAction : public SoAction {
00071   typedef SoAction inherited;
00072 
00073   SO_ACTION_HEADER(SoCallbackAction);
00074 
00075 public:
00076   SoCallbackAction(void);
00077   SoCallbackAction(const SbViewportRegion & vp);
00078 
00079   virtual ~SoCallbackAction();
00080 
00081   static void initClass(void);
00082 
00083   void setViewportRegion(const SbViewportRegion & vp);
00084 
00085   enum Response { CONTINUE,  ABORT, PRUNE };
00086 
00087   typedef Response SoCallbackActionCB(void * userdata,
00088                                       SoCallbackAction * action,
00089                                       const SoNode * node);
00090 
00091   void addPreCallback(const SoType type, SoCallbackActionCB * cb, void * userdata);
00092   void addPostCallback(const SoType type, SoCallbackActionCB * cb, void * userdata);
00093 
00094   void addPreTailCallback(SoCallbackActionCB * cb, void * userdata);
00095   void addPostTailCallback(SoCallbackActionCB * cb, void * userdata);
00096 
00097   void addTriangleCallback(const SoType type, SoTriangleCB * cb, void * userdata);
00098   void addLineSegmentCallback(const SoType type, SoLineSegmentCB * cb, void * userdata);
00099   void addPointCallback(const SoType type, SoPointCB * cb, void * userdata);
00100 
00101   SoDecimationTypeElement::Type getDecimationType(void) const;
00102   float getDecimationPercentage(void) const;
00103   float getComplexity(void) const;
00104   SoComplexity::Type getComplexityType(void) const;
00105   int32_t getNumCoordinates(void) const;
00106   const SbVec3f & getCoordinate3(const int index) const;
00107   const SbVec4f & getCoordinate4(const int index) const;
00108   SoDrawStyle::Style getDrawStyle(void) const;
00109   unsigned short getLinePattern(void) const;
00110   float getLineWidth(void) const;
00111   float getPointSize(void) const;
00112   const SbName & getFontName(void) const;
00113   float getFontSize(void) const;
00114   SoLightModel::Model getLightModel(void) const;
00115   const SbVec3f & getLightAttenuation(void) const;
00116   void getMaterial(SbColor & ambient, SbColor & diffuse,
00117                    SbColor & specular, SbColor & emission,
00118                    float & shininess, float & transparency,
00119                    const int index = 0) const;
00120   SoMaterialBinding::Binding getMaterialBinding(void) const;
00121   uint32_t getNumNormals(void) const;
00122   const SbVec3f & getNormal(const int index) const;
00123   SoNormalBinding::Binding getNormalBinding(void) const;
00124   int32_t getNumProfileCoordinates(void) const;
00125   const SbVec2f & getProfileCoordinate2(const int index) const;
00126   const SbVec3f & getProfileCoordinate3(const int index) const;
00127   const SoNodeList & getProfile(void) const;
00128   SoShapeHints::VertexOrdering getVertexOrdering(void) const;
00129   SoShapeHints::ShapeType getShapeType(void) const;
00130   SoShapeHints::FaceType getFaceType(void) const;
00131   float getCreaseAngle(void) const;
00132   int32_t getNumTextureCoordinates(void) const;
00133   const SbVec2f & getTextureCoordinate2(const int index) const;
00134   const SbVec3f & getTextureCoordinate3(const int index) const;
00135   const SbVec4f & getTextureCoordinate4(const int index) const;
00136   SoTextureCoordinateBinding::Binding getTextureCoordinateBinding(void) const;
00137   const SbColor & getTextureBlendColor(void) const;
00138   const unsigned char * getTextureImage(SbVec2s & size, int & numcomps) const;
00139   const unsigned char * getTextureImage(SbVec3s & size, int & numcomps) const;
00140   const SbMatrix & getTextureMatrix(void) const;
00141   SoTexture2::Model getTextureModel(void) const;
00142   SoTexture2::Wrap getTextureWrapS(void) const;
00143   SoTexture2::Wrap getTextureWrapT(void) const;
00144   SoTexture2::Wrap getTextureWrapR(void) const;
00145   const SbMatrix & getModelMatrix(void) const;
00146   SoUnits::Units getUnits(void) const;
00147   float getFocalDistance(void) const;
00148   const SbMatrix & getProjectionMatrix(void) const;
00149   const SbMatrix & getViewingMatrix(void) const;
00150   const SbViewVolume & getViewVolume(void) const;
00151   const SbViewportRegion & getViewportRegion(void) const;
00152   SoPickStyle::Style getPickStyle(void) const;
00153   int32_t getSwitch(void) const;
00154 
00155   Response getCurrentResponse(void) const;
00156   void invokePreCallbacks(const SoNode * const node);
00157   void invokePostCallbacks(const SoNode * const node);
00158   void invokeTriangleCallbacks(const SoShape * const shape,
00159                                const SoPrimitiveVertex * const v1,
00160                                const SoPrimitiveVertex * const v2,
00161                                const SoPrimitiveVertex * const v3);
00162   void invokeLineSegmentCallbacks(const SoShape * const shape,
00163                                   const SoPrimitiveVertex * const v1,
00164                                   const SoPrimitiveVertex * const v2);
00165   void invokePointCallbacks(const SoShape * const shape,
00166                             const SoPrimitiveVertex * const v);
00167 
00168   SbBool shouldGeneratePrimitives(const SoShape * shape) const;
00169 
00170   virtual SoNode * getCurPathTail(void);
00171   void setCurrentNode(SoNode * const node);
00172 
00173 protected:
00174   virtual void beginTraversal(SoNode * node);
00175 
00176 private:
00177   void commonConstructor(void);
00178   class SoCallbackActionP * pimpl;
00179   friend class SoCallbackActionP;
00180 };
00181 
00182 #endif // !COIN_SOCALLBACKACTION_H

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

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