当前位置: 首页>>代码示例>>C#>>正文


C# Material.Default方法代码示例

本文整理汇总了C#中Material.Default方法的典型用法代码示例。如果您正苦于以下问题:C# Material.Default方法的具体用法?C# Material.Default怎么用?C# Material.Default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Material的用法示例。


在下文中一共展示了Material.Default方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddModelMesh

		/// <summary>
		/// Adds a Mesh to the ModelObjects List
		/// </summary>
		protected virtual void AddModelMesh (Mesh mesh, ObjectAttributes attr)
		{
			//Add this to the list of all the meshes
			if (AllMeshes == null)
				AllMeshes = new RhinoList<Mesh> ();
				
			AllMeshes.Add (mesh);

			Material material = new Material ();

			int materialIndex = -1;

			switch (attr.MaterialSource) {
		
			case (ObjectMaterialSource.MaterialFromLayer):
				if (attr.LayerIndex >= 0 && attr.LayerIndex < ModelFile.Layers.Count)
					materialIndex = ModelFile.Layers [attr.LayerIndex].RenderMaterialIndex;
				break;
			
			case (ObjectMaterialSource.MaterialFromObject):
				materialIndex = attr.MaterialIndex;
				break;

			case (ObjectMaterialSource.MaterialFromParent):
				materialIndex = attr.MaterialIndex;
				break;
			}

			if (materialIndex < 0 || materialIndex >= ModelFile.Materials.Count) {
				materialIndex = -1;
				material.Default ();
			} else {
				material = ModelFile.Materials [materialIndex];
			}
				
			object[] displayMeshes = DisplayMesh.CreateWithMesh (mesh, attr, material, materialIndex);

			if (displayMeshes != null) {
				var modelMesh = new ModelMesh (displayMeshes, attr.ObjectId);
				AddModelObject (modelMesh, attr);
			}
		}
开发者ID:HovAvet,项目名称:RhinoMobile,代码行数:45,代码来源:RMModel.cs

示例2: AddModelObject

		/// <summary>
		/// Adds a ModelObject to the ModelObjects List
		/// </summary>
		protected virtual void AddModelObject (ModelObject obj, ObjectAttributes attr)
		{
			if (obj != null) {
				Material material = new Material ();
		
				int materialIndex = -1;

				switch (attr.MaterialSource) {
				case (ObjectMaterialSource.MaterialFromLayer):
					if (attr.LayerIndex >= 0 && attr.LayerIndex < ModelFile.Layers.Count)
						materialIndex = ModelFile.Layers [attr.LayerIndex].RenderMaterialIndex;
					break;
				case (ObjectMaterialSource.MaterialFromObject):
					materialIndex = attr.MaterialIndex;
					break;
				case (ObjectMaterialSource.MaterialFromParent):
					materialIndex = attr.MaterialIndex;
					break;
				}

				if (materialIndex < 0 || materialIndex >= ModelFile.Materials.Count) {
					materialIndex = -1;
					material.Default ();
				} else {
					material = ModelFile.Materials [materialIndex];
				}

				obj.Material = material;
				obj.LayerIndex = attr.LayerIndex;
				obj.Visible = attr.Visible;

				ModelObjectsDictionary.Add (obj.ObjectId, obj);

				// If the object is not an instance object, add it to the ModelObjects list
				if (attr.Mode != ObjectMode.InstanceDefinitionObject)
					ModelObjects.Add (obj);
			}
		}
开发者ID:HovAvet,项目名称:RhinoMobile,代码行数:41,代码来源:RMModel.cs


注:本文中的Material.Default方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。