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


C# SceneNode.SetMaterialTexture方法代码示例

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


在下文中一共展示了SceneNode.SetMaterialTexture方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 = (int)MaterialType.Reflection2Layer;
            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:RealBadAngel,项目名称:irrlicht.netcp,代码行数:47,代码来源:WaterSceneNode.cs

示例2: UpdateVoiceEffectSceneNode

        public void UpdateVoiceEffectSceneNode(SceneNode _parentNode, int _level)
        {
            _level = OpenMetaverse.Utils.Clamp(_level, 0, voiceEffectTexture.Length - 1);

            if (_parentNode is BillboardSceneNode)
                _parentNode.SetMaterialTexture(0, voiceEffectTexture[_level]);
        }
开发者ID:caocao,项目名称:3di-viewer-rei,代码行数:7,代码来源:EffectManager.cs

示例3: Load

        public override int Load()
        {
            if (WaterSceneNode == null)
            {
                const string filename = "advanced_sea_shader.fx";

                Timer = Reference.Device.Timer;
                Size = new Dimension2Df(256, 256);

                if (Reference.SceneManager.ActiveCamera != null)
                {
                    CameraSceneNode currentCamera = Reference.SceneManager.ActiveCamera;
                    Camera = Reference.SceneManager.AddCameraSceneNode(parentNode);
                    Camera.FarValue = currentCamera.FarValue;
                    Camera.FOV = currentCamera.FOV;
                    Reference.SceneManager.ActiveCamera = currentCamera;
                }
                else
                {
                    Camera = Reference.SceneManager.AddCameraSceneNode(parentNode);
                }

                AnimatedMesh mesh = Reference.SceneManager.AddHillPlaneMesh("terrain", new Dimension2Df(512, 512), new Dimension2D(256, 256), 0.0f, new Dimension2Df(0, 0), new Dimension2Df(1024, 1024));
                SceneNode amsn = Reference.SceneManager.AddOctTreeSceneNode(mesh, parentNode, -1, 128);
                amsn.Position = new Vector3D(128, 0, 128);
                amsn.SetMaterialTexture(0, Reference.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"\media\textures\sand01.jpg"));

                AnimatedMesh watermesh = Reference.SceneManager.AddHillPlaneMesh("realisticwater", Size, new Dimension2D(1, 1), 0f, new Dimension2Df(0, 0), new Dimension2Df(1, 1));
                WaterSceneNode = Reference.SceneManager.AddOctTreeSceneNode(watermesh, parentNode, -1, 128);

                Texture bumpTexture = Reference.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"\media\textures\waterbump.jpg");

                GPUProgrammingServices gpuProgrammingServices = Reference.VideoDriver.GPUProgrammingServices;

                string path = Util.ApplicationDataDirectory + @"\media\shaders\" + filename;
                if (System.IO.File.Exists(path))
                {
                    try
                    {
                        ShaderMaterial = Reference.VideoDriver.GPUProgrammingServices.AddHighLevelShaderMaterialFromFiles(
                        path, "VertexShaderFunction", VertexShaderType._2_0,
                        path, "PixelShaderFunction", PixelShaderType._2_0,
                        ShaderEvent, MaterialType.Lightmap, 0
                        );
                    }
                    catch (Exception e)
                    {
                        Reference.Log.Fatal("Load", e);
                    }

                    if (ShaderMaterial > 0)
                        Reference.Log.Debug("Load: Loaded" + path);
                    else
                        Reference.Log.Debug("Load: not Loaded:" + path);
                }
                else
                {
                    Viewer.Log.Warn("[SHADER] [SEA] Shader file was not found: " + Util.ApplicationDataDirectory + @"\media\shaders\" + filename);
                }
                float waterheight = 0;
                if (Reference.Viewer.ProtocolManager.AvatarConnection.m_user.Network.CurrentSim != null)
                {
                    waterheight = Reference.Viewer.ProtocolManager.AvatarConnection.m_user.Network.CurrentSim.WaterHeight;
                }
                WaterSceneNode.Position = new Vector3D(128, waterheight, 128);
                WaterSceneNode.Scale = new Vector3D(200, 1, 200);
                WaterSceneNode.SetMaterialType(ShaderMaterial);
                WaterSceneNode.SetMaterialTexture(0, bumpTexture);
                RefractionMap = Reference.VideoDriver.CreateRenderTargetTexture(renderTargetSize);
                ReflectionMap = Reference.VideoDriver.CreateRenderTargetTexture(renderTargetSize);

                WaterSceneNode.SetMaterialTexture(1, RefractionMap);
                WaterSceneNode.SetMaterialTexture(2, ReflectionMap);
            }
            return ShaderMaterial;
        }
