1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0026298: Visualization, OpenGl_Text - make font resolution configurable.

Add THE_DEFAULT_RESOLUTION static const parameter to Graphic3d_RenderingParams.
Add resolution to Graphic3d_RenderingParams.
Drop redundant variables from OpenGl_Workspace.
Add a new parameter to Graphic3d_GraphicDriver::TextSize method (and to OpenGl_GraphicDriver).
Add a new parameter to OpenGl_Text::Render() and to OpenGl_Text::render() methods.
OpenGl_Text::FontKey() considers a resolution (PPI) now.
Add a new argument '-resolution' (sets a pixel density) in the 'VRenderParams' draw-command.
This commit is contained in:
isk
2015-09-29 12:17:58 +03:00
committed by bugmaster
parent 5b0f2540d7
commit 4b1c8733e8
12 changed files with 115 additions and 44 deletions

View File

@@ -99,8 +99,13 @@ public:
virtual Standard_ShortReal DefaultTextHeight() const = 0;
//! call_togl_textsize2d
virtual void TextSize (const Standard_CString AText, const Standard_ShortReal AHeight, Standard_ShortReal& AWidth, Standard_ShortReal& AnAscent, Standard_ShortReal& ADescent) const = 0;
//! Computes text width.
virtual void TextSize (const Handle(Graphic3d_CView)& theView,
const Standard_CString theText,
const Standard_ShortReal theHeight,
Standard_ShortReal& theWidth,
Standard_ShortReal& theAscent,
Standard_ShortReal& theDescent) const = 0;
//! Add a new top-level z layer with ID <theLayerId> for
//! the view. Z layers allow drawing structures in higher layers

View File

@@ -25,6 +25,8 @@
class Graphic3d_RenderingParams
{
public:
//! Default pixels density.
static const unsigned int THE_DEFAULT_RESOLUTION = 72u;
//! Default number of samples per pixel.
static const Standard_Integer THE_DEFAULT_SPP = 1;
@@ -60,7 +62,9 @@ public:
StereoMode (Graphic3d_StereoMode_QuadBuffer),
AnaglyphFilter (Anaglyph_RedCyan_Optimized),
ToReverseStereo (Standard_False)
ToReverseStereo (Standard_False),
Resolution (THE_DEFAULT_RESOLUTION)
{
const Graphic3d_Vec4 aZero (0.0f, 0.0f, 0.0f, 0.0f);
AnaglyphLeft .SetRow (0, Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f));
@@ -93,6 +97,12 @@ public:
Graphic3d_Mat4 AnaglyphRight; //!< right anaglyph filter (in normalized colorspace), Color = AnaglyphRight * theColorRight + AnaglyphLeft * theColorLeft;
Standard_Boolean ToReverseStereo; //!< flag to reverse stereo pair, FALSE by default
unsigned int Resolution; //!< Pixels density (PPI), defines scaling factor for parameters like text size
//!< (when defined in screen-space units rather than in 3D) to be properly displayed
//!< on device (screen / printer). 72 is default value.
//!< Note that using difference resolution in different Views in same Viewer
//!< will lead to performance regression (for example, text will be recreated every time).
};
#endif // _Graphic3d_RenderingParams_HeaderFile