\hypertarget{a07568}{}\section{A\+CG\+:\+:Shader\+Generator Class Reference}
\label{a07568}\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}


{\ttfamily \#include $<$Open\+Flipper/libs\+\_\+required/\+A\+C\+G/\+G\+L/\+Shader\+Generator.\+hh$>$}

\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{a07572}{Default\+I\+O\+Desc}
\item 
struct \hyperlink{a07576}{Keywords}
\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{a07568_af285f3be6dae44a1085f6a720e45d22b}\label{a07568_af285f3be6dae44a1085f6a720e45d22b}} 
void \hyperlink{a07568_af285f3be6dae44a1085f6a720e45d22b}{set\+G\+L\+S\+L\+Version} (int \+\_\+version)
\begin{DoxyCompactList}\small\item\em Set glsl version. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_a93687261bc88f553004b17a61a0e2f80}\label{a07568_a93687261bc88f553004b17a61a0e2f80}} 
void \hyperlink{a07568_a93687261bc88f553004b17a61a0e2f80}{add\+Include\+File} (Q\+String \+\_\+file\+Name)
\begin{DoxyCompactList}\small\item\em Imports another shader, same as \#include. \end{DoxyCompactList}\item 
void \hyperlink{a07568_ad493ea6998a074d11feca2440a02cb96}{init\+Vertex\+Shader\+IO} (const \hyperlink{a07560}{Shader\+Gen\+Desc} $\ast$\+\_\+desc, const \hyperlink{a07572}{Default\+I\+O\+Desc} $\ast$\+\_\+iodesc)
\begin{DoxyCompactList}\small\item\em Adds fitting vertex shader io for a given description. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_a86401320ffa399b3f06ce5d8670bb778}\label{a07568_a86401320ffa399b3f06ce5d8670bb778}} 
void \hyperlink{a07568_a86401320ffa399b3f06ce5d8670bb778}{init\+Tess\+Control\+Shader\+IO} (const \hyperlink{a07560}{Shader\+Gen\+Desc} $\ast$\+\_\+desc, \hyperlink{a07568}{Shader\+Generator} $\ast$\+\_\+prev\+Stage, const \hyperlink{a07572}{Default\+I\+O\+Desc} $\ast$\+\_\+iodesc)
\begin{DoxyCompactList}\small\item\em Adds fitting tess-\/control shader io for a given description. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_a0d64835a0a06845d4f0923cb31d9b9a8}\label{a07568_a0d64835a0a06845d4f0923cb31d9b9a8}} 
void \hyperlink{a07568_a0d64835a0a06845d4f0923cb31d9b9a8}{init\+Tess\+Eval\+Shader\+IO} (const \hyperlink{a07560}{Shader\+Gen\+Desc} $\ast$\+\_\+desc, \hyperlink{a07568}{Shader\+Generator} $\ast$\+\_\+prev\+Stage, const \hyperlink{a07572}{Default\+I\+O\+Desc} $\ast$\+\_\+iodesc)
\begin{DoxyCompactList}\small\item\em Adds fitting tess-\/evaluation shader io for a given description. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_a3f2823917527e07678349e5337fd17dc}\label{a07568_a3f2823917527e07678349e5337fd17dc}} 
void \hyperlink{a07568_a3f2823917527e07678349e5337fd17dc}{init\+Geometry\+Shader\+IO} (const \hyperlink{a07560}{Shader\+Gen\+Desc} $\ast$\+\_\+desc, \hyperlink{a07568}{Shader\+Generator} $\ast$\+\_\+prev\+Stage, const \hyperlink{a07572}{Default\+I\+O\+Desc} $\ast$\+\_\+iodesc)
\begin{DoxyCompactList}\small\item\em Adds fitting geometry shader io for a given description. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_a84419235fa61a3f563108daf9cc1fe63}\label{a07568_a84419235fa61a3f563108daf9cc1fe63}} 
void \hyperlink{a07568_a84419235fa61a3f563108daf9cc1fe63}{init\+Fragment\+Shader\+IO} (const \hyperlink{a07560}{Shader\+Gen\+Desc} $\ast$\+\_\+desc, \hyperlink{a07568}{Shader\+Generator} $\ast$\+\_\+prev\+Stage, const \hyperlink{a07572}{Default\+I\+O\+Desc} $\ast$\+\_\+iodesc)
\begin{DoxyCompactList}\small\item\em Adds fitting fragment shader io for a given description. \end{DoxyCompactList}\item 
void \hyperlink{a07568_af0ad5c4a359e06dfb527ee7c36af33df}{init\+Default\+Uniforms} ()
\begin{DoxyCompactList}\small\item\em Adds frequently used uniform parameters. \end{DoxyCompactList}\item 
void \hyperlink{a07568_a275720867d78ae855bb5a978145a40cb}{add\+Input} (const Q\+String \&\+\_\+input)
\begin{DoxyCompactList}\small\item\em Add one \hyperlink{a06188}{G\+L\+SL} input specifier. \end{DoxyCompactList}\item 
void \hyperlink{a07568_a1b8a2a88c4f02ef3a27f44c21b07c746}{add\+Input} (const Q\+String \&\+\_\+type, const Q\+String \&\+\_\+varname)
\begin{DoxyCompactList}\small\item\em Add one \hyperlink{a06188}{G\+L\+SL} input specifier. \end{DoxyCompactList}\item 
void \hyperlink{a07568_a5737eb147ab691feaedc78032aabbe5b}{add\+Output} (const Q\+String \&\+\_\+output)
\begin{DoxyCompactList}\small\item\em Add one \hyperlink{a06188}{G\+L\+SL} output specifier. \end{DoxyCompactList}\item 
void \hyperlink{a07568_a505507eec305a4da2e5283cd736704da}{add\+Output} (const Q\+String \&\+\_\+type, const Q\+String \&\+\_\+varname)
\begin{DoxyCompactList}\small\item\em Add one \hyperlink{a06188}{G\+L\+SL} output specifier. \end{DoxyCompactList}\item 
void \hyperlink{a07568_a87cff132858bda2f529707c3c00561a8}{add\+Uniform} (Q\+String \+\_\+uniform, Q\+String \+\_\+comment=\char`\"{}\char`\"{})
\begin{DoxyCompactList}\small\item\em Add one \hyperlink{a06188}{G\+L\+SL} uniform specifier. \end{DoxyCompactList}\item 
void \hyperlink{a07568_ad5f478c0f84795ad4066e5b957a4e343}{add\+Define} (const Q\+String \&\+\_\+define)
\begin{DoxyCompactList}\small\item\em Add one define. \end{DoxyCompactList}\item 
void \hyperlink{a07568_a46f333f5fddd102c35be80d18ac82a5e}{add\+I\+O\+Define} (const Q\+String \&\+\_\+macro\+Name, const Q\+String \&\+\_\+resolved\+Name)
\begin{DoxyCompactList}\small\item\em Assign an opaque name to the abstract macro. \end{DoxyCompactList}\item 
void \hyperlink{a07568_ab5e8941ac4ad00617a8caea6833965b1}{add\+Macros} (const Q\+String\+List \&\+\_\+macros)
\begin{DoxyCompactList}\small\item\em Add a list of preprocessor macros. \end{DoxyCompactList}\item 
bool \hyperlink{a07568_a5b5e4d9fef58b9c44942cae02bdb5a39}{has\+Define} (Q\+String \+\_\+define) const
\begin{DoxyCompactList}\small\item\em Check for define. \end{DoxyCompactList}\item 
void \hyperlink{a07568_a3e60221f88f9bbe7960a4c0ab634006a}{add\+Layout} (Q\+String \+\_\+layout)
\begin{DoxyCompactList}\small\item\em Add a layout directive. \end{DoxyCompactList}\item 
void \hyperlink{a07568_a9291f354de83902f42554a5158932dc6}{add\+Raw\+I\+O\+Block} (Q\+String\+List \+\_\+code\+Block)
\begin{DoxyCompactList}\small\item\em Add a raw glsl IO code block. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_ab3876748ec61ac9e17a5e2c5966305bb}\label{a07568_ab3876748ec61ac9e17a5e2c5966305bb}} 
void \hyperlink{a07568_ab3876748ec61ac9e17a5e2c5966305bb}{add\+Light} (int light\+Index\+\_\+, Shader\+Gen\+Light\+Type \+\_\+light)
\begin{DoxyCompactList}\small\item\em Add a light description to shader\+: \end{DoxyCompactList}\item 
void \hyperlink{a07568_a440cab52ed3884aaee8b0db5c0cab9eb}{build\+Shader\+Code} (Q\+String\+List $\ast$\+\_\+p\+Main\+Code, const Q\+String\+List \&\+\_\+default\+Lighting\+Functions)
\begin{DoxyCompactList}\small\item\em Shader assembly function. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_a6033af8a79ac3eae207836c30aa89b07}\label{a07568_a6033af8a79ac3eae207836c30aa89b07}} 
const Q\+String\+List \& \hyperlink{a07568_a6033af8a79ac3eae207836c30aa89b07}{get\+Shader\+Code} ()
\begin{DoxyCompactList}\small\item\em Get result of build\+Shader\+Code. \end{DoxyCompactList}\item 
void \hyperlink{a07568_a55a8f67b0ea882bbd8f96b32f181fd67}{save\+To\+File} (const char $\ast$\+\_\+file\+Name)
\begin{DoxyCompactList}\small\item\em Save generated shader code to text file. \end{DoxyCompactList}\item 
void \hyperlink{a07568_a1847d52b76cb6a355cee22c68a308331}{match\+Inputs} (const \hyperlink{a07568}{Shader\+Generator} $\ast$\+\_\+previous\+Shader\+Stage, bool \+\_\+pass\+To\+Next\+Stage, Q\+String \+\_\+input\+Prefix=\char`\"{}out\+Vertex\char`\"{}, Q\+String \+\_\+output\+Prefix=\char`\"{}out\+Geometry\char`\"{})
\begin{DoxyCompactList}\small\item\em Perform name matching of outputs and inputs between two shader stages. \end{DoxyCompactList}\item 
void \hyperlink{a07568_ae342850366efe88423f0a85cbbb796af}{define\+I\+O\+Abstraction} (const \hyperlink{a07572}{Default\+I\+O\+Desc} $\ast$\+\_\+iodesc, bool \+\_\+vs, bool \+\_\+fs)
\begin{DoxyCompactList}\small\item\em Define abstract IO names via shader defines. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_a84692877b8b8d26f37d81e5d18ff1fda}\label{a07568_a84692877b8b8d26f37d81e5d18ff1fda}} 
int \hyperlink{a07568_a84692877b8b8d26f37d81e5d18ff1fda}{get\+Num\+Outputs} () const
\begin{DoxyCompactList}\small\item\em get number of outputs \end{DoxyCompactList}\item 
Q\+String \hyperlink{a07568_ac8b9f403579a2fe03316248e41c59968}{get\+Output\+Name} (int \+\_\+id) const
\begin{DoxyCompactList}\small\item\em get variable name of output \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_a9f7cd815f10655e14d4227ee8b50cbd7}\label{a07568_a9f7cd815f10655e14d4227ee8b50cbd7}} 
int \hyperlink{a07568_a9f7cd815f10655e14d4227ee8b50cbd7}{get\+Num\+Inputs} () const
\begin{DoxyCompactList}\small\item\em get number of inputs \end{DoxyCompactList}\item 
Q\+String \hyperlink{a07568_a2f474b19afe895461ec94f6d6c9bc238}{get\+Input\+Name} (int \+\_\+id) const
\begin{DoxyCompactList}\small\item\em get variable name of input \end{DoxyCompactList}\item 
Q\+String \hyperlink{a07568_a4467468f2843e7f6385d7ee04abd87ae}{get\+I\+O\+Map\+Name} (int \+\_\+in\+Id) const
\begin{DoxyCompactList}\small\item\em get corresponding output name of an input id \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{a07568_a0d8af9d0697737f7dcc60e19e68a8deb}\label{a07568_a0d8af9d0697737f7dcc60e19e68a8deb}} 
static const \hyperlink{a07576}{Keywords} {\bfseries keywords}
\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{a07568_a31494761a0d8e3dd72527714fd032d19}{add\+String\+To\+List} (Q\+String \+\_\+str, Q\+String\+List $\ast$\+\_\+list, Q\+String \+\_\+prefix=\char`\"{}\char`\"{}, Q\+String \+\_\+postfix=\char`\"{}\char`\"{})
\item 
void \hyperlink{a07568_adbee4905c111de9bfb027967872ba22f}{add\+I\+O\+To\+Code} (const Q\+String\+List \&\+\_\+cmds)
\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{a07568_a5110612a8d8082d5811bd42e5163b58b}\label{a07568_a5110612a8d8082d5811bd42e5163b58b}} 
Q\+String\+List {\bfseries code\+\_\+}
\item 
\mbox{\Hypertarget{a07568_a69b97c401b6511f9ff4b3a1e10819ab1}\label{a07568_a69b97c401b6511f9ff4b3a1e10819ab1}} 
Q\+String\+List \hyperlink{a07568_a69b97c401b6511f9ff4b3a1e10819ab1}{imports\+\_\+}
\begin{DoxyCompactList}\small\item\em glsl code imports (with \#include ) \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_a479f8838d188599e20394abf6ee4c4e5}\label{a07568_a479f8838d188599e20394abf6ee4c4e5}} 
int {\bfseries version\+\_\+}
\item 
\mbox{\Hypertarget{a07568_a4723203f082cc4a29c3bea5a2433cb98}\label{a07568_a4723203f082cc4a29c3bea5a2433cb98}} 
Q\+String\+List {\bfseries inputs\+\_\+}
\item 
\mbox{\Hypertarget{a07568_a3d8c4ec781aed56e11df9a9968e2def2}\label{a07568_a3d8c4ec781aed56e11df9a9968e2def2}} 
Q\+String\+List {\bfseries outputs\+\_\+}
\item 
\mbox{\Hypertarget{a07568_a0f229e0e44fa3e14dbb2c5bd79228a82}\label{a07568_a0f229e0e44fa3e14dbb2c5bd79228a82}} 
Q\+String\+List {\bfseries uniforms\+\_\+}
\item 
\mbox{\Hypertarget{a07568_a407e8ce0b0fc52c1a5d3203c7b7ea370}\label{a07568_a407e8ce0b0fc52c1a5d3203c7b7ea370}} 
Q\+String\+List {\bfseries gen\+Defines\+\_\+}
\item 
\mbox{\Hypertarget{a07568_a11cc693ed765f88053dbb9d647d47a05}\label{a07568_a11cc693ed765f88053dbb9d647d47a05}} 
Q\+String\+List {\bfseries layouts\+\_\+}
\item 
\mbox{\Hypertarget{a07568_af8ed0e220725e8f4ce961853f0b0fa7d}\label{a07568_af8ed0e220725e8f4ce961853f0b0fa7d}} 
Q\+String\+List \hyperlink{a07568_af8ed0e220725e8f4ce961853f0b0fa7d}{raw\+I\+O\+\_\+}
\begin{DoxyCompactList}\small\item\em io block as glsl code \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_a3d86d5e873a3f5f55267175ed47e47a2}\label{a07568_a3d86d5e873a3f5f55267175ed47e47a2}} 
bool \hyperlink{a07568_a3d86d5e873a3f5f55267175ed47e47a2}{input\+Arrays\+\_\+}
\begin{DoxyCompactList}\small\item\em inputs of shader are arrays (tess-\/control, tess-\/eval, geometry) \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_ad33d1b646b78ff7bbf2fc6f85c4fb459}\label{a07568_ad33d1b646b78ff7bbf2fc6f85c4fb459}} 
bool \hyperlink{a07568_ad33d1b646b78ff7bbf2fc6f85c4fb459}{output\+Arrays\+\_\+}
\begin{DoxyCompactList}\small\item\em outputs of shader are arrays (tess-\/control) \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_a14a751a7a0f905dd987606163f2240e5}\label{a07568_a14a751a7a0f905dd987606163f2240e5}} 
Q\+String \hyperlink{a07568_a14a751a7a0f905dd987606163f2240e5}{input\+Prefix\+\_\+}
\begin{DoxyCompactList}\small\item\em prefix of inputs to this shader, same as prefix of ouputs of previous stage \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07568_ae69dbabe5532526d9912ea43158dd906}\label{a07568_ae69dbabe5532526d9912ea43158dd906}} 
Q\+String \hyperlink{a07568_ae69dbabe5532526d9912ea43158dd906}{output\+Prefix\+\_\+}
\begin{DoxyCompactList}\small\item\em prefix of outputs of this shader \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
The \hyperlink{a07568}{Shader\+Generator} is used to collect shader io, uniforms, defines and includes.