开发者ID:caocao,项目名称:3di-viewer-rei,代码行数:76,代码来源:AdvancedSea.cs

示例4: Load

        public override int Load()
        {
            string filename = "sky_shader.fx";

            if (Reference.Viewer.SkyQuality == Viewer.ShaderLevelType.Low)
            {
                filename = "sky_shader_low.fx";
            }

            int res = -1;

            string path = shaderDirectory + filename;
            if (System.IO.File.Exists(path))
            {
                try
                {
                    res = Reference.VideoDriver.GPUProgrammingServices.AddHighLevelShaderMaterialFromFiles(
                        path, "VS", VertexShaderType._2_0,
                        path, "PS", PixelShaderType._2_0,
                        ShaderEvent, MaterialType.Solid, 0
                        );
                }
                catch (Exception e)
                {
                    Reference.Log.Fatal("Load", e);
                    res = -1;
                }

                if (res > 0)
                {
                    Reference.Log.Debug("Load: Loaded" + path);
                }
                else
                {
                    Reference.Log.Debug("Load: not Loaded:" + path);
                }
            }
            else
            {
                Reference.Log.Warn("Load: File not exsit:" + path);
            }

            if (res > 0)
            {
                // Create sun.
                sunNode = Reference.SceneManager.AddBillboardSceneNode(parentNode, new Dimension2Df(256, 256), -1);
                sunNode.SetMaterialTexture(0, Reference.VideoDriver.GetTexture(textureDirectory + @"sun.bmp"));
                sunNode.SetMaterialType(MaterialType.TransparentAddColor);
                sunNode.Position = new Vector3D(1, 1, 0) * 8000;
                sunNode.SetMaterialType(MaterialType.TransparentAddColor);
                sunNode.SetMaterialFlag(MaterialFlag.Lighting, false);

                // Create moon.
                moonNode = Reference.SceneManager.AddBillboardSceneNode(parentNode, new Dimension2Df(512, 512), -1);
                moonNode.SetMaterialTexture(0, Reference.VideoDriver.GetTexture(textureDirectory + @"moon.bmp"));
                moonNode.SetMaterialType(MaterialType.TransparentAddColor);
                moonNode.Position = new Vector3D(-1, 1, 0) * 8000;
                moonNode.SetMaterialType(MaterialType.TransparentAddColor);
                moonNode.SetMaterialFlag(MaterialFlag.Lighting, false);

                if (Reference.Viewer.SkyQuality == Viewer.ShaderLevelType.High)
                {
                    const string memisphereMeshName = "sky.x";

                    if (System.IO.File.Exists(modelDirectory + memisphereMeshName))
                    {
                        AnimatedMesh animMesh = Reference.SceneManager.GetMesh(modelDirectory + memisphereMeshName);
                        if (animMesh != null)
                        {
                            Mesh mesh = animMesh.GetMesh(0);
                            skyNode = Reference.SceneManager.AddMeshSceneNode(mesh, parentNode, -1);
                            skyNode.Position = new Vector3D(128, 0, 128);
                            skyNode.Scale = new Vector3D(1.1f, 1.1f, 1.1f);
                            skyNode.SetMaterialFlag(MaterialFlag.BackFaceCulling, false);
                            skyNode.SetMaterialFlag(MaterialFlag.FogEnable, false);
                            skyNode.SetMaterialType(res);

            #if YK_UNUSE_MULTI_TEXTURE_STAR
                            const string starTextureName = "star.tga";
                            Texture tex = Reference.VideoDriver.GetTexture(modelDirectory + starTextureName);
                            skyNode.SetMaterialTexture(1, tex);
            #endif
                        }
                    }
                }
                else if (Reference.Viewer.SkyQuality == Viewer.ShaderLevelType.Low)
                {
                    SceneNode node = Reference.SceneManager.AddSkyBoxSceneNode(
                        parentNode,
                        new Texture[]
                        {
                            Reference.VideoDriver.GetTexture(textureDirectory + "sea_sky_UP.jpg"),
                            Reference.VideoDriver.GetTexture(textureDirectory + "sea_sky_DN.jpg"),
                            Reference.VideoDriver.GetTexture(textureDirectory + "sea_sky_LF.jpg"),
                            Reference.VideoDriver.GetTexture(textureDirectory + "sea_sky_RT.jpg"),
                            Reference.VideoDriver.GetTexture(textureDirectory + "sea_sky_FR.jpg"),
                            Reference.VideoDriver.GetTexture(textureDirectory + "sea_sky_BK.jpg"),
                        },
                        -1
                        );
//.........这里部分代码省略.........
开发者ID:caocao,项目名称:3di-viewer-rei,代码行数:101,代码来源:Sky.cs


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