this gives an error(but what is that @staticmethod?)
this gives “black screen” but no errors:
countab, countpb, countdb, countsb = 0, 0, 0, 0
class Light:
def amb_lght(cla, clb, clc, cld):
counta = countab
name = "ambient_light %d" % counta
counta += 1
alight = AmbientLight(name)
alight.setColor(VBase4(cla, clb, clc, cld))
alnp = render.attachNewNode(alight)
render.setLight(alnp)
return alnp
def pnt_lght(x, y, z, cla, clb, clc, cld):
countp = countpb
name = "point_light %d" % countp
plight = PointLight(name)
plight.setColor(VBase4(cla, clb, clc, cld))
plnp = render.attachNewNode(plight)
plnp.setPos(x, y, z)
render.setLight(plnp)
return plnp
def dir_lght(h, p, r, cla, clb, clc, cld):
countd = countdb
name = "directional_light %d" % countd
countd += 1
dlight = DirectionalLight(name)
dlight.setColor(VBase4(cla, clb, clc, cld))
dlnp = render.attachNewNode(dlight)
dlnp.setHpr(h, p, r)
render.setLight(dlnp)
return dlnp
def spot_lght_lookat(x, y, z, cla, clb, clc, cld, lens, obj):
counts = countsb
name = "directional_light %d" % counts
counts += 1
slight = Spotlight(name)
slight.setColor(VBase4(cla, clb, clc, cld))
slight.setLens(lens)
slnp = render.attachNewNode(slight)
slnp.setPos(x, y, z)
slnp.lookAt(obj)
render.setLight(slnp)
return slnp
you meant that?: