SoShadowLight.h

Go to the documentation of this file.
00001 
00007 /* ---------------------------------------------------------------------------
00008  * Authors:      Tomáš Burian (tburian _AT centrum.cz)
00009  * Thanks to:    PCJohn (peciva _AT fit.vutbr.cz)
00010  * Contributors:
00011  *
00012  * THIS SOFTWARE IS NOT COPYRIGHTED
00013  *
00014  * This source code is offered for use in the public domain.
00015  * You may use, modify or distribute it freely.
00016  *
00017  * This source code is distributed in the hope that it will be useful but
00018  * WITHOUT ANY WARRANTY.  ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
00019  * DISCLAIMED.  This includes but is not limited to warranties of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00021  *
00022  * If you find the source code useful, authors will kindly welcome
00023  * if you give them credit and keep their names with their source code,
00024  * but do not feel to be forced to do so.
00025  * ---------------------------------------------------------------------------
00026  */
00027 
00028 #ifndef SO_SHADOW_LIGHT__H
00029 #define SO_SHADOW_LIGHT__H
00030 
00031 
00032 #ifdef _WIN32
00033   #include <windows.h> // needed by gl.h
00034 #endif
00035 
00036 // Must be linked with glu32.lib opengl32.lib
00037 #include <GL/gl.h>
00038 
00049 #define GL_INCR_WRAP_EXT             0x8507 
00050 
00051 #define GL_DECR_WRAP_EXT             0x8508 
00052 
00053 
00054 //----------------------------------------------------------------------------
00055 // INCLUDEs
00056 //----------------------------------------------------------------------------
00057 
00058 #include "ShadowManager.h"
00059 //
00060 #include <Inventor/nodes/SoSeparator.h>
00061 #include <Inventor/nodes/SoCoordinate3.h>
00062 #include <Inventor/nodes/SoNormal.h>
00063 #include <Inventor/nodes/SoSwitch.h>
00064 #include <Inventor/nodes/SoNormalBinding.h>
00065 #include <Inventor/nodes/SoShapeHints.h>
00066 #include <Inventor/nodes/SoIndexedFaceSet.h>
00067 #include <Inventor/nodes/SoTranslation.h>
00068 //
00069 #include <Inventor/actions/SoCallbackAction.h>
00070 #include <Inventor/actions/SoSearchAction.h>
00071 #include <Inventor/actions/SoGetMatrixAction.h>
00072 //
00073 #include <Inventor/elements/SoShapeHintsElement.h>
00074 //
00075 #include <Inventor/misc/SoChildList.h>
00076 //
00077 #include <Inventor/SoPrimitiveVertex.h>
00078 #include <Inventor/SbLinear.h>
00079 
00080 //----------------------------------------------------------------------------
00081 // IMPLEMENTATION
00082 //----------------------------------------------------------------------------
00083 
00094 class SoShadowLight : public SoSeparator
00095 {
00096   private:
00098     CShadowManager * manager;
00100     SoLight * light;
00102     SoSeparator * lightRenderRoot;
00104     SoSeparator * volumesRoot;
00106     //SoSwitch * switchNode; // problem with z-fail
00108     SoNodeSensor * sensor;
00110     int nameIndex;
00112     static float envIntensity;    
00114     static GLenum incValue;
00116     static GLenum decValue;
00117 
00118     static void checkStencilExt();
00119     static GLboolean CheckExtension( char *extName );
00120 
00121     void init();
00122 
00123 // shadow rendering callbacks
00124     // static void lightStatusCB(void * userdata, SoAction * action); // problem with z-fail
00125     static void incrementStencilCB(void * userdata, SoAction * action);
00126     static void decrementStencilCB(void * userdata, SoAction * action);
00127     static void litStencilCB(void * userdata, SoAction * action);
00128     static void finishStencilCB(void * userdata, SoAction * action);    
00129 
00130   public:
00132     SbBool status;
00134     SbBool * pstatus;
00135 
00136     SoShadowLight(CShadowManager * sm, SoLight * l);
00137     ~SoShadowLight();
00138 
00139     void addVolume(SoSeparator * volume);
00140     SoSeparator * getVolume(int i);
00141     int getNumVolumes();
00142     void deleteVolumes();
00143     void deleteVolume(int casterName);    
00144 
00145     CShadowManager * getManager();
00146 
00147     SoLight * getLight();
00148     void setLightName(int lightIndex);
00149     int getLightName();
00150 
00151     void setSensor(SoNodeSensor * sensor);
00152     SoNodeSensor * getSensor();
00153     void createShadowVolumes();
00154     void createShadowVolumes(int caster);
00155 
00156 };
00157 
00158 
00159 #endif

Generated on Wed May 17 17:27:52 2006 for Shadow Engine by  doxygen 1.4.6-NO