0032969: Coding - get rid of unused headers [IMeshData to PLib]
[occt.git] / src / OpenGl / OpenGl_TextBuilder.hxx
1 // Created on: 2015-06-18
2 // Created by: Ilya SEVRIKOV
3 // Copyright (c) 2015 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef OpenGl_TextBuilder_Header
17 #define OpenGl_TextBuilder_Header
18
19 #include <OpenGl_Font.hxx>
20 #include <OpenGl_VertexBuffer.hxx>
21 #include <OpenGl_VertexBufferEditor.hxx>
22 #include <OpenGl_Vec.hxx>
23
24 #include <NCollection_Vector.hxx>
25 #include <NCollection_Handle.hxx>
26
27 class Font_TextFormatter;
28
29 //! This class generates primitive array required for rendering textured text using OpenGl_Font instance.
30 class OpenGl_TextBuilder
31 {
32 public:
33
34   //! Creates empty object.
35   Standard_EXPORT OpenGl_TextBuilder();
36
37   //! Creates texture quads for the given text.
38   Standard_EXPORT void Perform (const Handle(Font_TextFormatter)&                theFormatter,
39                                 const Handle(OpenGl_Context)&                    theContext,
40                                 OpenGl_Font&                                     theFont,
41                                 NCollection_Vector<GLuint>&                      theTextures,
42                                 NCollection_Vector<Handle(OpenGl_VertexBuffer)>& theVertsPerTexture,
43                                 NCollection_Vector<Handle(OpenGl_VertexBuffer)>& theTCrdsPerTexture);
44
45 protected: //! @name class auxiliary methods
46
47   Standard_EXPORT void createGlyphs (const Handle(Font_TextFormatter)&                                              theFormatter,
48                                      const Handle(OpenGl_Context)&                                                  theCtx,
49                                      OpenGl_Font&                                                                   theFont,
50                                      NCollection_Vector<GLuint>&                                                    theTextures,
51                                      NCollection_Vector< NCollection_Handle < NCollection_Vector <OpenGl_Vec2> > >& theVertsPerTexture,
52                                      NCollection_Vector< NCollection_Handle < NCollection_Vector <OpenGl_Vec2> > >& theTCrdsPerTexture);
53
54 protected: //! @name class auxiliary fields
55
56   NCollection_Vector<OpenGl_Font::Tile>  myTileRects;
57   OpenGl_VertexBufferEditor<OpenGl_Vec2> myVboEditor;
58 };
59
60 #endif // OpenGl_TextBuilder_Header