OpenSceneGraph 3.6.5
AnisotropicLighting
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13//osgFX - Copyright (C) 2003 Marco Jez
14
15#ifndef OSGFX_ANISOTROPICLIGHTING_
16#define OSGFX_ANISOTROPICLIGHTING_
17
18#include <osgFX/Export>
19#include <osgFX/Effect>
20
21#include <osg/ref_ptr>
22#include <osg/Texture2D>
23
24namespace osgFX
25{
26
42 public:
45
47
48 "Anisotropic Lighting",
49
50 "This single-pass effect implements a sort of anisotropic "
51 "lighting that replaces the standard OpenGL lighting model.\n"
52 "The final color of vertices is not computed directly, it is "
53 "the result of a texture lookup on a user-supplied lighting "
54 "image map. A vertex program is used to compute the s and t "
55 "texture coordinates as follows: s = (N dot H) ; t = (N dot L) "
56 "where N is the vertex normal, L is the light-to-vertex vector, "
57 "H is the half-way vector. This is a good example of how you "
58 "can use the State::getInitialViewMatrix() method to retrieve "
59 "the view matrix and perform view-dependant effects without "
60 "fakes of any kind.\n"
61 "This effect requires the ARB_vertex_program extension.",
62
63 "Marco Jez");
64
65
67 inline osg::Image* getLightingMap();
68
70 inline const osg::Image* getLightingMap() const;
71
73 inline void setLightingMap(osg::Image* image);
74
76 inline int getLightNumber() const;
77
79 inline void setLightNumber(int n);
80
81 protected:
84
86
87 private:
88 int _lightnum;
90 };
91
92 // INLINE METHODS
93
95 {
96 return _texture->getImage();
97 }
98
100 {
101 return _texture->getImage();
102 }
103
105 {
106 _texture->setImage(image);
107 }
108
110 {
111 return _lightnum;
112 }
113
115 {
116 _lightnum = n;
118 }
119
120}
121
122#endif
The osgFX library is a NodeKit that extends the core scene graph to provide a special effects framewo...
Definition AnisotropicLighting:25
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Image class for encapsulating the storage texture image data.
Definition Image:179
virtual void setImage(int s, int t, int r, GLint internalTextureformat, GLenum pixelFormat, GLenum type, unsigned char *data, AllocationMode mode, int packing=1, int rowLength=0)
Set the image dimensions, format and data.
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
void setLightNumber(int n)
set the OpenGL light number that will be used in lighting computations
Definition AnisotropicLighting:114
virtual ~AnisotropicLighting()
Definition AnisotropicLighting:82
void setLightingMap(osg::Image *image)
set the lighting map
Definition AnisotropicLighting:104
META_Effect(osgFX, AnisotropicLighting, "Anisotropic Lighting", "This single-pass effect implements a sort of anisotropic " "lighting that replaces the standard OpenGL lighting model.\n" "The final color of vertices is not computed directly, it is " "the result of a texture lookup on a user-supplied lighting " "image map. A vertex program is used to compute the s and t " "texture coordinates as follows: s = (N dot H) ; t = (N dot L) " "where N is the vertex normal, L is the light-to-vertex vector, " "H is the half-way vector. This is a good example of how you " "can use the State::getInitialViewMatrix() method to retrieve " "the view matrix and perform view-dependant effects without " "fakes of any kind.\n" "This effect requires the ARB_vertex_program extension.", "Marco Jez")
bool define_techniques()
abstract method to be implemented in derived classes; its purpose if to create the techniques that ca...
AnisotropicLighting(const AnisotropicLighting &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
int getLightNumber() const
get the OpenGL light number
Definition AnisotropicLighting:109
AnisotropicLighting & operator=(const AnisotropicLighting &)
Definition AnisotropicLighting:83
osg::Image * getLightingMap()
get the lighting map
Definition AnisotropicLighting:94
void dirtyTechniques()
force rebuilding of techniques on next traversal
Definition Effect:207
#define OSGFX_EXPORT
Definition Export:27

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.