1 |
dbg = 0 |
#initialized = 0 |
2 |
initialized = 0 |
|
3 |
|
from gfx.libutil.myimport import my_import |
4 |
|
|
5 |
import gfx.libpaper.textures |
my_import("gfx.libpaper.textures") |
|
reload(gfx.libpaper.textures) |
|
6 |
from gfx.libpaper.textures import Textures |
from gfx.libpaper.textures import Textures |
7 |
|
|
8 |
import gfx.libpaper.colors |
my_import("gfx.libpaper.colors") |
|
reload(gfx.libpaper.colors) |
|
9 |
from gfx.libpaper.colors import Colors |
from gfx.libpaper.colors import Colors |
10 |
|
|
11 |
|
my_import("gfx.libpaper.texcoords") |
12 |
|
from gfx.libpaper.texcoords import TexGenXYRepeatUnit |
13 |
|
|
14 |
|
my_import("gfx.libpaper.params") |
15 |
|
from gfx.libpaper.params import * |
16 |
|
|
17 |
from gzz.gfx.gl import GL,GLRen,Paper,PaperMill |
from gzz.gfx.gl import GL,GLRen,Paper,PaperMill |
18 |
import java |
import java |
19 |
from java.lang import Math |
from java.lang import Math |
20 |
def initialize(): |
|
21 |
global initialized |
#def initialize(): |
22 |
if initialized: return |
if 1: |
23 |
initialized = 1 |
#global initialized |
24 |
|
#if initialized: return |
25 |
|
#initialized = 1 |
26 |
dbg=1 |
dbg=1 |
27 |
# Discriminate between different renderers. |
# Discriminate between different renderers. |
28 |
# These are for debug output only. |
# These are for debug output only. |
35 |
# The backend files to load |
# The backend files to load |
36 |
files = [ |
files = [ |
37 |
#"textures.py", |
#"textures.py", |
38 |
"texcoords.py", |
#"texcoords.py", |
39 |
#"colors.py", |
#"colors.py", |
40 |
"params.py" |
#"params.py" |
41 |
] |
] |
42 |
|
|
43 |
# |
# |
50 |
# XXX Should check separately for texture_shader2, |
# XXX Should check separately for texture_shader2, |
51 |
# otherwise it'll be SLOW. |
# otherwise it'll be SLOW. |
52 |
if dbg: print "Using NV20 texture shaders" |
if dbg: print "Using NV20 texture shaders" |
53 |
files.append("texops_NV2X.py") |
#files.append("texops_NV2X.py") |
54 |
#from gfx.libpaper.texops_NV2X import * |
my_import("gfx.libpaper.texops_NV2X") |
55 |
|
from gfx.libpaper.texops_NV2X import * |
56 |
|
|
57 |
else: |
else: |
58 |
if dbg: print "Using unextended OpenGL texture accesses" |
if dbg: print "Using unextended OpenGL texture accesses" |
59 |
files.append("texops_STD.py") |
#files.append("texops_STD.py") |
60 |
#from gfx.libpaper.texops_STD import * |
my_import("gfx.libpaper.texops_STD") |
61 |
|
from gfx.libpaper.texops_STD import * |
62 |
|
|
63 |
|
|
64 |
# Check which combiners to use. |
# Check which combiners to use. |
69 |
if maxcomb < 4: |
if maxcomb < 4: |
70 |
# use NV10 version |
# use NV10 version |
71 |
if dbg: print "Using NV10 combiners ",maxcomb |
if dbg: print "Using NV10 combiners ",maxcomb |
72 |
files.append("texcomb_NV1X.py") |
#files.append("texcomb_NV1X.py") |
73 |
|
my_import("gfx.libpaper.texcomb_NV1X") |
74 |
|
from gfx.libpaper.texcomb_NV1X import * |
75 |
else: |
else: |
76 |
# use NV20 version |
# use NV20 version |
77 |
if dbg: print "Using NV20 combiners ",maxcomb |
if dbg: print "Using NV20 combiners ",maxcomb |
78 |
files.append("texcomb_NV2X.py") |
#files.append("texcomb_NV2X.py") |
79 |
|
my_import("gfx.libpaper.texcomb_NV2X") |
80 |
|
from gfx.libpaper.texcomb_NV2X import * |
81 |
else: |
else: |
82 |
assert 0, "Sorry, can't do without NVIDIA register combiners yet." |
assert 0, "Sorry, can't do without NVIDIA register combiners yet." |
83 |
|
|
85 |
print "Load file ",f |
print "Load file ",f |
86 |
execfile("gfx/libpaper/"+f, globals()) |
execfile("gfx/libpaper/"+f, globals()) |
87 |
|
|
88 |
|
dbg = 0 |
89 |
|
|
90 |
def randvec(rnd): return [rnd.nextDouble() for i in range(0,3)] |
def randvec(rnd): return [rnd.nextDouble() for i in range(0,3)] |
91 |
|
|
92 |
def randunitvec(rnd): |
def randunitvec(rnd): |
128 |
pas.setTeardowncode("PopAttrib") |
pas.setTeardowncode("PopAttrib") |
129 |
|
|
130 |
class ThePaperMill(PaperMill): |
class ThePaperMill(PaperMill): |
131 |
initialize() |
#initialize() |
132 |
|
|
133 |
def getPaper(self, seed, passmask=[1,1,1,1,1,1,1]): |
def getPaper(self, seed, passmask=[1,1,1,1,1,1,1]): |
134 |
reg = Registry() |
reg = Registry() |