Example #1
0
 /// <summary>
 /// Get a OpenGL materail from it's name
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public static GLMaterial Material(string key)
 {
     if (Materials.ContainsKey(key))
     {
         return(Materials[key]);
     }
     return(GLMaterial.Default());
 }
Example #2
0
        /// <summary>
        /// Create from XmlNode
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static GLMaterial CreateFrom(XmlNode node)
        {
            GLMaterial ret = new GLMaterial();

            ret.Ambiant   = ColorFromString(node.SelectSingleNode("Ambient").InnerText);
            ret.Diffuse   = ColorFromString(node.SelectSingleNode("Diffuse").InnerText);
            ret.Specular  = ColorFromString(node.SelectSingleNode("Specular").InnerText);
            ret.Shininess = double.Parse(node.SelectSingleNode("Shininess").InnerText, NumberStyles.Any, CultureInfo.InvariantCulture);
            return(ret);
        }
        /// <summary>
        /// Get Default
        /// </summary>
        /// <returns></returns>
        public static RenderingContext Default()
        {
            RenderingContext ret = new RenderingContext();

            ret.UseNormal                   = true;
            ret.UseObjectColor              = true;
            ret.Wireframe                   = false;
            ret.DefaultFaceMaterial         = GLMaterial.Default();
            ret.DefaultLineMaterial         = GLMaterial.Default();
            ret.DefaultLineMaterial.Ambiant = Color.DarkGray;
            ret.Lightning                   = true;
            return(ret);
        }
Example #4
0
        /// <summary>
        /// Get the default MAterial
        /// </summary>
        /// <returns></returns>
        public static GLMaterial Default()
        {
            GLMaterial ret = new GLMaterial();

            /*
             * ret.Ambiant = ColorExtension.ColorFromVector(new Vector4(0f, 0.25f, 0.5f, 0.0f));
             * ret.Diffuse = ColorExtension.ColorFromVector(new Vector4(0f, 0.5f, 1f, 0.0f));
             */
            ret.Ambiant   = SkinInfo.View3DBackColor;          // ColorExtension.ColorFromVector(new Vector4(0f, 0.25f, 0.5f, 0.0f));
            ret.Diffuse   = ret.Ambiant;
            ret.Specular  = ret.Ambiant.Darker();
            ret.Shininess = 1f;

            return(ret);
        }
Example #5
0
        public static Dictionary <string, GLMaterial> CreateMaterialDictionnary()
        {
            Dictionary <string, GLMaterial> ret = new Dictionary <string, GLMaterial>();

            ret.Add("", Default());

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(global::Sardauscan.Properties.Resources.OPENGL);
            XmlNodeList list = doc.SelectNodes("");

            foreach (XmlNode n in list)
            {
                string     name = n.Attributes["Name"].Value;
                GLMaterial mat  = CreateFrom(n);
                ret.Add(name, mat);
            }
            return(ret);
        }
 public void ApplyMaterial(GLMaterial mat)
 {
     mat.ToGL(Lightning);
 }
		public void ApplyMaterial(GLMaterial mat)
		{
			mat.ToGL(Lightning);
		}
Example #8
0
		/// <summary>
		/// Get the default MAterial
		/// </summary>
		/// <returns></returns>
		public static GLMaterial Default()
		{
			GLMaterial ret = new GLMaterial();
			/*
			ret.Ambiant = ColorExtension.ColorFromVector(new Vector4(0f, 0.25f, 0.5f, 0.0f));
			ret.Diffuse = ColorExtension.ColorFromVector(new Vector4(0f, 0.5f, 1f, 0.0f));
			*/
			ret.Ambiant = SkinInfo.View3DBackColor;// ColorExtension.ColorFromVector(new Vector4(0f, 0.25f, 0.5f, 0.0f));
			ret.Diffuse = ret.Ambiant;
			ret.Specular = ret.Ambiant.Darker();
			ret.Shininess = 1f;

			return ret;
		}
Example #9
0
		/// <summary>
		/// Create from XmlNode
		/// </summary>
		/// <param name="node"></param>
		/// <returns></returns>
		public static GLMaterial CreateFrom(XmlNode node)
		{
			GLMaterial ret = new GLMaterial();
			ret.Ambiant = ColorFromString(node.SelectSingleNode("Ambient").InnerText);
			ret.Diffuse = ColorFromString(node.SelectSingleNode("Diffuse").InnerText);
			ret.Specular = ColorFromString(node.SelectSingleNode("Specular").InnerText);
			ret.Shininess = double.Parse(node.SelectSingleNode("Shininess").InnerText, NumberStyles.Any, CultureInfo.InvariantCulture);
			return ret;
		}