The shader main-\/function is not generated here and must be provided as a parameter to the build\+Shader\+Code function. 

Definition at line 557 of file Shader\+Generator.\+hh.



\subsection{Member Function Documentation}
\mbox{\Hypertarget{a07568_ad5f478c0f84795ad4066e5b957a4e343}\label{a07568_ad5f478c0f84795ad4066e5b957a4e343}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!add\+Define@{add\+Define}}
\index{add\+Define@{add\+Define}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{add\+Define()}{addDefine()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::add\+Define (\begin{DoxyParamCaption}\item[{const Q\+String \&}]{\+\_\+define }\end{DoxyParamCaption})}



Add one define. 

Example\+: 
\begin{DoxyCode}
\textcolor{preprocessor}{#define SG\_GOURAUD 1}
\end{DoxyCode}
 

Definition at line 470 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_a275720867d78ae855bb5a978145a40cb}\label{a07568_a275720867d78ae855bb5a978145a40cb}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!add\+Input@{add\+Input}}
\index{add\+Input@{add\+Input}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{add\+Input()}{addInput()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::add\+Input (\begin{DoxyParamCaption}\item[{const Q\+String \&}]{\+\_\+input }\end{DoxyParamCaption})}



Add one \hyperlink{a06188}{G\+L\+SL} input specifier. 

Stores string pointer only Example\+: 
\begin{DoxyCode}
in vec4 inPosition;
\end{DoxyCode}
 

Definition at line 458 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_a1b8a2a88c4f02ef3a27f44c21b07c746}\label{a07568_a1b8a2a88c4f02ef3a27f44c21b07c746}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!add\+Input@{add\+Input}}
\index{add\+Input@{add\+Input}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{add\+Input()}{addInput()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::add\+Input (\begin{DoxyParamCaption}\item[{const Q\+String \&}]{\+\_\+type,  }\item[{const Q\+String \&}]{\+\_\+varname }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Add one \hyperlink{a06188}{G\+L\+SL} input specifier. 

Stores string pointer only Example\+: 
\begin{DoxyCode}
in vec4 inPosition;
\end{DoxyCode}
 

Definition at line 639 of file Shader\+Generator.\+hh.

\mbox{\Hypertarget{a07568_a46f333f5fddd102c35be80d18ac82a5e}\label{a07568_a46f333f5fddd102c35be80d18ac82a5e}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!add\+I\+O\+Define@{add\+I\+O\+Define}}
\index{add\+I\+O\+Define@{add\+I\+O\+Define}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{add\+I\+O\+Define()}{addIODefine()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::add\+I\+O\+Define (\begin{DoxyParamCaption}\item[{const Q\+String \&}]{\+\_\+macro\+Name,  }\item[{const Q\+String \&}]{\+\_\+resolved\+Name }\end{DoxyParamCaption})}



Assign an opaque name to the abstract macro. 



Definition at line 476 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_adbee4905c111de9bfb027967872ba22f}\label{a07568_adbee4905c111de9bfb027967872ba22f}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!add\+I\+O\+To\+Code@{add\+I\+O\+To\+Code}}
\index{add\+I\+O\+To\+Code@{add\+I\+O\+To\+Code}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{add\+I\+O\+To\+Code()}{addIOToCode()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::add\+I\+O\+To\+Code (\begin{DoxyParamCaption}\item[{const Q\+String\+List \&}]{\+\_\+cmds }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}

Adds command lines to the shader code. Eventually appends missing \textquotesingle{};\textquotesingle{} 

Definition at line 539 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_a3e60221f88f9bbe7960a4c0ab634006a}\label{a07568_a3e60221f88f9bbe7960a4c0ab634006a}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!add\+Layout@{add\+Layout}}
\index{add\+Layout@{add\+Layout}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{add\+Layout()}{addLayout()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::add\+Layout (\begin{DoxyParamCaption}\item[{Q\+String}]{\+\_\+layout }\end{DoxyParamCaption})}



Add a layout directive. 

Example\+: 
\begin{DoxyCode}
layout(vertices = 3) out;
\end{DoxyCode}
 

Definition at line 522 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_ab5e8941ac4ad00617a8caea6833965b1}\label{a07568_ab5e8941ac4ad00617a8caea6833965b1}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!add\+Macros@{add\+Macros}}
\index{add\+Macros@{add\+Macros}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{add\+Macros()}{addMacros()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::add\+Macros (\begin{DoxyParamCaption}\item[{const Q\+String\+List \&}]{\+\_\+macros }\end{DoxyParamCaption})}



Add a list of preprocessor macros. 



Definition at line 481 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_a5737eb147ab691feaedc78032aabbe5b}\label{a07568_a5737eb147ab691feaedc78032aabbe5b}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!add\+Output@{add\+Output}}
\index{add\+Output@{add\+Output}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{add\+Output()}{addOutput()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::add\+Output (\begin{DoxyParamCaption}\item[{const Q\+String \&}]{\+\_\+output }\end{DoxyParamCaption})}



Add one \hyperlink{a06188}{G\+L\+SL} output specifier. 

Stores string pointer only Example\+: 
\begin{DoxyCode}
out vec4 inPosition;
\end{DoxyCode}
 

Definition at line 464 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_a505507eec305a4da2e5283cd736704da}\label{a07568_a505507eec305a4da2e5283cd736704da}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!add\+Output@{add\+Output}}
\index{add\+Output@{add\+Output}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{add\+Output()}{addOutput()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::add\+Output (\begin{DoxyParamCaption}\item[{const Q\+String \&}]{\+\_\+type,  }\item[{const Q\+String \&}]{\+\_\+varname }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Add one \hyperlink{a06188}{G\+L\+SL} output specifier. 

Stores string pointer only Example\+: 
\begin{DoxyCode}
out vec4 inPosition;
\end{DoxyCode}
 

Definition at line 659 of file Shader\+Generator.\+hh.

\mbox{\Hypertarget{a07568_a9291f354de83902f42554a5158932dc6}\label{a07568_a9291f354de83902f42554a5158932dc6}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!add\+Raw\+I\+O\+Block@{add\+Raw\+I\+O\+Block}}
\index{add\+Raw\+I\+O\+Block@{add\+Raw\+I\+O\+Block}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{add\+Raw\+I\+O\+Block()}{addRawIOBlock()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::add\+Raw\+I\+O\+Block (\begin{DoxyParamCaption}\item[{Q\+String\+List}]{\+\_\+code\+Block }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Add a raw glsl IO code block. 

This code block is inserted between the generated IO block and the main function.

Example\+: 
\begin{DoxyCode}
in vec3 someInput; 
out vec3 outSomeOutput;
uniform vec3 paramA;
\textcolor{preprocessor}{#define USE\_METHOD\_X}
\textcolor{preprocessor}{#include "imports.h"}
..
\end{DoxyCode}
 

Definition at line 724 of file Shader\+Generator.\+hh.

\mbox{\Hypertarget{a07568_a31494761a0d8e3dd72527714fd032d19}\label{a07568_a31494761a0d8e3dd72527714fd032d19}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!add\+String\+To\+List@{add\+String\+To\+List}}
\index{add\+String\+To\+List@{add\+String\+To\+List}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{add\+String\+To\+List()}{addStringToList()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::add\+String\+To\+List (\begin{DoxyParamCaption}\item[{Q\+String}]{\+\_\+str,  }\item[{Q\+String\+List $\ast$}]{\+\_\+list,  }\item[{Q\+String}]{\+\_\+prefix = {\ttfamily \char`\"{}\char`\"{}},  }\item[{Q\+String}]{\+\_\+postfix = {\ttfamily \char`\"{}\char`\"{}} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}

aborts if string already present prefix, postfix functionality is very basic\+: only checks for occurrence and disregards location 

Definition at line 433 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_a87cff132858bda2f529707c3c00561a8}\label{a07568_a87cff132858bda2f529707c3c00561a8}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!add\+Uniform@{add\+Uniform}}
\index{add\+Uniform@{add\+Uniform}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{add\+Uniform()}{addUniform()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::add\+Uniform (\begin{DoxyParamCaption}\item[{Q\+String}]{\+\_\+uniform,  }\item[{Q\+String}]{\+\_\+comment = {\ttfamily \char`\"{}\char`\"{}} }\end{DoxyParamCaption})}



Add one \hyperlink{a06188}{G\+L\+SL} uniform specifier. 

Stores string pointer only Example\+: 
\begin{DoxyCode}
uniform sampler2D sampAmbient;
\end{DoxyCode}
 

Definition at line 528 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_a440cab52ed3884aaee8b0db5c0cab9eb}\label{a07568_a440cab52ed3884aaee8b0db5c0cab9eb}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!build\+Shader\+Code@{build\+Shader\+Code}}
\index{build\+Shader\+Code@{build\+Shader\+Code}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{build\+Shader\+Code()}{buildShaderCode()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::build\+Shader\+Code (\begin{DoxyParamCaption}\item[{Q\+String\+List $\ast$}]{\+\_\+p\+Main\+Code,  }\item[{const Q\+String\+List \&}]{\+\_\+default\+Lighting\+Functions }\end{DoxyParamCaption})}



Shader assembly function. 

Also scans shader code for references to default lighting functions Lit\+Point\+Light(), Lit\+Dir\+Light(), Lit\+Spot\+Light() and eventually adds these to the shader. 

Definition at line 554 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_ae342850366efe88423f0a85cbbb796af}\label{a07568_ae342850366efe88423f0a85cbbb796af}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!define\+I\+O\+Abstraction@{define\+I\+O\+Abstraction}}
\index{define\+I\+O\+Abstraction@{define\+I\+O\+Abstraction}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{define\+I\+O\+Abstraction()}{defineIOAbstraction()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::define\+I\+O\+Abstraction (\begin{DoxyParamCaption}\item[{const \hyperlink{a07572}{Default\+I\+O\+Desc} $\ast$}]{\+\_\+iodesc,  }\item[{bool}]{\+\_\+vs,  }\item[{bool}]{\+\_\+fs }\end{DoxyParamCaption})}



Define abstract IO names via shader defines. 

Default shader inputs and outputs can be conveniently accessed via S\+G\+\_\+\+I\+N\+P\+U\+T\+\_\+X and S\+G\+\_\+\+O\+U\+T\+P\+U\+T\+\_\+X defines without having to worry about the combinatoric problem of shader stages. For example, in a fragment-\/shader view-\/space normals can always be accessed via S\+G\+\_\+\+I\+N\+P\+U\+T\+\_\+\+N\+O\+R\+M\+A\+L\+VS, regardless whether there is a geometry shader or not.


\begin{DoxyParams}{Parameters}
{\em \+\_\+iodesc} & shader IO descriptor \\
\hline
{\em \+\_\+vs} & IO abstraction for vertex shader \\
\hline
{\em \+\_\+fs} & IO abstraction for fragment shader \\
\hline
\end{DoxyParams}


Definition at line 291 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_a2f474b19afe895461ec94f6d6c9bc238}\label{a07568_a2f474b19afe895461ec94f6d6c9bc238}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!get\+Input\+Name@{get\+Input\+Name}}
\index{get\+Input\+Name@{get\+Input\+Name}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{get\+Input\+Name()}{getInputName()}}
{\footnotesize\ttfamily Q\+String A\+C\+G\+::\+Shader\+Generator\+::get\+Input\+Name (\begin{DoxyParamCaption}\item[{int}]{\+\_\+id }\end{DoxyParamCaption}) const}



get variable name of input 


\begin{DoxyParams}{Parameters}
{\em \+\_\+id} & zero based index of input \\
\hline
\end{DoxyParams}


Definition at line 778 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_a4467468f2843e7f6385d7ee04abd87ae}\label{a07568_a4467468f2843e7f6385d7ee04abd87ae}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!get\+I\+O\+Map\+Name@{get\+I\+O\+Map\+Name}}
\index{get\+I\+O\+Map\+Name@{get\+I\+O\+Map\+Name}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{get\+I\+O\+Map\+Name()}{getIOMapName()}}
{\footnotesize\ttfamily Q\+String A\+C\+G\+::\+Shader\+Generator\+::get\+I\+O\+Map\+Name (\begin{DoxyParamCaption}\item[{int}]{\+\_\+in\+Id }\end{DoxyParamCaption}) const}



get corresponding output name of an input id 


\begin{DoxyParams}{Parameters}
{\em \+\_\+in\+Id} & zero-\/based index of input id \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
matching output name 
\end{DoxyReturn}


Definition at line 796 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_ac8b9f403579a2fe03316248e41c59968}\label{a07568_ac8b9f403579a2fe03316248e41c59968}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!get\+Output\+Name@{get\+Output\+Name}}
\index{get\+Output\+Name@{get\+Output\+Name}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{get\+Output\+Name()}{getOutputName()}}
{\footnotesize\ttfamily Q\+String A\+C\+G\+::\+Shader\+Generator\+::get\+Output\+Name (\begin{DoxyParamCaption}\item[{int}]{\+\_\+id }\end{DoxyParamCaption}) const}



get variable name of output 


\begin{DoxyParams}{Parameters}
{\em \+\_\+id} & zero based index of output \\
\hline
\end{DoxyParams}


Definition at line 755 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_a5b5e4d9fef58b9c44942cae02bdb5a39}\label{a07568_a5b5e4d9fef58b9c44942cae02bdb5a39}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!has\+Define@{has\+Define}}
\index{has\+Define@{has\+Define}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{has\+Define()}{hasDefine()}}
{\footnotesize\ttfamily bool A\+C\+G\+::\+Shader\+Generator\+::has\+Define (\begin{DoxyParamCaption}\item[{Q\+String}]{\+\_\+define }\end{DoxyParamCaption}) const}



Check for define. 

Example\+: 
\begin{DoxyCode}
\hyperlink{a07568_a5b5e4d9fef58b9c44942cae02bdb5a39}{hasDefine}(\textcolor{stringliteral}{"#define SG\_REQUEST\_NORMAL"})
\end{DoxyCode}
 

Definition at line 493 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_af0ad5c4a359e06dfb527ee7c36af33df}\label{a07568_af0ad5c4a359e06dfb527ee7c36af33df}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!init\+Default\+Uniforms@{init\+Default\+Uniforms}}
\index{init\+Default\+Uniforms@{init\+Default\+Uniforms}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{init\+Default\+Uniforms()}{initDefaultUniforms()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::init\+Default\+Uniforms (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Adds frequently used uniform parameters. 

Adds frequently used uniform parameters like\+:
\begin{DoxyItemize}
\item world, view, projection matrices
\item cam pos, view dir
\item per object material names\+: g\+\_\+c\+Diffuse, g\+\_\+c\+Ambient... 
\end{DoxyItemize}

Definition at line 386 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_ad493ea6998a074d11feca2440a02cb96}\label{a07568_ad493ea6998a074d11feca2440a02cb96}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!init\+Vertex\+Shader\+IO@{init\+Vertex\+Shader\+IO}}
\index{init\+Vertex\+Shader\+IO@{init\+Vertex\+Shader\+IO}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{init\+Vertex\+Shader\+I\+O()}{initVertexShaderIO()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::init\+Vertex\+Shader\+IO (\begin{DoxyParamCaption}\item[{const \hyperlink{a07560}{Shader\+Gen\+Desc} $\ast$}]{\+\_\+desc,  }\item[{const \hyperlink{a07572}{Default\+I\+O\+Desc} $\ast$}]{\+\_\+iodesc }\end{DoxyParamCaption})}



Adds fitting vertex shader io for a given description. 

T\+O\+DO Setup for multiple texture coordinates as input 

Definition at line 142 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_a1847d52b76cb6a355cee22c68a308331}\label{a07568_a1847d52b76cb6a355cee22c68a308331}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!match\+Inputs@{match\+Inputs}}
\index{match\+Inputs@{match\+Inputs}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{match\+Inputs()}{matchInputs()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::match\+Inputs (\begin{DoxyParamCaption}\item[{const \hyperlink{a07568}{Shader\+Generator} $\ast$}]{\+\_\+previous\+Shader\+Stage,  }\item[{bool}]{\+\_\+pass\+To\+Next\+Stage,  }\item[{Q\+String}]{\+\_\+input\+Prefix = {\ttfamily \char`\"{}outVertex\char`\"{}},  }\item[{Q\+String}]{\+\_\+output\+Prefix = {\ttfamily \char`\"{}outGeometry\char`\"{}} }\end{DoxyParamCaption})}



Perform name matching of outputs and inputs between two shader stages. 

IO of this shader (for instance fragment-\/shader) and its previous shader (for instance vertex shader) require matching names. Example\+: The vertex shader has an output \char`\"{}out vec3 out\+Vertex\+Normal\char`\"{}, then this function simply adds the input \char`\"{}in vec3 out\+Vertex\+Normal\char`\"{} to the current shader (either a geometry or fragment shader). If this is a geometry shader, \+\_\+pass\+To\+Next\+Stage should be set to true so that \char`\"{}out vec3 out\+Geometry\+Normal\char`\"{} is also added to the outputs.


\begin{DoxyParams}{Parameters}
{\em \+\_\+previous\+Shader\+Stage} & shader of the previous stage, which should have all outputs setup already \\
\hline
{\em \+\_\+pass\+To\+Next\+Stage} & all outputs of the previous shader stage are passed to the next stage (should be false for fragment shader for instance) \\
\hline
{\em \+\_\+input\+Prefix} & name prefix of inputs to this shader (only necessary if \+\_\+pass\+To\+Next\+Stage is true) \\
\hline
{\em \+\_\+output\+Prefix} & name prefix of outputs of this shader (only necessary if \+\_\+pass\+To\+Next\+Stage is true) \\
\hline
\end{DoxyParams}


Definition at line 684 of file Shader\+Generator.\+cc.

\mbox{\Hypertarget{a07568_a55a8f67b0ea882bbd8f96b32f181fd67}\label{a07568_a55a8f67b0ea882bbd8f96b32f181fd67}} 
\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!save\+To\+File@{save\+To\+File}}
\index{save\+To\+File@{save\+To\+File}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection{\texorpdfstring{save\+To\+File()}{saveToFile()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Shader\+Generator\+::save\+To\+File (\begin{DoxyParamCaption}\item[{const char $\ast$}]{\+\_\+file\+Name }\end{DoxyParamCaption})}



Save generated shader code to text file. 


\begin{DoxyParams}{Parameters}
{\em \+\_\+file\+Name} & Where to save \\
\hline
\end{DoxyParams}


Definition at line 659 of file Shader\+Generator.\+cc.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
Open\+Flipper/libs\+\_\+required/\+A\+C\+G/\+G\+L/Shader\+Generator.\+hh\item 
Open\+Flipper/libs\+\_\+required/\+A\+C\+G/\+G\+L/Shader\+Generator.\+cc\end{DoxyCompactItemize}
