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


{\ttfamily \#include $<$A\+C\+G/\+G\+L/\+Shader\+Generator.\+hh$>$}

\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{a00488}{Default\+I\+O\+Desc}
\item 
struct \hyperlink{a00758}{Keywords}
\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{a01160_af285f3be6dae44a1085f6a720e45d22b}{void \hyperlink{a01160_af285f3be6dae44a1085f6a720e45d22b}{set\+G\+L\+S\+L\+Version} (int \+\_\+version)}\label{a01160_af285f3be6dae44a1085f6a720e45d22b}

\begin{DoxyCompactList}\small\item\em Set glsl version. \end{DoxyCompactList}\item 
\hypertarget{a01160_a93687261bc88f553004b17a61a0e2f80}{void \hyperlink{a01160_a93687261bc88f553004b17a61a0e2f80}{add\+Include\+File} (Q\+String \+\_\+file\+Name)}\label{a01160_a93687261bc88f553004b17a61a0e2f80}

\begin{DoxyCompactList}\small\item\em Imports another shader, same as \#include. \end{DoxyCompactList}\item 
void \hyperlink{a01160_ad493ea6998a074d11feca2440a02cb96}{init\+Vertex\+Shader\+I\+O} (const \hyperlink{a01158}{Shader\+Gen\+Desc} $\ast$\+\_\+desc, const \hyperlink{a00488}{Default\+I\+O\+Desc} $\ast$\+\_\+iodesc)
\begin{DoxyCompactList}\small\item\em Adds fitting vertex shader io for a given description. \end{DoxyCompactList}\item 
\hypertarget{a01160_a86401320ffa399b3f06ce5d8670bb778}{void \hyperlink{a01160_a86401320ffa399b3f06ce5d8670bb778}{init\+Tess\+Control\+Shader\+I\+O} (const \hyperlink{a01158}{Shader\+Gen\+Desc} $\ast$\+\_\+desc, \hyperlink{a01160}{Shader\+Generator} $\ast$\+\_\+prev\+Stage, const \hyperlink{a00488}{Default\+I\+O\+Desc} $\ast$\+\_\+iodesc)}\label{a01160_a86401320ffa399b3f06ce5d8670bb778}

\begin{DoxyCompactList}\small\item\em Adds fitting tess-\/control shader io for a given description. \end{DoxyCompactList}\item 
\hypertarget{a01160_a0d64835a0a06845d4f0923cb31d9b9a8}{void \hyperlink{a01160_a0d64835a0a06845d4f0923cb31d9b9a8}{init\+Tess\+Eval\+Shader\+I\+O} (const \hyperlink{a01158}{Shader\+Gen\+Desc} $\ast$\+\_\+desc, \hyperlink{a01160}{Shader\+Generator} $\ast$\+\_\+prev\+Stage, const \hyperlink{a00488}{Default\+I\+O\+Desc} $\ast$\+\_\+iodesc)}\label{a01160_a0d64835a0a06845d4f0923cb31d9b9a8}

\begin{DoxyCompactList}\small\item\em Adds fitting tess-\/evaluation shader io for a given description. \end{DoxyCompactList}\item 
\hypertarget{a01160_a3f2823917527e07678349e5337fd17dc}{void \hyperlink{a01160_a3f2823917527e07678349e5337fd17dc}{init\+Geometry\+Shader\+I\+O} (const \hyperlink{a01158}{Shader\+Gen\+Desc} $\ast$\+\_\+desc, \hyperlink{a01160}{Shader\+Generator} $\ast$\+\_\+prev\+Stage, const \hyperlink{a00488}{Default\+I\+O\+Desc} $\ast$\+\_\+iodesc)}\label{a01160_a3f2823917527e07678349e5337fd17dc}

\begin{DoxyCompactList}\small\item\em Adds fitting geometry shader io for a given description. \end{DoxyCompactList}\item 
\hypertarget{a01160_a84419235fa61a3f563108daf9cc1fe63}{void \hyperlink{a01160_a84419235fa61a3f563108daf9cc1fe63}{init\+Fragment\+Shader\+I\+O} (const \hyperlink{a01158}{Shader\+Gen\+Desc} $\ast$\+\_\+desc, \hyperlink{a01160}{Shader\+Generator} $\ast$\+\_\+prev\+Stage, const \hyperlink{a00488}{Default\+I\+O\+Desc} $\ast$\+\_\+iodesc)}\label{a01160_a84419235fa61a3f563108daf9cc1fe63}

\begin{DoxyCompactList}\small\item\em Adds fitting fragment shader io for a given description. \end{DoxyCompactList}\item 
void \hyperlink{a01160_af0ad5c4a359e06dfb527ee7c36af33df}{init\+Default\+Uniforms} ()
\begin{DoxyCompactList}\small\item\em Adds frequently used uniform parameters. \end{DoxyCompactList}\item 
void \hyperlink{a01160_a275720867d78ae855bb5a978145a40cb}{add\+Input} (const Q\+String \&\+\_\+input)
\begin{DoxyCompactList}\small\item\em Add one \hyperlink{a03358}{G\+L\+S\+L} input specifier. \end{DoxyCompactList}\item 
void \hyperlink{a01160_a1b8a2a88c4f02ef3a27f44c21b07c746}{add\+Input} (const Q\+String \&\+\_\+type, const Q\+String \&\+\_\+varname)
\begin{DoxyCompactList}\small\item\em Add one \hyperlink{a03358}{G\+L\+S\+L} input specifier. \end{DoxyCompactList}\item 
void \hyperlink{a01160_a5737eb147ab691feaedc78032aabbe5b}{add\+Output} (const Q\+String \&\+\_\+output)
\begin{DoxyCompactList}\small\item\em Add one \hyperlink{a03358}{G\+L\+S\+L} output specifier. \end{DoxyCompactList}\item 
void \hyperlink{a01160_a505507eec305a4da2e5283cd736704da}{add\+Output} (const Q\+String \&\+\_\+type, const Q\+String \&\+\_\+varname)
\begin{DoxyCompactList}\small\item\em Add one \hyperlink{a03358}{G\+L\+S\+L} output specifier. \end{DoxyCompactList}\item 
void \hyperlink{a01160_a87cff132858bda2f529707c3c00561a8}{add\+Uniform} (Q\+String \+\_\+uniform, Q\+String \+\_\+comment=\char`\"{}\char`\"{})
\begin{DoxyCompactList}\small\item\em Add one \hyperlink{a03358}{G\+L\+S\+L} uniform specifier. \end{DoxyCompactList}\item 
void \hyperlink{a01160_ad5f478c0f84795ad4066e5b957a4e343}{add\+Define} (const Q\+String \&\+\_\+define)
\begin{DoxyCompactList}\small\item\em Add one define. \end{DoxyCompactList}\item 
void \hyperlink{a01160_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{a01160_ab5e8941ac4ad00617a8caea6833965b1}{add\+Macros} (const Q\+String\+List \&\+\_\+macros)
\begin{DoxyCompactList}\small\item\em Add a list of preprocessor macros. \end{DoxyCompactList}\item 
bool \hyperlink{a01160_ac1fba7c63b3921c21af55413661fab0e}{has\+Define} (Q\+String \+\_\+define) const 
\begin{DoxyCompactList}\small\item\em Check for define. \end{DoxyCompactList}\item 
void \hyperlink{a01160_a3e60221f88f9bbe7960a4c0ab634006a}{add\+Layout} (Q\+String \+\_\+layout)
\begin{DoxyCompactList}\small\item\em Add a layout directive. \end{DoxyCompactList}\item 
void \hyperlink{a01160_a9291f354de83902f42554a5158932dc6}{add\+Raw\+I\+O\+Block} (Q\+String\+List \+\_\+code\+Block)
\begin{DoxyCompactList}\small\item\em Add a raw glsl I\+O code block. \end{DoxyCompactList}\item 
\hypertarget{a01160_ab3876748ec61ac9e17a5e2c5966305bb}{void \hyperlink{a01160_ab3876748ec61ac9e17a5e2c5966305bb}{add\+Light} (int light\+Index\+\_\+, Shader\+Gen\+Light\+Type \+\_\+light)}\label{a01160_ab3876748ec61ac9e17a5e2c5966305bb}

\begin{DoxyCompactList}\small\item\em Add a light description to shader\+: \end{DoxyCompactList}\item 
void \hyperlink{a01160_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 
\hypertarget{a01160_a6033af8a79ac3eae207836c30aa89b07}{const Q\+String\+List \& \hyperlink{a01160_a6033af8a79ac3eae207836c30aa89b07}{get\+Shader\+Code} ()}\label{a01160_a6033af8a79ac3eae207836c30aa89b07}

\begin{DoxyCompactList}\small\item\em Get result of build\+Shader\+Code. \end{DoxyCompactList}\item 
void \hyperlink{a01160_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{a01160_a1847d52b76cb6a355cee22c68a308331}{match\+Inputs} (const \hyperlink{a01160}{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{a01160_ae342850366efe88423f0a85cbbb796af}{define\+I\+O\+Abstraction} (const \hyperlink{a00488}{Default\+I\+O\+Desc} $\ast$\+\_\+iodesc, bool \+\_\+vs, bool \+\_\+fs)
\begin{DoxyCompactList}\small\item\em Define abstract I\+O names via shader defines. \end{DoxyCompactList}\item 
\hypertarget{a01160_a68bb543153b07549417f29ad15e205bf}{int \hyperlink{a01160_a68bb543153b07549417f29ad15e205bf}{get\+Num\+Outputs} () const }\label{a01160_a68bb543153b07549417f29ad15e205bf}

\begin{DoxyCompactList}\small\item\em get number of outputs \end{DoxyCompactList}\item 
Q\+String \hyperlink{a01160_a6682105e3474e1fa13ad185d5b7bb697}{get\+Output\+Name} (int \+\_\+id) const 
\begin{DoxyCompactList}\small\item\em get variable name of output \end{DoxyCompactList}\item 
\hypertarget{a01160_a4556ce4cac34920144ff39ce5577eb51}{int \hyperlink{a01160_a4556ce4cac34920144ff39ce5577eb51}{get\+Num\+Inputs} () const }\label{a01160_a4556ce4cac34920144ff39ce5577eb51}

\begin{DoxyCompactList}\small\item\em get number of inputs \end{DoxyCompactList}\item 
Q\+String \hyperlink{a01160_ad6a73c1aaca60a1c6d923b18e199dd23}{get\+Input\+Name} (int \+\_\+id) const 
\begin{DoxyCompactList}\small\item\em get variable name of input \end{DoxyCompactList}\item 
Q\+String \hyperlink{a01160_aa3893388bda14e24ec22b507aeece32d}{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 
\hypertarget{a01160_a0d8af9d0697737f7dcc60e19e68a8deb}{static const \hyperlink{a00758}{Keywords} {\bfseries keywords}}\label{a01160_a0d8af9d0697737f7dcc60e19e68a8deb}

\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{a01160_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{a01160_adbee4905c111de9bfb027967872ba22f}{add\+I\+O\+To\+Code} (const Q\+String\+List \&\+\_\+cmds)
\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{a01160_a5110612a8d8082d5811bd42e5163b58b}{Q\+String\+List {\bfseries code\+\_\+}}\label{a01160_a5110612a8d8082d5811bd42e5163b58b}

\item 
\hypertarget{a01160_a69b97c401b6511f9ff4b3a1e10819ab1}{Q\+String\+List \hyperlink{a01160_a69b97c401b6511f9ff4b3a1e10819ab1}{imports\+\_\+}}\label{a01160_a69b97c401b6511f9ff4b3a1e10819ab1}

\begin{DoxyCompactList}\small\item\em glsl code imports (with \#include ) \end{DoxyCompactList}\item 
\hypertarget{a01160_a479f8838d188599e20394abf6ee4c4e5}{int {\bfseries version\+\_\+}}\label{a01160_a479f8838d188599e20394abf6ee4c4e5}

\item 
\hypertarget{a01160_a4723203f082cc4a29c3bea5a2433cb98}{Q\+String\+List {\bfseries inputs\+\_\+}}\label{a01160_a4723203f082cc4a29c3bea5a2433cb98}

\item 
\hypertarget{a01160_a3d8c4ec781aed56e11df9a9968e2def2}{Q\+String\+List {\bfseries outputs\+\_\+}}\label{a01160_a3d8c4ec781aed56e11df9a9968e2def2}

\item 
\hypertarget{a01160_a0f229e0e44fa3e14dbb2c5bd79228a82}{Q\+String\+List {\bfseries uniforms\+\_\+}}\label{a01160_a0f229e0e44fa3e14dbb2c5bd79228a82}

\item 
\hypertarget{a01160_a407e8ce0b0fc52c1a5d3203c7b7ea370}{Q\+String\+List {\bfseries gen\+Defines\+\_\+}}\label{a01160_a407e8ce0b0fc52c1a5d3203c7b7ea370}

\item 
\hypertarget{a01160_a11cc693ed765f88053dbb9d647d47a05}{Q\+String\+List {\bfseries layouts\+\_\+}}\label{a01160_a11cc693ed765f88053dbb9d647d47a05}

\item 
\hypertarget{a01160_af8ed0e220725e8f4ce961853f0b0fa7d}{Q\+String\+List \hyperlink{a01160_af8ed0e220725e8f4ce961853f0b0fa7d}{raw\+I\+O\+\_\+}}\label{a01160_af8ed0e220725e8f4ce961853f0b0fa7d}

\begin{DoxyCompactList}\small\item\em io block as glsl code \end{DoxyCompactList}\item 
\hypertarget{a01160_a3d86d5e873a3f5f55267175ed47e47a2}{bool \hyperlink{a01160_a3d86d5e873a3f5f55267175ed47e47a2}{input\+Arrays\+\_\+}}\label{a01160_a3d86d5e873a3f5f55267175ed47e47a2}

\begin{DoxyCompactList}\small\item\em inputs of shader are arrays (tess-\/control, tess-\/eval, geometry) \end{DoxyCompactList}\item 
\hypertarget{a01160_ad33d1b646b78ff7bbf2fc6f85c4fb459}{bool \hyperlink{a01160_ad33d1b646b78ff7bbf2fc6f85c4fb459}{output\+Arrays\+\_\+}}\label{a01160_ad33d1b646b78ff7bbf2fc6f85c4fb459}

\begin{DoxyCompactList}\small\item\em outputs of shader are arrays (tess-\/control) \end{DoxyCompactList}\item 
\hypertarget{a01160_a14a751a7a0f905dd987606163f2240e5}{Q\+String \hyperlink{a01160_a14a751a7a0f905dd987606163f2240e5}{input\+Prefix\+\_\+}}\label{a01160_a14a751a7a0f905dd987606163f2240e5}

\begin{DoxyCompactList}\small\item\em prefix of inputs to this shader, same as prefix of ouputs of previous stage \end{DoxyCompactList}\item 
\hypertarget{a01160_ae69dbabe5532526d9912ea43158dd906}{Q\+String \hyperlink{a01160_ae69dbabe5532526d9912ea43158dd906}{output\+Prefix\+\_\+}}\label{a01160_ae69dbabe5532526d9912ea43158dd906}

\begin{DoxyCompactList}\small\item\em prefix of outputs of this shader \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
The \hyperlink{a01160}{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 518 of file Shader\+Generator.\+hh.



\subsection{Member Function Documentation}
\hypertarget{a01160_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[{add\+Define}]{\setlength{\rightskip}{0pt plus 5cm}void A\+C\+G\+::\+Shader\+Generator\+::add\+Define (
\begin{DoxyParamCaption}
\item[{const Q\+String \&}]{\+\_\+define}
\end{DoxyParamCaption}
)}}\label{a01160_ad5f478c0f84795ad4066e5b957a4e343}


Add one define. 

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

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

\hypertarget{a01160_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[{add\+Input}]{\setlength{\rightskip}{0pt plus 5cm}void A\+C\+G\+::\+Shader\+Generator\+::add\+Input (
\begin{DoxyParamCaption}
\item[{const Q\+String \&}]{\+\_\+input}
\end{DoxyParamCaption}
)}}\label{a01160_a275720867d78ae855bb5a978145a40cb}


Add one \hyperlink{a03358}{G\+L\+S\+L} input specifier. 

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

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

\hypertarget{a01160_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[{add\+Input}]{\setlength{\rightskip}{0pt plus 5cm}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]}}}\label{a01160_a1b8a2a88c4f02ef3a27f44c21b07c746}


Add one \hyperlink{a03358}{G\+L\+S\+L} input specifier. 

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

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

\hypertarget{a01160_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[{add\+I\+O\+Define}]{\setlength{\rightskip}{0pt plus 5cm}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}
)}}\label{a01160_a46f333f5fddd102c35be80d18ac82a5e}


Assign an opaque name to the abstract macro. 



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

\hypertarget{a01160_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[{add\+I\+O\+To\+Code}]{\setlength{\rightskip}{0pt plus 5cm}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]}}}\label{a01160_adbee4905c111de9bfb027967872ba22f}
Adds command lines to the shader code. Eventually appends missing ';' 

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

\hypertarget{a01160_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[{add\+Layout}]{\setlength{\rightskip}{0pt plus 5cm}void A\+C\+G\+::\+Shader\+Generator\+::add\+Layout (
\begin{DoxyParamCaption}
\item[{Q\+String}]{\+\_\+layout}
\end{DoxyParamCaption}
)}}\label{a01160_a3e60221f88f9bbe7960a4c0ab634006a}


Add a layout directive. 

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

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

\hypertarget{a01160_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[{add\+Macros}]{\setlength{\rightskip}{0pt plus 5cm}void A\+C\+G\+::\+Shader\+Generator\+::add\+Macros (
\begin{DoxyParamCaption}
\item[{const Q\+String\+List \&}]{\+\_\+macros}
\end{DoxyParamCaption}
)}}\label{a01160_ab5e8941ac4ad00617a8caea6833965b1}


Add a list of preprocessor macros. 



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

\hypertarget{a01160_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[{add\+Output}]{\setlength{\rightskip}{0pt plus 5cm}void A\+C\+G\+::\+Shader\+Generator\+::add\+Output (
\begin{DoxyParamCaption}
\item[{const Q\+String \&}]{\+\_\+output}
\end{DoxyParamCaption}
)}}\label{a01160_a5737eb147ab691feaedc78032aabbe5b}


Add one \hyperlink{a03358}{G\+L\+S\+L} output specifier. 

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

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

\hypertarget{a01160_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[{add\+Output}]{\setlength{\rightskip}{0pt plus 5cm}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]}}}\label{a01160_a505507eec305a4da2e5283cd736704da}


Add one \hyperlink{a03358}{G\+L\+S\+L} output specifier. 

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

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

\hypertarget{a01160_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[{add\+Raw\+I\+O\+Block}]{\setlength{\rightskip}{0pt plus 5cm}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]}}}\label{a01160_a9291f354de83902f42554a5158932dc6}


Add a raw glsl I\+O code block. 

This code block is inserted between the generated I\+O 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 685 of file Shader\+Generator.\+hh.

\hypertarget{a01160_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[{add\+String\+To\+List}]{\setlength{\rightskip}{0pt plus 5cm}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]}}}\label{a01160_a31494761a0d8e3dd72527714fd032d19}
aborts if string already present prefix, postfix functionality is very basic\+: only checks for occurrence and disregards location 

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

