diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletXPlugin/TriangleIndexVertexArray.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletXPlugin/TriangleIndexVertexArray.cs | 69 |
1 files changed, 53 insertions, 16 deletions
diff --git a/OpenSim/Region/Physics/BulletXPlugin/TriangleIndexVertexArray.cs b/OpenSim/Region/Physics/BulletXPlugin/TriangleIndexVertexArray.cs index 4f63687..e73c953 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/TriangleIndexVertexArray.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/TriangleIndexVertexArray.cs | |||
@@ -34,8 +34,8 @@ | |||
34 | */ | 34 | */ |
35 | using System; | 35 | using System; |
36 | using System.Collections.Generic; | 36 | using System.Collections.Generic; |
37 | using System.Text; | ||
38 | using MonoXnaCompactMaths; | 37 | using MonoXnaCompactMaths; |
38 | using XnaDevRu.BulletX; | ||
39 | 39 | ||
40 | namespace OpenSim.Region.Physics.BulletXPlugin | 40 | namespace OpenSim.Region.Physics.BulletXPlugin |
41 | { | 41 | { |
@@ -52,7 +52,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
52 | private Vector3[] _vertexBase; | 52 | private Vector3[] _vertexBase; |
53 | private int _vertexStride; | 53 | private int _vertexStride; |
54 | 54 | ||
55 | public IndexedMesh(int numTriangleIndices, int[] triangleIndexBase, int triangleIndexStride, int numVertices, Vector3[] vertexBase, int vertexStride) | 55 | public IndexedMesh(int numTriangleIndices, int[] triangleIndexBase, int triangleIndexStride, int numVertices, |
56 | Vector3[] vertexBase, int vertexStride) | ||
56 | { | 57 | { |
57 | _numTriangles = numTriangleIndices; | 58 | _numTriangles = numTriangleIndices; |
58 | _triangleIndexBase = triangleIndexBase; | 59 | _triangleIndexBase = triangleIndexBase; |
@@ -72,25 +73,57 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
72 | _vertexStride = 24; | 73 | _vertexStride = 24; |
73 | } | 74 | } |
74 | 75 | ||
75 | public int TriangleCount { get { return _numTriangles; } set { _numTriangles = value; } } | 76 | public int TriangleCount |
76 | public int[] TriangleIndexBase { get { return _triangleIndexBase; } set { _triangleIndexBase = value; } } | 77 | { |
77 | public int TriangleIndexStride { get { return _triangleIndexStride; } set { _triangleIndexStride = value; } } | 78 | get { return _numTriangles; } |
78 | public int VertexCount { get { return _numVertices; } set { _numVertices = value; } } | 79 | set { _numTriangles = value; } |
79 | public Vector3[] VertexBase { get { return _vertexBase; } set { _vertexBase = value; } } | 80 | } |
80 | public int VertexStride { get { return _vertexStride; } set { _vertexStride = value; } } | 81 | |
82 | public int[] TriangleIndexBase | ||
83 | { | ||
84 | get { return _triangleIndexBase; } | ||
85 | set { _triangleIndexBase = value; } | ||
86 | } | ||
87 | |||
88 | public int TriangleIndexStride | ||
89 | { | ||
90 | get { return _triangleIndexStride; } | ||
91 | set { _triangleIndexStride = value; } | ||
92 | } | ||
93 | |||
94 | public int VertexCount | ||
95 | { | ||
96 | get { return _numVertices; } | ||
97 | set { _numVertices = value; } | ||
98 | } | ||
99 | |||
100 | public Vector3[] VertexBase | ||
101 | { | ||
102 | get { return _vertexBase; } | ||
103 | set { _vertexBase = value; } | ||
104 | } | ||
105 | |||
106 | public int VertexStride | ||
107 | { | ||
108 | get { return _vertexStride; } | ||
109 | set { _vertexStride = value; } | ||
110 | } | ||
81 | } | 111 | } |
82 | 112 | ||
83 | /// <summary> | 113 | /// <summary> |
84 | /// TriangleIndexVertexArray allows to use multiple meshes, by indexing into existing triangle/index arrays. | 114 | /// TriangleIndexVertexArray allows to use multiple meshes, by indexing into existing triangle/index arrays. |
85 | /// Additional meshes can be added using addIndexedMesh | 115 | /// Additional meshes can be added using addIndexedMesh |
86 | /// </summary> | 116 | /// </summary> |
87 | public class TriangleIndexVertexArray : XnaDevRu.BulletX.StridingMeshInterface | 117 | public class TriangleIndexVertexArray : StridingMeshInterface |
88 | { | 118 | { |
89 | List<IndexedMesh> _indexedMeshes = new List<IndexedMesh>(); | 119 | private List<IndexedMesh> _indexedMeshes = new List<IndexedMesh>(); |
90 | 120 | ||
91 | public TriangleIndexVertexArray() { } | 121 | public TriangleIndexVertexArray() |
122 | { | ||
123 | } | ||
92 | 124 | ||
93 | public TriangleIndexVertexArray(int numTriangleIndices, int[] triangleIndexBase, int triangleIndexStride, int numVertices, Vector3[] vertexBase, int vertexStride) | 125 | public TriangleIndexVertexArray(int numTriangleIndices, int[] triangleIndexBase, int triangleIndexStride, |
126 | int numVertices, Vector3[] vertexBase, int vertexStride) | ||
94 | { | 127 | { |
95 | IndexedMesh mesh = new IndexedMesh(); | 128 | IndexedMesh mesh = new IndexedMesh(); |
96 | mesh.TriangleCount = numTriangleIndices; | 129 | mesh.TriangleCount = numTriangleIndices; |
@@ -104,19 +137,23 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
104 | } | 137 | } |
105 | 138 | ||
106 | public TriangleIndexVertexArray(int[] triangleIndexBase, Vector3[] vertexBase) | 139 | public TriangleIndexVertexArray(int[] triangleIndexBase, Vector3[] vertexBase) |
107 | : this(triangleIndexBase.Length, triangleIndexBase, 32, vertexBase.Length, vertexBase, 24) { } | 140 | : this(triangleIndexBase.Length, triangleIndexBase, 32, vertexBase.Length, vertexBase, 24) |
141 | { | ||
142 | } | ||
108 | 143 | ||
109 | public void AddIndexedMesh(IndexedMesh indexedMesh) | 144 | public void AddIndexedMesh(IndexedMesh indexedMesh) |
110 | { | 145 | { |
111 | _indexedMeshes.Add(indexedMesh); | 146 | _indexedMeshes.Add(indexedMesh); |
112 | } | 147 | } |
113 | 148 | ||
114 | public override void GetLockedVertexIndexBase(out List<Vector3> verts, out List<int> indicies, out int numfaces, int subpart) | 149 | public override void GetLockedVertexIndexBase(out List<Vector3> verts, out List<int> indicies, out int numfaces, |
150 | int subpart) | ||
115 | { | 151 | { |
116 | throw new Exception("The method or operation is not implemented."); | 152 | throw new Exception("The method or operation is not implemented."); |
117 | } | 153 | } |
118 | 154 | ||
119 | public override void GetLockedReadOnlyVertexIndexBase(out List<Vector3> verts, out List<int> indicies, out int numfaces, int subpart) | 155 | public override void GetLockedReadOnlyVertexIndexBase(out List<Vector3> verts, out List<int> indicies, |
156 | out int numfaces, int subpart) | ||
120 | { | 157 | { |
121 | IndexedMesh m = _indexedMeshes[0]; | 158 | IndexedMesh m = _indexedMeshes[0]; |
122 | Vector3[] vertexBase = m.VertexBase; | 159 | Vector3[] vertexBase = m.VertexBase; |
@@ -158,4 +195,4 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
158 | throw new Exception("The method or operation is not implemented."); | 195 | throw new Exception("The method or operation is not implemented."); |
159 | } | 196 | } |
160 | } | 197 | } |
161 | } | 198 | } \ No newline at end of file |