本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.VertexPositionColorTexture.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# VertexPositionColorTexture.CopyTo方法的具体用法?C# VertexPositionColorTexture.CopyTo怎么用?C# VertexPositionColorTexture.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.VertexPositionColorTexture
的用法示例。
在下文中一共展示了VertexPositionColorTexture.CopyTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLinkedLocationBackgroundVerts
public VertexPositionColorTexture[] GetLinkedLocationBackgroundVerts(double downsample,
Microsoft.Xna.Framework.Color unselectedColor,
Microsoft.Xna.Framework.Color selectionColor,
out int[] indicies)
{
indicies = _OverlappingLinkedLocationIndicies;
//Figure out if we are too small to display location link icons
if (this.Radius / downsample <= 64)
{
//Free the memory just in case
_OverlappingLinkedLocationVerts = null;
_OverlappingLinkedLocationIndicies = null;
_OverlappingLinkedLocationCircles = null;
return new VertexPositionColorTexture[0];
}
if (_OverlappingLinkedLocationCircles != null)
{
if (_OverlappingLinkedLocationCircles.Count != Links.Count)
{
_OverlappingLinkedLocationCircles = CalculateOverlappedLocationCircles();
_OverlappingLinkedLocationVerts = null;
_OverlappingLinkedLocationIndicies = null;
}
}
OverlappedLocation overlapLocation = AnnotationOverlay.LastMouseOverObject as OverlappedLocation;
if (overlapLocation != null)
{
//Redo our verticies if we are
if (overlapLocation.link.A == this || overlapLocation.link.B == this)
{
_OverlappingLinkedLocationCircles = CalculateOverlappedLocationCircles();
_OverlappingLinkedLocationVerts = null;
_OverlappingLinkedLocationIndicies = null;
}
}
if (_OverlappingLinkedLocationVerts != null)
{
for (int i = 0; i < _OverlappingLinkedLocationVerts.Length; i++)
{
_OverlappingLinkedLocationVerts[i].Color = unselectedColor;
}
return _OverlappingLinkedLocationVerts;
}
//If we've already calculated the verticies use those
if (_OverlappingLinkedLocationVerts == null)
{
VertexPositionColorTexture[] Verts = new VertexPositionColorTexture[OverlappingLinkedLocationCircles.Count * GlobalPrimitives.SquareVerts.Length];
indicies = new int[OverlappingLinkedLocationCircles.Count * GlobalPrimitives.SquareIndicies.Length];
int iVert = 0;
int iIndex = 0;
foreach (KeyValuePair<Location_CanvasCircleAnnotationViewModel, GridCircle> Item in this.OverlappingLinkedLocationCircles)
{
GridCircle locCircle = Item.Value;
Location_CanvasCircleAnnotationViewModel linkedLoc = Item.Key;
//Make sure our verts and location lengths still agree, sometimes the collection size can grow.
if (iVert >= Verts.Length)
{
VertexPositionColorTexture[] VertsTemp = new VertexPositionColorTexture[OverlappingLinkedLocationCircles.Count * GlobalPrimitives.SquareVerts.Length];
Verts.CopyTo(VertsTemp, 0);
Verts = VertsTemp;
VertsTemp = null;
int[] indiciesTemp = new int[OverlappingLinkedLocationCircles.Count * GlobalPrimitives.SquareIndicies.Length];
indicies.CopyTo(indiciesTemp, 0);
indicies = indiciesTemp;
indiciesTemp = null;
}
GlobalPrimitives.SquareVerts.CopyTo(Verts, iVert);
Microsoft.Xna.Framework.Color color = (linkedLoc == AnnotationOverlay.LastMouseOverObject) ? selectionColor : unselectedColor;
bool invertTexture = linkedLoc.Section - this.Section < 0;
//Scale, translate, and color the background verts correctly
for (int i = 0; i < GlobalPrimitives.SquareVerts.Length; i++)
{
Verts[i + iVert].Position *= (float)locCircle.Radius;
Verts[i + iVert].Position.X += (float)locCircle.Center.X;
Verts[i + iVert].Position.Y += (float)locCircle.Center.Y;
Verts[i + iVert].Color = color;
if (invertTexture)
{
Verts[i + iVert].TextureCoordinate.Y = 1 - Verts[i + iVert].TextureCoordinate.Y;
}
}
for (int i = 0; i < GlobalPrimitives.SquareIndicies.Length; i++)
{
indicies[iIndex + i] = GlobalPrimitives.SquareIndicies[i] + iVert;
//.........这里部分代码省略.........