Texture composition for text no longer on the render thread
This commit is contained in:
@@ -24,36 +24,9 @@ public:
|
||||
static void AssignSamplerUniforms(GLuint program, const RuntimeShaderArtifact& artifact);
|
||||
|
||||
private:
|
||||
struct Glyph
|
||||
{
|
||||
double advance = 0.0;
|
||||
double planeLeft = 0.0;
|
||||
double planeTop = 0.0;
|
||||
double planeRight = 0.0;
|
||||
double planeBottom = 0.0;
|
||||
double atlasLeft = 0.0;
|
||||
double atlasTop = 0.0;
|
||||
double atlasRight = 0.0;
|
||||
double atlasBottom = 0.0;
|
||||
bool hasBounds = false;
|
||||
};
|
||||
|
||||
struct Atlas
|
||||
{
|
||||
std::string fontId;
|
||||
unsigned width = 0;
|
||||
unsigned height = 0;
|
||||
double ascender = -0.9;
|
||||
double descender = 0.25;
|
||||
double lineHeight = 1.2;
|
||||
std::vector<unsigned char> rgbaPixels;
|
||||
std::map<unsigned, Glyph> glyphsByCodepoint;
|
||||
};
|
||||
|
||||
struct TextTexture
|
||||
{
|
||||
std::string parameterId;
|
||||
std::string fontId;
|
||||
std::string cachedText;
|
||||
GLuint texture = 0;
|
||||
unsigned width = 0;
|
||||
@@ -62,16 +35,10 @@ private:
|
||||
unsigned maxLength = 64;
|
||||
};
|
||||
|
||||
bool LoadAtlas(const RenderCadenceCompositor::FontAtlasBuildOutput& output, Atlas& atlas, std::string& error) const;
|
||||
bool EnsureTextTexture(TextTexture& texture);
|
||||
std::vector<unsigned char> ComposeTextTexture(const Atlas& atlas, const TextTexture& texture, const std::string& text, unsigned& width, unsigned& height, unsigned& liveWidth) const;
|
||||
const Atlas* FindAtlas(const std::string& fontId) const;
|
||||
static const ShaderParameterValue* FindParameterValue(const RuntimeShaderArtifact& artifact, const std::string& parameterId);
|
||||
static std::string DefaultTextValue(const RuntimeShaderArtifact& artifact, const std::string& parameterId);
|
||||
static void SampleAtlasPixel(const Atlas& atlas, double x, double y, unsigned char* rgba);
|
||||
const RuntimePreparedTextTexture* FindPreparedTexture(const std::string& parameterId) const;
|
||||
static void DestroyTexture(TextTexture& texture);
|
||||
|
||||
RuntimeShaderArtifact mArtifact;
|
||||
std::vector<Atlas> mAtlases;
|
||||
std::vector<TextTexture> mTextTextures;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user