File: vtkVolumeTextureMapper3D_OneComponentShadeFP.asm

package info (click to toggle)
paraview 3.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 124,600 kB
  • ctags: 133,728
  • sloc: cpp: 958,817; ansic: 509,658; tcl: 45,787; xml: 23,401; python: 19,574; perl: 3,112; yacc: 1,787; java: 1,517; sh: 665; asm: 471; lex: 400; makefile: 168; objc: 28
file content (96 lines) | stat: -rwxr-xr-x 2,335 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
!!ARBfp1.0
	
# This is the fragment program for one
# component data with shading	

# We need some temporary variables		
TEMP index, normal, finalColor;
TEMP temp1, temp2, temp3; 
TEMP sampleColor;
TEMP ndotl, ndoth, ndotv; 
TEMP lightInfo, lightResult;
	 
# We are going to use the first 
# texture coordinate		
ATTRIB tex0 = fragment.texcoord[0];

# This is the lighting information
PARAM lightDirection = program.local[0];
PARAM halfwayVector  = program.local[1];
PARAM coefficient    = program.local[2];
PARAM lightDiffColor = program.local[3]; 
PARAM lightSpecColor = program.local[4]; 
PARAM viewVector     = program.local[5];
PARAM constants      = program.local[6];
	
# This is our output color
OUTPUT out = result.color;

# Look up the scalar value / gradient
# magnitude in the first volume	
TEX temp1, tex0, texture[0], 3D;

# Look up the gradient direction
# in the third volume	
TEX temp2, tex0, texture[2], 3D;

# This normal is stored 0 to 1, change to -1 to 1
# by multiplying by 2.0 then adding -1.0.	
MAD normal, temp2, constants.x, constants.y;
	
# Swizzle this to use (a,r) as texture
# coordinates	
SWZ index, temp1, a, r, 1, 1;

# Use this coordinate to look up a 
# final color in the third texture
# (this is a 2D texture)			
TEX sampleColor, index, texture[1], 2D;

# Take the dot product of the light
# direction and the normal
DP3 ndotl, normal, lightDirection;

# Take the dot product of the halfway
# vector and the normal		
DP3 ndoth, normal, halfwayVector;

DP3 ndotv, normal, viewVector;
	 
# flip if necessary for two sided lighting
MUL temp3, ndotl, constants.y; 
CMP ndotl, ndotv, ndotl, temp3;
MUL temp3, ndoth, constants.y; 
CMP ndoth, ndotv, ndoth, temp3;
	 
# put the pieces together for a LIT operation		
MOV lightInfo.x, ndotl.x; 
MOV lightInfo.y, ndoth.x; 
MOV lightInfo.w, coefficient.w; 

# compute the lighting	
LIT lightResult, lightInfo;

# This is the ambient contribution	
MUL finalColor, coefficient.x, sampleColor;

# This is the diffuse contribution	
MUL temp3, lightDiffColor, sampleColor;
MUL temp3, temp3, lightResult.y;
ADD finalColor, finalColor, temp3;

# This is th specular contribution	
MUL temp3, lightSpecColor, lightResult.z; 
	
# Add specular into result so far, and replace
# with the original alpha.	
ADD out, finalColor, temp3;
MOV out.w, sampleColor.w;
	 
END