00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef SO_SHADOW_LIGHT__H
00029 #define SO_SHADOW_LIGHT__H
00030
00031
00032 #ifdef _WIN32
00033 #include <windows.h>
00034 #endif
00035
00036
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
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
00082
00083
00094 class SoShadowLight : public SoSeparator
00095 {
00096 private:
00098 CShadowManager * manager;
00100 SoLight * light;
00102 SoSeparator * lightRenderRoot;
00104 SoSeparator * volumesRoot;
00106
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
00124
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