本文整理汇总了C#中IModel.SetMeshMaterial方法的典型用法代码示例。如果您正苦于以下问题:C# IModel.SetMeshMaterial方法的具体用法?C# IModel.SetMeshMaterial怎么用?C# IModel.SetMeshMaterial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IModel
的用法示例。
在下文中一共展示了IModel.SetMeshMaterial方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
//.........这里部分代码省略.........
// create and setup materials and load models
ITexture p_tex;
IMaterial p_mat;
// desk
p_res_man.CreateMaterial(out p_mat);
p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\desk\\desk_diff.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D);
p_tex = (ITexture)p_obj;
p_mat.SetDiffuseTexture(p_tex);
p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\desk\\desk.dmd", out p_obj, 0);
pMdlDesk = (IModel)p_obj;
pMdlDesk.SetModelMaterial(p_mat);
// table-lamp
p_res_man.CreateMaterial(out p_mat);
p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\table_lamp\\lamp_diff.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D);
p_tex = (ITexture)p_obj;
p_mat.SetDiffuseTexture(p_tex);
p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\table_lamp\\lamp.dmd", out p_obj, 0);
pMdlLamp = (IModel)p_obj;
pMdlLamp.SetModelMaterial(p_mat);
// chair
p_res_man.CreateMaterial(out p_mat);
p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\chair\\chair_diff.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D);
p_tex = (ITexture)p_obj;
p_mat.SetDiffuseTexture(p_tex);
p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\chair\\chair.dmd", out p_obj, 0);
pMdlChair = (IModel)p_obj;
pMdlChair.SetModelMaterial(p_mat);
// music box
p_res_man.CreateMaterial(out p_mat);
p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\music_box\\mbox_d.dds", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D);
p_tex = (ITexture)p_obj;
p_mat.SetDiffuseTexture(p_tex);
p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\music_box\\music_box.dmd", out p_obj, 0);
pMdlMusicBox = (IModel)p_obj;
pMdlMusicBox.SetModelMaterial(p_mat);
// church
p_res_man.Load(RESOURCE_PATH + "meshes\\church\\church.dmd", out p_obj, 0);
pModelChurch = (IModel)p_obj;
pModelChurch.SetModelMaterial(p_mat);
p_res_man.CreateMaterial(out p_mat);
col = TColor4.ColorSilver();
p_mat.SetDiffuseColor(ref col);
col = TColor4.ColorWhite();
p_mat.SetSpecularColor(ref col);
p_mat.SetShininess(25f);
pModelChurch.SetMeshMaterial(0, p_mat);
p_res_man.CreateMaterial(out p_mat);
p_res_man.Load(RESOURCE_PATH + "meshes\\church\\church_roof.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D);
p_tex = (ITexture)p_obj;
p_mat.SetDiffuseTexture(p_tex);
pModelChurch.SetMeshMaterial(1, p_mat);
p_res_man.CreateMaterial(out p_mat);
p_res_man.Load(RESOURCE_PATH + "meshes\\church\\church_main.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D);
p_tex = (ITexture)p_obj;
p_mat.SetDiffuseTexture(p_tex);
pModelChurch.SetMeshMaterial(2, p_mat);
// snow globe
p_res_man.Load(RESOURCE_PATH + "meshes\\snow_globe.dmd", out p_obj, 0);
pSnowGlobe = (IModel)p_obj;
p_res_man.CreateMaterial(out p_mat);
col = TColor4.ColorWhite();
p_mat.SetDiffuseColor(ref col);
pSnowGlobe.SetMeshMaterial(0, p_mat);
p_res_man.CreateMaterial(out p_mat);
col = TColor4.ColorBrown();
p_mat.SetDiffuseColor(ref col);
col = TColor4.ColorWhite();
p_mat.SetSpecularColor(ref col);
p_mat.SetShininess(25f);
pSnowGlobe.SetMeshMaterial(2, p_mat);
p_res_man.CreateMaterial(out p_mat);
col = TColor4.ColorWhite(100);
p_mat.SetDiffuseColor(ref col);
col = TColor4.ColorWhite();
p_mat.SetSpecularColor(ref col);
p_mat.SetShininess(50f);
p_mat.SetBlending(true, E_BLENDING_EFFECT.BE_NORMAL);
// When material with blending is set model will sort mesh order for meshes with blending to be the last.
pSnowGlobe.SetMeshMaterial(1, p_mat);
// We will use black fog to simulate darkness.
col = TColor4.ColorBlack();
pRender3D.SetFogColor(ref col);
pRender3D.SetLinearFogBounds(12.5f, 20f);
pRender3D.ToggleFog(true);
}