public static Material Load(string Name) { try { Material M = GetMaterial(Name); if (M == null) { foreach (var v in MaterialsList) { if (v.Name.GetHashCode() == Name.GetHashCode()) { M = v; } } if (M == null) { return(null); } } if (M.UseCounter == 0) { Shaders.Load(M.Shader.Name); for (int i = 0; i < M.Textures.Length; i++) { if (M.Textures[i] != null) { Textures.Load(M.Textures[i].Name); } } MATERIALS.Add(M); } M.UseCounter++; return(M); } catch { Log.WriteLineRed("Materials.Load() Exception, Name: \"{0}\"", Name); return(null); } }
public static void LoadEngineContent() { foreach (var i in Textures.TexturesList) { if (i.EngineContent) { Textures.Load(i.Name); } } foreach (var i in Shaders.ShadersList) { if (i.EngineContent) { Shaders.Load(i.Name); } } foreach (var i in Materials.MaterialsList) { if (i.EngineContent) { Materials.Load(i.Name); } } if (Settings.Debug.Enabled) { //DebugAmbientLight = Mesh.LoadFromFile("DebugAmbientLight", Engine.CombinePaths(Settings.Paths.EngineMeshes, "DebugAmbientLight.obj")); //DebugDirectionalLight = Mesh.LoadFromFile("DebugDirectionalLight", Engine.CombinePaths(Settings.Paths.EngineMeshes, "DebugDirectionalLight.obj")); //DebugPointLight = Mesh.LoadFromFile("DebugPointLight", Engine.CombinePaths(Settings.Paths.EngineMeshes, "DebugPointLight.obj")); //DebugSpotLight = Mesh.LoadFromFile("DebugSpotLight", Engine.CombinePaths(Settings.Paths.EngineMeshes, "DebugSpotLight.obj")); //DebugAmbientLight.Parts[0].Material = Materials.Load("DebugAmbientLight"); //DebugDirectionalLight.Parts[0].Material = Materials.Load("DebugDirectionalLight"); //DebugPointLight.Parts[0].Material = Materials.Load("DebugPointLight"); //DebugSpotLight.Parts[0].Material = Materials.Load("DebugSpotLight"); } }
public Material(Material Original) { Shader = Shaders.Load(Original.Shader.Name); CullFace = Original.CullFace; Transparent = Original.Transparent; Ka = Original.Ka; Kd = Original.Kd; Ks = Original.Ks; Ke = Original.Ke; Shininess = Original.Shininess; Reflection = Original.Reflection; ParallaxScale = Original.ParallaxScale; Textures = new Texture[Original.Textures.Length]; for (int i = 0; i < Textures.Length; i++) { if (Original.Textures[i] != null) { Textures[i] = LED_Engine.Textures.Load(Original.Textures[i].Name); } } }