/
MyModel.cs
41 lines (38 loc) · 1.32 KB
/
MyModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SharpDX;
using SharpDX.Toolkit;
namespace Project1
{
using SharpDX.Toolkit.Graphics;
public enum ModelType
{
Colored, Textured
}
public class MyModel
{
public Buffer vertices;
public VertexInputLayout inputLayout;
public int vertexStride;
public ModelType modelType;
public Texture2D Texture;
public MyModel(Project1Game game, VertexPositionColor[] shapeArray, String textureName)
{
this.vertices = Buffer.Vertex.New(game.GraphicsDevice, shapeArray);
this.inputLayout = VertexInputLayout.New<VertexPositionColor>(0);
vertexStride = Utilities.SizeOf<VertexPositionColor>();
modelType = ModelType.Colored;
}
public MyModel(Project1Game game, VertexPositionTexture[] shapeArray, String textureName)
{
this.vertices = Buffer.Vertex.New(game.GraphicsDevice, shapeArray);
this.inputLayout = VertexInputLayout.New<VertexPositionTexture>(0);
vertexStride = Utilities.SizeOf<VertexPositionTexture>();
modelType = ModelType.Textured;
Texture = game.Content.Load<Texture2D>(textureName);
}
}
}