Combine AIS objects

Hey everyone

I'm trying to visualize a .3DS file with ASSIMP library. I've subclassed AIS_InteractiveObject and made my own class, AIS_Mesh. Like in the tutorial. I have parsed the ASSIMP scene to a mesh, this in the ::compute method with Graphic3d_ArrayOfTriangles for the triangles and Graphic3d_AspectFillArea3d for the materials. Right now i have a vector of AIS_MESH objects, each object is a face with the correct color.

now for my questions

1) I want to combine (compose) my faces(AIS_Mesh objects) into one unit (compound?), this to reduce memory overhead. Is there any way to combine these faces?

2) i can only retrieve the TopoDS_Shape from AIS_Mesh class if i display it in the InteractiveContext, this is possible after i downcast to AIS_Shape Is there any way to get the TopoDS_Shape without displaying it first? This feels like a ugly hack tho...

3) I do not need the individual meshes from my imported 3DS file, i want one object with the correct face colors. Is there any performance gain if i build the faces first with BRepBuilderAPI_MakeFace? And combine these in one TopoDS_Compound, and construct a AIS_ColoredShape?

Thank you in advance

gkv311 n's picture

Is there any performance gain if i build the faces first with BRepBuilderAPI_MakeFace? And combine these in one TopoDS_Compound, and construct a AIS_ColoredShape?

Yes, AIS_ColoredShape does smart grouping of subshapes by unique materials, so that using this class should bring you better performance (if subshapes indeed share common materials)

sOup x's picture

Each face has a unique material though, but you can easily assign the color of each face with AIS_ColoredShape. Thanks for the help (:

gkv311 n's picture

Each face has a unique material though

I don't think that your model defines that much unique materials to make rendering slow. How many materials do you get? The reader might also provide you duplicated materials, which you may try to merge.