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


C# Preset.ToString方法代码示例

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


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

示例1: Material

 public Material(Preset preset)
 {
     name = preset.ToString();
     switch (preset)
     {
         case Preset.Dirt:
             friction = 0.3f;
             jumpStrenghtModifier = 0.9f;
             redReplacement = new Color(81, 32, 0);
             greenReplacement = new Color(127, 88, 62);
             blueReplacement = new Color(53, 21, 0);
             break;
         case Preset.Rock:
             friction = 0.5f;
             jumpStrenghtModifier = 1;
             redReplacement = new Color(128, 128, 128);
             greenReplacement = new Color(175, 175, 175);
             blueReplacement = new Color(96, 96, 96);
             break;
         case Preset.Rubber: // wtf placeholder colors
             friction = 2f;
             jumpStrenghtModifier = 1.1f;
             redReplacement = new Color(128, 128, 128);
             greenReplacement = new Color(137, 137, 174);
             blueReplacement = new Color(127, 88, 62);
             break;
         case Preset.Metal: // Even out colors, make slightly less purple
             friction = 0.4f;
             jumpStrenghtModifier = 1f;
             redReplacement = new Color(183, 183, 213);
             greenReplacement = new Color(228, 240, 255);
             blueReplacement = new Color(137, 137, 174);
             break;
         case Preset.Glass:
             friction = 0.3f;
             jumpStrenghtModifier = 1f;
             redReplacement = new Color(100, 100, 110, 128);
             greenReplacement = new Color(110, 110, 120, 128);
             blueReplacement = new Color(90, 90, 100, 128);
             break;
         case Preset.Sand:
             friction = 0.65f;
             jumpStrenghtModifier = 0.8f;
             redReplacement = new Color(255, 151, 61);
             greenReplacement = new Color(255, 190, 112);
             blueReplacement = new Color(255, 120, 30);
             break;
         case Preset.Grass:
             friction = 0.2f;
             jumpStrenghtModifier = 1f;
             redReplacement = new Color(0, 151, 0);
             greenReplacement = new Color(0, 182, 0);
             blueReplacement = new Color(0, 113, 0);
             break;
         case Preset.Ice:
             friction = 0.01f;
             jumpStrenghtModifier = 1;
             redReplacement = new Color(193, 230, 255);
             greenReplacement = new Color(255, 255, 255);
             blueReplacement = new Color(142, 210, 255);
             break;
     }
 }
开发者ID:FooKittens,项目名称:Baine,代码行数:63,代码来源:Material.cs

示例2: GetPreset

        private static Tuple<double, double>[] GetPreset(Preset preset, int count)
        {
            switch (preset)
            {
                case Preset.Simple_Up:
                    #region Simple_Up

                    return GetXs(count).
                        Select(o => Tuple.Create(o, o)).
                        ToArray();

                    #endregion
                case Preset.Simple_Down:
                    #region Simple_Down

                    return ReverseY(GetPreset(Preset.Simple_Up, count));

                    #endregion

                case Preset.Cube_Up:
                    #region Cube

                    return GetXs(count).
                        Select(o => Tuple.Create(o, o * o * o)).
                        ToArray();

                    #endregion
                case Preset.Cube_Down:
                    #region Cube_Down

                    return ReverseX(GetPreset(Preset.Cube_Up, count));

                    #endregion

                case Preset.CubeRoot_Up:
                    #region CubeRoot

                    return ReverseX(GetPreset(Preset.CubeRoot_Down, count));

                    #endregion
                case Preset.CubeRoot_Down:
                    #region CubeRoot_Down

                    return ReverseY(GetPreset(Preset.Cube_Up, count));

                    #endregion

                case Preset.S_Curve_Up:
                    #region S_Curve_Up

                    return GetXs(count).
                        Select(o => Tuple.Create(o, (-Math.Cos(o * Math.PI) * .5) + .5)).
                        ToArray();

                    #endregion
                case Preset.S_Curve_Down:
                    #region S_Curve_Down

                    return ReverseY(GetPreset(Preset.S_Curve_Up, count));

                    #endregion

                default:
                    throw new ApplicationException("Unknown Preset: " + preset.ToString());
            }
        }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:66,代码来源:GradientStopsPreset.xaml.cs

