OSG
3.4.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
osg_head
include
osgFX
AnisotropicLighting.h
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
24
namespace
osgFX
25
{
26
41
class
OSGFX_EXPORT
AnisotropicLighting
:
public
Effect
{
42
public
:
43
AnisotropicLighting
();
44
AnisotropicLighting
(
const
AnisotropicLighting
& copy,
const
osg::CopyOp
& copyop =
osg::CopyOp::SHALLOW_COPY
);
45
46
META_Effect
(
osgFX
,
AnisotropicLighting
,
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
:
82
virtual
~AnisotropicLighting
() {}
83
AnisotropicLighting
&
operator=
(
const
AnisotropicLighting
&) {
return
*
this
; }
84
85
bool
define_techniques();
86
87
private
:
88
int
_lightnum;
89
osg::ref_ptr<osg::Texture2D>
_texture;
90
};
91
92
// INLINE METHODS
93
94
inline
osg::Image
*
AnisotropicLighting::getLightingMap
()
95
{
96
return
_texture->
getImage
();
97
}
98
99
inline
const
osg::Image
*
AnisotropicLighting::getLightingMap
()
const
100
{
101
return
_texture->
getImage
();
102
}
103
104
inline
void
AnisotropicLighting::setLightingMap
(
osg::Image
* image)
105
{
106
_texture->
setImage
(image);
107
}
108
109
inline
int
AnisotropicLighting::getLightNumber
()
const
110
{
111
return
_lightnum;
112
}
113
114
inline
void
AnisotropicLighting::setLightNumber
(
int
n)
115
{
116
_lightnum = n;
117
dirtyTechniques
();
118
}
119
120
}
121
122
#endif
osgFX::AnisotropicLighting::setLightingMap
void setLightingMap(osg::Image *image)
Definition:
AnisotropicLighting.h:104
osgFX::AnisotropicLighting::getLightingMap
osg::Image * getLightingMap()
Definition:
AnisotropicLighting.h:94
osgFX::Effect
Definition:
Effect.h:66
osg::ref_ptr< osg::Texture2D >
osg::Image
Definition:
Image.h:138
osg::Texture2D::setImage
void setImage(Image *image)
META_Effect
#define META_Effect(library, classname, effectname, effectdescription, effectauthor)
Definition:
Effect.h:35
osg::CopyOp::SHALLOW_COPY
Definition:
CopyOp.h:47
osgFX::AnisotropicLighting::getLightNumber
int getLightNumber() const
Definition:
AnisotropicLighting.h:109
osgFX
Definition:
AnisotropicLighting.h:24
osgFX::AnisotropicLighting::setLightNumber
void setLightNumber(int n)
Definition:
AnisotropicLighting.h:114
osgFX::Effect::dirtyTechniques
void dirtyTechniques()
Definition:
Effect.h:204
OSGFX_EXPORT
#define OSGFX_EXPORT
Definition:
Export.h:27
osgFX::AnisotropicLighting
Definition:
AnisotropicLighting.h:41
osg::CopyOp
Definition:
CopyOp.h:40
osgFX::AnisotropicLighting::operator=
AnisotropicLighting & operator=(const AnisotropicLighting &)
Definition:
AnisotropicLighting.h:83
osg::Texture2D::getImage
Image * getImage()
Definition:
Texture2D.h:47
osgFX::AnisotropicLighting::~AnisotropicLighting
virtual ~AnisotropicLighting()
Definition:
AnisotropicLighting.h:82
Generated on Tue Oct 4 2016 19:20:48 for OSG by
1.8.8