00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2018 BY FEI S.A.S, *** 00017 *** MERIGNAC, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : R.ALBOU (Sep 2001) 00022 **=======================================================================*/ 00023 #ifndef _SO_SHADOW_GROUP_ 00024 #define _SO_SHADOW_GROUP_ 00025 00026 00027 #include <Inventor/nodes/SoGroup.h> 00028 #include <Inventor/fields/SoSFBool.h> 00029 #include <Inventor/fields/SoSFEnum.h> 00030 #include <Inventor/fields/SoSFFloat.h> 00031 #include <Inventor/fields/SoSFInt32.h> 00032 #include <Inventor/SbMatrix.h> 00033 #include <Inventor/SbPImpl.h> 00034 00035 class SoGLShadowMapping ; 00036 class SoCache ; 00037 class SoGLTexture; 00038 00039 SO_PIMPL_PUBLIC_DECLARATION(SoShadowGroup) 00040 00041 00177 class SoShadowGroup : public SoGroup 00178 { 00179 SO_NODE_HEADER(SoShadowGroup); 00180 SO_PIMPL_PUBLIC_HEADER(SoShadowGroup) 00181 00182 public: 00186 enum VisibilityFlag { 00192 ABSOLUTE_RADIUS, 00193 00200 LONGEST_BBOX_EDGE_FACTOR 00201 } ; 00202 00206 enum ShadowingMethod { 00210 VARIANCE_SHADOW_MAP, 00211 #ifndef HIDDEN_FROM_DOC 00212 LAST_METHOD 00213 #endif 00214 }; 00215 00219 SoShadowGroup(); 00220 00224 SoShadowGroup(int nChildren); 00225 00230 SoSFBool isActive ; 00231 00237 SoSFFloat intensity ; 00238 00250 SoSFFloat precision ; 00251 00258 SoSFFloat quality ; 00259 00265 SoSFBool shadowCachingEnabled ; 00266 00282 SoSFFloat visibilityRadius ; 00283 00288 SoSFEnum visibilityFlag ; 00289 00290 00297 SoSFInt32 smoothFactor; 00298 00309 SoSFFloat minVariance; 00310 00319 SoSFFloat lightBleedingReduction; 00320 00327 SoSFEnum method; 00328 00335 static SbBool isSupported(SoShadowGroup::ShadowingMethod method = SoShadowGroup::VARIANCE_SHADOW_MAP) ; 00336 00337 00338 private: 00340 virtual void GLRender(SoGLRenderAction *action); 00341 00342 /*----------------------------------------------------------------------------*/ 00343 00344 private: 00345 typedef std::vector<int> StackIndexVector; 00346 00347 static void initClass() ; 00348 static void exitClass() ; 00349 00351 const SbMatrix& getLightViewProjectionMatrix() const; 00352 00354 int getLightIndex() const; 00355 00357 static int getShadowMapTextureUnit(SoGLRenderAction* action); 00358 00360 void invalidateLightCaches(); 00361 00364 bool isCacheValid(SoState* state, SoCache* &cache, const StackIndexVector& elemsToCheck); 00365 00366 00368 bool isShadowActive(SoState* state) const; 00369 00371 float getQuality(SoState* state) const; 00372 00376 virtual void notify(SoNotList *list); 00377 00379 SbVec2i32 getShadowMapSize(); 00380 00381 private: 00382 virtual ~SoShadowGroup(); 00383 00384 private: 00385 00386 #if 1 SoDEPRECATED 00392 SoSFBool isShapesBefore; 00393 #endif 00396 void addElementsToCache(SoState* state, SoCache* cache) const; 00397 00399 void chooseShadowingMethod(); 00400 00402 inventor::impl::SoShadowGroupImpl* createImplementation() const; 00403 00404 void commonInit(); 00405 00407 static int s_defaultTextureUnit; 00408 }; 00409 /*----------------------------------------------------------------------------*/ 00410 #endif // _SO_SHADOW_GROUP_ 00411 00412 00413