MCPcopy Create free account
hub / github.com/comaps/comaps / GetNormalsAndMask

Function GetNormalsAndMask

libs/drape_frontend/gui/gui_text.cpp:27–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25namespace
26{
27glsl::vec2 GetNormalsAndMask(dp::TextureManager::GlyphRegion const & glyph, float xOffset, float yOffset,
28 float textRatio, std::array<glsl::vec2, 4> & normals,
29 std::array<glsl::vec2, 4> & maskTexCoord)
30{
31 m2::PointF const pixelSize = glyph.GetPixelSize() * textRatio;
32 m2::RectF const & r = glyph.GetTexRect();
33
34 xOffset *= textRatio;
35 yOffset *= textRatio;
36
37 float const upVector = -pixelSize.y - yOffset;
38 float const bottomVector = -yOffset;
39
40 normals[0] = glsl::vec2(xOffset, bottomVector);
41 normals[1] = glsl::vec2(xOffset, upVector);
42 normals[2] = glsl::vec2(pixelSize.x + xOffset, bottomVector);
43 normals[3] = glsl::vec2(pixelSize.x + xOffset, upVector);
44
45 maskTexCoord[0] = glsl::ToVec2(r.LeftTop());
46 maskTexCoord[1] = glsl::ToVec2(r.LeftBottom());
47 maskTexCoord[2] = glsl::ToVec2(r.RightTop());
48 maskTexCoord[3] = glsl::ToVec2(r.RightBottom());
49
50 return {xOffset, yOffset};
51}
52
53void FillCommonDecl(dp::BindingDecl & decl, std::string const & name, uint8_t compCount, uint8_t stride, uint8_t offset)
54{

Callers 2

CacheStaticTextMethod · 0.85
SetTextMethod · 0.85

Calls 7

vec2Class · 0.85
ToVec2Function · 0.85
GetPixelSizeMethod · 0.80
LeftTopMethod · 0.80
LeftBottomMethod · 0.80
RightTopMethod · 0.80
RightBottomMethod · 0.80

Tested by

no test coverage detected