2
* Copyright (C) 2005 Terence M. Welsh
4
* This file is part of Hyperspace.
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.
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.
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
26
const char* goo_vp_asm = {
29
"PARAM mvp[4] = { state.matrix.mvp };\n"
30
"PARAM mvit[4] = { state.matrix.modelview.invtrans };\n"
32
"TEMP oPos, fogtemp;\n"
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"
40
"MOV result.color, vertex.color;\n"
42
"MOV result.texcoord[0], vertex.normal;\n"
44
"# vector pointing at eye;\n"
45
"SUB result.texcoord[1], mvit[3], vertex.position;\n"
47
"SUB fogtemp, state.fog.params.z, oPos.z;\n"
48
"MUL result.fogcoord.x, fogtemp.x, state.fog.params.w;\n"
54
const char* goo_fp_asm = {
57
"TEMP total, temp, eye_vec, norm, ref_vec, cube_vec, alpha;\n"
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"
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"
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"
81
"# use reflection vector to find fragment color\n"
82
"TEX total, ref_vec, texture[2], CUBE;\n"
84
"# modulate with vertex color\n"
85
"MUL_SAT total, total, fragment.color;\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"
94
"LRP result.color, fragment.fogcoord.x, total, state.fog.color;\n"
100
const char* tunnel_vp_asm = {
103
"PARAM mvp[4] = { state.matrix.mvp };\n"
105
"TEMP temppos, fogtemp;\n"
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"
113
"MOV result.color, vertex.color;\n"
114
"MOV result.texcoord[0], vertex.texcoord[0];\n"
116
"SUB fogtemp, state.fog.params.z, temppos.z;\n"
117
"MUL result.fogcoord.x, fogtemp.x, state.fog.params.w;\n"
123
const char* tunnel_fp_asm = {
126
"TEMP temp, vertcolor, color, tex0, tex1, coord;\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"
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"
144
"MOV color.a, 1.0;\n"
147
"LRP result.color, fragment.fogcoord.x, color, state.fog.color;\n"