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 SHADOW_CASTER__H 00029 #define SHADOW_CASTER__H 00030 00031 //---------------------------------------------------------------------------- 00032 // INCLUDEs 00033 //---------------------------------------------------------------------------- 00034 00035 #include "ShadowManager.h" 00036 #include "ObjectModel.h" 00037 // 00038 #include <Inventor/nodes/SoSeparator.h> 00039 #include <Inventor/nodes/SoCoordinate3.h> 00040 #include <Inventor/nodes/SoNormal.h> 00041 #include <Inventor/nodes/SoNormalBinding.h> 00042 #include <Inventor/nodes/SoShapeHints.h> 00043 #include <Inventor/nodes/SoIndexedFaceSet.h> 00044 #include <Inventor/nodes/SoTranslation.h> 00045 #include <Inventor/nodes/SoRotationXYZ.h> 00046 // 00047 #include <Inventor/actions/SoCallbackAction.h> 00048 #include <Inventor/actions/SoSearchAction.h> 00049 #include <Inventor/actions/SoGetMatrixAction.h> 00050 #include <Inventor/actions/SoWriteAction.h> 00051 // 00052 #include <Inventor/elements/SoShapeHintsElement.h> 00053 // 00054 #include <Inventor/misc/SoChildList.h> 00055 // 00056 #include <Inventor/SoPrimitiveVertex.h> 00057 #include <Inventor/SbLinear.h> 00058 00059 //---------------------------------------------------------------------------- 00060 // IMPLEMENTATION 00061 //---------------------------------------------------------------------------- 00062 00071 class CShadowCaster : public SoSeparator 00072 { 00073 public: 00075 CObjectModel * objectModel; 00077 SbMatrix trMatrix; 00079 SbMatrix trMatrixOld; 00081 SoPath * path; 00083 SoSeparator * objectRoot; 00084 00085 private: 00087 CShadowManager * manager; 00089 int nameIndex; 00091 SoPathSensor * moveSensor; 00093 SoNodeSensor * shapeSensor; 00095 bool hasMoved; 00096 00097 bool getTransformationMatrix(); 00098 00099 public: 00100 CShadowCaster(CShadowManager * sm, SoSeparator * or); 00101 ~CShadowCaster(); 00102 00103 SoSeparator * getObjectNode(); 00104 CObjectModel * getObjectModel(); 00105 SbMatrix * getMatrix(); 00106 void setCasterName(int objectIndex); 00107 int getCasterName(); 00108 00109 void setMoveSensor(SoPathSensor * sensor); 00110 void setShapeSensor(SoNodeSensor * sensor); 00111 SoPathSensor * getMoveSensor(); 00112 SoNodeSensor * getShapeSensor(); 00113 00114 void createFaceModel(); 00115 void showFaceModel(); 00116 void createShadowVolumes(); 00117 00118 void setMoved(bool m); 00119 bool moved(); 00120 00121 }; 00122 00123 00124 #endif