Here is my code so far for this function:
Code: Select all
System::Collections::ArrayList* IMesh::get_Triangles(){
irr::scene::IMesh* tmp;
System::Collections::ArrayList* triangles = new System::Collections::ArrayList();
tmp = get_NativeMesh();
//hahahah
int cMeshBuffer, j;
int v1i, v2i, v3i;
irr::scene::IMeshBuffer *mb;
float vArray[9]; // vertex array (3*3 floats)
int tmpCount = 0;
for (cMeshBuffer=0; cMeshBuffer < tmp->getMeshBufferCount(); cMeshBuffer++){
mb = tmp->getMeshBuffer(cMeshBuffer);
irr::video::S3DVertex* mb_vertices = (irr::video::S3DVertex*)mb->getVertices();
irr::u16* mb_indices = mb->getIndices();
// add each triangle from the mesh
for (j=0; j<mb->getIndexCount(); j+=3){
v1i = mb_indices[j];
v2i = mb_indices[j+1];
v3i = mb_indices[j+2];
Irrlicht::Core::Vector3D a;
Irrlicht::Core::Vector3D b;
Irrlicht::Core::Vector3D c;
a.X = mb_vertices[v1i].Pos.X;
a.Y = mb_vertices[v1i].Pos.Y;
a.Z = mb_vertices[v1i].Pos.Z;
b.X = mb_vertices[v2i].Pos.X;
b.Y = mb_vertices[v2i].Pos.Y;
b.Z = mb_vertices[v2i].Pos.Z;
c.X = mb_vertices[v3i].Pos.X;
c.Y = mb_vertices[v3i].Pos.Y;
c.Z = mb_vertices[v3i].Pos.Z;
Irrlicht::Core::Triangle3D* t;
t->Set(a,b,c);
(*triangles).Add(t);
}
}
return triangles;
}
Code: Select all
c:\Documents and Settings\tkoenig\Desktop\Code\irrlicht-1.0\source\Irrlicht.NET\IMesh.cpp(92): error C2664: 'System::Collections::ArrayList::Add' : cannot convert parameter 1 from 'Irrlicht::Core::Triangle3D __gc *' to 'System::Object __gc *'
Any suggestions? Is this something other folks want to do also? The reason I want to do it is so I can try to implement some sort of physics library binding with Irrlicht.NET, maybe using the ODE.NET DLL from TAO.
Thanks!