diff options
Diffstat (limited to 'libraries/ModifiedBulletX/ModifiedBulletX/Collision/CollisionShapes/TriangleMesh.cs')
-rw-r--r-- | libraries/ModifiedBulletX/ModifiedBulletX/Collision/CollisionShapes/TriangleMesh.cs | 204 |
1 files changed, 102 insertions, 102 deletions
diff --git a/libraries/ModifiedBulletX/ModifiedBulletX/Collision/CollisionShapes/TriangleMesh.cs b/libraries/ModifiedBulletX/ModifiedBulletX/Collision/CollisionShapes/TriangleMesh.cs index 1426355..d5b93ba 100644 --- a/libraries/ModifiedBulletX/ModifiedBulletX/Collision/CollisionShapes/TriangleMesh.cs +++ b/libraries/ModifiedBulletX/ModifiedBulletX/Collision/CollisionShapes/TriangleMesh.cs | |||
@@ -1,102 +1,102 @@ | |||
1 | /* | 1 | /* |
2 | Bullet for XNA Copyright (c) 2003-2007 Vsevolod Klementjev http://www.codeplex.com/xnadevru | 2 | Bullet for XNA Copyright (c) 2003-2007 Vsevolod Klementjev http://www.codeplex.com/xnadevru |
3 | Bullet original C++ version Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com | 3 | Bullet original C++ version Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com |
4 | 4 | ||
5 | This software is provided 'as-is', without any express or implied | 5 | This software is provided 'as-is', without any express or implied |
6 | warranty. In no event will the authors be held liable for any damages | 6 | warranty. In no event will the authors be held liable for any damages |
7 | arising from the use of this software. | 7 | arising from the use of this software. |
8 | 8 | ||
9 | Permission is granted to anyone to use this software for any purpose, | 9 | Permission is granted to anyone to use this software for any purpose, |
10 | including commercial applications, and to alter it and redistribute it | 10 | including commercial applications, and to alter it and redistribute it |
11 | freely, subject to the following restrictions: | 11 | freely, subject to the following restrictions: |
12 | 12 | ||
13 | 1. The origin of this software must not be misrepresented; you must not | 13 | 1. The origin of this software must not be misrepresented; you must not |
14 | claim that you wrote the original software. If you use this software | 14 | claim that you wrote the original software. If you use this software |
15 | in a product, an acknowledgment in the product documentation would be | 15 | in a product, an acknowledgment in the product documentation would be |
16 | appreciated but is not required. | 16 | appreciated but is not required. |
17 | 2. Altered source versions must be plainly marked as such, and must not be | 17 | 2. Altered source versions must be plainly marked as such, and must not be |
18 | misrepresented as being the original software. | 18 | misrepresented as being the original software. |
19 | 3. This notice may not be removed or altered from any source distribution. | 19 | 3. This notice may not be removed or altered from any source distribution. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | using System; | 22 | using System; |
23 | using System.Collections.Generic; | 23 | using System.Collections.Generic; |
24 | using System.Text; | 24 | using System.Text; |
25 | 25 | ||
26 | using MonoXnaCompactMaths; | 26 | using MonoXnaCompactMaths; |
27 | 27 | ||
28 | namespace XnaDevRu.BulletX | 28 | namespace XnaDevRu.BulletX |
29 | { | 29 | { |
30 | class TriangleMesh : StridingMeshInterface | 30 | class TriangleMesh : StridingMeshInterface |
31 | { | 31 | { |
32 | int _numTriangles; | 32 | int _numTriangles; |
33 | List<Vector3> _verts; | 33 | List<Vector3> _verts; |
34 | 34 | ||
35 | public TriangleMesh() | 35 | public TriangleMesh() |
36 | { | 36 | { |
37 | _numTriangles = 0; | 37 | _numTriangles = 0; |
38 | _verts = new List<Vector3>(); | 38 | _verts = new List<Vector3>(); |
39 | } | 39 | } |
40 | 40 | ||
41 | void AddTriangle(Vector3 vertex0, Vector3 vertex1, Vector3 vertex2) | 41 | void AddTriangle(Vector3 vertex0, Vector3 vertex1, Vector3 vertex2) |
42 | { | 42 | { |
43 | _verts.Add(vertex0); | 43 | _verts.Add(vertex0); |
44 | _verts.Add(vertex1); | 44 | _verts.Add(vertex1); |
45 | _verts.Add(vertex2); | 45 | _verts.Add(vertex2); |
46 | _numTriangles++; | 46 | _numTriangles++; |
47 | } | 47 | } |
48 | 48 | ||
49 | public override void GetLockedVertexIndexBase(out List<Vector3> verts, out List<int> indicies, out int numfaces, int subpart) | 49 | public override void GetLockedVertexIndexBase(out List<Vector3> verts, out List<int> indicies, out int numfaces, int subpart) |
50 | { | 50 | { |
51 | verts = new List<Vector3>(); | 51 | verts = new List<Vector3>(); |
52 | for (int i = 0; i < 3; i++) | 52 | for (int i = 0; i < 3; i++) |
53 | { | 53 | { |
54 | verts.Add(_verts[subpart * 3 + i]); | 54 | verts.Add(_verts[subpart * 3 + i]); |
55 | } | 55 | } |
56 | indicies = new List<int>(); | 56 | indicies = new List<int>(); |
57 | indicies.Add(0); | 57 | indicies.Add(0); |
58 | indicies.Add(1); | 58 | indicies.Add(1); |
59 | indicies.Add(2); | 59 | indicies.Add(2); |
60 | numfaces = 1; | 60 | numfaces = 1; |
61 | } | 61 | } |
62 | 62 | ||
63 | public override void GetLockedReadOnlyVertexIndexBase(out List<Vector3> verts, out List<int> indicies, out int numfaces, int subpart) | 63 | public override void GetLockedReadOnlyVertexIndexBase(out List<Vector3> verts, out List<int> indicies, out int numfaces, int subpart) |
64 | { | 64 | { |
65 | verts = new List<Vector3>(); | 65 | verts = new List<Vector3>(); |
66 | for (int i = 0; i < 3; i++) | 66 | for (int i = 0; i < 3; i++) |
67 | { | 67 | { |
68 | verts.Add(_verts[subpart * 3 + i]); | 68 | verts.Add(_verts[subpart * 3 + i]); |
69 | } | 69 | } |
70 | indicies = new List<int>(); | 70 | indicies = new List<int>(); |
71 | indicies.Add(0); | 71 | indicies.Add(0); |
72 | indicies.Add(1); | 72 | indicies.Add(1); |
73 | indicies.Add(2); | 73 | indicies.Add(2); |
74 | numfaces = 1; | 74 | numfaces = 1; |
75 | } | 75 | } |
76 | 76 | ||
77 | public override void UnLockVertexBase(int subpart) | 77 | public override void UnLockVertexBase(int subpart) |
78 | { | 78 | { |
79 | 79 | ||
80 | } | 80 | } |
81 | 81 | ||
82 | public override void UnLockReadOnlyVertexBase(int subpart) | 82 | public override void UnLockReadOnlyVertexBase(int subpart) |
83 | { | 83 | { |
84 | 84 | ||
85 | } | 85 | } |
86 | 86 | ||
87 | public override int SubPartsCount() | 87 | public override int SubPartsCount() |
88 | { | 88 | { |
89 | return _numTriangles; | 89 | return _numTriangles; |
90 | } | 90 | } |
91 | 91 | ||
92 | public override void PreallocateVertices(int numverts) | 92 | public override void PreallocateVertices(int numverts) |
93 | { | 93 | { |
94 | 94 | ||
95 | } | 95 | } |
96 | 96 | ||
97 | public override void PreallocateIndices(int numindices) | 97 | public override void PreallocateIndices(int numindices) |
98 | { | 98 | { |
99 | 99 | ||
100 | } | 100 | } |
101 | } | 101 | } |
102 | } | 102 | } |