collada.material.Effect¶
-
class
collada.material.Effect(id, params, shadingtype, bumpmap=None, double_sided=False, emission=(0.0, 0.0, 0.0, 1.0), ambient=(0.0, 0.0, 0.0, 1.0), diffuse=(0.0, 0.0, 0.0, 1.0), specular=(0.0, 0.0, 0.0, 1.0), shininess=0.0, reflective=(0.0, 0.0, 0.0, 1.0), reflectivity=0.0, transparent=(0.0, 0.0, 0.0, 1.0), transparency=None, index_of_refraction=None, opaque_mode=None, xmlnode=None)¶ Bases:
collada.common.DaeObjectClass containing data coming from an <effect> tag.
-
__init__(id, params, shadingtype, bumpmap=None, double_sided=False, emission=(0.0, 0.0, 0.0, 1.0), ambient=(0.0, 0.0, 0.0, 1.0), diffuse=(0.0, 0.0, 0.0, 1.0), specular=(0.0, 0.0, 0.0, 1.0), shininess=0.0, reflective=(0.0, 0.0, 0.0, 1.0), reflectivity=0.0, transparent=(0.0, 0.0, 0.0, 1.0), transparency=None, index_of_refraction=None, opaque_mode=None, xmlnode=None)¶ Create an effect instance out of properties.
Parameters: - id (str) – A string identifier for the effect
- params (list) – A list containing elements of type
collada.material.Sampler2Dandcollada.material.Surface - shadingtype (str) – The type of shader to be used for this effect. Right now, we
only supper the shaders listed in
shaders - bumpmap (collada.material.Map) – The bump map for this effect, or None if there isn’t one
- double_sided (bool) – Whether or not the material should be rendered double sided
- emission – Either an RGBA-format tuple of four floats or an instance
of
collada.material.Map - ambient – Either an RGBA-format tuple of four floats or an instance
of
collada.material.Map - diffuse – Either an RGBA-format tuple of four floats or an instance
of
collada.material.Map - specular – Either an RGBA-format tuple of four floats or an instance
of
collada.material.Map - shininess – Either a single float or an instance of
collada.material.Map - reflective – Either an RGBA-format tuple of four floats or an instance
of
collada.material.Map - reflectivity – Either a single float or an instance of
collada.material.Map - transparent (tuple) – Either an RGBA-format tuple of four floats or an instance
of
collada.material.Map - transparency – Either a single float or an instance of
collada.material.Map - index_of_refraction (float) – A single float indicating the index of refraction for perfectly refracted light
- opaque_mode (collada.material.OPAQUE_MODE) – The opaque mode for the effect. If not specified, defaults to A_ONE.
- xmlnode – If loaded from xml, the xml node
Methods
__init__(id, params, shadingtype[, bumpmap, …])Create an effect instance out of properties. load(collada, localscope, node)Load and return a class instance from an XML node. save()Saves the effect back to xmlnode-
supported= ['emission', 'ambient', 'diffuse', 'specular', 'shininess', 'reflective', 'reflectivity', 'transparent', 'transparency', 'index_of_refraction']¶ Supported material properties list.
-
shaders= ['phong', 'lambert', 'blinn', 'constant']¶ Supported shader list.
-
id= None¶ The string identifier for the effect
-
params= None¶ A list containing elements of type
collada.material.Sampler2Dandcollada.material.Surface
-
shadingtype= None¶ String with the type of the shading.
-
bumpmap= None¶ Either the bump map of the effect of type
collada.material.Mapor None if there is none.
-
double_sided= None¶ A boolean indicating whether or not the material should be rendered double sided
-
emission= None¶ Either an RGB-format tuple of three floats or an instance of
collada.material.Map
-
ambient= None¶ Either an RGB-format tuple of three floats or an instance of
collada.material.Map
-
diffuse= None¶ Either an RGB-format tuple of three floats or an instance of
collada.material.Map
-
specular= None¶ Either an RGB-format tuple of three floats or an instance of
collada.material.Map
-
shininess= None¶ Either a single float or an instance of
collada.material.Map
-
reflective= None¶ Either an RGB-format tuple of three floats or an instance of
collada.material.Map
-
reflectivity= None¶ Either a single float or an instance of
collada.material.Map
-
transparent= None¶ Either an RGB-format tuple of three floats or an instance of
collada.material.Map
-
index_of_refraction= None¶ A single float indicating the index of refraction for perfectly refracted light
-
opaque_mode= None¶ The opaque mode for the effect. An instance of
collada.material.OPAQUE_MODE.
-
transparency= None¶ Either a single float or an instance of
collada.material.Map
-
xmlnode= None¶ ElementTree representation of the effect
-
static
load(collada, localscope, node)¶ Load and return a class instance from an XML node.
Inspect the data inside node, which must match this class tag and create an instance out of it.
Parameters: - collada (collada.Collada) – The collada file object where this object lives
- localscope (dict) – If there is a local scope where we should look for local ids (sid) this is the dictionary. Otherwise empty dict ({})
- node – An Element from python’s ElementTree API
-
almostEqual(other)¶ Checks if this effect is almost equal (within float precision) to the given effect.
Parameters: other (collada.material.Effect) – Effect to compare to Return type: bool
-