17 |
profiles = [] |
profiles = [] |
18 |
|
|
19 |
|
|
20 |
|
if (GL.hasExtension("GL_NV_fragment_program")): |
21 |
|
profiles.append("NV_PROG") |
22 |
|
|
23 |
if (GL.hasExtension("GL_NV_texture_shader")): |
if (GL.hasExtension("GL_NV_texture_shader")): |
24 |
profiles.append("NV_SHAD") |
profiles.append("NV_SHAD") |
25 |
|
|
61 |
using_shader = 0 |
using_shader = 0 |
62 |
using_secondary_color = 0 |
using_secondary_color = 0 |
63 |
using_multitex = 0 |
using_multitex = 0 |
64 |
|
|
65 |
|
if profile == "NV_PROG": |
66 |
|
code = """!FP1.0; |
67 |
|
# Compute one pixel difference of texcoords in R0 |
68 |
|
DDX R0, f[TEX0]; |
69 |
|
DDY R1, f[TEX0]; |
70 |
|
MUL R0, R0, R0; |
71 |
|
MAD R0, R1, R1; |
72 |
|
RSQ R1.x, R0.x; |
73 |
|
RSQ R1.y, R0.y; |
74 |
|
MUL R0, R1; |
75 |
|
|
76 |
|
# Compute texcoord +/- 1 pixel |
77 |
|
ADD R1, f[TEX0], R0; |
78 |
|
ADD R2, f[TEX0], -R0; |
79 |
|
|
80 |
|
# Compute texcoord +/- 2 pixels |
81 |
|
ADD R3, R1, R0; |
82 |
|
ADD R4, R2, -R0; |
83 |
|
|
84 |
|
# Read texture |
85 |
|
TEX R0, R0, TEX0, 2D; |
86 |
|
TEX R1, R1, TEX0, 2D; |
87 |
|
TEX R2, R2, TEX0, 2D; |
88 |
|
TEX R3, R3, TEX0, 2D; |
89 |
|
TEX R4, R4, TEX0, 2D; |
90 |
|
|
91 |
|
# Add c * sqrt(1 - r^2) |
92 |
|
... |
93 |
|
|
94 |
|
# Take maximum |
95 |
|
... |
96 |
|
|
97 |
|
""" |
98 |
|
|
99 |
if profile == "NV_SHAD": |
if profile == "NV_SHAD": |
100 |
print "Using 2-vector HILO displacement texture with GL_NV_texture_shader" |
print "Using 2-vector HILO displacement texture with GL_NV_texture_shader" |