Changeset 13041 for OpenSceneGraph/trunk/include/osgFX/AnisotropicLighting
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgFX/AnisotropicLighting
r5328 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 */ … … 26 26 27 27 /** 28 This single-pass effect implements a sort of anisotropic 28 This single-pass effect implements a sort of anisotropic 29 29 lighting that replaces the standard OpenGL lighting model. 30 The final color of vertices is not computed directly, it is 31 the result of a texture lookup on a user-supplied lighting 32 image map. A vertex program is used to compute the s and t 33 texture coordinates as follows: s = (N dot H) ; t = (N dot L) 34 where N is the vertex normal, L is the light-to-vertex vector, 35 H is the half-way vector. This is a good example of how you 36 can use the State::getInitialViewMatrix() method to retrieve 37 the view matrix and perform view-dependant effects without 30 The final color of vertices is not computed directly, it is 31 the result of a texture lookup on a user-supplied lighting 32 image map. A vertex program is used to compute the s and t 33 texture coordinates as follows: s = (N dot H) ; t = (N dot L) 34 where N is the vertex normal, L is the light-to-vertex vector, 35 H is the half-way vector. This is a good example of how you 36 can use the State::getInitialViewMatrix() method to retrieve 37 the view matrix and perform view-dependant effects without 38 38 fakes of any kind. 39 39 This effect requires the ARB_vertex_program extension. … … 44 44 AnisotropicLighting(const AnisotropicLighting& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); 45 45 46 META_Effect(osgFX, AnisotropicLighting, 47 48 "Anisotropic Lighting", 49 46 META_Effect(osgFX, AnisotropicLighting, 47 48 "Anisotropic Lighting", 49 50 50 "This single-pass effect implements a sort of anisotropic " 51 51 "lighting that replaces the standard OpenGL lighting model.\n" … … 59 59 "the view matrix and perform view-dependant effects without " 60 60 "fakes of any kind.\n" 61 "This effect requires the ARB_vertex_program extension.", 62 61 "This effect requires the ARB_vertex_program extension.", 62 63 63 "Marco Jez"); 64 65 64 65 66 66 /** get the lighting map */ 67 67 inline osg::Image* getLightingMap(); 68 68 69 69 /** get the const lighting map */ 70 70 inline const osg::Image* getLightingMap() const; 71 71 72 72 /** set the lighting map */ 73 73 inline void setLightingMap(osg::Image* image); … … 75 75 /** get the OpenGL light number */ 76 76 inline int getLightNumber() const; 77 77 78 78 /** set the OpenGL light number that will be used in lighting computations */ 79 79 inline void setLightNumber(int n); … … 91 91 92 92 // INLINE METHODS 93 93 94 94 inline osg::Image* AnisotropicLighting::getLightingMap() 95 95 { 96 96 return _texture->getImage(); 97 97 } 98 98 99 99 inline const osg::Image* AnisotropicLighting::getLightingMap() const 100 100 { 101 101 return _texture->getImage(); 102 102 } 103 103 104 104 inline void AnisotropicLighting::setLightingMap(osg::Image* image) 105 105 { 106 106 _texture->setImage(image); 107 107 } 108 108 109 109 inline int AnisotropicLighting::getLightNumber() const 110 110 { 111 111 return _lightnum; 112 112 } 113 113 114 114 inline void AnisotropicLighting::setLightNumber(int n) 115 115 {
