94 |
pass |
pass |
95 |
|
|
96 |
class ShaderPass: |
class ShaderPass: |
97 |
def __init__(self, shaderType, maxaniso): |
def __init__(self, shaderType): |
98 |
self.st = shaderType |
self.st = shaderType |
99 |
self.tex = [None for texunit in shaderType] |
self.tex = [None for texunit in shaderType] |
|
self.maxaniso = maxaniso |
|
100 |
def getTextureTypes(self): |
def getTextureTypes(self): |
101 |
"Get the texture type names (D2, R2 ...) for the texture units." |
"Get the texture type names (D2, R2 ...) for the texture units." |
102 |
return [texunit[1] for texunit in self.st] |
return [texunit[1] for texunit in self.st] |
122 |
|
|
123 |
if target != None: |
if target != None: |
124 |
texid = self.tex[t].getTexId() |
texid = self.tex[t].getTexId() |
|
minfilter = self.tex[t].minfilter |
|
|
magfilter = self.tex[t].magfilter |
|
125 |
if texid == None: raise NoTextureSetForStage() |
if texid == None: raise NoTextureSetForStage() |
126 |
c += """ |
c += """ |
127 |
Enable %(target)s |
Enable %(target)s |
128 |
BindTexture %(target)s %(texid)s |
BindTexture %(target)s %(texid)s |
|
|
|
|
TexParameter %(target)s TEXTURE_WRAP_S REPEAT |
|
|
TexParameter %(target)s TEXTURE_WRAP_T REPEAT |
|
|
TexParameter %(target)s TEXTURE_MIN_FILTER %(minfilter)s |
|
|
TexParameter %(target)s TEXTURE_MAG_FILTER %(magfilter)s |
|
129 |
""" % locals() |
""" % locals() |
130 |
if len(self.st[t]) > 2: # Previous texture input |
if len(self.st[t]) > 2: # Previous texture input |
131 |
c += """ |
c += """ |
142 |
TexEnv TEXTURE_SHADER_NV OFFSET_TEXTURE_MATRIX_NV %s %s %s %s |
TexEnv TEXTURE_SHADER_NV OFFSET_TEXTURE_MATRIX_NV %s %s %s %s |
143 |
""" % mat |
""" % mat |
144 |
|
|
|
|
|
|
if self.maxaniso != None: |
|
|
maxaniso = self.maxaniso |
|
|
c += """ |
|
|
TexParameter %(target)s TEXTURE_MAX_ANISOTROPY_EXT %(maxaniso)s |
|
|
""" % locals() |
|
|
|
|
145 |
return c |
return c |
146 |
def getRGBoutputs(self): |
def getRGBoutputs(self): |
147 |
"""A list of the texture units whose outputs are useful in |
"""A list of the texture units whose outputs are useful in |
153 |
def getRGBoutputscales(self): |
def getRGBoutputscales(self): |
154 |
return [self.tex[i].scale for i in self.getRGBoutputs()] |
return [self.tex[i].scale for i in self.getRGBoutputs()] |
155 |
|
|
156 |
def makeNormalShaderPass(maxaniso = None): |
def makeNormalShaderPass(): |
157 |
return ShaderPass(shaderTypes[5], maxaniso) |
return ShaderPass(shaderTypes[5]) |
158 |
|
|
159 |
scaleFactor = 1.5 |
scaleFactor = 1.5 |