本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.VertexPositionColorTexture类的典型用法代码示例。如果您正苦于以下问题:C# VertexPositionColorTexture类的具体用法?C# VertexPositionColorTexture怎么用?C# VertexPositionColorTexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VertexPositionColorTexture类属于Microsoft.Xna.Framework.Graphics命名空间,在下文中一共展示了VertexPositionColorTexture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DrawDottedCircle
public static void DrawDottedCircle(float radius, Vector2 center, int segments, float rotation, Renderer renderer,
Color col)
{
if (segments == 0)
return;
VertexPositionColorTexture[] arr = new VertexPositionColorTexture[segments];
int c = 0;
Vector2 off = center;
for (double i = 0; i <= Math.PI * 2 - 0.001d; i += Math.PI * 2 / segments)
{
arr[c] = new VertexPositionColorTexture(
new Vector3((float)Math.Cos(i + rotation) * radius + off.X, (float)Math.Sin(i + rotation) * radius + off.Y, 0),
col, new Vector2());
c++;
}
bool a = renderer.IsDrawing;
bool b = renderer.IsScaeld;
if (!renderer.IsDrawing)
renderer.BeginUnscaled();
Main.renderer.Draw(MicroWorld.Graphics.GraphicsEngine.pixel, new Rectangle(0, 0, 0, 0), Color.White);
renderer.End();
renderer.GraphicsDevice.DrawUserPrimitives<VertexPositionColorTexture>(PrimitiveType.LineList,
arr, 0, arr.Length / 2);
if (a) renderer.Begin(b);
}
开发者ID:XZelnar,项目名称:MicroWorld,代码行数:29,代码来源:RenderHelper.cs
示例2: Draw
public void Draw(Rectangle dstRectangle, Color color)
{
// ensure space for my vertices and indices.
this.EnsureSpace(6, 4);
// add the new indices
indices[indexCount++] = (short)(vertexCount + 0);
indices[indexCount++] = (short)(vertexCount + 1);
indices[indexCount++] = (short)(vertexCount + 3);
indices[indexCount++] = (short)(vertexCount + 1);
indices[indexCount++] = (short)(vertexCount + 2);
indices[indexCount++] = (short)(vertexCount + 3);
// add the new vertices
vertices[vertexCount++] = new VertexPositionColorTexture(
new Vector3(dstRectangle.Left, dstRectangle.Top, 0)
, color, new Vector2(1,1));
vertices[vertexCount++] = new VertexPositionColorTexture(
new Vector3(dstRectangle.Right, dstRectangle.Top, 0)
, color, new Vector2(0, 1));
vertices[vertexCount++] = new VertexPositionColorTexture(
new Vector3(dstRectangle.Right, dstRectangle.Bottom, 0)
, color, new Vector2(0, 0));
vertices[vertexCount++] = new VertexPositionColorTexture(
new Vector3(dstRectangle.Left, dstRectangle.Bottom, 0)
, color, new Vector2(1, 0));
// we premultiply all vertices times the world matrix.
// the world matrix changes alot and we don't want to have to flush
// every time it changes.
Matrix world = this.World;
for (int i = vertexCount - 4; i < vertexCount; i++)
Vector3.Transform(ref vertices[i].Position, ref world, out vertices[i].Position);
}
开发者ID:mikecann,项目名称:Portal2D-XNA,代码行数:34,代码来源:cCustomSpriteBatch.cs
示例3: SelectableCurve
public SelectableCurve(Color color)
{
this.color = color;
screenPoints = new VertexPositionColorTexture[subdivisions * 2];
selectPoints = new VertexPositionColorTexture[subdivisions * 2];
indices = new int[3 * subdivisions];
cornerAlpha = new float[4] { 1, 1, 1, 1 };
// create left points array and initialize each vertex
leftPoints = new VertexPositionColorTexture[GetNumPointsAfterIterations(6, iterations)];
for (int i = 0; i < leftPoints.Length; i++)
{
leftPoints[i] = new VertexPositionColorTexture(Vector3.Zero, color, Vector2.Zero);
}
intermediary = new Vector3[iterations + 1][];
for (int i = 0; i < iterations + 1; i++)
{
intermediary[i] = new Vector3[GetNumPointsAfterIterations(6, i)];
}
screenPoints[0] = new VertexPositionColorTexture(Vector3.Zero, color, Vector2.Zero);
screenPoints[1] = new VertexPositionColorTexture(Vector3.Zero, color, Vector2.Zero);
screenPoints[2] = new VertexPositionColorTexture(Vector3.Zero, color, Vector2.Zero);
screenPoints[3] = new VertexPositionColorTexture(Vector3.Zero, color, Vector2.Zero);
selectPoints[0] = new VertexPositionColorTexture(Vector3.Zero, color, Vector2.Zero);
selectPoints[1] = new VertexPositionColorTexture(Vector3.Zero, color, Vector2.Zero);
selectPoints[2] = new VertexPositionColorTexture(Vector3.Zero, color, Vector2.Zero);
selectPoints[3] = new VertexPositionColorTexture(Vector3.Zero, color, Vector2.Zero);
ComputeIndices();
}
开发者ID:plapides,项目名称:BohemianArtifact,代码行数:34,代码来源:SelectableCurve.cs
示例4: AddLazer
public void AddLazer(Vector3 startPos, Vector3 endPos, Color color)
{
VertexPositionColorTexture start = new VertexPositionColorTexture();
VertexPositionColorTexture end = new VertexPositionColorTexture();
start.Position = startPos;
start.Color = color;
start.TextureCoordinate = Vector2.UnitX * currentTime;
end.Position = endPos;
end.Color = color;
end.TextureCoordinate = Vector2.UnitX * currentTime;
vertices.Add(start); //1
vertices.Add(end); //2
start.Position.X += 1; end.Position.X += 1;
vertices.Add(start); //3
vertices.Add(end); //4
start.Position.X -= 2; end.Position.X -= 2;
vertices.Add(start); //5
vertices.Add(end); //6
start.Position.Y += 1; end.Position.Y += 1;
vertices.Add(start); //7
vertices.Add(end); //8
start.Position.Y -= 2; end.Position.Y -= 2;
vertices.Add(start); //9
vertices.Add(end); //10
}
开发者ID:summer-of-software,项目名称:vtank,代码行数:25,代码来源:LazerBeam.cs
示例5: SpriteBatchItem
public SpriteBatchItem()
{
this.vertexTL = new VertexPositionColorTexture();
this.vertexTR = new VertexPositionColorTexture();
this.vertexBL = new VertexPositionColorTexture();
this.vertexBR = new VertexPositionColorTexture();
}
开发者ID:Zeludon,项目名称:FEZ,代码行数:7,代码来源:SpriteBatchItem.cs
示例6: Border
public Border(World world, ScreenManager screenManager, Camera2D camera)
{
_screenManager = screenManager;
_camera = camera;
float halfWidth = ConvertUnits.ToSimUnits(screenManager.GraphicsDevice.Viewport.Width) / 2f - 0.75f;
float halfHeight = ConvertUnits.ToSimUnits(screenManager.GraphicsDevice.Viewport.Height) / 2f - 0.75f;
Vertices borders = new Vertices(4);
borders.Add(new Vector2(-halfWidth, halfHeight));
borders.Add(new Vector2(halfWidth, halfHeight));
borders.Add(new Vector2(halfWidth, -halfHeight));
borders.Add(new Vector2(-halfWidth, -halfHeight));
_anchor = BodyFactory.CreateLoopShape(world, borders);
_anchor.CollisionCategories = Category.All;
_anchor.CollidesWith = Category.All;
_basicEffect = new BasicEffect(screenManager.GraphicsDevice);
_basicEffect.VertexColorEnabled = true;
_basicEffect.TextureEnabled = true;
_basicEffect.Texture = screenManager.Content.Load<Texture2D>("Materials/pavement");
VertexPositionColorTexture[] vertice = new VertexPositionColorTexture[8];
vertice[0] = new VertexPositionColorTexture(new Vector3(-halfWidth, -halfHeight, 0f), Color.LightGray, new Vector2(-halfWidth, -halfHeight) / 5.25f);
vertice[1] = new VertexPositionColorTexture(new Vector3(halfWidth, -halfHeight, 0f), Color.LightGray, new Vector2(halfWidth, -halfHeight) / 5.25f);
vertice[2] = new VertexPositionColorTexture(new Vector3(halfWidth, halfHeight, 0f), Color.LightGray, new Vector2(halfWidth, halfHeight) / 5.25f);
vertice[3] = new VertexPositionColorTexture(new Vector3(-halfWidth, halfHeight, 0f), Color.LightGray, new Vector2(-halfWidth, halfHeight) / 5.25f);
vertice[4] = new VertexPositionColorTexture(new Vector3(-halfWidth - 2f, -halfHeight - 2f, 0f), Color.LightGray, new Vector2(-halfWidth - 2f, -halfHeight - 2f) / 5.25f);
vertice[5] = new VertexPositionColorTexture(new Vector3(halfWidth + 2f, -halfHeight - 2f, 0f), Color.LightGray, new Vector2(halfWidth + 2f, -halfHeight - 2f) / 5.25f);
vertice[6] = new VertexPositionColorTexture(new Vector3(halfWidth + 2f, halfHeight + 2f, 0f), Color.LightGray, new Vector2(halfWidth + 2f, halfHeight + 2f) / 5.25f);
vertice[7] = new VertexPositionColorTexture(new Vector3(-halfWidth - 2f, halfHeight + 2f, 0f), Color.LightGray, new Vector2(-halfWidth - 2f, halfHeight + 2f) / 5.25f);
_borderVerts = new VertexPositionColorTexture[24];
_borderVerts[0] = vertice[0];
_borderVerts[1] = vertice[5];
_borderVerts[2] = vertice[4];
_borderVerts[3] = vertice[0];
_borderVerts[4] = vertice[1];
_borderVerts[5] = vertice[5];
_borderVerts[6] = vertice[1];
_borderVerts[7] = vertice[6];
_borderVerts[8] = vertice[5];
_borderVerts[9] = vertice[1];
_borderVerts[10] = vertice[2];
_borderVerts[11] = vertice[6];
_borderVerts[12] = vertice[2];
_borderVerts[13] = vertice[7];
_borderVerts[14] = vertice[6];
_borderVerts[15] = vertice[2];
_borderVerts[16] = vertice[3];
_borderVerts[17] = vertice[7];
_borderVerts[18] = vertice[3];
_borderVerts[19] = vertice[4];
_borderVerts[20] = vertice[7];
_borderVerts[21] = vertice[3];
_borderVerts[22] = vertice[0];
_borderVerts[23] = vertice[4];
}
开发者ID:tinco,项目名称:Farseer-Physics,代码行数:59,代码来源:Border.cs
示例7: SelectableLine
public SelectableLine(Vector3 start, Vector3 end, Color color, float thickness)
: base(color)
{
linePoints[0] = new VertexPositionColorTexture(start, color, Vector2.Zero);
linePoints[1] = new VertexPositionColorTexture(end, color, Vector2.Zero);
selectableThickness = thickness;
Recompute();
}
开发者ID:plapides,项目名称:BohemianArtifact,代码行数:8,代码来源:SelectableLine.cs
示例8: SelectableQuad
public SelectableQuad(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, Color color)
: base()
{
screenPoints[0] = new VertexPositionColorTexture(p1, color, Vector2.Zero);
screenPoints[1] = new VertexPositionColorTexture(p2, color, Vector2.UnitX);
screenPoints[2] = new VertexPositionColorTexture(p3, color, Vector2.One);
screenPoints[3] = new VertexPositionColorTexture(p4, color, Vector2.UnitY);
Synchronize();
}
开发者ID:plapides,项目名称:BohemianArtifact,代码行数:9,代码来源:SelectableQuad.cs
示例9: Draw
public void Draw(Texture2D texture, Vector2 position, Color color)
{
_texture = texture; //Hack sorta
_vertexArray[_index++] = new VertexPositionColorTexture(new Vector3(position.X, position.Y, 0), color, Vector2.Zero);
_vertexArray[_index++] = new VertexPositionColorTexture(new Vector3(position.X + texture.Width, position.Y, 0), color, Vector2.UnitX);
_vertexArray[_index++] = new VertexPositionColorTexture(new Vector3(position.X, position.Y + texture.Height, 0), color, Vector2.UnitY);
_vertexArray[_index++] = new VertexPositionColorTexture(new Vector3(position.X + texture.Width, position.Y + texture.Height, 0), color, Vector2.One);
}
开发者ID:danzel,项目名称:PssSpritePerformanceTests,代码行数:9,代码来源:MonoGameSpriteBatchVector3.cs
示例10: getVertices
public void getVertices(VertexPositionColorTexture[] vertices,int offset)
{
vertices[offset++] = verts[0];
vertices[offset++] = verts[1];
vertices[offset++] = verts[3];
vertices[offset++] = verts[1];
vertices[offset++] = verts[3];
vertices[offset++] = verts[2];
}
开发者ID:kenpower,项目名称:XNA4,代码行数:10,代码来源:Particle.cs
示例11: CreateTexturedVertexBuffer
private static VertexBuffer CreateTexturedVertexBuffer(ModelMeshData mesh)
{
var vertices = new VertexPositionColorTexture[mesh.Vertices.Count];
for (var i = 0; i != mesh.Vertices.Count; ++i)
vertices[i] = new VertexPositionColorTexture(mesh.Vertices[i], mesh.Colors[i], mesh.TextureCoords[i]);
VertexBuffer vertexBuffer = new VertexBuffer(GraphicsDeviceHolder.Device,
mesh.Vertices.Count * VertexPositionColorTexture.SizeInBytes, BufferUsage.WriteOnly);
vertexBuffer.SetData(vertices);
return vertexBuffer;
}
开发者ID:dennisyolkin,项目名称:gta_gameworld_renderer,代码行数:10,代码来源:Model3dFactory.cs
示例12: PolygonRect
public PolygonRect(float X, float Y, float Z, float Width, float Height, Texture2D tex)
{
vertices = new VertexPositionColorTexture[6];
vertices[0] = new VertexPositionColorTexture(new Vector3(X, Y, Z), Color.White, Vector2.Zero);
vertices[1] = new VertexPositionColorTexture(new Vector3(X + Width, Y, Z), Color.White, new Vector2(1,0));
vertices[2] = new VertexPositionColorTexture(new Vector3(X + Width, Y + Height, Z), Color.White, new Vector2(1,1));
vertices[3] = new VertexPositionColorTexture(new Vector3(X + Width, Y + Height, Z), Color.White, new Vector2(1, 1));
vertices[4] = new VertexPositionColorTexture(new Vector3(X, Y + Height, Z), Color.White, new Vector2(0, 1));
vertices[5] = new VertexPositionColorTexture(new Vector3(X, Y, Z), Color.White, Vector2.Zero);
}
开发者ID:Jack-Moody,项目名称:How-It-Went-Down,代码行数:10,代码来源:PolygonRect.cs
示例13: CreateCube
public void CreateCube(Color color, out VertexPositionColorTexture[] vertexData, out int[] indexData)
{
vertexData = new VertexPositionColorTexture[]
{
// front
new VertexPositionColorTexture(new Vector3(-0.5f, -0.5f, -0.5f), color, new Vector2(0, 0)),
new VertexPositionColorTexture(new Vector3(0.5f, -0.5f, -0.5f), color, new Vector2(1, 0)),
new VertexPositionColorTexture(new Vector3(-0.5f, 0.5f, -0.5f), color, new Vector2(0, 1)),
new VertexPositionColorTexture(new Vector3(0.5f, 0.5f, -0.5f), color, new Vector2(1, 1)),
// top
new VertexPositionColorTexture(new Vector3(-0.5f, 0.5f, -0.5f), color, new Vector2(0, 0)),
new VertexPositionColorTexture(new Vector3(0.5f, 0.5f, -0.5f), color, new Vector2(1, 0)),
new VertexPositionColorTexture(new Vector3(-0.5f, 0.5f, 0.5f), color, new Vector2(0, 1)),
new VertexPositionColorTexture(new Vector3(0.5f, 0.5f, 0.5f), color, new Vector2(1, 1)),
// back
new VertexPositionColorTexture(new Vector3(0.5f, -0.5f, 0.5f), color, new Vector2(1, 1)),
new VertexPositionColorTexture(new Vector3(-0.5f, -0.5f, 0.5f), color, new Vector2(0, 1)),
new VertexPositionColorTexture(new Vector3(0.5f, 0.5f, 0.5f), color, new Vector2(1, 0)),
new VertexPositionColorTexture(new Vector3(-0.5f, 0.5f, 0.5f), color, new Vector2(0, 0)),
// bottom
new VertexPositionColorTexture(new Vector3(0.5f, -0.5f, -0.5f), color, new Vector2(1, 1)),
new VertexPositionColorTexture(new Vector3(-0.5f, -0.5f, -0.5f), color, new Vector2(0, 1)),
new VertexPositionColorTexture(new Vector3(0.5f, -0.5f, 0.5f), color, new Vector2(1, 0)),
new VertexPositionColorTexture(new Vector3(-0.5f, -0.5f, 0.5f), color, new Vector2(0, 0)),
// left
new VertexPositionColorTexture(new Vector3(-0.5f, -0.5f, 0.5f), color, new Vector2(1, 0)),
new VertexPositionColorTexture(new Vector3(-0.5f, -0.5f, -0.5f), color, new Vector2(0, 0)),
new VertexPositionColorTexture(new Vector3(-0.5f, 0.5f, 0.5f), color, new Vector2(1, 1)),
new VertexPositionColorTexture(new Vector3(-0.5f, 0.5f, -0.5f), color, new Vector2(0, 1)),
// right
new VertexPositionColorTexture(new Vector3(0.5f, -0.5f, -0.5f), color, new Vector2(0, 0)),
new VertexPositionColorTexture(new Vector3(0.5f, -0.5f, 0.5f), color, new Vector2(1, 0)),
new VertexPositionColorTexture(new Vector3(0.5f, 0.5f, -0.5f), color, new Vector2(0, 1)),
new VertexPositionColorTexture(new Vector3(0.5f, 0.5f, 0.5f), color, new Vector2(1, 1)),
};
indexData = new int[] {
0, 1, 2, 3, 2, 1,
4, 5, 6, 7, 6, 5,
8, 9, 10, 11, 10, 9,
12, 13, 14, 15, 14, 13,
16, 17, 18, 19, 18, 17,
20, 21, 22, 23, 22, 21
};
}
开发者ID:infinitespace-studios,项目名称:monogame-voxviewer,代码行数:54,代码来源:VoxViewer.cs
示例14: TexturedPrimitiveObject
public TexturedPrimitiveObject(string id, ObjectType objectType,
Transform3D transform, VertexPositionColorTexture[] vertices,
BasicEffect effect, PrimitiveType primitiveType, int primitiveCount, Texture2D texture)
: base(id, objectType, transform)
{
this.vertices = vertices;
this.effect = effect;
this.primitiveType = primitiveType;
this.primitiveCount = primitiveCount;
this.texture = texture;
}
开发者ID:TaraMG,项目名称:TeamCyberDyne,代码行数:11,代码来源:TexturedPrimitiveObject.cs
示例15: GetFaces
public List<TriangleData> GetFaces()
{
Matrix rootTransform = sceneModel.Root.Transform;
List<TriangleData> faceList = new List<TriangleData>();// new TriangleData[totalNumFaces];
foreach (ModelMesh mesh in sceneModel.Meshes)
{
foreach (ModelMeshPart meshPart in mesh.MeshParts)
{
VertexPositionColorTexture[] meshPartVertices = new VertexPositionColorTexture[meshPart.NumVertices];
meshPart.VertexBuffer.GetData<VertexPositionColorTexture>(meshPartVertices);
if (meshPart.IndexBuffer.IndexElementSize == IndexElementSize.SixteenBits)
{
short[] meshIndices = new short[meshPart.IndexBuffer.IndexCount];
meshPart.IndexBuffer.GetData<short>(meshIndices);
for (int cFaces = 0; cFaces < meshPart.PrimitiveCount; cFaces++)
{
Vector3[] vertices = new Vector3[3];
for (int cFaceVertice = 0; cFaceVertice < 3; cFaceVertice++)
{
vertices[cFaceVertice] = Vector3.Transform(meshPartVertices[meshIndices[meshPart.VertexOffset + (cFaces * 3) + cFaceVertice]].Position, rootTransform);
}
TriangleData triangleData = new TriangleData(ref vertices);
faceList.Add(triangleData);
}
}
else
{
int[] meshIndices = new int[meshPart.IndexBuffer.IndexCount];
meshPart.IndexBuffer.GetData<int>(meshIndices);
for (int cFaces = 0; cFaces < meshPart.PrimitiveCount; cFaces++)
{
Vector3[] vertices = new Vector3[3];
for (int cFaceVertice = 0; cFaceVertice < 3; cFaceVertice++)
{
vertices[cFaceVertice] = Vector3.Transform(meshPartVertices[meshIndices[meshPart.VertexOffset + (cFaces * 3) + cFaceVertice]].Position, rootTransform);
}
TriangleData triangleData = new TriangleData(ref vertices);
faceList.Add(triangleData);
}
}
}
}
return faceList;
}
开发者ID:rpenido,项目名称:obstavoid,代码行数:54,代码来源:MechanismEnviroment.cs
示例16: Create3DAxis
public void Create3DAxis(GraphicsDevice device)
{
int vertexCount = 6;
vertices = new VertexPositionColorTexture[vertexCount];
vertices[0] = new VertexPositionColorTexture(new Vector3(-axisLenght, 0.0f, -axisLenght), Color.White, new Vector2(0f, 0f));
vertices[1] = new VertexPositionColorTexture(new Vector3(axisLenght, 0.0f, -axisLenght), Color.White, new Vector2(1f, 0f));
vertices[2] = new VertexPositionColorTexture(new Vector3(-axisLenght, 0.0f, axisLenght), Color.White, new Vector2(0f, 1f));
vertices[3] = new VertexPositionColorTexture(new Vector3(axisLenght, 0.0f, axisLenght), Color.White, new Vector2(1f, 1f));
vBuffer = new VertexBuffer(device, typeof(VertexPositionColorTexture), vertices.GetLength(0), BufferUsage.WriteOnly);
}
开发者ID:paulodgn,项目名称:ProjetoTank,代码行数:12,代码来源:Plano.cs
示例17: EllipseTexture
public Texture2D EllipseTexture(float radiusX, float radiusY, MaterialType type, Color color,
float materialScale)
{
VertexPositionColorTexture[] verticesFill = new VertexPositionColorTexture[3 * (CircleSegments - 2)];
VertexPositionColor[] verticesOutline = new VertexPositionColor[2 * CircleSegments];
const float segmentSize = MathHelper.TwoPi / CircleSegments;
float theta = segmentSize;
radiusX = ConvertUnits.ToDisplayUnits(radiusX);
radiusY = ConvertUnits.ToDisplayUnits(radiusY);
materialScale /= _materials[type].Width;
Vector2 start = new Vector2(radiusX, 0f);
for (int i = 0; i < CircleSegments - 2; ++i)
{
Vector2 p1 = new Vector2(radiusX * (float)Math.Cos(theta), radiusY * (float)Math.Sin(theta));
Vector2 p2 = new Vector2(radiusX * (float)Math.Cos(theta + segmentSize),
radiusY * (float)Math.Sin(theta + segmentSize));
// fill vertices
verticesFill[3 * i].Position = new Vector3(start, 0f);
verticesFill[3 * i + 1].Position = new Vector3(p1, 0f);
verticesFill[3 * i + 2].Position = new Vector3(p2, 0f);
verticesFill[3 * i].TextureCoordinate = start * materialScale;
verticesFill[3 * i + 1].TextureCoordinate = p1 * materialScale;
verticesFill[3 * i + 2].TextureCoordinate = p2 * materialScale;
verticesFill[3 * i].Color = verticesFill[3 * i + 1].Color = verticesFill[3 * i + 2].Color = color;
// outline vertices
if (i == 0)
{
verticesOutline[0].Position = new Vector3(start, 0f);
verticesOutline[1].Position = new Vector3(p1, 0f);
verticesOutline[0].Color = verticesOutline[1].Color = Color.Black;
}
if (i == CircleSegments - 3)
{
verticesOutline[2 * CircleSegments - 2].Position = new Vector3(p2, 0f);
verticesOutline[2 * CircleSegments - 1].Position = new Vector3(start, 0f);
verticesOutline[2 * CircleSegments - 2].Color =
verticesOutline[2 * CircleSegments - 1].Color = Color.Black;
}
verticesOutline[2 * i + 2].Position = new Vector3(p1, 0f);
verticesOutline[2 * i + 3].Position = new Vector3(p2, 0f);
verticesOutline[2 * i + 2].Color = verticesOutline[2 * i + 3].Color = Color.Black;
theta += segmentSize;
}
return RenderTexture((int)(radiusX * 2f), (int)(radiusY * 2f),
_materials[type], verticesFill, verticesOutline);
}
开发者ID:LostCodeStudios,项目名称:GameLib,代码行数:53,代码来源:AssetCreator.cs
示例18: LoadContent
public void LoadContent(ContentManager content)
{
Model model = content.Load<Model>("AntonPhibesCollision");
//////START collision stuff
Matrix[] M = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(M);
foreach (ModelMesh mesh in model.Meshes)
{// For accumulating the triangles for this mesh
List<Vector2> triangles = new List<Vector2>();
// Loop over the mesh parts
foreach (ModelMeshPart meshPart in mesh.MeshParts)
{
//
// Obtain the vertices for the mesh part
//
int numVertices = meshPart.VertexBuffer.VertexCount;
VertexPositionColorTexture[] verticesRaw = new VertexPositionColorTexture[numVertices];
meshPart.VertexBuffer.GetData<VertexPositionColorTexture>(verticesRaw);
//
// Obtain the indices for the mesh part
//
int numIndices = meshPart.IndexBuffer.IndexCount;
short[] indices = new short[numIndices];
meshPart.IndexBuffer.GetData<short>(indices);
//
// Build the list of triangles
//
for (int i = 0; i < meshPart.PrimitiveCount * 3; i++)
{
// The actual index is relative to a supplied start position
int index = i + meshPart.StartIndex;
// Transform the vertex into world coordinates
Vector3 v = Vector3.Transform(verticesRaw[indices[index] + meshPart.VertexOffset].Position, M[mesh.ParentBone.Index]);
triangles.Add(new Vector2(v.X, v.Z));
}
}
regions[mesh.Name] = triangles;
}
//END COllision stuff
}
开发者ID:ksuh90,项目名称:P3,代码行数:51,代码来源:CollisionDetection.cs
示例19: Initialize
public override void Initialize()
{
effect = new BasicEffect(game.graphics.GraphicsDevice);
vertexData = new VertexPositionColorTexture[4];
vertexData[TOP_LEFT] = new VertexPositionColorTexture(new Vector3(minX, allZ, maxY), col, new Vector2(0, 0));
vertexData[TOP_RIGHT] = new VertexPositionColorTexture(new Vector3(maxX, allZ, maxY), col, new Vector2(1, 0));
vertexData[BOTTOM_RIGHT] = new VertexPositionColorTexture(new Vector3(maxX, allZ, minY), col, new Vector2(1, 1));
vertexData[BOTTOM_LEFT] = new VertexPositionColorTexture(new Vector3(minX, allZ, minY), col, new Vector2(0, 1));
indexData = new int[] { TOP_LEFT, BOTTOM_RIGHT, BOTTOM_LEFT, TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT };
base.Initialize();
}
开发者ID:Ritsuki,项目名称:XsNotAlone-Game,代码行数:14,代码来源:XsScRectTextured.cs
示例20: CreateQuadVertices
private static VertexPositionColorTexture[] CreateQuadVertices(int width, int height)
{
int halfWidth = width / 2;
int halfHeight = height / 2;
VertexPositionColorTexture[] vertices = new VertexPositionColorTexture[4];
vertices[0] = new VertexPositionColorTexture(new Vector3(-halfWidth, halfHeight, 0), Color.Red, UpperLeft);
vertices[1] = new VertexPositionColorTexture(new Vector3(halfWidth, halfHeight, 0), Color.Red, UpperRight);
vertices[2] = new VertexPositionColorTexture(new Vector3(-halfWidth, -halfHeight, 0), Color.Red, BottomLeft);
vertices[3] = new VertexPositionColorTexture(new Vector3(halfWidth, -halfHeight, 0), Color.Red, BottomRight);
return vertices;
}
开发者ID:keaton-freude,项目名称:PlayingAround,代码行数:14,代码来源:TexturedQuad.cs
注:本文中的Microsoft.Xna.Framework.Graphics.VertexPositionColorTexture类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论