~ubuntu-branches/debian/squeeze/stella/squeeze

« back to all changes in this revision

Viewing changes to src/common/GLShaderProgs.hxx

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Kitt
  • Date: 2010-07-12 23:49:36 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100712234936-juawrr3etzhr2qpv
Tags: 3.1.2-1
* New maintainer (closes: #532039).
* New upstream version (closes: #461121):
  - includes launcher (closes: #396058).
* Fix the reference to the X Window System in the description (closes:
  #411815).
* Move to main, DFSG-free ROMs are available (see README.Debian).
* Enhance the package description.
* Drop the libslang2-dev dependency (closes: #560274).
* Remove the Encoding entry from stella.desktop.
* Avoid ignoring errors when cleaning.
* Add ${misc:Depends} to the package dependencies.
* Provide a doc-base file to install the documentation using doc-base.
* Switch to debhelper 7 with a simplified rules file.
* Use autotools-dev to provide updated configuration files.
* Update to Standards-Version 3.9.0:
  - Move to menu section Applications/Emulators.
  - Move the homepage declaration.
* Re-write the manpage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//============================================================================
 
2
//
 
3
//   SSSS    tt          lll  lll
 
4
//  SS  SS   tt           ll   ll
 
5
//  SS     tttttt  eeee   ll   ll   aaaa
 
6
//   SSSS    tt   ee  ee  ll   ll      aa
 
7
//      SS   tt   eeeeee  ll   ll   aaaaa  --  "An Atari 2600 VCS Emulator"
 
8
//  SS  SS   tt   ee      ll   ll  aa  aa
 
9
//   SSSS     ttt  eeeee llll llll  aaaaa
 
10
//
 
11
// Copyright (c) 1995-2010 by Bradford W. Mott, Stephen Anthony
 
12
// and the Stella Team
 
13
//
 
14
// See the file "License.txt" for information on usage and redistribution of
 
15
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
 
16
//
 
17
// $Id: GLShaderProgs.hxx 2001 2010-04-10 21:37:23Z stephena $
 
18
//============================================================================
 
19
 
 
20
#ifndef GL_SHADER_PROGS_HXX
 
21
#define GL_SHADER_PROGS_HXX
 
22
 
 
23
/**
 
24
  This code is generated using the 'create_shaders.pl' script,
 
25
  located in the src/tools directory.
 
26
*/
 
27
 
 
28
namespace GLShader {
 
29
 
 
30
static const char* bleed_frag[] = {
 
31
"uniform sampler2D tex;\n"
 
32
"uniform float pH;\n"
 
33
"uniform float pW;\n"
 
34
"uniform float pWx2;\n"
 
35
"\n"
 
36
"void main()\n"
 
37
"{\n"
 
38
"       // Save current color\n"
 
39
"       vec4 current = texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t));\n"
 
40
"\n"
 
41
"       // Box filter\n"
 
42
"       // Comments for position are given in (x,y) coordinates with the current pixel as the origin\n"
 
43
"       vec4 color = ( \n"
 
44
"               // (-1,1)\n"
 
45
"               texture2D(tex, vec2(gl_TexCoord[0].s-pW, gl_TexCoord[0].t+pH))\n"
 
46
"               // (0,1)\n"
 
47
"               + texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t+pH))\n"
 
48
"               // (1,1)\n"
 
49
"               + texture2D(tex, vec2(gl_TexCoord[0].s+pW, gl_TexCoord[0].t+pH))\n"
 
50
"               // (-1,0)\n"
 
51
"               + texture2D(tex, vec2(gl_TexCoord[0].s-pW, gl_TexCoord[0].t))\n"
 
52
"               // (0,0)\n"
 
53
"               + current\n"
 
54
"               // (1,0)\n"
 
55
"               + texture2D(tex, vec2(gl_TexCoord[0].s+pW, gl_TexCoord[0].t))\n"
 
56
"               // (-1,-1)\n"
 
57
"               + texture2D(tex, vec2(gl_TexCoord[0].s-pW, gl_TexCoord[0].t-pH))\n"
 
58
"               // (0,-1)\n"
 
59
"               + texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t-pH))\n"
 
60
"               // (1,-1)\n"
 
61
"               + texture2D(tex, vec2(gl_TexCoord[0].s+pW, gl_TexCoord[0].t-pH))\n"
 
62
"\n"
 
63
"               // Make it wider\n"
 
64
"               // (-2,1)\n"
 
65
"               + texture2D(tex, vec2(gl_TexCoord[0].s-pWx2, gl_TexCoord[0].t+pH))\n"
 
66
"               // (-2,0)\n"
 
67
"               + texture2D(tex, vec2(gl_TexCoord[0].s-pWx2, gl_TexCoord[0].t))\n"
 
68
"               // (-2,-1)\n"
 
69
"               + texture2D(tex, vec2(gl_TexCoord[0].s-pWx2, gl_TexCoord[0].t-pH))\n"
 
70
"               // (2,1)\n"
 
71
"               + texture2D(tex, vec2(gl_TexCoord[0].s+pWx2, gl_TexCoord[0].t+pH))\n"
 
72
"               // (2,0)\n"
 
73
"               + texture2D(tex, vec2(gl_TexCoord[0].s+pWx2, gl_TexCoord[0].t))\n"
 
74
"               // (2,-1)\n"
 
75
"               + texture2D(tex, vec2(gl_TexCoord[0].s+pWx2, gl_TexCoord[0].t-pH))\n"
 
76
"               ) / 15.0;\n"
 
77
"\n"
 
78
"       // Make darker colors not bleed over lighter colors (act like light)\n"
 
79
"       color =  vec4(max(current.x, color.x), max(current.y, color.y), max(current.z, color.z), 1.0);\n"
 
80
"\n"
 
81
"       gl_FragColor = color;\n"
 
82
"}\n"
 
83
"\0"
 
84
};
 
85
 
 
86
static const char* noise_frag[] = {
 
87
"uniform sampler2D tex;\n"
 
88
"uniform sampler2D mask;\n"
 
89
"\n"
 
90
"void main()\n"
 
91
"{\n"
 
92
"       gl_FragColor =\n"
 
93
"               texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t))\n"
 
94
"               + texture2D(mask, vec2(gl_TexCoord[1].s, gl_TexCoord[1].t))\n"
 
95
"       ;\n"
 
96
"}\n"
 
97
"\0"
 
98
};
 
99
 
 
100
static const char* phosphor_frag[] = {
 
101
"uniform sampler2D tex;\n"
 
102
"uniform sampler2D mask;\n"
 
103
"\n"
 
104
"void main()\n"
 
105
"{\n"
 
106
"       gl_FragColor =\n"
 
107
"               0.65 * texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t))\n"
 
108
"               + 0.35 * texture2D(mask, vec2(gl_TexCoord[1].s, gl_TexCoord[1].t))\n"
 
109
"       ;\n"
 
110
"}\n"
 
111
"\0"
 
112
};
 
113
 
 
114
static const char* texture_frag[] = {
 
115
"uniform sampler2D tex;\n"
 
116
"uniform sampler2D mask;\n"
 
117
"\n"
 
118
"void main()\n"
 
119
"{\n"
 
120
"       gl_FragColor =\n"
 
121
"               texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t))\n"
 
122
"               * texture2D(mask, vec2(gl_TexCoord[1].s, gl_TexCoord[1].t))\n"
 
123
"               * 1.05\n"
 
124
"               + 0.07\n"
 
125
"       ;\n"
 
126
"}\n"
 
127
"\0"
 
128
};
 
129
 
 
130
static const char* texture_noise_frag[] = {
 
131
"uniform sampler2D tex;\n"
 
132
"uniform sampler2D texMask;\n"
 
133
"uniform sampler2D noiseMask;\n"
 
134
"\n"
 
135
"void main()\n"
 
136
"{\n"
 
137
"       gl_FragColor =\n"
 
138
"               // Texture part\n"
 
139
"               texture2D(tex, vec2(gl_TexCoord[0].s, gl_TexCoord[0].t))\n"
 
140
"               * texture2D(texMask, vec2(gl_TexCoord[1].s, gl_TexCoord[1].t))\n"
 
141
"               * 1.05\n"
 
142
"               + 0.07\n"
 
143
"               // Noise part\n"
 
144
"               + texture2D(noiseMask, vec2(gl_TexCoord[1].s, gl_TexCoord[1].t))\n"
 
145
"       ;\n"
 
146
"}\n"
 
147
"\0"
 
148
};
 
149
 
 
150
} // namespace GLShader
 
151
 
 
152
#endif