• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# RenderState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中RenderState的典型用法代码示例。如果您正苦于以下问题:C# RenderState类的具体用法?C# RenderState怎么用?C# RenderState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RenderState类属于命名空间,在下文中一共展示了RenderState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnRenderCore

        protected override void  OnRenderCore(DrawingContext dc, RenderState state)
        {
            if (DataSource == null) return;
            var transform = Plotter2D.Viewport.Transform;

            Rect bounds = Rect.Empty;
            using (IPointEnumerator enumerator = DataSource.GetEnumerator(GetContext()))
            {
                Point point = new Point();
                while (enumerator.MoveNext())
                {
                    enumerator.GetCurrent(ref point);
                    enumerator.ApplyMappings(this);

                    Point zero = new Point(point.X, 0);
                    Point screenPoint = point.DataToScreen(transform);
                    Point screenZero = zero.DataToScreen(transform);

                    double height = screenPoint.Y = screenZero.Y;
                    height = (height >= 0) ? height : -height;

                    dc.DrawRectangle(Fill, new Pen(Stroke, StrokeThickness),
                                     new Rect(screenPoint.X - BarWidth / 2, screenZero.Y, BarWidth, height));

                    bounds = Rect.Union(bounds, point);
                }
            }

            ContentBounds = bounds;
        }
开发者ID:BdGL3,项目名称:CXPortal,代码行数:30,代码来源:BarGraph.cs


示例2: StartEffect

 public void StartEffect(string text, float duration)
 {
     _renderState = RenderState.Rendering;
     _sequense = null;
     _sequense = DOTween.Sequence();
     _animation = _textUI.DOText(text, duration);
     _sequense.Append(_animation);
     _sequense.AppendCallback(new TweenCallback(FinishDisplay));
 }
开发者ID:funcodes,项目名称:AirGame,代码行数:9,代码来源:TextEffect.cs


