def __init__(self, id, surface, minfilter=None, magfilter=None, xmlnode=None): """Create a Sampler2D object. :param str id: A string identifier for the sampler within the local scope of the material :param collada.material.Surface surface: Surface instance that this object samples from :param str minfilter: Minification filter string id, see collada spec for details :param str magfilter: Maximization filter string id, see collada spec for details :param xmlnode: If loaded from xml, the xml node """ self.id = id """The string identifier for the sampler within the local scope of the material""" self.surface = surface """Surface instance that this object samples from""" self.minfilter = minfilter """Minification filter string id, see collada spec for details""" self.magfilter = magfilter """Maximization filter string id, see collada spec for details""" if xmlnode != None: self.xmlnode = xmlnode """ElementTree representation of the sampler.""" else: sampler_node = E.sampler2D(E.source(self.surface.id)) if minfilter: sampler_node.append(E.minfilter(self.minfilter)) if magfilter: sampler_node.append(E.magfilter(self.magfilter)) self.xmlnode = E.newparam(sampler_node, sid=self.id)
def __init__(self, id, img, format=None, xmlnode=None): """Creates a surface. :param str id: A string identifier for the surface within the local scope of the material :param collada.material.CImage img: The image object :param str format: The format of the image :param xmlnode: If loaded from xml, the xml node """ self.id = id """The string identifier for the surface within the local scope of the material""" self.image = img """:class:`collada.material.CImage` object from the image library.""" self.format = format if format is not None else "A8R8G8B8" """Format string.""" if xmlnode != None: self.xmlnode = xmlnode """ElementTree representation of the surface.""" else: self.xmlnode = E.newparam( E.surface( E.init_from(self.image.id), E.format(self.format) , type="2D") , sid=self.id)