hello.
I continue my work, tying to make my code works in panda 1.5
I have another problem. This time, though, i know it’s all thanks to my crappy coding.
The aim is to make a button that switch between a shadow_mapping shader and the default shader. ( the shadow_mapping is the same shader with just a shadow map included )
The problem is to get the same shaderInput
I’m wondering how’s the “right way” to do that.
Here’s my code., in 1.42 there is no problem, (apart from the ugliness,… ).
Mesh ‘creation’:
self.mesh.setShader(loader.loadShader('mesh.sha'))
ts1 = TextureStage('texture')
self.mesh.setTexture(ts1,self.default_textures[0])
ts2 =TextureStage('normalmap')
self.mesh.setTexture(ts2,self.default_textures[1])
self.mesh.setShaderInput('direction',self.direction[0],self.direction[1],self.direction[2]) self.mesh.setShaderInput('directiono',self.direction_ortho[0],self.direction_ortho[1],self.direction_ortho[2])
self.mesh.setTag("material_type","mesh")
and the ‘switch’, activate…
myShaderAttrib = ShaderAttrib.make()
myShaderAttrib = myShaderAttrib.setShaderInput('light',self.LCam)
myShaderAttrib = MyShaderAttrib.setShaderInput('Ldepthmap',self.Ldepthmap)
myShaderAttrib = myShaderAttrib.setShaderInput('offset',Vec4(self.Xoffset,self.Yoffset,self.Doffset,0))
shadowshader = loader.loadShader('shadow_mapping.sha'))
standard_attrib = myShaderAttrib.setShader(shadowshader)
standard_state = render.getState().addAttrib(standard_attrib)
base.cam.node().setTagStateKey("material_type")
base.cam.node().setTagState('mesh',standard_state)
[other material_type]
…and deactivate:
base.cam.node().setInitialState(render.getState())
base.cam.node().setTagState('mesh' ,render.getState())
error in 1.5:
Assertion failed: Shader input directiono is not present.
at line 323 of c:\temp\mkpr\panda\src\pgraph\shaderAttrib.cxx
Assertion failed: Shader input direction is not present.
at line 323 of c:\temp\mkpr\panda\src\pgraph\shaderAttrib.cxx
thanks