Create material in code (2.0)
by Dieter Eichert · in Torque X 2D · 03/26/2008 (9:49 am) · 2 replies
Hello,
usally i used this code to preload a whole directory of textures:
But there is no DefaultEffect anymore. Do anyone know which class is state of the art now?
thanks, max.
usally i used this code to preload a whole directory of textures:
private static void LoadMaterialDirectory(string directory, string suffix, bool translucent)
{
string[] charFiles = System.IO.Directory.GetFiles(directory);
foreach (string file in charFiles)
{
Gener material = new DefaultEffect();
material.Translucent = translucent;
material.BaseTex = file;
string name = System.IO.Path.GetFileNameWithoutExtension(file);
GarageGames.Torque.Materials.MaterialManager.Add(name + suffix, material);
}
}But there is no DefaultEffect anymore. Do anyone know which class is state of the art now?
thanks, max.
About the author
#2
now the method looks like this:
03/27/2008 (5:09 am)
Thanx.now the method looks like this:
private static void LoadMaterialDirectory(string directory, string suffix, bool translucent)
{
string[] charFiles = System.IO.Directory.GetFiles(directory);
foreach (string file in charFiles)
{
SimpleMaterial material = new SimpleMaterial();
material.IsTranslucent = translucent;
material.TextureFilename = file;
string name = System.IO.Path.GetFileNameWithoutExtension(file);
GarageGames.Torque.Materials.MaterialManager.Add(name + suffix, material);
}
}
Associate John Kanalakis
EnvyGames
John K.