示例3: SMAA

        /**
         * If you have one or two spare render targets of the same size as the
         * backbuffer, you may want to pass them in the 'storage' parameter.
         * You may pass one or the two, depending on what you have available.
         *
         * A RG buffer (at least) is expected for storing edges. Note that
         * this target _must_ have a D24S8 depth/stencil buffer.
         * A RGBA buffer is expected for the blending weights.
         *
         * By default, two render targets will be created for storing
         * intermediate calculations.
         *
         * AreaTexDX9.dds and SearchTex.dds from the SMAA distribution need
         * to be added to the content project and compiled as well (no mips,
         * no color key, no premultiplied alpha). `textureBaseName` will
         * be prepended to the search path for these textures in case
         * you don't want them in the root content folder.
         *
         * `effectBaseName` specifies the first part of the effect to be loaded.
         * the chosen `preset` will be appended.
         *
         * NOTE: The caller is responsible for ensuring that the effect exists
         * and can be accessed by the given content manager. This is because compiling
         * shaders at runtime is virtually impossible / very difficult to achieve in
         * XNA and the easiest way is to use the content pipeline to generate
         * all shader permutations upfront.
         */
        public SMAA(GraphicsDevice _device, int _width, int _height, Preset _preset,
            ITextureProvider texProvider,
            IEffectProvider effectProvider,
            RenderTarget2D rt_rg = null,
            RenderTarget2D rt_rgba = null
            )
        {
            Debug.Assert(_width > 0);
            Debug.Assert(_height > 0);
            Debug.Assert(effectProvider != null);
            Debug.Assert(texProvider != null);
            Debug.Assert(_device != null);

            effect = effectProvider.Get(_preset.ToString());

            device = _device;
            width = _width;
            height = _height;

            threshold = 0.05f;
            maxSearchSteps = 8;

            // If storage for the edges is not specified we will create it.
            if (rt_rg != null)
            {
                Debug.Assert(rt_rg.DepthStencilFormat == DepthFormat.Depth24Stencil8);

                edgeTex = rt_rg;
                releaseEdgeResources = false;
            }
            else
            {
                edgeTex = new RenderTarget2D(device, width, height, false,
                    SurfaceFormat.Color,
                    DepthFormat.Depth24Stencil8);

                releaseEdgeResources = true;
            }

            // If storage for the blend weights is not specified we will create it.
            if (rt_rgba != null)
            {
                blendTex = rt_rgba;
                releaseBlendResources = false;
            }
            else
            {
                blendTex = new RenderTarget2D(device, width, height, false,
                    SurfaceFormat.Color,
                    DepthFormat.None);

                releaseBlendResources = true;
            }

            // Load the precomputed textures.
            areaTex = texProvider.Get("AreaTexDX9");
            searchTex = texProvider.Get("SearchTex");

            // Create some handles for techniques and variables.
            thresholdHandle = effect.Parameters["threshold"];
            maxSearchStepsHandle = effect.Parameters["maxSearchSteps"];
            areaTexHandle = effect.Parameters["areaTex2D"];
            searchTexHandle = effect.Parameters["searchTex2D"];
            colorTexHandle = effect.Parameters["colorTex2D"];
            depthTexHandle = effect.Parameters["depthTex2D"];
            edgesTexHandle = effect.Parameters["edgesTex2D"];
            blendTexHandle = effect.Parameters["blendTex2D"];
            pixelSizeHandle = effect.Parameters["SMAA_PIXEL_SIZE"];
            lumaEdgeDetectionHandle = effect.Techniques["LumaEdgeDetection"];
            colorEdgeDetectionHandle = effect.Techniques["ColorEdgeDetection"];
            depthEdgeDetectionHandle = effect.Techniques["DepthEdgeDetection"];
            blendWeightCalculationHandle = effect.Techniques["BlendWeightCalculation"];
            neighborhoodBlendingHandle = effect.Techniques["NeighborhoodBlending"];
//.........这里部分代码省略.........
开发者ID:acgessler,项目名称:smaa,代码行数:101,代码来源:SMAA.cs


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