store vertices on MeshPart
parent
47a98f8fc5
commit
597e0b59f4
|
@ -1,6 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Numerics;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
namespace Smuggler
|
namespace Smuggler
|
||||||
|
@ -72,9 +72,9 @@ namespace Smuggler
|
||||||
|
|
||||||
indices[indexCounter] = index;
|
indices[indexCounter] = index;
|
||||||
vertices[index] = new VertexPositionNormalTexture(
|
vertices[index] = new VertexPositionNormalTexture(
|
||||||
new Microsoft.Xna.Framework.Vector3(position.X, position.Y, position.Z),
|
new Vector3(position.X, position.Y, position.Z),
|
||||||
new Microsoft.Xna.Framework.Vector3(normal.X, normal.Y, normal.Z),
|
new Vector3(normal.X, normal.Y, normal.Z),
|
||||||
new Microsoft.Xna.Framework.Vector2(texcoord.X, texcoord.Y)
|
new Vector2(texcoord.X, texcoord.Y)
|
||||||
);
|
);
|
||||||
|
|
||||||
indexCounter++;
|
indexCounter++;
|
||||||
|
@ -87,6 +87,7 @@ namespace Smuggler
|
||||||
new MeshPart(
|
new MeshPart(
|
||||||
vertexBuffer,
|
vertexBuffer,
|
||||||
indexBuffer,
|
indexBuffer,
|
||||||
|
positions,
|
||||||
triangles.ToArray(),
|
triangles.ToArray(),
|
||||||
new BasicEffect(graphicsDevice)
|
new BasicEffect(graphicsDevice)
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,13 +7,15 @@ namespace Smuggler
|
||||||
{
|
{
|
||||||
public IndexBuffer IndexBuffer { get; }
|
public IndexBuffer IndexBuffer { get; }
|
||||||
public VertexBuffer VertexBuffer { get; }
|
public VertexBuffer VertexBuffer { get; }
|
||||||
|
public Vector3[] Vertices { get; }
|
||||||
public Triangle[] Triangles { get; }
|
public Triangle[] Triangles { get; }
|
||||||
public BasicEffect Effect { get; }
|
public BasicEffect Effect { get; }
|
||||||
|
|
||||||
public MeshPart(VertexBuffer vertexBuffer, IndexBuffer indexBuffer, Triangle[] triangles, BasicEffect effect)
|
public MeshPart(VertexBuffer vertexBuffer, IndexBuffer indexBuffer, Vector3[] vertices, Triangle[] triangles, BasicEffect effect)
|
||||||
{
|
{
|
||||||
VertexBuffer = vertexBuffer;
|
VertexBuffer = vertexBuffer;
|
||||||
IndexBuffer = indexBuffer;
|
IndexBuffer = indexBuffer;
|
||||||
|
Vertices = vertices;
|
||||||
Triangles = triangles;
|
Triangles = triangles;
|
||||||
Effect = effect;
|
Effect = effect;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +32,7 @@ namespace Smuggler
|
||||||
foreach (var pass in Effect.CurrentTechnique.Passes)
|
foreach (var pass in Effect.CurrentTechnique.Passes)
|
||||||
{
|
{
|
||||||
pass.Apply();
|
pass.Apply();
|
||||||
|
|
||||||
graphicsDevice.DrawIndexedPrimitives(
|
graphicsDevice.DrawIndexedPrimitives(
|
||||||
PrimitiveType.TriangleList,
|
PrimitiveType.TriangleList,
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Reference in New Issue