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


C# SceneNode.SetMaterialTexture方法代码示例

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


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

示例1: WaterSceneNode

        public WaterSceneNode(SceneNode parent, SceneManager mgr, Dimension2Df tileSize,
                              Dimension2D tileCount, Dimension2D precision, int id) :
            base(parent, mgr, id)
        {
            _scene = mgr;
            _driver = mgr.VideoDriver;

            AnimatedMesh wmesh = _scene.AddHillPlaneMesh("watermesh" + _current,
                tileSize,
                tileCount, 0,
                new Dimension2Df(0, 0),
                new Dimension2Df(1, 1));
            _current++;

            int dmat;
            if (_driver.DriverType == DriverType.OpenGL)
                dmat = _driver.GPUProgrammingServices.AddHighLevelShaderMaterial(
                 WATER_VERTEX_GLSL, "main", VertexShaderType._1_1, WATER_FRAGMENT_GLSL,
                 "main", PixelShaderType._1_1, OnShaderSet, MaterialType.TransparentAlphaChannel, 0);
            else
                dmat = _driver.GPUProgrammingServices.AddHighLevelShaderMaterial(
                 WATER_HLSL, "vertexMain", VertexShaderType._2_0, WATER_HLSL,
                 "pixelMain", PixelShaderType._2_0, OnShaderSet, MaterialType.TransparentAlphaChannel, 2);

            if (_driver.DriverType == DriverType.OpenGL)
                ClampShader = _driver.GPUProgrammingServices.AddHighLevelShaderMaterial(
                 CLAMP_VERTEX_GLSL, "main", VertexShaderType._1_1, CLAMP_FRAGMENT_GLSL,
                 "main", PixelShaderType._1_1, OnShaderSet, MaterialType.TransparentAlphaChannel, 1);
            else
                ClampShader = _driver.GPUProgrammingServices.AddHighLevelShaderMaterial(
                 CLAMP_HLSL, "vertexMain", VertexShaderType._2_0, CLAMP_HLSL,
                 "pixelMain", PixelShaderType._2_0, OnShaderSet, MaterialType.TransparentAlphaChannel, 3);

            _waternode = _scene.AddMeshSceneNode(wmesh.GetMesh(0), this, -1);
            _waternode.SetMaterialType(dmat);
            _waternode.SetMaterialFlag(MaterialFlag.BackFaceCulling, false);
            _waternode.SetMaterialFlag(MaterialFlag.Lighting, false);
            _waternode.SetMaterialFlag(MaterialFlag.FogEnable, false);

            _rt = _driver.CreateRenderTargetTexture(precision);
            _waternode.SetMaterialTexture(0, _rt);

            CameraSceneNode oldcam = _scene.ActiveCamera;
            _fixedcam = _scene.AddCameraSceneNode(null);
            if (oldcam != null)
                _scene.ActiveCamera = oldcam;
        }
开发者ID:zaki,项目名称:irrlicht.net,代码行数:47,代码来源:WaterSceneNode.cs

示例2: thread_LoadTexture

		void thread_LoadTexture(SceneNode node, string path, Dimension2Di size)
		{
			Texture t;
			Dimension2Di si;
			Image i = irrDevice.DriverNoCheck.CreateImage(path);

			if (i != null)
			{
				Image j = irrDevice.DriverNoCheck.CreateImage(ColorFormat.A8R8G8B8, size);
				i.CopyToScaling(j);

				irrDevice.Lock();
				t = irrDevice.Driver.AddTexture(path + "|" + size.ToString(), j);
				irrDevice.Unlock();

				si = i.Dimension;

				i.Drop();
				j.Drop();

				lock (loadedTextures)
				{
					loadedTextures.Add(t.Name.Path);
				}
			}
			else
			{
				t = noPreviewTexture;
				si = noPreviewTexture.Size;
			}

			irrDevice.Lock();
			node.SetMaterialTexture(0, t);
			irrDevice.Unlock();

			if (OnTextureLoaded != null)
				OnTextureLoaded(node, t, si);

			node.Drop();
		}
开发者ID:Download,项目名称:Irrlicht-Lime,代码行数:40,代码来源:TextureManager.cs


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