本文整理汇总了C#中Scene.addMaterial方法的典型用法代码示例。如果您正苦于以下问题:C# Scene.addMaterial方法的具体用法?C# Scene.addMaterial怎么用?C# Scene.addMaterial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scene
的用法示例。
在下文中一共展示了Scene.addMaterial方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateScene
public override void PopulateScene(Scene scene)
{
scene.addMaterial("Stone1", new Material(new Texture("stone1.jpg")));
scene.addMaterial("Stone2", new Material(new Texture("stone2.jpg")));
scene.addMaterial("Stone3", new Material(new Texture("stone3.jpg")));
scene.addMaterial("Stone4", new Material(new Texture("stone4.jpg")));
scene.addLight("Light1", new Light(new Vector(0.2f, 0.2f, 1f), 0xFFFFFF, 144, 120));
scene.addLight("Light2", new Light(new Vector(-1f, -1f, 1f), 0x332211, 100, 40));
scene.addLight("Light3", new Light(new Vector(-1f, -1f, 1f), 0x666666, 200, 120));
try
{
new Importer3ds().importFromStream(File.OpenRead("wobble.3ds"), scene);
}
catch (Exception e) { System.Console.WriteLine(e + ""); }
scene.rebuild();
for (int i = 0; i < scene.objects; i++)
TextureProjector.ProjectFrontal(scene._object[i]);
scene.Object("Sphere1").setMaterial(scene.material("Stone1"));
scene.Object("Wobble1").setMaterial(scene.material("Stone2"));
scene.Object("Wobble2").setMaterial(scene.material("Stone3"));
scene.Object("Wobble3").setMaterial(scene.material("Stone4"));
scene.normalize();
}
示例2: PopulateScene
public override void PopulateScene(Scene scene)
{
scene.addMaterial("Chrome", new Material("chrome.material"));
try
{
new Importer3ds().importFromStream(File.OpenRead("mech.3ds"), scene);
}
catch (Exception e) { System.Console.WriteLine(e + ""); }
scene.rebuild();
for (int i = 0; i < scene.objects; i++)
scene._object[i].setMaterial(scene.material("Chrome"));
scene.normalize();
scene.rotate(3.14159265f / 2, 3.14159265f / 2, 0f);
}