VR-Forces 4.1 Class Documentation
DtShadowMapImplMinimal.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2008 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: ShadowMapImplMinimal.h,v $ $Revision: 1.3 $ $State: Exp $
7 ******************************************************************************/
8 
9 #ifndef shadowMapImplMinimal_H_
10 #define shadowMapImplMinimal_H_
11 
14 #include <vrvOsg/vrvOsg.h>
15 
16 #include <osg/Camera>
17 #include <osg/Material>
18 #include <osg/MatrixTransform>
19 #include <osg/LightSource>
20 #include <osgUtil/CullVisitor>
21 #include <osg/TexGen>
22 #include <osg/Texture2D>
23 
24 namespace makOsgShadowFX
25 {
26 
28 {
29  public :
31  DtShadowMapMinimal(const DtShadowMapMinimal& orig, const osg::CopyOp& op);
32 
33  META_Object(makOsgShadowFX, DtShadowMapMinimal);
34 
35 
36  protected:
37  virtual void setupShadowReceivingScene();
38 
39  virtual void aimShadowCastingCamera( const osg::Light *light,
40  const osg::Vec4 &worldLightPos, const osg::Vec3 &worldLightDir,
41  const osg::Vec3 &worldLightUp = osg::Vec3(0,1,0) );
42 
43  virtual void aimShadowCastingCameraWithBounds( const osg::BoundingSphere &bounds,
44  const osg::Light *light, const osg::Vec4 &worldLightPos,
45  const osg::Vec3 &worldLightDir, const osg::Vec3 &worldLightUp = osg::Vec3(0,1,0) );
46 
47  virtual osg::BoundingBox computeScenePolytopeBounds(const osg::Matrix* m = NULL );
48 
49  virtual void cutScenePolytope( const osg::Matrix & matrix, const osg::Matrix & inverse,
50  const osg::BoundingBox &bb =osg::BoundingBox(-1,-1,-1,1,1,1) );
51 
52  virtual void frameShadowCastingCamera( const osg::Camera* cameraMain,
53  osg::Camera* cameraShadow, int pass=1 );
54 
55  virtual osg::BoundingBox computeShadowReceivingCoarseBounds();
56 
60  BOUNDING_BOX
61  };
62  // Modify projection matrix so that some output subrange
63  // is remapped to whole clip space (-1..1,-1..1,-1..1).
64  // Bit mask can be used to limit remaping to selected bounds only.
65  // 1=left|2=right|4=bottom|8=top|16=near|32=far
66  static void trimProjection( osg::Matrixd & projection, osg::BoundingBox subrange, unsigned int trimMask = (1|2|4|8|16|32));
67  static void clampProjection ( osg::Matrixd & projection, float n = 0, float f = FLT_MAX );
68  static void extendProjection( osg::Matrixd & projection, osg::Viewport * viewport, const osg::Vec2& margin );
69 
71  std::vector< osg::Vec3d > mySceneReceivingShadowPolytopePoints;
72 
73  osg::Matrixd myClampedProjection;
74  };
75 
76 } //makOsgShadowFX::
77 
78 #endif

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)