1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00
Files
occt/src/OpenGl/OpenGl_TextBuilder.hxx
nds 04f32ec6a6 0030537: Visualization - wrapping text in font text formatter
Font_TextFormatter inherits Standard_Transient, now it is given as a handle in functions.
Graphic3d_Text - extended with Font_TextFormatter to be able to have it filled out of text render. If it is not defined here, the default text formatter of context is used.
OpenGl_Context - has default Font_TextFormatter for rendering OpenGl_Text.

(cherry picked from commit d5c557436d)
2019-10-04 18:55:18 +03:00

62 lines
2.8 KiB
C++

// Created on: 2015-06-18
// Created by: Ilya SEVRIKOV
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef OpenGl_TextBuilder_Header
#define OpenGl_TextBuilder_Header
#include <OpenGl_Context.hxx>
#include <OpenGl_Font.hxx>
#include <OpenGl_VertexBuffer.hxx>
#include <OpenGl_VertexBufferEditor.hxx>
#include <OpenGl_Vec.hxx>
#include <NCollection_Vector.hxx>
#include <NCollection_Handle.hxx>
class Font_TextFormatter;
//! This class generates primitive array required for rendering textured text using OpenGl_Font instance.
class OpenGl_TextBuilder
{
public:
//! Creates empty object.
Standard_EXPORT OpenGl_TextBuilder();
//! Creates texture quads for the given text.
Standard_EXPORT void Perform (const Handle(Font_TextFormatter)& theFormatter,
const Handle(OpenGl_Context)& theContext,
OpenGl_Font& theFont,
NCollection_Vector<GLuint>& theTextures,
NCollection_Vector<Handle(OpenGl_VertexBuffer)>& theVertsPerTexture,
NCollection_Vector<Handle(OpenGl_VertexBuffer)>& theTCrdsPerTexture);
protected: //! @name class auxillary methods
Standard_EXPORT void createGlyphs (const Handle(Font_TextFormatter)& theFormatter,
const Handle(OpenGl_Context)& theCtx,
OpenGl_Font& theFont,
NCollection_Vector<GLuint>& theTextures,
NCollection_Vector< NCollection_Handle < NCollection_Vector <OpenGl_Vec2> > >& theVertsPerTexture,
NCollection_Vector< NCollection_Handle < NCollection_Vector <OpenGl_Vec2> > >& theTCrdsPerTexture);
protected: //! @name class auxillary fields
NCollection_Vector<OpenGl_Font::Tile> myTileRects;
OpenGl_VertexBufferEditor<OpenGl_Vec2> myVboEditor;
};
#endif // OpenGl_TextBuilder_Header