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


C# ColorEx.Clone方法代码示例

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


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

示例1: SetSurfaceParams

        /// <summary>
        /// 
        /// </summary>
        /// <param name="ambient"></param>
        /// <param name="diffuse"></param>
        /// <param name="specular"></param>
        /// <param name="emissive"></param>
        /// <param name="shininess"></param>
        public override void SetSurfaceParams(ColorEx ambient, ColorEx diffuse, ColorEx specular, ColorEx emissive, float shininess, TrackVertexColor tracking)
        {
            // TODO: Cache color values to prune unneccessary setting

            if (cache.materialAmbient.CompareTo(ambient) == 0 &&
                cache.materialDiffuse.CompareTo(diffuse) == 0 &&
                cache.materialSpecular.CompareTo(specular) == 0 &&
                cache.materialEmissive.CompareTo(emissive) == 0 &&
                cache.materialShininess == shininess &&
                cache.materialTracking == tracking)
                return;

            cache.materialAmbient = ambient.Clone();
            cache.materialDiffuse = diffuse.Clone();
            cache.materialSpecular = specular.Clone();
            cache.materialEmissive = emissive.Clone();
            cache.materialShininess = shininess;
            cache.materialTracking = tracking;

            // create a new material based on the supplied params
            D3D.Material mat = new D3D.Material();
            mat.Diffuse = diffuse.ToColor();
            mat.Ambient = ambient.ToColor();
            mat.Specular = specular.ToColor();
            mat.Emissive = emissive.ToColor();
            mat.SpecularSharpness = shininess;

            // set the current material
            device.Material = mat;

            if (tracking != TrackVertexColor.None) {
                SetRenderState(ref cache.colorVertex, RenderStates.ColorVertex, true);
                device.SetRenderState(RenderStates.AmbientMaterialSource, (int)(((tracking & TrackVertexColor.Ambient) != 0) ? D3D.ColorSource.Color1 : D3D.ColorSource.Material));
                device.SetRenderState(RenderStates.DiffuseMaterialSource, (int)(((tracking & TrackVertexColor.Diffuse) != 0) ? D3D.ColorSource.Color1 : D3D.ColorSource.Material));
                device.SetRenderState(RenderStates.SpecularMaterialSource, (int)(((tracking & TrackVertexColor.Specular) != 0) ? D3D.ColorSource.Color1 : D3D.ColorSource.Material));
                device.SetRenderState(RenderStates.EmissiveMaterialSource, (int)(((tracking & TrackVertexColor.Emissive) != 0) ? D3D.ColorSource.Color1 : D3D.ColorSource.Material));
            } else
                SetRenderState(ref cache.colorVertex, RenderStates.ColorVertex, false);
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:47,代码来源:D3D9RenderSystem.cs

示例2: SetFog

 /// <summary>
 /// 
 /// </summary>
 /// <param name="mode"></param>
 /// <param name="color"></param>
 /// <param name="density"></param>
 /// <param name="start"></param>
 /// <param name="end"></param>
 public override void SetFog(Axiom.Graphics.FogMode mode, ColorEx color, float density, float start, float end)
 {
     //log.InfoFormat("D3D9RenderSystem.SetFog: mode {0}, color {1}, density {2}, start {3}, end {4}",
     //    mode, color, density, start, end);
     // disable fog if set to none
     if(mode == FogMode.None) {
         if (cache.fogTableMode != D3D.FogMode.None) {
             cache.fogTableMode = D3D.FogMode.None;
             device.RenderState.FogTableMode = D3D.FogMode.None;
         }
         if (cache.fogVertexMode != D3D.FogMode.None) {
             cache.fogVertexMode = D3D.FogMode.None;
             device.RenderState.FogVertexMode = D3D.FogMode.None;
         }
         if (cache.fogEnable) {
             cache.fogEnable = false;
             device.RenderState.FogEnable = false;
         }
     }
     else {
         // enable fog
         D3D.FogMode d3dFogMode = D3DHelper.ConvertEnum(mode);
         if (!cache.fogEnable) {
             cache.fogEnable = true;
             device.RenderState.FogEnable = true;
         }
         if (cache.fogVertexMode != d3dFogMode) {
             cache.fogVertexMode = d3dFogMode;
             device.RenderState.FogVertexMode = d3dFogMode;
         }
         if (cache.fogTableMode != D3D.FogMode.None) {
             cache.fogTableMode = D3D.FogMode.None;
             device.RenderState.FogTableMode = D3D.FogMode.None;
         }
         if (cache.fogColor.CompareTo(color) != 0) {
             cache.fogColor = color.Clone();
             device.RenderState.FogColor = color.ToColor();
         }
         if (cache.fogStart != start) {
             cache.fogStart = start;
             device.RenderState.FogStart = start;
         }
         if (cache.fogEnd != end) {
             cache.fogEnd = end;
             device.RenderState.FogEnd = end;
         }
         if (cache.fogDensity != density) {
             cache.fogDensity = density;
             device.RenderState.FogDensity = density;
         }
     }
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:60,代码来源:D3D9RenderSystem.cs


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