Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:31

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 
0031 //! defines a ShapeHints node of VRML specifying properties of geometry and its appearance.
0032 //! The ShapeHints node indicates that IndexedFaceSets are solid, contain ordered vertices, or
0033 //! contain convex faces.
0034 //! These hints allow VRML implementations to optimize certain rendering features.
0035 //! Optimizations that may be performed include enabling back-face culling and disabling
0036 //! two-sided lighting. For example, if an object is solid and has ordered vertices, an
0037 //! implementation may turn on backface culling and turn off two-sided lighting. To ensure
0038 //! that an IndexedFaceSet can be viewed from either direction, set shapeType to be
0039 //! UNKNOWN_SHAPE_TYPE.
0040 //! If you know that your shapes are closed and will alwsys be viewed from the outside, set
0041 //! vertexOrdering to be either CLOCKWISE or COUNTERCLOCKWISE (depending on
0042 //! how you built your object), and set shapeType to be SOLID. Placing this near the top of
0043 //! your VRML file will allow the scene to be rendered much faster.
0044 //! The ShapeHints node also affects how default normals are generated. When an
0045 //! IndexedFaceSet has to generate default normals, it uses the creaseAngle field to determine
0046 //! which edges should be smoothly shaded and which ones should have a sharp crease. The
0047 //! crease angle is the angle between surface normals on adjacent polygons. For example, a
0048 //! crease angle of .5 radians (the default value) means that an edge between two adjacent
0049 //! polygonal faces will be smooth shaded if the normals to the two faces form an angle that is
0050 //! less than .5 radians (about 30 degrees). Otherwise, it will be faceted.
0051 class Vrml_ShapeHints 
0052 {
0053 public:
0054 
0055   DEFINE_STANDARD_ALLOC
0056 
0057   
0058   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);
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 Standard_Real aAngle);
0073   
0074   Standard_EXPORT Standard_Real Angle() const;
0075   
0076   Standard_EXPORT Standard_OStream& Print (Standard_OStream& anOStream) const;
0077 
0078 
0079 
0080 
0081 protected:
0082 
0083 
0084 
0085 
0086 
0087 private:
0088 
0089 
0090 
0091   Vrml_VertexOrdering myVertexOrdering;
0092   Vrml_ShapeType myShapeType;
0093   Vrml_FaceType myFaceType;
0094   Standard_Real myAngle;
0095 
0096 
0097 };
0098 
0099 
0100 
0101 
0102 
0103 
0104 
0105 #endif // _Vrml_ShapeHints_HeaderFile