1 |
dbg = 0 |
dbg = 0 |
2 |
|
initialized = 0 |
3 |
|
|
4 |
execfile("gfx/libcolor/spaces.py") |
execfile("gfx/libcolor/spaces.py") |
5 |
execfile("gfx/libpaper/texcoords.py") |
|
6 |
execfile("gfx/libpaper/texops_NV2X.py") |
def initialize(): |
7 |
execfile("gfx/libpaper/textures.py") |
global initialized |
8 |
execfile("gfx/libpaper/texcomb_NV2X.py") |
if initialized: return |
9 |
|
initialized = 1 |
10 |
|
dbg=1 |
11 |
|
# Discriminate between different renderers. |
12 |
|
# These are for debug output only. |
13 |
|
if dbg: |
14 |
|
vendor = GZZGL.getGLString("VENDOR") |
15 |
|
renderer = GZZGL.getGLString("RENDERER") |
16 |
|
version = GZZGL.getGLString("VERSION") |
17 |
|
print "GL strings: '%s' '%s' '%s'"%( |
18 |
|
vendor,renderer,version) |
19 |
|
extensions = GZZGL.getGLString("EXTENSIONS").split() |
20 |
|
# The backend files to load |
21 |
|
files = [ |
22 |
|
"textures.py", |
23 |
|
"texcoords.py", |
24 |
|
] |
25 |
|
# |
26 |
|
# Now, go through some questions. |
27 |
|
# |
28 |
|
|
29 |
|
# Check which texture operations to use. |
30 |
|
if "GL_NV_texture_shader" in extensions: |
31 |
|
# We can use the general texture shaders. |
32 |
|
# XXX Should check separately for texture_shader2, |
33 |
|
# otherwise it'll be SLOW. |
34 |
|
if dbg: print "Using NV20 texture shaders" |
35 |
|
files.append("texops_NV2X.py") |
36 |
|
else: |
37 |
|
if dbg: print "Using unextended OpenGL texture accesses" |
38 |
|
files.append("texops_STD.py") |
39 |
|
|
40 |
|
|
41 |
|
# Check which combiners to use. |
42 |
|
if "GL_NV_register_combiners" in extensions: |
43 |
|
# We have at least a NV10, possibly better. |
44 |
|
# Check the number of general combiners to be sure. |
45 |
|
maxcomb = GZZGL.getGLFloat("MAX_GENERAL_COMBINERS_NV")[0] |
46 |
|
if maxcomb < 2: |
47 |
|
assert 0, "Sorry, not sufficient register combiners (%s)"%maxcomb |
48 |
|
elif maxcomb < 4: |
49 |
|
# use NV10 version |
50 |
|
if dbg: print "Using NV10 combiners ",maxcomb |
51 |
|
files.append("texcomb_NV1X.py") |
52 |
|
else: |
53 |
|
# use NV20 version |
54 |
|
if dbg: print "Using NV20 combiners ",maxcomb |
55 |
|
files.append("texcomb_NV2X.py") |
56 |
|
else: |
57 |
|
assert 0, "Sorry, can't do without NVIDIA register combiners yet." |
58 |
|
|
59 |
|
for f in files: |
60 |
|
execfile("gfx/libpaper/"+f, globals()) |
61 |
|
|
62 |
|
# "gfx/libpaper/texcoords.py", |
63 |
|
# "gfx/libpaper/texops_NV2X.py", |
64 |
|
# "gfx/libpaper/textures.py", |
65 |
|
# "gfx/libpaper/texcomb_NV2X.py", |
66 |
|
dbg=0 |
67 |
|
|
68 |
def randvec(rnd): return [rnd.nextDouble() for i in range(0,3)] |
def randvec(rnd): return [rnd.nextDouble() for i in range(0,3)] |
69 |
|
|
90 |
|
|
91 |
class PaperMill: |
class PaperMill: |
92 |
def makePaperPass(self, seed, ppass, trans = 0, type = None, emboss = 0): |
def makePaperPass(self, seed, ppass, trans = 0, type = None, emboss = 0): |
93 |
|
initialize() |
94 |
rnd = java.util.Random(seed) |
rnd = java.util.Random(seed) |
95 |
#sh = ShaderPass(selectRandom(shaderTypes,rnd)) |
#sh = ShaderPass(selectRandom(shaderTypes,rnd)) |
96 |
if emboss: |
if emboss: |