b311480e |
1 | -- Created on: 1997-02-11 |
2 | -- Created by: Alexander BRIVIN and Dmitry TARASOV |
3 | -- Copyright (c) 1997-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class ShapeHints from Vrml |
18 | |
19 | ---Purpose: defines a ShapeHints node of VRML specifying properties of geometry and its appearance. |
20 | -- The ShapeHints node indicates that IndexedFaceSets are solid, contain ordered vertices, or |
21 | -- contain convex faces. |
22 | -- These hints allow VRML implementations to optimize certain rendering features. |
23 | -- Optimizations that may be performed include enabling back-face culling and disabling |
24 | -- two-sided lighting. For example, if an object is solid and has ordered vertices, an |
25 | -- implementation may turn on backface culling and turn off two-sided lighting. To ensure |
26 | -- that an IndexedFaceSet can be viewed from either direction, set shapeType to be |
27 | -- UNKNOWN_SHAPE_TYPE. |
28 | -- If you know that your shapes are closed and will alwsys be viewed from the outside, set |
29 | -- vertexOrdering to be either CLOCKWISE or COUNTERCLOCKWISE (depending on |
30 | -- how you built your object), and set shapeType to be SOLID. Placing this near the top of |
31 | -- your VRML file will allow the scene to be rendered much faster. |
32 | -- The ShapeHints node also affects how default normals are generated. When an |
33 | -- IndexedFaceSet has to generate default normals, it uses the creaseAngle field to determine |
34 | -- which edges should be smoothly shaded and which ones should have a sharp crease. The |
35 | -- crease angle is the angle between surface normals on adjacent polygons. For example, a |
36 | -- crease angle of .5 radians (the default value) means that an edge between two adjacent |
37 | -- polygonal faces will be smooth shaded if the normals to the two faces form an angle that is |
38 | -- less than .5 radians (about 30 degrees). Otherwise, it will be faceted. |
39 | uses |
40 | |
41 | VertexOrdering from Vrml, |
42 | ShapeType from Vrml, |
43 | FaceType from Vrml |
44 | |
45 | is |
46 | Create ( aVertexOrdering : VertexOrdering from Vrml = Vrml_UNKNOWN_ORDERING; |
47 | aShapeType : ShapeType from Vrml = Vrml_UNKNOWN_SHAPE_TYPE; |
48 | aFaceType : FaceType from Vrml = Vrml_CONVEX; |
49 | aAngle : Real from Standard = 0.5 ) |
50 | returns ShapeHints from Vrml; |
51 | |
52 | SetVertexOrdering ( me : in out; |
53 | aVertexOrdering : VertexOrdering from Vrml ); |
54 | VertexOrdering ( me ) returns VertexOrdering from Vrml; |
55 | |
56 | SetShapeType ( me : in out; aShapeType : ShapeType from Vrml ); |
57 | ShapeType ( me ) returns ShapeType from Vrml; |
58 | |
59 | SetFaceType ( me : in out; aFaceType : FaceType from Vrml ); |
60 | FaceType ( me ) returns FaceType from Vrml; |
61 | |
62 | SetAngle ( me : in out; aAngle : Real from Standard ); |
63 | Angle ( me ) returns Real from Standard; |
64 | |
65 | Print ( me; anOStream: in out OStream from Standard) returns OStream from Standard; |
66 | ---C++: return & |
67 | |
68 | fields |
69 | |
70 | myVertexOrdering : VertexOrdering from Vrml; -- Ordering of face vertices |
71 | myShapeType : ShapeType from Vrml; -- Info about shape geometry |
72 | myFaceType : FaceType from Vrml; -- Info about face geometry |
73 | myAngle : Real from Standard; -- Smallest angle for sharp edge |
74 | |
75 | end ShapeHints; |