diff --git a/Thesis/Thesis.tex b/Thesis/Thesis.tex index 8735b45..8fe2666 100644 --- a/Thesis/Thesis.tex +++ b/Thesis/Thesis.tex @@ -1739,7 +1739,7 @@ void TextRenderer::Load(const std::string &font, unsigned int fontSize) ... \end{lstlisting} -\newapge +\newpage \paragraph{Actual loading and configuration} We load the font using freeType, after checking if it was loaded correctly we set size of a single character, disable byte-alignment in order for the text to be rendered correctly, preload first 128 [ASCII] characters and since we already loaded everything we wanted we destroy FreeType library @@ -1788,10 +1788,39 @@ void TextRenderer::Load(const std::string &font, unsigned int fontSize) \end{tikzpicture} \caption{Loading font logic} -\label{fig:findingMatches} +\label{fig:loadingFont} \end{figure} +\paragraph{Loading characters} +In order to preload ASCII characters we use a method loadCharacter from TextRenderer, it uses FreeType library to load character, then generates textures for a character (it needs to allign a texture to character), sets options for texture and adds the character object to characters array +\begin{figure}[htp] +\centering +\begin{tikzpicture}[node distance=1.5cm] +\useasboundingbox (-5,0) rectangle (5, -13cm); % Set a custom bounding box +\node (start) [startstop] {Load character}; +\node (pro1) [process, below of=start] {Load character using FreeType}; +\draw [arrow] (start) -- (pro1); + +\node (pro2) [process, below of=pro1] {Generate Texture}; +\draw [arrow] (pro1) -- (pro2); + +\node (pro3) [process, below of=pro2] {Setup texture options}; +\draw [arrow] (pro2) -- (pro3); + +\node (pro4) [process, below of=pro3] {Create character instance}; +\draw [arrow] (pro3) -- (pro4); + +\node (pro5) [process, below of=pro4] {Push character to characters array}; +\draw [arrow] (pro4) -- (pro5); + +\node (stop) [startstop, below of=pro5] {Finish loading}; +\draw [arrow] (pro5) -- (stop); + +\end{tikzpicture} +\caption{Loading single character logic} +\label{fig:loadingCharacter} +\end{figure} \subsection{Dependency Management} There are several libraries: OpenGL, GLFW, stb\_image and freetype being integrated into engine, they are simply included at the top of any files that need them.