示例3: Render

        /// <summary>
        /// Renders the control</summary>
        /// <param name="action">Render action</param>
        /// <param name="camera">Camera</param>
        /// <param name="state">Render state</param>
        /// <param name="transform">Transform</param>
        public void Render(IRenderAction action, Camera camera, RenderState state, Matrix4F transform)
        {
            float s1, s2, s3;

            // apply xform
            Gl.glPushMatrix();
            Util3D.glMultMatrixf(transform);

            CalcAxisLengths(camera, transform, out s1, out s2, out s3);

            bool drawX, drawY, drawZ;
            DecideArrowDrawing(transform, camera, out drawX, out drawY, out drawZ);

            if (drawX)
            {
                RenderXArrow(s1);
                RenderXAxis(s1);
            }
            if (drawY)
            {
                RenderYArrow(s2);
                RenderYAxis(s2);
            }
            if (drawZ)
            {
                RenderZArrow(s3);
                RenderZAxis(s3);
            }

            RenderXYSquare(s1 * SquareLength, s2 * SquareLength, true);
            RenderYZSquare(s2 * SquareLength, s3 * SquareLength, true);
            RenderXZSquare(s1 * SquareLength, s3 * SquareLength, true);
            
            Gl.glPopMatrix();
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:41,代码来源:TranslatorControl.cs


示例4: Renderer

 public Renderer(GraphicsDevice device, RenderState renderState)
 {
     RenderState  = renderState;
     Device = device;
     _effect = new BasicEffect(Device);
     _bufferedInstructions = new List<IEnumerable<RenderInstruction>>();
 }
开发者ID:Jaywd,项目名称:binary.fail.project.haumea,代码行数:7,代码来源:Renderer.cs


示例5: Paint

        /// <summary>
        /// The method that is passed to the BitmapContext for rendering the image using OpenGl</summary>
        private void Paint()
        {
            // Setup render state. Copied from RenderCommands.DoCommand()'s RenderSmooth.
            RenderState rs = new RenderState();
            rs.RenderMode =
                RenderMode.Smooth |
                RenderMode.SolidColor |
                RenderMode.Lit |
                RenderMode.CullBackFace |
                RenderMode.Textured;
            rs.SolidColor = new Vec4F(1, 1, 1, 1);
            m_scene.StateStack.Push(rs);

            // Change some settings related to printing information text. We don't want it.
            string originalTitle = m_action.Title;
            m_action.Title = string.Empty;
            bool originalStatsEnabled = Util3D.RenderStats.Enabled;
            Util3D.RenderStats.Enabled = false;

            // Dispatch the scene
            m_action.Dispatch(m_scene, m_camera);

            // Restore some settings.
            m_action.Title = originalTitle;
            Util3D.RenderStats.Enabled = originalStatsEnabled;
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:28,代码来源:ThumbnailGenerator.cs


示例6: PreRenderCode

		protected override void PreRenderCode(RenderState state)
		{
			if (ShowMeasure)
				AddMeasure();
			IsGrey = true;

			base.PreRenderCode(state);
		}
开发者ID:noikiy,项目名称:Barcodes,代码行数:8,代码来源:DebugRenderer.cs


示例7: TraverseNode

 /// <summary>
 /// Constructor</summary>
 /// <param name="renderObject">RenderObject. A reference is held to this, so that IRenderObject.Dispatch
 /// can be called.</param>
 /// <param name="transform">Transform to use when dispatching the RenderObject; a reference is held</param>
 /// <param name="graphPath">Graph path leading to RenderObject; a reference is held</param>
 /// <param name="renderState">RenderState to use for RenderObject; is copied</param>
 public TraverseNode(
     IRenderObject renderObject,
     Matrix4F transform,
     Stack<SceneNode> graphPath,
     RenderState renderState)
 {
     Init(renderObject, transform, graphPath, renderState);
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:15,代码来源:TraverseNode.cs


示例8: GraphicsDevice

 public GraphicsDevice()
 {
     BitmapCacheEnabled = true;
     RenderAtScale = 1;
     RenderState = new RenderState();
     PresentationParameters = new PresentationParameters();
     PresentationParameters.BackBufferFormat = SurfaceFormat.Canvas;
 }
开发者ID:liwq-net,项目名称:SilverSprite,代码行数:8,代码来源:GraphicsDevice.cs


示例9: SetTemporaryRenderState

    public void SetTemporaryRenderState(RenderState renderState, int value)
    {
      int oldState = _device.GetRenderState(renderState);
      if (oldState.Equals(value))
        return;

      _changedStates[renderState] = oldState;
      _device.SetRenderState(renderState, value);
    }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:9,代码来源:TemporaryRenderState.cs


示例10: TextureBaker

 public TextureBaker(GraphicsDevice graphicsDevice, int width, int height, RenderState state)
     : base(graphicsDevice)
 {
     _renderTarget = new RenderTarget2D(GraphicsDevice, width, height);
     GraphicsDevice.SetRenderTarget(_renderTarget);
     GraphicsDevice.Clear(Color.Transparent);
     Begin(SpriteSortMode.Immediate, BlendState.Opaque);
     SetState(state);
 }
开发者ID:yadiate,项目名称:MonoGameGui,代码行数:9,代码来源:TextureBaker.cs


示例11: ProcessCustomElement

        public async Task<Errorable<bool>> ProcessCustomElement(string elementName, RenderState state)
        {
            if (elementName != "cms-scheduled") return false;

            var err = await processScheduledElement(state).ConfigureAwait(continueOnCapturedContext: false);
            if (err.HasErrors) return err.Errors;

            return true;
        }
开发者ID:JamesDunne,项目名称:ivo-cms,代码行数:9,代码来源:ScheduledElementProvider.cs


示例12: FontStyle

        public FontStyle( string fontName )
        {
            Font = _UI.Font.Get( fontName );
            RenderState = new RenderState( (int)E_Effect.IntensityAsAlpha_PMA, E_BlendState.AlphaBlend );

            TrackingPercentage = 0.0f;
            HeightPercentage = 1.0f;

            RenderPasses = new List< FontStyleRenderPass >();
        }
开发者ID:JacobNorlin,项目名称:project-duck,代码行数:10,代码来源:FontStyle.cs


示例13: Init

 // Init
 public void Init()
 {
     Texture.TextureIndex = 0;
     Texture.PUV = new Vector2( 0.0f );
     Texture.SUV = new Vector2( 1.0f );
     Color = 0xffffffff;
     AspectRatio = 1.0f;
     Scale = 1.0f;
     RenderState = new RenderState( (int)E_Effect.MultiTexture1, E_BlendState.AlphaBlend );
     LayerOffset = 0;
 }
开发者ID:JacobNorlin,项目名称:project-duck,代码行数:12,代码来源:FontIcon.cs


示例14: Init

 /// <summary>
 /// Initializes instance</summary>
 /// <param name="renderObject">RenderObject. A reference is held to this, so that IRenderObject.Dispatch
 /// can be called.</param>
 /// <param name="transform">Transform to use when dispatching the RenderObject; a reference is held</param>
 /// <param name="graphPath">Graph path leading to RenderObject; a reference is held</param>
 /// <param name="renderState">RenderState to use for RenderObject; is copied</param>
 public void Init(
     IRenderObject renderObject,
     Matrix4F transform,
     Stack<SceneNode> graphPath,
     RenderState renderState)
 {
     m_renderObject = renderObject;
     m_transform = transform;
     m_renderState.Init(renderState);
     m_graphPath = graphPath.ToArray();//faster to create every time than to cache!
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:18,代码来源:TraverseNode.cs


示例15: RenderStatesDiffer

        private static bool RenderStatesDiffer(RenderState oldRenderState, RenderState newRenderState, RenderMode flag)
        {
            bool oldRenderStateNull = (oldRenderState == null);
            bool newFlag = ((newRenderState.RenderMode & flag) != 0);

            if (oldRenderStateNull)
                return true;

            bool oldFlag = ((oldRenderState.RenderMode & flag) != 0);

            return oldFlag != newFlag;
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:12,代码来源:RenderStateGuardianUtils.cs


示例16: Render

        protected internal void Render(RenderState state)
        {
            for(int i=0;i<subBatchs.Count;i++)
                subBatchs[i].Render(state);

            Graphics.device.SetRenderTarget(backbuffer);
            state.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
            for (int i = 0; i < drawCalls.Count; i++)
                drawCalls[i].Render(state);
            state.spriteBatch.End();
            drawCalls.Clear();

            subBatchs.Clear();
        }
开发者ID:warrocky,项目名称:FightLands,代码行数:14,代码来源:RenderBatch.cs


示例17: PreRenderModule

		protected override void PreRenderModule(RenderState state)
		{
			base.PreRenderModule(state);

			if (!ShowModuleShading)
				return;

			if (IsGrey)
			{
				Canvas.FillRectangle(Brushes.Gray, state.Location.X, Settings.TopMargin, (state.CurrentPattern.WideCount * Settings.WideWidth) + (state.CurrentPattern.NarrowCount * Settings.NarrowWidth), Canvas.VisibleClipBounds.Height);
			}
			IsGrey = !IsGrey;

		}
开发者ID:noikiy,项目名称:Barcodes,代码行数:14,代码来源:DebugRenderer.cs


示例18: CommitSmooth

        private static void CommitSmooth(RenderState renderState, RenderState previousRenderState)
        {
            if ((renderState.RenderMode & RenderMode.Smooth) != 0)
            {
                if (RenderStatesDiffer(previousRenderState, renderState, RenderMode.Smooth))
                {
                    Gl.glShadeModel(Gl.GL_SMOOTH);
                    Gl.glPolygonMode(Gl.GL_FRONT_AND_BACK, Gl.GL_FILL);
                    Util3D.RenderStats.RenderStateChanges++;
                    //Console.WriteLine("CommitSmooth");
                }

                Vec4F color = renderState.SolidColor;
                Gl.glColor4f(color.X, color.Y, color.Z, color.W);
            }
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:16,代码来源:RenderStateGuardianUtils.cs


示例19: Render

        /// <summary>
        /// Renders a renderable components and applies its required renderstate if necessary.
        /// </summary>
        void Render(ICamera camera, RenderComponent renderable) {
            RenderState desiredState = renderable.RenderState;

            if (desiredState != null) {
                if (_currentlyEnabledState != desiredState) {
                    if (_currentlyEnabledState != null) {
                        _currentlyEnabledState(false);
                    }

                    desiredState(true);

                    _currentlyEnabledState = desiredState;
                }
            }

            renderable.Render(camera);
        }
开发者ID:jyunfan2015,项目名称:Fruitless,代码行数:20,代码来源:Renderer.cs


示例20: LoadContent

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(_gdm.GraphicsDevice);
            RenderState renderState = new RenderState(_spriteBatch.GetScreenDimensions());
            _renderer = new Renderer(_gdm.GraphicsDevice, renderState);

            _mouseCursorTexture = _content.Load<Texture2D>("cursor");
            _logFont            = _content.Load<SpriteFont>("LogFont");

            LoadFile("../../gamedata.haumea");

            foreach (IView view in _views)
            {
                view.LoadContent(_content);
            }
        }
开发者ID:Jaywd,项目名称:binary.fail.project.haumea,代码行数:21,代码来源:Engine.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RenderTarget类代码示例发布时间:2022-05-24
下一篇:
C# RenderOptions类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap