Inaki Ayucar
Well, it depends on how accurate you want to be.
In every case, you will have to loop through the polygons of the mesh
To do so, get access to the index buffer of the model. It gives you, for every face, 3 indices of the vertices that belong to that face. For example:
Face 0
indexBuffer[0][0] = Index of Vertex0 in Face 0
indexBuffer[0][1] = Index of Vertex1 in Face 0
indexBuffer[0][2] = Index of Vertex2 in Face 0
Then, in you access the vertexBuffer using those indices and you get the Vertex Information.
Once you know how to loop through the polygons, you will need to test if each polygon is:
1.- Outside the octree cell
2.- Inside the octree cell
3.- In between (the polygon intersects the octree cell boundaries).
To test if a polygon is inside an octree cell, you can do a in-out test with every vertex of the polygon against every plane of the cell, what is pretty fast. If every vertices are outside of one plane of the cell, the the polygon is outside of the cell (case 1). If every vertex is inside of all planes, then the polygon is inside (case 2). If not, the polygon intersects (case 3)
The easiest way to split your model is to discard the third case, assuming than an intersection polygon is inside or outside (whatever you want, but better assume "inside" to avoid artifacts).
If you want to be extremely accurate, you should keep track of the third case too, dividing the intersection polygon into 2 parts (clipping the poly against the cell plane), and moving the first part to mesh1 and the second part to mesh2. There are lots of algorithms for polygon clipping, just google that term.
Altough this task should be done in pre-processing time, I guess this second way could be too expensive. Up to you...
Hope this helps.