42cf5bc1 |
1 | // Created on: 1997-02-11 |
2 | // Created by: Alexander BRIVIN and Dmitry TARASOV |
3 | // Copyright (c) 1997-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Vrml_ShapeHints_HeaderFile |
18 | #define _Vrml_ShapeHints_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Vrml_VertexOrdering.hxx> |
25 | #include <Vrml_ShapeType.hxx> |
26 | #include <Vrml_FaceType.hxx> |
27 | #include <Standard_Real.hxx> |
28 | #include <Standard_OStream.hxx> |
29 | |
30 | |
31 | //! defines a ShapeHints node of VRML specifying properties of geometry and its appearance. |
32 | //! The ShapeHints node indicates that IndexedFaceSets are solid, contain ordered vertices, or |
33 | //! contain convex faces. |
34 | //! These hints allow VRML implementations to optimize certain rendering features. |
35 | //! Optimizations that may be performed include enabling back-face culling and disabling |
36 | //! two-sided lighting. For example, if an object is solid and has ordered vertices, an |
37 | //! implementation may turn on backface culling and turn off two-sided lighting. To ensure |
38 | //! that an IndexedFaceSet can be viewed from either direction, set shapeType to be |
39 | //! UNKNOWN_SHAPE_TYPE. |
40 | //! If you know that your shapes are closed and will alwsys be viewed from the outside, set |
41 | //! vertexOrdering to be either CLOCKWISE or COUNTERCLOCKWISE (depending on |
42 | //! how you built your object), and set shapeType to be SOLID. Placing this near the top of |
43 | //! your VRML file will allow the scene to be rendered much faster. |
44 | //! The ShapeHints node also affects how default normals are generated. When an |
45 | //! IndexedFaceSet has to generate default normals, it uses the creaseAngle field to determine |
46 | //! which edges should be smoothly shaded and which ones should have a sharp crease. The |
47 | //! crease angle is the angle between surface normals on adjacent polygons. For example, a |
48 | //! crease angle of .5 radians (the default value) means that an edge between two adjacent |
49 | //! polygonal faces will be smooth shaded if the normals to the two faces form an angle that is |
50 | //! less than .5 radians (about 30 degrees). Otherwise, it will be faceted. |
51 | class Vrml_ShapeHints |
52 | { |
53 | public: |
54 | |
55 | DEFINE_STANDARD_ALLOC |
56 | |
57 | |
58 | Standard_EXPORT Vrml_ShapeHints(const Vrml_VertexOrdering aVertexOrdering = Vrml_UNKNOWN_ORDERING, const Vrml_ShapeType aShapeType = Vrml_UNKNOWN_SHAPE_TYPE, const Vrml_FaceType aFaceType = Vrml_CONVEX, const Standard_Real aAngle = 0.5); |
59 | |
60 | Standard_EXPORT void SetVertexOrdering (const Vrml_VertexOrdering aVertexOrdering); |
61 | |
62 | Standard_EXPORT Vrml_VertexOrdering VertexOrdering() const; |
63 | |
64 | Standard_EXPORT void SetShapeType (const Vrml_ShapeType aShapeType); |
65 | |
66 | Standard_EXPORT Vrml_ShapeType ShapeType() const; |
67 | |
68 | Standard_EXPORT void SetFaceType (const Vrml_FaceType aFaceType); |
69 | |
70 | Standard_EXPORT Vrml_FaceType FaceType() const; |
71 | |
72 | Standard_EXPORT void SetAngle (const Standard_Real aAngle); |
73 | |
74 | Standard_EXPORT Standard_Real Angle() const; |
75 | |
76 | Standard_EXPORT Standard_OStream& Print (Standard_OStream& anOStream) const; |
77 | |
78 | |
79 | |
80 | |
81 | protected: |
82 | |
83 | |
84 | |
85 | |
86 | |
87 | private: |
88 | |
89 | |
90 | |
91 | Vrml_VertexOrdering myVertexOrdering; |
92 | Vrml_ShapeType myShapeType; |
93 | Vrml_FaceType myFaceType; |
94 | Standard_Real myAngle; |
95 | |
96 | |
97 | }; |
98 | |
99 | |
100 | |
101 | |
102 | |
103 | |
104 | |
105 | #endif // _Vrml_ShapeHints_HeaderFile |