\hypertarget{a01160_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[{add\+Uniform}]{\setlength{\rightskip}{0pt plus 5cm}void A\+C\+G\+::\+Shader\+Generator\+::add\+Uniform (
\begin{DoxyParamCaption}
\item[{Q\+String}]{\+\_\+uniform, }
\item[{Q\+String}]{\+\_\+comment = {\ttfamily \char`\"{}\char`\"{}}}
\end{DoxyParamCaption}
)}}\label{a01160_a87cff132858bda2f529707c3c00561a8}


Add one \hyperlink{a03358}{G\+L\+S\+L} uniform specifier. 

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

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

\hypertarget{a01160_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[{build\+Shader\+Code}]{\setlength{\rightskip}{0pt plus 5cm}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}
)}}\label{a01160_a440cab52ed3884aaee8b0db5c0cab9eb}


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 562 of file Shader\+Generator.\+cc.

\hypertarget{a01160_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[{define\+I\+O\+Abstraction}]{\setlength{\rightskip}{0pt plus 5cm}void A\+C\+G\+::\+Shader\+Generator\+::define\+I\+O\+Abstraction (
\begin{DoxyParamCaption}
\item[{const {\bf Default\+I\+O\+Desc} $\ast$}]{\+\_\+iodesc, }
\item[{bool}]{\+\_\+vs, }
\item[{bool}]{\+\_\+fs}
\end{DoxyParamCaption}
)}}\label{a01160_ae342850366efe88423f0a85cbbb796af}


