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


C# Vector3.ToXNA方法代码示例

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


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

示例1: VertexPositionTextureNormalBinormalTangent

// ReSharper restore NotAccessedField.Global
// ReSharper restore MemberCanBePrivate.Global

        public VertexPositionTextureNormalBinormalTangent(Vector3 position, Vector2 textureCoordinate, Vector3 normal, Vector3 binormal, Vector3 tangent)
        {
            Position = position.ToXNA();
            TextureCoordinate = textureCoordinate.ToXNA();
            Normal = normal.ToXNA();
            Binormal = binormal.ToXNA();
            Tangent = tangent.ToXNA();
        }
开发者ID:xoxota99,项目名称:Myre,代码行数:11,代码来源:VertexPositionTextureNormalBinormalTangent.cs

示例2: Draw

        public void Draw(Rectangle area)
        {
            var device = _vertices.GraphicsDevice;
            var pp = device.PresentationParameters;

// ReSharper disable CompareOfFloatsByEqualityOperator
            if (_dirty || area != _previousArea || _screenHeight != pp.BackBufferHeight || _screenWidth != pp.BackBufferWidth)
// ReSharper restore CompareOfFloatsByEqualityOperator
            {
                _screenHeight = pp.BackBufferHeight;
                _screenWidth = pp.BackBufferWidth;

                float x = (area.X / _screenWidth) * 2 - 1;
                float y = -((area.Y / _screenHeight) * 2 - 1);
                float width = (area.Width / _screenWidth) * 2;
                float height = (area.Height / _screenHeight) * 2;

                for (int i = 0; i < _data.Length; i++)
                {
                    var position = new Vector3(
                            x + (i / (float)(_data.Length - 1)) * width,
                            (y - height) + _data[i] * height,
                            0);
                    _transformedData[i] = new VertexPositionColor(position.ToXNA(), _colour);
                }

                _vertices.SetData<VertexPositionColor>(_transformedData);

                _dirty = false;
                _previousArea = area;
            }

            _effect.Techniques[0].Passes[0].Apply();
            device.SetVertexBuffer(_vertices);
            device.DrawPrimitives(PrimitiveType.LineStrip, 0, _data.Length - 1);
        }
开发者ID:xoxota99,项目名称:Myre,代码行数:36,代码来源:Graph.cs

示例3: SetValue

        public static void SetValue(this EffectParameter collection, Vector3 value)
        {
            Contract.Requires(collection != null);

            collection.SetValue(value.ToXNA());
        }
开发者ID:martindevans,项目名称:Myre,代码行数:6,代码来源:EffectParameterExtensions.cs

示例4: CreateFromPoints

 public static Plane CreateFromPoints(Vector3 a, Vector3 b, Vector3 c)
 {
     Microsoft.Xna.Framework.Plane p = new Microsoft.Xna.Framework.Plane(a.ToXNA(), b.ToXNA(), c.ToXNA());
     return new Plane(p.Normal.FromXNA(), p.D);
 }
开发者ID:xoxota99,项目名称:Myre,代码行数:5,代码来源:PlaneExtensions.cs

示例5: VertexPosition

// ReSharper restore NotAccessedField.Global
// ReSharper restore MemberCanBePrivate.Global

        public VertexPosition(Vector3 position)
        {
            Position = position.ToXNA();
        }
开发者ID:xoxota99,项目名称:Myre,代码行数:7,代码来源:VertexPosition.cs

示例6: SetValue

 public static void SetValue(this EffectParameter collection, Vector3 value)
 {
     collection.SetValue(value.ToXNA());
 }
开发者ID:xoxota99,项目名称:Myre,代码行数:4,代码来源:EffectParameterExtensions.cs

示例7: Spawn

        /// <summary>
        /// Spawns a new particle.
        /// </summary>
        /// <param name="position">The position.</param>
        /// <param name="velocity">The velocity.</param>
        /// <param name="angularVelocity">The angular velocity.</param>
        /// <param name="size">The size.</param>
        /// <param name="lifetimeScale">The lifetime scale. This should be between 0 and 1.</param>
        /// <param name="startColour">The start colour.</param>
        /// <param name="endColour">The end colour.</param>
        public void Spawn(Vector3 position, Vector3 velocity, float angularVelocity, float size, float lifetimeScale, Color startColour, Color endColour)
        {
            if (_dirty)
                InitialiseBuffer();

            // exit if we have run out of capacity
            int nextFreeParticle = (_free + 1) % Description.Capacity;
            if (nextFreeParticle == _finished)
                return;

            // write data into buffer
            for (int i = 0; i < 4; i++)
            {
                _particles[_free * 4 + i].Position = position.ToXNA();
                _particles[_free * 4 + i].Velocity = new Vector4(velocity, angularVelocity).ToXNA();
                _particles[_free * 4 + i].Scales = new HalfVector2(size, lifetimeScale > 0 ? 1f / lifetimeScale : 1);
                _particles[_free * 4 + i].StartColour = startColour;
                _particles[_free * 4 + i].EndColour = endColour;
                _particles[_free * 4 + i].Time = _time;
            }

            _free = nextFreeParticle;
        }
开发者ID:martindevans,项目名称:Myre,代码行数:33,代码来源:ParticleSystem.cs


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