~ubuntu-branches/ubuntu/quantal/rss-glx/quantal

« back to all changes in this revision

Viewing changes to src/shaders.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2009-06-03 18:41:32 UTC
  • mfrom: (1.1.5 upstream) (2.2.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090603184132-znjy66pq9xom7hac
Tags: 0.9.0-2ubuntu1
* Merge from debian unstable, remaining changes:
  - Drop dependency on openal. It is not enabled by default anyway, and
    allows openal to migrate to universe.
  - src/skyrocket.{cpp,xml}: Disable sound by default.
  - Add --disable-sound configure flag to debian/rules, as we don't keep 
    the dependencies on openal nor freeglut (both universe packages).
* Dropped changes, merged upstream:
  - other_src/Makefile.am: fix the upstream build rules to actually use
    the ImageMagick CFLAGS returned by pkg-config.
  - Move the unconditional ImageMagick check up in configure.in so that
    our first PKG_CHECK_MODULES() call isn't hidden behind a shell
    conditional.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2005  Terence M. Welsh
 
3
 *
 
4
 * This file is part of Hyperspace.
 
5
 *
 
6
 * Hyperspace is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License version 2 as 
 
8
 * published by the Free Software Foundation.
 
9
 *
 
10
 * Hyperspace is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 */
 
19
 
 
20
 
 
21
#ifndef SHADERS_H
 
22
#define SHADERS_H
 
23
 
 
24
 
 
25
 
 
26
const char* goo_vp_asm = {
 
27
"!!ARBvp1.0\n"
 
28
 
 
29
"PARAM mvp[4] = { state.matrix.mvp };\n"
 
30
"PARAM mvit[4] = { state.matrix.modelview.invtrans };\n"
 
31
 
 
32
"TEMP oPos, fogtemp;\n"
 
33
 
 
34
"DP4 oPos.x, mvp[0], vertex.position;\n"
 
35
"DP4 oPos.y, mvp[1], vertex.position;\n"
 
36
"DP4 oPos.z, mvp[2], vertex.position;\n"
 
37
"DP4 oPos.w, mvp[3], vertex.position;\n"
 
38
"MOV result.position, oPos;\n"
 
39
 
 
40
"MOV result.color, vertex.color;\n"
 
41
 
 
42
"MOV result.texcoord[0], vertex.normal;\n"
 
43
 
 
44
"# vector pointing at eye;\n"
 
45
"SUB result.texcoord[1], mvit[3], vertex.position;\n"
 
46
 
 
47
"SUB fogtemp, state.fog.params.z, oPos.z;\n"
 
48
"MUL result.fogcoord.x, fogtemp.x, state.fog.params.w;\n"
 
49
 
 
50
"END\n"
 
51
};
 
52
 
 
53
 
 
54
const char* goo_fp_asm = {
 
55
"!!ARBfp1.0\n"
 
56
 
 
57
"TEMP total, temp, eye_vec, norm, ref_vec, cube_vec, alpha;\n"
 
58
 
 
59
"# get normal from normal map\n"
 
60
"TEX norm, fragment.texcoord[0], texture[0], CUBE;\n"
 
61
"# remap to {-1, 1}\n"
 
62
"MAD norm, norm, 2.0, -1.0;\n"
 
63
"# get normal from normal map\n"
 
64
"TEX temp, fragment.texcoord[0], texture[1], CUBE;\n"
 
65
"# remap to {-1, 1}\n"
 
66
"MAD temp, temp, 2.0, -1.0;\n"
 
67
"# lerp between normals\n"
 
68
"LRP norm, fragment.color.a, temp, norm;\n"
 
69
 
 
70
"# normalize eye vector\n"
 
71
"DP3 temp.x, fragment.texcoord[1], fragment.texcoord[1];\n"
 
72
"RSQ temp.x, temp.x;\n"
 
73
"MUL eye_vec, fragment.texcoord[1], temp.x;\n"
 
74
 
 
75
"# calculate reflection vector\n"
 
76
"DP3 temp.x, eye_vec, norm;\n"
 
77
"MUL temp.x, temp.x, 2.0;\n"
 
78
"MUL temp, norm, temp.x;\n"
 
79
"SUB ref_vec, temp, eye_vec;\n"
 
80
 
 
81
"# use reflection vector to find fragment color\n"
 
82
"TEX total, ref_vec, texture[2], CUBE;\n"
 
83
 
 
84
"# modulate with vertex color\n"
 
85
"MUL_SAT total, total, fragment.color;\n"
 
86
 
 
87
"# fresnel alpha\n"
 
88
"DP3 alpha.a, norm, eye_vec;\n"
 
89
"ABS alpha.a, alpha.a;\n"
 
90
"SUB alpha.a, 1.0, alpha.a;\n"
 
91
"MUL_SAT total.a, alpha.a, alpha.a;\n"
 
92
 
 
93
"# fog\n"
 
94
"LRP result.color, fragment.fogcoord.x, total, state.fog.color;\n"
 
95
 
 
96
"END\n"
 
97
};
 
98
 
 
99
 
 
100
const char* tunnel_vp_asm = {
 
101
"!!ARBvp1.0\n"
 
102
 
 
103
"PARAM mvp[4] = { state.matrix.mvp };\n"
 
104
 
 
105
"TEMP temppos, fogtemp;\n"
 
106
 
 
107
"DP4 result.position.x, mvp[0], vertex.position;\n"
 
108
"DP4 result.position.y, mvp[1], vertex.position;\n"
 
109
"DP4 temppos.z, mvp[2], vertex.position;\n"
 
110
"MOV result.position.z, temppos.z;\n"
 
111
"DP4 result.position.w, mvp[3], vertex.position;\n"
 
112
 
 
113
"MOV result.color, vertex.color;\n"
 
114
"MOV result.texcoord[0], vertex.texcoord[0];\n"
 
115
 
 
116
"SUB fogtemp, state.fog.params.z, temppos.z;\n"
 
117
"MUL result.fogcoord.x, fogtemp.x, state.fog.params.w;\n"
 
118
 
 
119
"END\n"
 
120
};
 
121
 
 
122
 
 
123
const char* tunnel_fp_asm = {
 
124
"!!ARBfp1.0\n"
 
125
 
 
126
"TEMP temp, vertcolor, color, tex0, tex1, coord;\n"
 
127
 
 
128
"# texture\n"
 
129
"TEX tex0, fragment.texcoord[0], texture[0], 2D;\n"
 
130
"TEX tex1, fragment.texcoord[0], texture[1], 2D;\n"
 
131
"LRP tex0, fragment.color.a, tex1, tex0;\n"
 
132
"MUL color, tex0, fragment.color;\n"
 
133
 
 
134
"# higher resolution texture\n"
 
135
"MUL coord, fragment.texcoord[0], 3.0;\n"
 
136
"TEX tex0, coord, texture[0], 2D;\n"
 
137
"TEX tex1, coord, texture[1], 2D;\n"
 
138
"LRP tex0, fragment.color.a, tex1, tex0;\n"
 
139
"MUL tex0, tex0, 0.5;\n"
 
140
"MUL vertcolor, fragment.color, fragment.color;\n"
 
141
"MAD color, tex0, vertcolor, color;\n"
 
142
 
 
143
"# set alpha\n"
 
144
"MOV color.a, 1.0;\n"
 
145
 
 
146
"# fog\n"
 
147
"LRP result.color, fragment.fogcoord.x, color, state.fog.color;\n"
 
148
 
 
149
"END\n"
 
150
};
 
151
 
 
152
 
 
153
#endif
 
154