Example #1
0
 def getEggMaterial(self):
     if self.eggmaterial:
         return self.eggmaterial
     m = EggMaterial(self.name + "_mat")
     # XXX TODO: add support for specular, and obey illum setting
     # XXX as best as we can
     rgb = self.get("Kd")
     d = self.get("d")
     if rgb is not None:
         m.setDiff(Vec4(rgb[0], rgb[1], rgb[2], d))
     rgb = self.get("Ka")
     if rgb is not None:
         m.setAmb(Vec4(rgb[0], rgb[1], rgb[2], 1.0))
     rgb = self.get("Ks")
     if rgb is not None:
         m.setSpec(Vec4(rgb[0], rgb[1], rgb[2], 1.0))
     ns = self.get("Ns")
     if ns is not None:
         m.setShininess(ns)
     self.eggmaterial = m
     return self.eggmaterial