addLight(), setMaterial(), unsetMaterial()

Define the shading of an element. Shading results from the general lighting situation and the kind of surface materials that are assigned to the various elements in the scene. The class reference elaborates on Lights and Materials.

<world>.addLight(lightobj)
<sprite>.addLight(lightobj)
<tag>.addLight(lightobj)
  • lightobj ... object that is instanced from a class that inherits from slut.light.Light

<world>.setMaterial(materialobj)
<sprite>.setMaterial(materialobj)
<tag>.setMaterial(materialobj)
  • materialobj ... object that is instanced from a class that inherits from slut.material.Material

<world>.unsetMaterial(materialobj)
<sprite>.unsetMaterial(materialobj)
<tag>.unsetMaterial(materialobj)
  • materialobj ... object that is instanced from a class that inherits from slut.material.Material

Relevant examples: shading.py

In Context

def onSetup(self):
    whitematerial = MaterialWhite('matWhite')

    globallight = LightBlue('blu', 
    	pos=(-2.0, 5.0, 0.0, 1.0), dir=(0.0, -1.0, 0.0))
    self.addLight(globallight)

    sp = Sphere(self, 'sph1')
    sp.setMaterial(whitematerial)
Initiated by Stephan Hechenberger
Thanks to CADRE's 103