Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-29 09:20:53

0001 // Created on: 1997-02-11
0002 // Created by: Alexander BRIVIN and Dmitry TARASOV
0003 // Copyright (c) 1997-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Vrml_ShapeHints_HeaderFile
0018 #define _Vrml_ShapeHints_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Vrml_VertexOrdering.hxx>
0025 #include <Vrml_ShapeType.hxx>
0026 #include <Vrml_FaceType.hxx>
0027 #include <Standard_Real.hxx>
0028 #include <Standard_OStream.hxx>
0029 
0030 //! defines a ShapeHints node of VRML specifying properties of geometry and its appearance.
0031 //! The ShapeHints node indicates that IndexedFaceSets are solid, contain ordered vertices, or
0032 //! contain convex faces.
0033 //! These hints allow VRML implementations to optimize certain rendering features.
0034 //! Optimizations that may be performed include enabling back-face culling and disabling
0035 //! two-sided lighting. For example, if an object is solid and has ordered vertices, an
0036 //! implementation may turn on backface culling and turn off two-sided lighting. To ensure
0037 //! that an IndexedFaceSet can be viewed from either direction, set shapeType to be
0038 //! UNKNOWN_SHAPE_TYPE.
0039 //! If you know that your shapes are closed and will alwsys be viewed from the outside, set
0040 //! vertexOrdering to be either CLOCKWISE or COUNTERCLOCKWISE (depending on
0041 //! how you built your object), and set shapeType to be SOLID. Placing this near the top of
0042 //! your VRML file will allow the scene to be rendered much faster.
0043 //! The ShapeHints node also affects how default normals are generated. When an
0044 //! IndexedFaceSet has to generate default normals, it uses the creaseAngle field to determine
0045 //! which edges should be smoothly shaded and which ones should have a sharp crease. The
0046 //! crease angle is the angle between surface normals on adjacent polygons. For example, a
0047 //! crease angle of .5 radians (the default value) means that an edge between two adjacent
0048 //! polygonal faces will be smooth shaded if the normals to the two faces form an angle that is
0049 //! less than .5 radians (about 30 degrees). Otherwise, it will be faceted.
0050 class Vrml_ShapeHints
0051 {
0052 public:
0053   DEFINE_STANDARD_ALLOC
0054 
0055   Standard_EXPORT Vrml_ShapeHints(const Vrml_VertexOrdering aVertexOrdering = Vrml_UNKNOWN_ORDERING,
0056                                   const Vrml_ShapeType      aShapeType = Vrml_UNKNOWN_SHAPE_TYPE,
0057                                   const Vrml_FaceType       aFaceType  = Vrml_CONVEX,
0058                                   const double              aAngle     = 0.5);
0059 
0060   Standard_EXPORT void SetVertexOrdering(const Vrml_VertexOrdering aVertexOrdering);
0061 
0062   Standard_EXPORT Vrml_VertexOrdering VertexOrdering() const;
0063 
0064   Standard_EXPORT void SetShapeType(const Vrml_ShapeType aShapeType);
0065 
0066   Standard_EXPORT Vrml_ShapeType ShapeType() const;
0067 
0068   Standard_EXPORT void SetFaceType(const Vrml_FaceType aFaceType);
0069 
0070   Standard_EXPORT Vrml_FaceType FaceType() const;
0071 
0072   Standard_EXPORT void SetAngle(const double aAngle);
0073 
0074   Standard_EXPORT double Angle() const;
0075 
0076   Standard_EXPORT Standard_OStream& Print(Standard_OStream& anOStream) const;
0077 
0078 private:
0079   Vrml_VertexOrdering myVertexOrdering;
0080   Vrml_ShapeType      myShapeType;
0081   Vrml_FaceType       myFaceType;
0082   double              myAngle;
0083 };
0084 
0085 #endif // _Vrml_ShapeHints_HeaderFile