NAP
nap
system_modules
naprender
src
renderableglyph.h
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5
#pragma once
6
7
// External Includes
8
#include <glyph.h>
9
#include <texture.h>
10
11
namespace
nap
12
{
13
// Forward Declares
14
class
FontInstance;
15
class
RenderService;
16
class
Core;
17
24
class
NAPAPI
RenderableGlyph
:
public
IGlyphRepresentation
25
{
26
RTTI_ENABLE(
IGlyphRepresentation
)
27
public
:
28
// Constructor
29
RenderableGlyph
(
nap::Core
& core);
30
31
// Destructor
32
virtual
~
RenderableGlyph
()
override
;
33
37
const
glm::ivec2&
getSize
()
const
{
return
mSize; }
38
42
const
glm::ivec2&
getBearing
()
const
{
return
mBearing; }
43
47
int
getWidth
()
const
{
return
mSize.x; }
48
52
int
getHeight
()
const
{
return
mSize.y; }
53
57
int
getOffsetLeft
()
const
{
return
mBearing.x; }
58
62
int
getOffsetTop
()
const
{
return
mBearing.y; }
63
67
const
Texture2D
&
getTexture
()
const
{
return
*mTexture; }
68
72
Texture2D
&
getTexture
() {
return
*mTexture; }
73
77
int
getHorizontalAdvance
()
const
{
return
mAdvance.x; }
78
82
int
getVerticalAdvance
()
const
{
return
mAdvance.y; }
83
88
bool
empty
()
const
{
return
mTexture ==
nullptr
; }
89
90
protected
:
96
virtual
bool
setup(
const
Glyph
& glyph,
bool
generateMipmaps,
utility::ErrorState
& errorCode);
97
98
private
:
99
std::unique_ptr<Texture2D> mTexture =
nullptr
;
100
glm::ivec2 mSize = { -1, -1 };
101
glm::ivec2 mBearing = { -1, -1 };
102
glm::ivec2 mAdvance = { -1, -1 };
103
};
104
105
107
// Renderable2DGlyph
109
115
class
NAPAPI
Renderable2DGlyph
:
public
RenderableGlyph
116
{
117
RTTI_ENABLE(
RenderableGlyph
)
118
public
:
119
// Constructor
120
Renderable2DGlyph
(
nap::Core
& core);
121
122
protected
:
128
virtual
bool
onInit(
const
Glyph
& glyph,
utility::ErrorState
& errorCode)
override
;
129
};
130
131
133
// Renderable2DMipMapGlyph
135
141
class
NAPAPI
Renderable2DMipMapGlyph
:
public
RenderableGlyph
142
{
143
RTTI_ENABLE(
RenderableGlyph
)
144
public
:
145
// Constructor
146
Renderable2DMipMapGlyph
(
nap::Core
& core);
147
148
protected
:
154
virtual
bool
onInit(
const
Glyph
& glyph,
utility::ErrorState
& errorCode)
override
;
155
};
156
}
nap::RenderableGlyph::getBearing
const glm::ivec2 & getBearing() const
Definition:
renderableglyph.h:42
nap::RenderableGlyph::getHorizontalAdvance
int getHorizontalAdvance() const
Definition:
renderableglyph.h:77
nap::RenderableGlyph::getSize
const glm::ivec2 & getSize() const
Definition:
renderableglyph.h:37
nap::RenderableGlyph::getHeight
int getHeight() const
Definition:
renderableglyph.h:52
nap::IGlyphRepresentation
Definition:
glyph.h:97
nap::utility::ErrorState
Definition:
errorstate.h:19
nap::Renderable2DMipMapGlyph
Definition:
renderableglyph.h:141
nap::RenderableGlyph::getWidth
int getWidth() const
Definition:
renderableglyph.h:47
nap::RenderableGlyph::empty
bool empty() const
Definition:
renderableglyph.h:88
nap::Glyph
Definition:
glyph.h:24
nap::RenderableGlyph::getOffsetTop
int getOffsetTop() const
Definition:
renderableglyph.h:62
nap::Texture2D
Definition:
texture.h:128
nap::Core
Definition:
core.h:82
nap::RenderableGlyph
Definition:
renderableglyph.h:24
nap::Renderable2DGlyph
Definition:
renderableglyph.h:115
nap::RenderableGlyph::getTexture
Texture2D & getTexture()
Definition:
renderableglyph.h:72
nap
Definition:
templateapp.h:17
nap::RenderableGlyph::getTexture
const Texture2D & getTexture() const
Definition:
renderableglyph.h:67
nap::RenderableGlyph::getOffsetLeft
int getOffsetLeft() const
Definition:
renderableglyph.h:57
nap::RenderableGlyph::getVerticalAdvance
int getVerticalAdvance() const
Definition:
renderableglyph.h:82
Generated by doxygen