Define abstract I\+O 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\+V\+S, regardless whether there is a geometry shader or not.


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


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

\hypertarget{a01160_ad6a73c1aaca60a1c6d923b18e199dd23}{\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[{get\+Input\+Name}]{\setlength{\rightskip}{0pt plus 5cm}Q\+String A\+C\+G\+::\+Shader\+Generator\+::get\+Input\+Name (
\begin{DoxyParamCaption}
\item[{int}]{\+\_\+id}
\end{DoxyParamCaption}
) const}}\label{a01160_ad6a73c1aaca60a1c6d923b18e199dd23}


get variable name of input 


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


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

\hypertarget{a01160_aa3893388bda14e24ec22b507aeece32d}{\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[{get\+I\+O\+Map\+Name}]{\setlength{\rightskip}{0pt plus 5cm}Q\+String A\+C\+G\+::\+Shader\+Generator\+::get\+I\+O\+Map\+Name (
\begin{DoxyParamCaption}
\item[{int}]{\+\_\+in\+Id}
\end{DoxyParamCaption}
) const}}\label{a01160_aa3893388bda14e24ec22b507aeece32d}


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 804 of file Shader\+Generator.\+cc.

\hypertarget{a01160_a6682105e3474e1fa13ad185d5b7bb697}{\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[{get\+Output\+Name}]{\setlength{\rightskip}{0pt plus 5cm}Q\+String A\+C\+G\+::\+Shader\+Generator\+::get\+Output\+Name (
\begin{DoxyParamCaption}
\item[{int}]{\+\_\+id}
\end{DoxyParamCaption}
) const}}\label{a01160_a6682105e3474e1fa13ad185d5b7bb697}


