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


C# Device.SetTexture方法代码示例

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


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

示例1: Draw

 public void Draw(ref Device device, ref Matrix Transformation, ref Matrix View, ref Matrix Proj, ref List<LightClass> Lights, ref float luminosity, ref float percent_negatif)
 {
     if (State != ObjectState.Not_prepared)
     {
         if (State != ObjectState.Disposed)
         {
             for (int i = 0; i < Lights.Count; i++)
             {
                 this.effect.SetValue("LightPosition[" + i.ToString() + "]", new Vector4(Lights[i].Position, 1));
                 this.effect.SetValue("LightDistanceSquared[" + i.ToString() + "]", Lights[i].Range);
                 this.effect.SetValue("LightDiffuseColor[" + i.ToString() + "]", Lights[i].Diffuse.ToVector4());
             }
             this.effect.SetValue("percent_Negatif", percent_negatif);
             this.effect.SetValue("View", View);
             this.effect.SetValue("Projection", Proj);
             this.effect.SetValue("luminosity", luminosity);
             this.effect.Technique = Technique;
             this.effect.Begin();
             this.effect.BeginPass(0);
             this.effect.SetValue("World", SubTransformation * Transformation);
             this.effect.SetValue("WorldInverseTranspose", Matrix.Transpose(Matrix.Invert(SubTransformation * Transformation)));
             device.SetStreamSource(0, VertexBuffer, 0, Utilities.SizeOf<structVertex>());
             device.VertexDeclaration = this.vertexElems3D;
             var aaa = ResManager.getTexture(materialSet.map_Kd, ref device, false);
             device.SetTexture(0, ResManager.ListTextures[ResManager.getTexture(materialSet.map_Kd, ref device, false)].Texture);
             device.SetTexture(1, ResManager.ListTextures[ResManager.getTexture(materialSet.map_Ns, ref device, true)].Texture);
             device.DrawPrimitives(PrimitiveType.TriangleList, 0, Vertices.Length / 3);
             this.effect.EndPass();
             this.effect.End();
         }
         else
         {
             debug.WriteNicely("!", ConsoleColor.DarkRed, "ATTENTION, VOUS TENTEZ D'AFFICHER UN MESH N'EXISTANT PLUS", 0);
         }
     }
     else
     {
         debug.WriteNicely("!", ConsoleColor.DarkRed, "ATTENTION, VOUS TENTEZ D'AFFICHER UN MESH PAS PREPARE", 0);
     }
 }
开发者ID:Arys02,项目名称:Underground,代码行数:40,代码来源:OBJLoader.cs

示例2: Render

        /// <summary>Renders the view.</summary>
        public void Render(Device device)
        {
            device.SetRenderState(RenderState.CullMode, Cull.None);
            device.SetRenderState(RenderState.ZEnable, ZBufferType.DontUseZBuffer);
            device.SetRenderState(RenderState.ZWriteEnable, false);

            device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Point);
            device.SetSamplerState(0, SamplerState.MagFilter, _useLinearFiltering ? TextureFilter.Linear : TextureFilter.Point);
            device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Point);

            device.SetRenderState(RenderState.ShadeMode, ShadeMode.Flat);
            device.SetRenderState(RenderState.FillMode, FillMode.Solid);

            device.SetRenderState(RenderState.Lighting, false);
            device.SetTexture(0, _viewTexture);

            device.SetStreamSource(0, _vertexBuffer, 0, Marshal.SizeOf(typeof(DX9TransformedColorTexture)));
            device.VertexDeclaration = _vertexDeclaration;
            device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
        }
开发者ID:retrozombie,项目名称:Hovertank3DdotNet,代码行数:21,代码来源:DX9SoftwareRenderer.cs


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