1
/************************************************************************** *
2
* This file is part of the Coin 3D visualization library.
3
* Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* ("GPL") version 2 as published by the Free Software Foundation.
8
* See the file LICENSE.GPL at the root directory of this source
9
* distribution for additional information about the GNU GPL.
11
* For using Coin with software that can not be combined with the GNU
12
* GPL, and for taking advantage of the additional benefits of our
13
* support services, please contact Systems in Motion about acquiring
14
* a Coin Professional Edition License.
16
* See http://www.coin3d.org/ for more information.
18
* Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
19
* http://www.sim.no/ sales@sim.no coin-support@coin3d.org
21
\**************************************************************************/
24
#error this is a private header file
25
#endif /* !COIN_INTERNAL */
27
#ifndef SO_DIRECTIONALLIGHT_GLSL_H
28
#define SO_DIRECTIONALLIGHT_GLSL_H
30
static const char DIRECTIONALLIGHT_shadersource[] =
32
"void DirectionalLight(in int i,\n"
34
" inout vec4 ambient,\n"
35
" inout vec4 diffuse,\n"
36
" inout vec4 specular)\n"
38
" float nDotVP; // normal . light direction\n"
39
" float nDotHV; // normal . light half vector\n"
40
" float pf; // power factor\n"
42
" nDotVP = max(0.0, dot(normal, normalize(vec3(gl_LightSource[i].position))));\n"
43
" nDotHV = max(0.0, dot(normal, vec3(gl_LightSource[i].halfVector)));\n"
45
" float shininess = gl_FrontMaterial.shininess; \n"
46
" if (nDotVP == 0.0) \n"
49
" pf = pow(nDotHV, shininess);\n"
51
" ambient += gl_LightSource[i].ambient;\n"
52
" diffuse += gl_LightSource[i].diffuse * nDotVP;\n"
53
" specular += gl_LightSource[i].specular * pf;\n"
58
#endif /* ! SO_DIRECTIONALLIGHT_GLSL_H */