當前位置: 首頁>>代碼示例>>C#>>正文


C# Vector2.ToVector3方法代碼示例

本文整理匯總了C#中Microsoft.Xna.Framework.Vector2.ToVector3方法的典型用法代碼示例。如果您正苦於以下問題:C# Vector2.ToVector3方法的具體用法?C# Vector2.ToVector3怎麽用?C# Vector2.ToVector3使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Microsoft.Xna.Framework.Vector2的用法示例。


在下文中一共展示了Vector2.ToVector3方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CalculateBlocks

 private void CalculateBlocks()
 {
     var leftTop = new Vector2( this._location.X - this._width / 2.0f, this._location.Y - this._heigth / 2.0f );
     var rightTop = leftTop + new Vector2( this._width, 0 );
     var rightBottom = leftTop + new Vector2( this._width, this._heigth );
     var leftBottom = leftTop + new Vector2( 0, this._heigth );
     this._blockses = new[]
                          {
                              new VertexPositionTexture( leftTop.ToVector3(), this._quadrangle.LeftTop ),
                              new VertexPositionTexture( rightTop.ToVector3(), this._quadrangle.RightTop ),
                              new VertexPositionTexture( rightBottom.ToVector3(), this._quadrangle.RightBottom ),
                              new VertexPositionTexture( leftBottom.ToVector3(), this._quadrangle.LeftBottom )
                          };
 }
開發者ID:Klakier,項目名稱:Road-Traffic-Simualator,代碼行數:14,代碼來源:TextureInPoint.cs

示例2: Translate

        public void Translate( IControl control, Vector2 translationVector )
        {
            if ( translationVector.Equal( Vector2.Zero, Constans.Epsilon ) )
            {
                return;
            }

            var translationMatrix = Matrix.CreateTranslation( translationVector.ToVector3() );
            if ( this._selectedControls.Contains( control ) )
            {
                this._selectedControls.ForEach( s => s.TranslateWithoutNotification( translationMatrix ) );
                this._selectedControls.ForEach( s => s.Invalidate() );
            }
            else
            {
                control.Translate( translationMatrix );
            }
        }
開發者ID:Klakier,項目名稱:Road-Traffic-Simualator,代碼行數:18,代碼來源:MoveControl.cs

示例3: SetObjectPosition

 /// <summary>
 /// Before an object is rendered, call this method with the object coordinates in the world.
 /// It updates the World matrix accordingly.
 /// </summary>
 /// <param name="position">Position of the object (in the world)</param>
 public void SetObjectPosition(Vector2 position)
 {
     World = Matrix.CreateTranslation(position.ToVector3());
 }
開發者ID:Jaywd,項目名稱:binary.fail.project.haumea,代碼行數:9,代碼來源:RenderState.cs


注:本文中的Microsoft.Xna.Framework.Vector2.ToVector3方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。