1 // Created on: 2007-08-04
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2007-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and / or modify it
8 // under the terms of the GNU Lesser General Public version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef VrmlData_ShapeConvert_HeaderFile
17 #define VrmlData_ShapeConvert_HeaderFile
19 #include <VrmlData_Geometry.hxx>
20 #include <VrmlData_Appearance.hxx>
21 #include <NCollection_List.hxx>
22 #include <TopoDS_Shape.hxx>
26 class Handle_Poly_Triangulation;
27 class Handle_Poly_Polygon3D;
28 class Handle_VrmlData_Coordinate;
30 * Algorithm converting one shape or a set of shapes to VrmlData_Scene.
33 class VrmlData_ShapeConvert
38 TCollection_AsciiString Name;
40 Handle(VrmlData_Node) Node;
43 // ---------- PUBLIC METHODS ----------
49 * Scene receiving all Vrml data.
51 * Scale factor, considering that VRML standard specifies coordinates in
52 * meters. So if your data are in mm, you should provide theScale=0.001
54 inline VrmlData_ShapeConvert (VrmlData_Scene& theScene,
55 const Standard_Real theScale = 1.)
61 * Add one shape to the internal list, may be called several times with
64 Standard_EXPORT void AddShape (const TopoDS_Shape& theShape,
65 const char * theName = 0L);
68 * Convert all accumulated shapes and store them in myScene.
69 * The internal data structures are cleared in the end of convertion.
70 * @param theExtractFaces
71 * If True, converter extracst faces from the shapes.
72 * @param theExtractEdges
73 * If True, converter extracts edges from the shapes.
74 * @param theDeflection
75 * Deflection for tessellation of geometrical lines/surfaces. Existing mesh
76 * is used if its deflection is smaller than the one given by this
79 * Angular deflection for tessellation of geometrical lines.
81 Standard_EXPORT void Convert (const Standard_Boolean theExtractFaces,
82 const Standard_Boolean theExtractEdges,
83 const Standard_Real theDeflection = 0.01,
84 const Standard_Real theDeflAngle = 20.*M_PI/180.);
85 //this value of theDeflAngle is used by default
86 //for tesselation while shading (Drawer->HLRAngle())
88 // ---------- PROTECTED METHODS ----------
90 Handle_VrmlData_Geometry triToIndexedFaceSet
91 (const Handle_Poly_Triangulation&,
93 const Handle_VrmlData_Coordinate&);
95 Handle_VrmlData_Geometry polToIndexedLineSet
96 (const Handle_Poly_Polygon3D&);
98 Handle_VrmlData_Appearance defaultMaterialFace () const;
100 Handle_VrmlData_Appearance defaultMaterialEdge () const;
103 // ---------- PRIVATE FIELDS ----------
105 VrmlData_Scene& myScene;
106 Standard_Real myScale;
107 NCollection_List <ShapeData> myShapes;
108 // ---------- PRIVATE METHODS ----------
109 void operator= (const VrmlData_ShapeConvert&);