3 |
|
|
4 |
tex = GZZGL.createTexture() |
tex = GZZGL.createTexture() |
5 |
tex.shade(128, 128, 0, 4, "RGBA", "RGBA", |
tex.shade(128, 128, 0, 4, "RGBA", "RGBA", |
6 |
"fnoise", ["scale", "0.05", "freq", "4", "df", "4", "bias", "0.5"]) |
"fnoise", ["scale", "0.05", "freq", "8", "df", "4", "bias", "0.5"]) |
7 |
|
|
8 |
class IrreguScene: |
class IrreguScene: |
9 |
def __init__(self): |
def __init__(self): |
10 |
print "Texture id:", tex.getTexId() |
print "Texture id:", tex.getTexId() |
11 |
self.iq = GZZGL.createIrregularQuad(-1, -1, 1, 1, 1.2, """ |
|
12 |
|
self.combiners = "Enable" |
13 |
|
self.initirregu() |
14 |
|
self.x1, self.y1 = 600, 450 |
15 |
|
self.combiners = "Enable" |
16 |
|
|
17 |
|
def initirregu(self): |
18 |
|
self.iq = GZZGL.createIrregularQuad(-1, -1, 1, 1, .5, """ |
19 |
PushAttrib ENABLE_BIT |
PushAttrib ENABLE_BIT |
20 |
Enable ALPHA_TEST |
Enable ALPHA_TEST |
21 |
AlphaFunc GREATER 0.2 |
AlphaFunc GREATER 0.0 |
22 |
BindTexture TEXTURE_2D %s |
BindTexture TEXTURE_2D %s |
23 |
Enable TEXTURE_2D |
Enable TEXTURE_2D |
24 |
Enable REGISTER_COMBINERS_NV |
%s REGISTER_COMBINERS_NV |
25 |
CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1 |
CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1 |
26 |
CombinerInputNV COMBINER0_NV ALPHA VARIABLE_A_NV ZERO UNSIGNED_INVERT_NV ALPHA |
CombinerInputNV COMBINER0_NV ALPHA VARIABLE_A_NV ZERO UNSIGNED_INVERT_NV ALPHA |
27 |
CombinerInputNV COMBINER0_NV ALPHA VARIABLE_B_NV TEXTURE0 SIGNED_NEGATE_NV ALPHA |
CombinerInputNV COMBINER0_NV ALPHA VARIABLE_B_NV TEXTURE0 SIGNED_NEGATE_NV ALPHA |
33 |
FinalCombinerInputNV VARIABLE_C_NV ZERO UNSIGNED_IDENTITY_NV RGB |
FinalCombinerInputNV VARIABLE_C_NV ZERO UNSIGNED_IDENTITY_NV RGB |
34 |
FinalCombinerInputNV VARIABLE_D_NV PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB |
FinalCombinerInputNV VARIABLE_D_NV PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB |
35 |
FinalCombinerInputNV VARIABLE_G_NV SPARE0_NV UNSIGNED_IDENTITY_NV ALPHA |
FinalCombinerInputNV VARIABLE_G_NV SPARE0_NV UNSIGNED_IDENTITY_NV ALPHA |
36 |
""" % tex.getTexId()) |
""" % (tex.getTexId(), self.combiners)) |
|
|
|
|
self.x1, self.y1 = 600, 450 |
|
37 |
|
|
38 |
def key(self, k): |
def key(self, k): |
39 |
if 0: pass |
if 0: pass |
41 |
elif k == "Down": self.y1 += 50 |
elif k == "Down": self.y1 += 50 |
42 |
elif k == "Left": self.x1 -= 50 |
elif k == "Left": self.x1 -= 50 |
43 |
elif k == "Right": self.x1 += 50 |
elif k == "Right": self.x1 += 50 |
44 |
|
elif k == "c": |
45 |
|
if self.combiners == "Enable": |
46 |
|
self.combiners = "Disable" |
47 |
|
else: |
48 |
|
self.combiners = "Enable" |
49 |
|
self.initirregu() |
50 |
pass |
pass |
51 |
|
|
52 |
def scene(self, vs): |
def scene(self, vs): |
53 |
putnoc(vs, background((0.1,0.4,0.5))) |
putnoc(vs, background((0.1,0.4,0.5))) |
54 |
|
|
55 |
cs1 = vs.coords.affineCoordsys(0, "1", 10, self.x1, self.y1, 100, 0, 0, 100) |
cs1 = vs.coords.affineCoordsys(0, "1", 10, self.x1, self.y1, 100, 0, 0, 100) |
56 |
cs2 = vs.coords.affineCoordsys(0, "2", 10, 600, 450, 100, 0, 0, 100) |
cs2 = vs.coords.affineCoordsys(0, "2", 10, 600, 450, 150, 0, 0, 150) |
57 |
vs.map.put(self.iq, cs1, cs2) |
vs.map.put(self.iq, cs1, cs2) |
58 |
|
|
59 |
currentScene = IrreguScene() |
currentScene = IrreguScene() |