VR-Forces 4.0.4 Class Documentation
include/makOsgShadowFX/DtShadowMapImplMinimal.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2008 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: ShadowMapImplMinimal.h,v $ $Revision: 1.3 $ $State: Exp $
00007 ******************************************************************************/
00008 
00009 #ifndef shadowMapImplMinimal_H_
00010 #define shadowMapImplMinimal_H_
00011 
00012 #include <makOsgShadowFX/DtShadowMapImpl.h>
00013 #include <makOsgShadowFX/ConvexPolyhedron.h>
00014 #include <vrvOsg/vrvOsg.h>
00015 
00016 #include <osg/Camera>
00017 #include <osg/Material>
00018 #include <osg/MatrixTransform>
00019 #include <osg/LightSource>
00020 #include <osgUtil/CullVisitor>
00021 #include <osg/TexGen>
00022 #include <osg/Texture2D>
00023 
00024 namespace makOsgShadowFX 
00025 {
00026 
00027 class DT_DLL_VRVOSG DtShadowMapMinimal : public DtShadowMap
00028 {
00029     public :
00030         DtShadowMapMinimal();
00031         DtShadowMapMinimal(const DtShadowMapMinimal& orig, const osg::CopyOp& op);
00032 
00033         META_Object(makOsgShadowFX, DtShadowMapMinimal);
00034  
00035 
00036     protected:
00037       virtual void setupShadowReceivingScene();
00038 
00039        virtual void aimShadowCastingCamera( const osg::Light *light,
00040           const osg::Vec4 &worldLightPos, const osg::Vec3 &worldLightDir,                                       
00041           const osg::Vec3 &worldLightUp = osg::Vec3(0,1,0) );
00042 
00043        virtual void aimShadowCastingCameraWithBounds( const osg::BoundingSphere &bounds,
00044           const osg::Light *light, const osg::Vec4 &worldLightPos,
00045           const osg::Vec3 &worldLightDir, const osg::Vec3 &worldLightUp = osg::Vec3(0,1,0) );
00046 
00047        virtual osg::BoundingBox computeScenePolytopeBounds(const osg::Matrix* m = NULL ); 
00048 
00049        virtual void cutScenePolytope( const osg::Matrix & matrix, const osg::Matrix & inverse,
00050           const osg::BoundingBox &bb =osg::BoundingBox(-1,-1,-1,1,1,1) );
00051 
00052        virtual void frameShadowCastingCamera( const osg::Camera* cameraMain, 
00053                                       osg::Camera* cameraShadow, int pass=1 );
00054 
00055        virtual osg::BoundingBox computeShadowReceivingCoarseBounds();
00056 
00057        enum ShadowReceivingCoarseBoundAccuracy {
00058           EMPTY_BOX,
00059           BOUNDING_SPHERE,
00060           BOUNDING_BOX
00061        };
00062        // Modify projection matrix so that some output subrange
00063        // is remapped to whole clip space (-1..1,-1..1,-1..1).
00064        // Bit mask can be used to limit remaping to selected bounds only.
00065        // 1=left|2=right|4=bottom|8=top|16=near|32=far
00066        static void trimProjection( osg::Matrixd & projection, osg::BoundingBox subrange, unsigned int trimMask = (1|2|4|8|16|32));
00067        static void clampProjection ( osg::Matrixd & projection, float n = 0, float f = FLT_MAX );
00068        static void extendProjection( osg::Matrixd & projection, osg::Viewport * viewport, const osg::Vec2& margin );
00069 
00070        ConvexPolyhedron                 mySceneReceivingShadowPolytope;
00071        std::vector< osg::Vec3d >        mySceneReceivingShadowPolytopePoints;
00072   
00073        osg::Matrixd                     myClampedProjection;
00074     };
00075 
00076 } //makOsgShadowFX::
00077 
00078 #endif

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)