|
|
|||
File indexing completed on 2026-05-13 08:43:05
0001 // Created on: 2009-12-10 0002 // Created by: Paul SUPRYATKIN 0003 // Copyright (c) 2009-2014 OPEN CASCADE SAS 0004 // 0005 // This file is part of Open CASCADE Technology software library. 0006 // 0007 // This library is free software; you can redistribute it and/or modify it under 0008 // the terms of the GNU Lesser General Public License version 2.1 as published 0009 // by the Free Software Foundation, with special exception defined in the file 0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0011 // distribution for complete text of the license and disclaimer of any warranty. 0012 // 0013 // Alternatively, this file may be used under the terms of Open CASCADE 0014 // commercial license or contractual agreement. 0015 0016 #ifndef _AIS_Triangulation_HeaderFile 0017 #define _AIS_Triangulation_HeaderFile 0018 0019 #include <TColStd_HArray1OfInteger.hxx> 0020 #include <AIS_InteractiveObject.hxx> 0021 0022 class Poly_Triangulation; 0023 0024 DEFINE_STANDARD_HANDLE(AIS_Triangulation, AIS_InteractiveObject) 0025 0026 //! Interactive object that draws data from Poly_Triangulation, optionally with colors associated 0027 //! with each triangulation vertex. For maximum efficiency colors are represented as 32-bit integers 0028 //! instead of classic Quantity_Color values. 0029 //! Interactive selection of triangles and vertices is not yet implemented. 0030 class AIS_Triangulation : public AIS_InteractiveObject 0031 { 0032 DEFINE_STANDARD_RTTIEXT(AIS_Triangulation, AIS_InteractiveObject) 0033 public: 0034 //! Constructs the Triangulation display object 0035 Standard_EXPORT AIS_Triangulation(const Handle(Poly_Triangulation)& aTriangulation); 0036 0037 //! Set the color for each node. 0038 //! Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red 0039 //! Order of color components is essential for further usage by OpenGL 0040 Standard_EXPORT void SetColors(const Handle(TColStd_HArray1OfInteger)& aColor); 0041 0042 //! Get the color for each node. 0043 //! Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red 0044 Standard_EXPORT Handle(TColStd_HArray1OfInteger) GetColors() const; 0045 0046 //! Returns true if triangulation has vertex colors. 0047 Standard_Boolean HasVertexColors() const { return (myFlagColor == 1); } 0048 0049 Standard_EXPORT void SetTriangulation(const Handle(Poly_Triangulation)& aTriangulation); 0050 0051 //! Returns Poly_Triangulation . 0052 Standard_EXPORT Handle(Poly_Triangulation) GetTriangulation() const; 0053 0054 //! Sets the value aValue for transparency in the reconstructed compound shape. 0055 Standard_EXPORT virtual void SetTransparency(const Standard_Real aValue = 0.6) Standard_OVERRIDE; 0056 0057 //! Removes the setting for transparency in the reconstructed compound shape. 0058 Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE; 0059 0060 protected: 0061 Standard_EXPORT void updatePresentation(); 0062 0063 private: 0064 Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr, 0065 const Handle(Prs3d_Presentation)& thePrs, 0066 const Standard_Integer theMode) Standard_OVERRIDE; 0067 0068 Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel, 0069 const Standard_Integer theMode) Standard_OVERRIDE; 0070 0071 //! Attenuates 32-bit color by a given attenuation factor (0...1): 0072 //! aColor = Alpha << 24 + Blue << 16 + Green << 8 + Red 0073 //! All color components are multiplied by aComponent, the result is then packed again as 32-bit 0074 //! integer. Color attenuation is applied to the vertex colors in order to have correct visual 0075 //! result after glColorMaterial(GL_AMBIENT_AND_DIFFUSE). Without it, colors look unnatural and 0076 //! flat. 0077 Standard_EXPORT Graphic3d_Vec4ub attenuateColor(const Standard_Integer theColor, 0078 const Standard_Real theComponent); 0079 0080 Handle(Poly_Triangulation) myTriangulation; 0081 Handle(TColStd_HArray1OfInteger) myColor; 0082 Standard_Integer myFlagColor; 0083 Standard_Integer myNbNodes; 0084 Standard_Integer myNbTriangles; 0085 }; 0086 0087 #endif // _AIS_Triangulation_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|