本文整理汇总了C#中Material.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Material.Save方法的具体用法?C# Material.Save怎么用?C# Material.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Material
的用法示例。
在下文中一共展示了Material.Save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Material_SaveLoad_Test
public void Material_SaveLoad_Test()
{
MaterialExtensions.ForEach(ext =>
{
string name = "Material";
string fileName = name + ext;
var mat1 = new Material(name)
{
Shader = AssetManager.Load(@"Engine\UberShader.fx") as Shader,
DiffuseTexture = AssetManager.Load(TestHelpers.SampleTexturePath) as Texture,
UseNormalMap = true,
NormalTexture = AssetManager.Load(TestHelpers.SampleTexturePath) as Texture,
AmbientColor = Color.Black,
DiffuseColor = Color.Blue,
EmissiveColor = Color.Green,
SpecularPower = 0.03f,
SpecularColor = Color.Red,
Technique = "SimpleEffect",
UseOffsetMapping = true,
HeightMapTexture = AssetManager.Load(TestHelpers.SampleTexturePath) as Texture,
OffsetHeight = 0.01f,
};
mat1.Save(fileName);
var mat2 = Material.Load(Device, fileName, name, AssetManager);
Assert.AreEqual(name, mat2.Name);
Assert.AreEqual(mat1.Shader, mat2.Shader);
Assert.AreEqual(mat1.DiffuseTexture, mat2.DiffuseTexture);
Assert.AreEqual(mat1.UseNormalMap, mat2.UseNormalMap);
Assert.AreEqual(mat1.NormalTexture, mat2.NormalTexture);
Assert.AreEqual(mat1.AmbientColor, mat2.AmbientColor);
Assert.AreEqual(mat1.DiffuseColor, mat2.DiffuseColor);
Assert.AreEqual(mat1.SpecularPower, mat2.SpecularPower);
Assert.AreEqual(mat1.SpecularColor, mat2.SpecularColor);
Assert.AreEqual(mat1.Technique, mat2.Technique);
Assert.AreEqual(mat1.UseOffsetMapping, mat2.UseOffsetMapping);
Assert.AreEqual(mat1.HeightMapTexture, mat2.HeightMapTexture);
Assert.AreEqual(mat1.OffsetHeight, mat2.OffsetHeight);
});
}