~ubuntu-branches/debian/sid/coin2/sid

« back to all changes in this revision

Viewing changes to build/msvc6/data/shaders/lights/DirectionalLight.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2008-06-28 02:38:17 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080628023817-lgrh0u677j1gcqgf
Tags: 2.5.0-2
* debian/control: Change suggests from libopenal0 to libopenal0a.
  Closes: #488001.  Change ${Source-Version} to ${binary:Version}.
  Update to standards version 3.8.0.

* debian/rules: Do not ignore errors in clean rule.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/************************************************************************** *
 
2
 *  This file is part of the Coin 3D visualization library.
 
3
 *  Copyright (C) 1998-2007 by Systems in Motion.  All rights reserved.
 
4
 *
 
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.
 
10
 *
 
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.
 
15
 *
 
16
 *  See http://www.coin3d.org/ for more information.
 
17
 *
 
18
 *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
 
19
 *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
 
20
 *
 
21
\**************************************************************************/
 
22
 
 
23
#ifndef COIN_INTERNAL
 
24
#error this is a private header file
 
25
#endif /* !COIN_INTERNAL */
 
26
 
 
27
#ifndef SO_DIRECTIONALLIGHT_GLSL_H
 
28
#define SO_DIRECTIONALLIGHT_GLSL_H
 
29
 
 
30
static const char DIRECTIONALLIGHT_shadersource[] =
 
31
  "\n"
 
32
  "void DirectionalLight(in int i,\n"
 
33
  "                      in vec3 normal,\n"
 
34
  "                      inout vec4 ambient,\n"
 
35
  "                      inout vec4 diffuse,\n"
 
36
  "                      inout vec4 specular)\n"
 
37
  "{\n"
 
38
  "  float nDotVP; // normal . light direction\n"
 
39
  "  float nDotHV; // normal . light half vector\n"
 
40
  "  float pf;     // power factor\n"
 
41
  "  \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"
 
44
  "\n"
 
45
  "  float shininess = gl_FrontMaterial.shininess;   \n"
 
46
  "  if (nDotVP == 0.0) \n"
 
47
  "    pf = 0.0;\n"
 
48
  "  else\n"
 
49
  "    pf = pow(nDotHV, shininess);\n"
 
50
  "  \n"
 
51
  "  ambient += gl_LightSource[i].ambient;\n"
 
52
  "  diffuse += gl_LightSource[i].diffuse * nDotVP;\n"
 
53
  "  specular += gl_LightSource[i].specular * pf;\n"
 
54
  "}\n"
 
55
  "\n"
 
56
  "\n";
 
57
 
 
58
#endif /* ! SO_DIRECTIONALLIGHT_GLSL_H */