- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgShadow/StandardShadowMap
r12188 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 * … … 28 28 typedef StandardShadowMap ThisClass; 29 29 /** Convenient typedef used in definition of ViewData struct and methods */ 30 typedef DebugShadowMap BaseClass; 30 typedef DebugShadowMap BaseClass; 31 31 32 32 /** Classic OSG constructor */ … … 34 34 35 35 /** Classic OSG cloning constructor */ 36 StandardShadowMap(const StandardShadowMap& ssm, 36 StandardShadowMap(const StandardShadowMap& ssm, 37 37 const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); 38 38 … … 54 54 // Texture Indices are changed by search and replace on shader source 55 55 // Carefully order these calls when changing both base and shadow indices 56 // In worst case when intend to swap indices 57 // one will have to call these methods more than once 58 // with one extra pass to change index to unused value to avoid 56 // In worst case when intend to swap indices 57 // one will have to call these methods more than once 58 // with one extra pass to change index to unused value to avoid 59 59 // unwanted superfluous replace: 60 60 // 61 61 // Example: Imagine we want to swap base(0) and shadow(1) indices: 62 62 // We have to do an extra step to make sure both do not end up as 1 63 // 63 // 64 64 // // initialy change base to something else than 1 65 // setBaseTextureCoordIndex( 100 ); 65 // setBaseTextureCoordIndex( 100 ); 66 66 // // now search and replace all gl_TexCord[1] to gl_TexCord[0] 67 67 // setShadowTextureCoordIndex( 0 ); 68 68 // // finally change base from 100 to 0 69 // setBaseTextureCoordIndex( 1 ); 69 // setBaseTextureCoordIndex( 1 ); 70 70 71 71 void setBaseTextureCoordIndex( unsigned int index ) 72 72 { updateTextureCoordIndices( _baseTextureCoordIndex, index ); 73 _baseTextureCoordIndex = index; } 73 _baseTextureCoordIndex = index; } 74 74 75 75 unsigned int getBaseTextureCoordIndex( void ) const … … 97 97 osg::Light* getLight( void ) 98 98 { return _light.get(); } 99 99 100 100 const osg::Light* getLight( void ) const 101 101 { return _light.get(); } 102 102 103 osg::Shader * getShadowVertexShader() 103 osg::Shader * getShadowVertexShader() 104 104 { return _shadowVertexShader.get(); } 105 105 106 osg::Shader * getShadowFragmentShader() 106 osg::Shader * getShadowFragmentShader() 107 107 { return _shadowFragmentShader.get(); } 108 108 … … 116 116 { _shadowVertexShader = shader; } 117 117 118 void setShadowFragmentShader( osg::Shader * shader ) 118 void setShadowFragmentShader( osg::Shader * shader ) 119 119 { _shadowFragmentShader = shader; } 120 120 121 void setMainVertexShader( osg::Shader * shader ) 121 void setMainVertexShader( osg::Shader * shader ) 122 122 { _mainVertexShader = shader; } 123 123 … … 168 168 virtual void cull( ); 169 169 170 virtual void aimShadowCastingCamera( 170 virtual void aimShadowCastingCamera( 171 171 const osg::BoundingSphere &bounds, 172 172 const osg::Light *light, 173 173 const osg::Vec4 &worldLightPos, 174 const osg::Vec3 &worldLightDir, 174 const osg::Vec3 &worldLightDir, 175 175 const osg::Vec3 &worldLightUp = osg::Vec3(0,1,0) ); 176 176 … … 186 186 virtual void aimShadowCastingCamera( const osg::Light *light, 187 187 const osg::Vec4 &worldLightPos, 188 const osg::Vec3 &worldLightDir, 188 const osg::Vec3 &worldLightDir, 189 189 const osg::Vec3 &worldLightUp 190 190 = osg::Vec3(0,1,0) ); 191 191 }; 192 192 193 193 friend struct ViewData; 194 194
