1 // Created on: 2007-08-04
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2007-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
22 #ifndef VrmlData_ShapeConvert_HeaderFile
23 #define VrmlData_ShapeConvert_HeaderFile
25 #include <VrmlData_Geometry.hxx>
26 #include <VrmlData_Appearance.hxx>
27 #include <NCollection_List.hxx>
28 #include <TopoDS_Shape.hxx>
32 class Handle_Poly_Triangulation;
33 class Handle_Poly_Polygon3D;
34 class Handle_VrmlData_Coordinate;
36 * Algorithm converting one shape or a set of shapes to VrmlData_Scene.
39 class VrmlData_ShapeConvert
44 TCollection_AsciiString Name;
46 Handle(VrmlData_Node) Node;
49 // ---------- PUBLIC METHODS ----------
55 * Scene receiving all Vrml data.
57 * Scale factor, considering that VRML standard specifies coordinates in
58 * meters. So if your data are in mm, you should provide theScale=0.001
60 inline VrmlData_ShapeConvert (VrmlData_Scene& theScene,
61 const Standard_Real theScale = 1.)
67 * Add one shape to the internal list, may be called several times with
70 Standard_EXPORT void AddShape (const TopoDS_Shape& theShape,
71 const char * theName = 0L);
74 * Convert all accumulated shapes and store them in myScene.
75 * The internal data structures are cleared in the end of convertion.
76 * @param theExtractFaces
77 * If True, converter extracst faces from the shapes.
78 * @param theExtractEdges
79 * If True, converter extracts edges from the shapes.
80 * @param theDeflection
81 * Deflection for tessellation of geometrical lines/surfaces. Existing mesh
82 * is used if its deflection is smaller than the one given by this
85 * Angular deflection for tessellation of geometrical lines.
87 Standard_EXPORT void Convert (const Standard_Boolean theExtractFaces,
88 const Standard_Boolean theExtractEdges,
89 const Standard_Real theDeflection = 0.01,
90 const Standard_Real theDeflAngle = 20.*M_PI/180.);
91 //this value of theDeflAngle is used by default
92 //for tesselation while shading (Drawer->HLRAngle())
95 // ---------- PROTECTED METHODS ----------
97 Handle_VrmlData_Geometry triToIndexedFaceSet
98 (const Handle_Poly_Triangulation&,
100 const Handle_VrmlData_Coordinate&);
102 Handle_VrmlData_Geometry polToIndexedLineSet
103 (const Handle_Poly_Polygon3D&);
105 Handle_VrmlData_Appearance defaultMaterialFace () const;
107 Handle_VrmlData_Appearance defaultMaterialEdge () const;
110 // ---------- PRIVATE FIELDS ----------
112 VrmlData_Scene& myScene;
113 Standard_Real myScale;
114 NCollection_List <ShapeData> myShapes;