本文整理汇总了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();
}
示例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);
}
示例3: SetValue
public static void SetValue(this EffectParameter collection, Vector3 value)
{
Contract.Requires(collection != null);
collection.SetValue(value.ToXNA());
}
示例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);
}
示例5: VertexPosition
// ReSharper restore NotAccessedField.Global
// ReSharper restore MemberCanBePrivate.Global
public VertexPosition(Vector3 position)
{
Position = position.ToXNA();
}
示例6: SetValue
public static void SetValue(this EffectParameter collection, Vector3 value)
{
collection.SetValue(value.ToXNA());
}
示例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;
}