get variable name of output 


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


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

\hypertarget{a01160_ac1fba7c63b3921c21af55413661fab0e}{\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[{has\+Define}]{\setlength{\rightskip}{0pt plus 5cm}bool A\+C\+G\+::\+Shader\+Generator\+::has\+Define (
\begin{DoxyParamCaption}
\item[{Q\+String}]{\+\_\+define}
\end{DoxyParamCaption}
) const}}\label{a01160_ac1fba7c63b3921c21af55413661fab0e}


Check for define. 

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

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

\hypertarget{a01160_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[{init\+Default\+Uniforms}]{\setlength{\rightskip}{0pt plus 5cm}void A\+C\+G\+::\+Shader\+Generator\+::init\+Default\+Uniforms (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{a01160_af0ad5c4a359e06dfb527ee7c36af33df}


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 394 of file Shader\+Generator.\+cc.

\hypertarget{a01160_ad493ea6998a074d11feca2440a02cb96}{\index{A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}!init\+Vertex\+Shader\+I\+O@{init\+Vertex\+Shader\+I\+O}}
\index{init\+Vertex\+Shader\+I\+O@{init\+Vertex\+Shader\+I\+O}!A\+C\+G\+::\+Shader\+Generator@{A\+C\+G\+::\+Shader\+Generator}}
\subsubsection[{init\+Vertex\+Shader\+I\+O}]{\setlength{\rightskip}{0pt plus 5cm}void A\+C\+G\+::\+Shader\+Generator\+::init\+Vertex\+Shader\+I\+O (
\begin{DoxyParamCaption}
\item[{const {\bf Shader\+Gen\+Desc} $\ast$}]{\+\_\+desc, }
\item[{const {\bf Default\+I\+O\+Desc} $\ast$}]{\+\_\+iodesc}
\end{DoxyParamCaption}
)}}\label{a01160_ad493ea6998a074d11feca2440a02cb96}


Adds fitting vertex shader io for a given description. 

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

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

\hypertarget{a01160_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[{match\+Inputs}]{\setlength{\rightskip}{0pt plus 5cm}void A\+C\+G\+::\+Shader\+Generator\+::match\+Inputs (
\begin{DoxyParamCaption}
\item[{const {\bf 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}
)}}\label{a01160_a1847d52b76cb6a355cee22c68a308331}


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

I\+O 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 692 of file Shader\+Generator.\+cc.

\hypertarget{a01160_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[{save\+To\+File}]{\setlength{\rightskip}{0pt plus 5cm}void A\+C\+G\+::\+Shader\+Generator\+::save\+To\+File (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{\+\_\+file\+Name}
\end{DoxyParamCaption}
)}}\label{a01160_a55a8f67b0ea882bbd8f96b32f181fd67}


Save generated shader code to text file. 


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


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



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