mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +03:00
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. # Conflicts: # src/Font/Font_TextFormatter.cxx # src/Font/Font_TextFormatter.hxx # src/Graphic3d/Graphic3d_Text.hxx # src/OpenGl/OpenGl_Context.cxx # src/OpenGl/OpenGl_Text.cxx # src/OpenGl/OpenGl_TextBuilder.cxx # src/StdPrs/StdPrs_BRepTextBuilder.cxx
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
#define Font_BRepTextBuilder_Header
|
||||
|
||||
#include <StdPrs_BRepTextBuilder.hxx>
|
||||
class Font_TextFormatter;
|
||||
|
||||
|
||||
//! Alias for porting from old name.
|
||||
typedef StdPrs_BRepTextBuilder Font_BRepTextBuilder;
|
||||
|
@@ -38,6 +38,7 @@
|
||||
#include <Graphic3d_TransformUtils.hxx>
|
||||
#include <Graphic3d_RenderingParams.hxx>
|
||||
#include <Image_SupportedFormats.hxx>
|
||||
#include <Font_TextFormatter.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <Standard_ProgramError.hxx>
|
||||
@@ -296,6 +297,8 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
||||
|
||||
memset (myFuncs.operator->(), 0, sizeof(OpenGl_GlFunctions));
|
||||
myShaderManager = new OpenGl_ShaderManager (this);
|
||||
|
||||
myDefaultFormatter = new Font_TextFormatter();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -136,6 +136,7 @@ template<typename theBaseClass_t> struct OpenGl_TmplCore45;
|
||||
typedef OpenGl_TmplCore45<OpenGl_GlCore44Back> OpenGl_GlCore45Back;
|
||||
typedef OpenGl_TmplCore45<OpenGl_GlCore44> OpenGl_GlCore45;
|
||||
|
||||
class Font_TextFormatter;
|
||||
class Graphic3d_Camera;
|
||||
class Graphic3d_PresentationAttributes;
|
||||
class OpenGl_Aspects;
|
||||
@@ -491,6 +492,9 @@ public:
|
||||
//! @return tool for management of shader programs within this context.
|
||||
inline const Handle(OpenGl_ShaderManager)& ShaderManager() const { return myShaderManager; }
|
||||
|
||||
//! @return default formatter of text withing this context
|
||||
inline const Handle(Font_TextFormatter)& DefaultTextFormatter() const { return myDefaultFormatter; }
|
||||
|
||||
public:
|
||||
|
||||
//! Either GL_CLAMP_TO_EDGE (1.2+) or GL_CLAMP (1.1).
|
||||
@@ -1163,6 +1167,7 @@ private: // context info
|
||||
Graphic3d_TextureUnit myPBRSpecIBLMapTexUnit; //!< samplerCube occSpecIBLMap, texture unit where specular IBL map is expected to be binded (0 if PBR is not supported)
|
||||
|
||||
Handle(OpenGl_ShaderManager) myShaderManager; //! support object for managing shader programs
|
||||
Handle(Font_TextFormatter) myDefaultFormatter;//!< default text formatter, an alternative to text params
|
||||
|
||||
private: //! @name fields tracking current state
|
||||
|
||||
|
@@ -689,7 +689,7 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
||||
Handle(Font_TextFormatter) aFormatter = myText->TextFormatter();
|
||||
if (aFormatter.IsNull())
|
||||
{
|
||||
aFormatter = new Font_TextFormatter();
|
||||
aFormatter = theCtx->DefaultTextFormatter();
|
||||
}
|
||||
aFormatter->SetupAlignment (myText->HorizontalAlignment(), myText->VerticalAlignment());
|
||||
aFormatter->Reset();
|
||||
|
Reference in New Issue
Block a user