how can I get this scale in the shader ?
I prefer not to use a setShaderInput
Is there a way to get the very information panda use/create ? I don’t see something like that in the list of possible shader input: panda3d.org/manual/index.ph/List_o … der_Inputs
I believe using shader input is the only way to feed tex scale to the shader.
If you’re too lazy (who doesn’t ?) to call setShaderInput() after setTexScale(), just insert setShaderInput call inside setTexScale.
Like this :
def setTexScale(self,*args):
self.__origsetTexScale(*args)
# texture stage isn't always the 1st argument, maybe it's a NodePath
ts=filter(lambda k: type(k)==TextureStage,args)[0]
scale=self.getTexScale(ts)
numComps=scale.getNumComponents()
v4=[scale[i] for i in range(numComps)] + [0]*(4-numComps)
print v4
self.setShaderInput('scale%s'%ts.getSort(),Vec4(*v4),1)
print 'shader input set'
# saves the original setTexScale function, so it can be called later
NodePath.DtoolClassDict['__origsetTexScale']=NodePath.setTexScale
# pushes the new setTexScale above to NodePath class
Dtool_funcToMethod(setTexScale,NodePath)
del setTexScale
# test
ts=TextureStage('new stage')
NodePath('').setTexScale(ts,0.1234,5.6789)
thank
but I think I will find a another way to do what I want.
setTexScale was a useful solution since It was incorporated in panda3d, but I won’t start to hack into it just for a small graphic thing.
The main problem will be rewriting all the shader with this new input, sending it even when I don’t use a scale,…