void IResource.LoadFromXML(XmlNode node) { foreach (XmlAttribute attrib in node.Attributes) { string[] attribs = attrib.Name.ToLower().Split('_'); switch (attribs[0]) { case "reflect": Reflect = bool.Parse(attrib.Value); break; case "refract": Refract = bool.Parse(attrib.Value); break; case "transmissive": Transmissive = bool.Parse(attrib.Value); break; case "transparent": Transparent = bool.Parse(attrib.Value); break; case "emissive": IsEmissive = bool.Parse(attrib.Value); break; case "emissivematerial": EmissiveMaterial = attrib.Value; break; case "kreflect": kReflect = float.Parse(attrib.Value); break; case "krefract": kRefract = float.Parse(attrib.Value); break; case "kior": kIOR = float.Parse(attrib.Value); break; case "ktrans": kTrans = float.Parse(attrib.Value); break; case "kambient": kAmbient = ResourceManager.Inst.ParseVector3(attrib.Value); break; case "kdiffuse": kDiffuse = ResourceManager.Inst.ParseVector3(attrib.Value); break; case "kspecular": kSpecular = ResourceManager.Inst.ParseVector3(attrib.Value); break; case "kspecpower": kSpecularPower = float.Parse(attrib.Value); break; case "krimcoeff": kRimCoeff = float.Parse(attrib.Value); break; case "texture": int index = int.Parse(attribs[1]); textures[index] = ResourceManager.Inst.GetTexture(attrib.Value); break; case "shader": shader = ResourceManager.Inst.GetShader(attrib.Value); break; case "name": name = attrib.Value; break; } } }
public void SetShader(Shader newShader) { this.shader = newShader; }