1 |
# Register combiners for NV2x architecture, where there |
# Register combiners for NV1x architecture, where there |
2 |
# are only two of them. |
# are only two of them. |
3 |
|
|
4 |
class TransparentCombinerPass: |
class TransparentCombinerPass: |
38 |
while len(texinputs) < 4: |
while len(texinputs) < 4: |
39 |
texinputs = texinputs + texinputs |
texinputs = texinputs + texinputs |
40 |
t0, t1, t2, t3 = texinputs[0:4] |
t0, t1, t2, t3 = texinputs[0:4] |
41 |
c = """ |
c = (""" |
42 |
Enable BLEND |
Enable BLEND |
43 |
BlendFunc ONE ZERO |
BlendFunc ONE ONE |
44 |
|
BlendEquation MIN |
45 |
Disable ALPHA_TEST |
Disable ALPHA_TEST |
46 |
|
|
47 |
Enable REGISTER_COMBINERS_NV |
Enable REGISTER_COMBINERS_NV |
49 |
|
|
50 |
CombinerParameterNV CONSTANT_COLOR0_NV %(r0)s |
CombinerParameterNV CONSTANT_COLOR0_NV %(r0)s |
51 |
CombinerParameterNV CONSTANT_COLOR1_NV %(r1)s |
CombinerParameterNV CONSTANT_COLOR1_NV %(r1)s |
52 |
Color %(r2)s |
Color %(c0)s |
53 |
|
SecondaryColorEXT %(c1)s |
54 |
CombinerInputNV COMBINER0_NV RGB VARIABLE_A_NV TEXTURE%(t0)s EXPAND_NORMAL_NV RGB |
Fog FOG_COLOR %(c2)s |
55 |
CombinerInputNV COMBINER0_NV RGB VARIABLE_B_NV TEXTURE%(t1)s EXPAND_NORMAL_NV RGB |
|
56 |
CombinerInputNV COMBINER0_NV RGB VARIABLE_C_NV CONSTANT_COLOR0_NV EXPAND_NORMAL_NV RGB |
"""+ |
57 |
CombinerInputNV COMBINER0_NV RGB VARIABLE_D_NV TEXTURE%(t2)s EXPAND_NORMAL_NV RGB |
# Stage 0: calculate dot products of the textures, and of |
58 |
|
# a texture times a constant. |
59 |
|
""" |
60 |
|
CI0 RGB VARIABLE_A_NV TEXTURE%(t0)s EXPAND_NORMAL_NV RGB |
61 |
|
CI0 RGB VARIABLE_B_NV TEXTURE%(t1)s EXPAND_NORMAL_NV RGB |
62 |
|
CI0 RGB VARIABLE_C_NV CONSTANT_COLOR0_NV EXPAND_NORMAL_NV RGB |
63 |
|
CI0 RGB VARIABLE_D_NV TEXTURE%(t2)s EXPAND_NORMAL_NV RGB |
64 |
CombinerOutputNV COMBINER0_NV RGB SPARE0_NV SPARE1_NV DISCARD_NV SCALE_BY_TWO_NV NONE TRUE TRUE FALSE |
CombinerOutputNV COMBINER0_NV RGB SPARE0_NV SPARE1_NV DISCARD_NV SCALE_BY_TWO_NV NONE TRUE TRUE FALSE |
65 |
|
|
66 |
CombinerInputNV COMBINER1_NV RGB VARIABLE_A_NV CONSTANT_COLOR1_NV UNSIGNED_IDENTITY_NV RGB |
CI0 ALPHA VARIABLE_A_NV TEXTURE%(t0)s EXPAND_NORMAL_NV BLUE |
67 |
CombinerInputNV COMBINER1_NV RGB VARIABLE_B_NV SPARE0_NV UNSIGNED_IDENTITY_NV RGB |
CI0 ALPHA VARIABLE_B_NV TEXTURE%(t1)s EXPAND_NORMAL_NV BLUE |
68 |
CombinerInputNV COMBINER1_NV RGB VARIABLE_C_NV CONSTANT_COLOR1_NV UNSIGNED_IDENTITY_NV RGB |
CI0 ALPHA VARIABLE_C_NV TEXTURE%(t0)s EXPAND_NORMAL_NV ALPHA |
69 |
CombinerInputNV COMBINER1_NV RGB VARIABLE_D_NV SPARE0_NV UNSIGNED_INVERT_NV RGB |
CI0 ALPHA VARIABLE_D_NV TEXTURE%(t1)s EXPAND_NORMAL_NV ALPHA |
|
CombinerOutputNV COMBINER1_NV RGB PRIMARY_COLOR_NV SECONDARY_COLOR_NV DISCARD_NV SCALE_BY_TWO_NV NONE TRUE TRUE FALSE |
|
|
|
|
|
FinalCombinerInputNV VARIABLE_A_NV PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB |
|
|
FinalCombinerInputNV VARIABLE_B_NV SPARE0_NV UNSIGNED_IDENTITY_NV RGB |
|
|
FinalCombinerInputNV VARIABLE_C_NV SPARE1_NV UNSIGNED_IDENTITY_NV RGB |
|
|
FinalCombinerInputNV VARIABLE_D_NV ZERO UNSIGNED_IDENTITY_NV RGB |
|
|
|
|
|
CombinerInputNV COMBINER0_NV ALPHA VARIABLE_A_NV CONSTANT_COLOR0_NV UNSIGNED_IDENTITY_NV ALPHA |
|
|
CombinerInputNV COMBINER0_NV ALPHA VARIABLE_B_NV SECONDARY_COLOR_NV UNSIGNED_INVERT_NV BLUE |
|
70 |
CombinerOutputNV COMBINER0_NV ALPHA SPARE0_NV DISCARD_NV DISCARD_NV SCALE_BY_FOUR_NV NONE FALSE FALSE FALSE |
CombinerOutputNV COMBINER0_NV ALPHA SPARE0_NV DISCARD_NV DISCARD_NV SCALE_BY_FOUR_NV NONE FALSE FALSE FALSE |
71 |
|
|
|
CombinerInputNV COMBINER1_NV ALPHA VARIABLE_A_NV ZERO UNSIGNED_INVERT_NV ALPHA |
|
|
CombinerInputNV COMBINER1_NV ALPHA VARIABLE_B_NV SPARE0_NV SIGNED_IDENTITY_NV ALPHA |
|
|
CombinerOutputNV COMBINER1_NV ALPHA SPARE0_NV DISCARD_NV DISCARD_NV SCALE_BY_FOUR_NV NONE FALSE FALSE FALSE |
|
72 |
|
|
|
FinalCombinerInputNV VARIABLE_G_NV SPARE0_NV UNSIGNED_INVERT_NV ALPHA |
|
73 |
|
|
74 |
""" % locals() |
"""+ |
75 |
|
# Stage 1: mix primary and secondary as determined |
76 |
|
# by the dot product above. |
77 |
|
""" |
78 |
|
CI1 RGB VARIABLE_A_NV PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB |
79 |
|
CI1 RGB VARIABLE_B_NV SPARE0_NV UNSIGNED_IDENTITY_NV RGB |
80 |
|
CI1 RGB VARIABLE_C_NV SECONDARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB |
81 |
|
CI1 RGB VARIABLE_D_NV SPARE0_NV UNSIGNED_INVERT_NV RGB |
82 |
|
CombinerOutputNV COMBINER1_NV RGB DISCARD_NV DISCARD_NV PRIMARY_COLOR_NV NONE NONE FALSE FALSE FALSE |
83 |
|
|
84 |
|
CI1 ALPHA VARIABLE_A_NV SPARE0_NV UNSIGNED_INVERT_NV BLUE |
85 |
|
CI1 ALPHA VARIABLE_B_NV SPARE0_NV SIGNED_IDENTITY_NV ALPHA |
86 |
|
CombinerOutputNV COMBINER1_NV ALPHA SPARE0_NV DISCARD_NV DISCARD_NV SCALE_BY_FOUR_NV NONE FALSE FALSE FALSE |
87 |
|
|
88 |
|
"""+ |
89 |
|
""" |
90 |
|
FCI VARIABLE_A_NV SPARE1_NV UNSIGNED_IDENTITY_NV RGB |
91 |
|
FCI VARIABLE_B_NV PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB |
92 |
|
FCI VARIABLE_C_NV FOG UNSIGNED_IDENTITY_NV RGB |
93 |
|
FCI VARIABLE_D_NV ZERO UNSIGNED_IDENTITY_NV RGB |
94 |
|
|
95 |
|
FCI VARIABLE_G_NV SPARE0_NV UNSIGNED_INVERT_NV ALPHA |
96 |
|
|
97 |
|
""") % locals() |
98 |
|
c = (c.replace("CI0", "CombinerInputNV COMBINER0_NV"). |
99 |
|
replace("CI1", "CombinerInputNV COMBINER1_NV"). |
100 |
|
replace("FCI", "FinalCombinerInputNV")) |
101 |
|
print "c: ",c |
102 |
return c |
return c |
103 |
|
|
104 |
|
|