Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ModelMeshPart.cs
Go to the documentation of this file.
2
3public sealed class ModelMeshPart
4{
6
8
9 private int startIndex;
10
11 private int primitiveCount;
12
13 private int vertexOffset;
14
15 private int numVertices;
16
17 private Effect effect;
18
19 private object tag;
20
21 internal ModelMesh parent;
22
23 public int StartIndex => startIndex;
24
26
28
29 public int NumVertices => numVertices;
30
32
34
36 {
37 get
38 {
39 return effect;
40 }
41 set
42 {
43 if (value == effect)
44 {
45 return;
46 }
47 bool flag = false;
48 bool flag2 = false;
49 int count = parent.MeshParts.Count;
50 for (int i = 0; i < count; i++)
51 {
52 ModelMeshPart modelMeshPart = parent.MeshParts[i];
53 if (!object.ReferenceEquals(modelMeshPart, this))
54 {
55 Effect objA = modelMeshPart.Effect;
56 if (object.ReferenceEquals(objA, effect))
57 {
58 flag = true;
59 }
60 else if (object.ReferenceEquals(objA, value))
61 {
62 flag2 = true;
63 }
64 }
65 }
66 if (!flag && effect != null)
67 {
69 }
70 if (!flag2 && value != null)
71 {
72 parent.Effects.Add(value);
73 }
74 effect = value;
75 }
76 }
77
78 public object Tag
79 {
80 get
81 {
82 return tag;
83 }
84 set
85 {
86 tag = value;
87 }
88 }
89
91 {
92 this.vertexOffset = vertexOffset;
93 this.numVertices = numVertices;
94 this.startIndex = startIndex;
95 this.primitiveCount = primitiveCount;
96 this.tag = tag;
97 }
98
99 internal void Draw()
100 {
101 if (NumVertices > 0)
102 {
105 graphicsDevice.Indices = indexBuffer;
106 graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, numVertices, startIndex, primitiveCount);
107 }
108 }
109}
unsafe void SetVertexBuffer(VertexBuffer vertexBuffer, int vertexOffset)
unsafe void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount)
ModelMeshPart(int vertexOffset, int numVertices, int startIndex, int primitiveCount, object tag)