1 // File: VrmlData_ShapeConvert.hxx
2 // Created: 04.08.07 09:48
3 // Author: Alexander GRIGORIEV
4 // Copyright: Open Cascade 2007
7 #ifndef VrmlData_ShapeConvert_HeaderFile
8 #define VrmlData_ShapeConvert_HeaderFile
10 #include <VrmlData_Geometry.hxx>
11 #include <VrmlData_Appearance.hxx>
12 #include <NCollection_List.hxx>
13 #include <TopoDS_Shape.hxx>
17 class Handle_Poly_Triangulation;
18 class Handle_Poly_Polygon3D;
19 class Handle_VrmlData_Coordinate;
21 * Algorithm converting one shape or a set of shapes to VrmlData_Scene.
24 class VrmlData_ShapeConvert
29 TCollection_AsciiString Name;
31 Handle(VrmlData_Node) Node;
34 // ---------- PUBLIC METHODS ----------
40 * Scene receiving all Vrml data.
42 * Scale factor, considering that VRML standard specifies coordinates in
43 * meters. So if your data are in mm, you should provide theScale=0.001
45 inline VrmlData_ShapeConvert (VrmlData_Scene& theScene,
46 const Standard_Real theScale = 1.)
52 * Add one shape to the internal list, may be called several times with
55 Standard_EXPORT void AddShape (const TopoDS_Shape& theShape,
56 const char * theName = 0L);
59 * Convert all accumulated shapes and store them in myScene.
60 * The internal data structures are cleared in the end of convertion.
61 * @param theExtractFaces
62 * If True, converter extracst faces from the shapes.
63 * @param theExtractEdges
64 * If True, converter extracts edges from the shapes.
65 * @param theDeflection
66 * Deflection for tessellation of geometrical lines/surfaces. Existing mesh
67 * is used if its deflection is smaller than the one given by this
70 * Angular deflection for tessellation of geometrical lines.
72 Standard_EXPORT void Convert (const Standard_Boolean theExtractFaces,
73 const Standard_Boolean theExtractEdges,
74 const Standard_Real theDeflection = 0.01,
75 const Standard_Real theDeflAngle = 20.*M_PI/180.);
76 //this value of theDeflAngle is used by default
77 //for tesselation while shading (Drawer->HLRAngle())
80 // ---------- PROTECTED METHODS ----------
82 Handle_VrmlData_Geometry triToIndexedFaceSet
83 (const Handle_Poly_Triangulation&,
85 const Handle_VrmlData_Coordinate&);
87 Handle_VrmlData_Geometry polToIndexedLineSet
88 (const Handle_Poly_Polygon3D&);
90 Handle_VrmlData_Appearance defaultMaterialFace () const;
92 Handle_VrmlData_Appearance defaultMaterialEdge () const;
95 // ---------- PRIVATE FIELDS ----------
97 VrmlData_Scene& myScene;
98 Standard_Real myScale;
99 NCollection_List <ShapeData> myShapes;