\hypertarget{a07596}{}\section{A\+CG\+:\+:Vertex\+Declaration Class Reference}
\label{a07596}\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}


Class to define the vertex input layout.  




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

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{a07596_a27c0b07fe515bbfb517ebc218a93a543}{add\+Element} (const \hyperlink{a07592}{Vertex\+Element} $\ast$\+\_\+p\+Element)
\item 
void \hyperlink{a07596_a455d94beee218b06de2538c14cea6d37}{add\+Element} (unsigned int \+\_\+type, unsigned int \+\_\+num\+Elements, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122a}{V\+E\+R\+T\+E\+X\+\_\+\+U\+S\+A\+GE} \+\_\+usage, const void $\ast$\+\_\+pointer, const char $\ast$\+\_\+shader\+Input\+Name=0, unsigned int \+\_\+divisor=0, unsigned int \+\_\+vbo=0)
\item 
void \hyperlink{a07596_a366b3438f3a2b32f268d1ae5142f540a}{add\+Element} (unsigned int \+\_\+type, unsigned int \+\_\+num\+Elements, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122a}{V\+E\+R\+T\+E\+X\+\_\+\+U\+S\+A\+GE} \+\_\+usage, size\+\_\+t \+\_\+byte\+Offset=0, const char $\ast$\+\_\+shader\+Input\+Name=0, unsigned int \+\_\+divisor=0, unsigned int \+\_\+vbo=0)
\item 
void \hyperlink{a07596_af354ef30a7b3174e9ead78f1d8b16c03}{add\+Elements} (unsigned int \+\_\+num\+Elements, const \hyperlink{a07592}{Vertex\+Element} $\ast$\+\_\+p\+Elements)
\item 
void \hyperlink{a07596_aafe575c5edc17d9546affb5ecb746d13}{clear} ()
\item 
void \hyperlink{a07596_aa6cad16c706ed85850feb45f0d32af24}{activate\+Fixed\+Function} () const
\item 
void \hyperlink{a07596_a5e7443b02ee77a1212f7cafe9fe3b26b}{deactivate\+Fixed\+Function} () const
\item 
void \hyperlink{a07596_ae7147b116ba273b2f0a5ac834773036f}{activate\+Shader\+Pipeline} (\hyperlink{a08132}{G\+L\+S\+L\+::\+Program} $\ast$\+\_\+prog) const
\item 
void \hyperlink{a07596_a6eaf217f511b0394d16c6a231c47c0eb}{deactivate\+Shader\+Pipeline} (\hyperlink{a08132}{G\+L\+S\+L\+::\+Program} $\ast$\+\_\+prog) const
\item 
void \hyperlink{a07596_a3c396f988691db74e770514f505179ad}{set\+Vertex\+Stride} (unsigned int \+\_\+stride)
\item 
unsigned int \hyperlink{a07596_a8366ec697079a9775499c7c4efa42f31}{get\+Vertex\+Stride} (unsigned int i=0) const
\item 
unsigned int \hyperlink{a07596_a45af8f227d8ec0b36d157d4d7445d660}{get\+Num\+Elements} () const
\item 
const \hyperlink{a07592}{Vertex\+Element} $\ast$ \hyperlink{a07596_ac4a9869949acb4e1efb023fdc4e4f4fc}{get\+Element} (unsigned int i) const
\item 
int \hyperlink{a07596_a1d9c1f43b9727be5e5ce9a54ecbceb46}{find\+Element\+Id\+By\+Usage} (\hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122a}{V\+E\+R\+T\+E\+X\+\_\+\+U\+S\+A\+GE} \+\_\+usage) const
\item 
const \hyperlink{a07592}{Vertex\+Element} $\ast$ \hyperlink{a07596_adeaa8811462ca7cd0eab0b7e0bb9e7a4}{find\+Element\+By\+Usage} (\hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122a}{V\+E\+R\+T\+E\+X\+\_\+\+U\+S\+A\+GE} \+\_\+usage) const
\item 
Q\+String \hyperlink{a07596_a2c4a54ab204506b1bb53523eb4db30b4}{to\+String} () const
\item 
bool \hyperlink{a07596_a00b8f6d71147a26862d3ada7f452ad00}{operator==} (const \hyperlink{a07596}{Vertex\+Declaration} \&\+\_\+other) const
\item 
bool \hyperlink{a07596_a5f04df6d413858d5601e681ba31348e8}{operator!=} (const \hyperlink{a07596}{Vertex\+Declaration} \&\+\_\+other) const
\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static size\+\_\+t \hyperlink{a07596_a37f40ce221c749fdaa185d418322bcc7}{get\+G\+L\+Type\+Size} (unsigned int \+\_\+type)
\item 
static size\+\_\+t \hyperlink{a07596_aac43aeaff371027a68cdb603ab37cc81}{get\+Element\+Size} (const \hyperlink{a07592}{Vertex\+Element} $\ast$\+\_\+p\+Element)
\item 
static bool \hyperlink{a07596_acda44059ea6cfeabcb1279d14e26569b}{supports\+Instanced\+Arrays} ()
\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{a07596_ae21f2744efbe0cda8655e38eb3cc254d}{update\+Offsets} ()
\item 
void \hyperlink{a07596_a6055f4e5cfec21ea1fc88a4450e37abc}{update\+Shader\+Input\+Name} (\hyperlink{a07592}{Vertex\+Element} $\ast$\+\_\+p\+Elem)
\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{a07596_acf25562bc898a1959d971e9cdf16dc3a}\label{a07596_acf25562bc898a1959d971e9cdf16dc3a}} 
std\+::vector$<$ \hyperlink{a07592}{Vertex\+Element} $>$ {\bfseries elements\+\_\+}
\item 
\mbox{\Hypertarget{a07596_a5e21ac3863f3ef54dbb434de0e844493}\label{a07596_a5e21ac3863f3ef54dbb434de0e844493}} 
unsigned int \hyperlink{a07596_a5e21ac3863f3ef54dbb434de0e844493}{vertex\+Stride\+\_\+}
\begin{DoxyCompactList}\small\item\em Offset in bytes between each vertex. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07596_acc8b38d2d543ff1107730cb220c0733c}\label{a07596_acc8b38d2d543ff1107730cb220c0733c}} 
std\+::map$<$ unsigned int, unsigned int $>$ \hyperlink{a07596_acc8b38d2d543ff1107730cb220c0733c}{vertex\+Strides\+V\+B\+O\+\_\+}
\begin{DoxyCompactList}\small\item\em Map vbo to offset in bytes between each vertex in that vbo. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{a07596_a0f9ac5835e1c51f74588f30ebb84851c}\label{a07596_a0f9ac5835e1c51f74588f30ebb84851c}} 
int \hyperlink{a07596_a0f9ac5835e1c51f74588f30ebb84851c}{stride\+User\+Defined\+\_\+}
\begin{DoxyCompactList}\small\item\em Flag that indicates, whether the stride was set by user or derived automatically. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Class to define the vertex input layout. 

This class is used to specify vertex data layout (normals,positions,...).

The layout of a vertex buffer typically includes\+:
\begin{DoxyItemize}
\item number of vertex elements
\item element usage (position, normal, ... )
\item element types (float, int, ...)
\item memory alignment
\item data pointers (only in case of system memory buffers)
\item source vertex buffers
\item divisor (step rate) for instance data
\item vertex stride
\end{DoxyItemize}

Example usage\+: Interleaved vertex data

Create a vertex declaration given the following vertex data\+: 
\begin{DoxyCode}
Vertex
\{
  float4 pos
  float3 normal
  float2 texcoord
  ubyte4 color
  float4 tangent
  float2 texcoord2
\}
\end{DoxyCode}


The accompanying vertex declaration is created as follows\+: 
\begin{DoxyCode}
VertexDeclaration decl;
decl.addElement(GL\_FLOAT, 4, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aa50a4029397cce53cd0ebb727e5165a5c}{VERTEX\_USAGE\_POSITION});
decl.addElement(GL\_FLOAT, 3, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aa0339cb865b55fd11e0bb1bd399f408be}{VERTEX\_USAGE\_NORMAL});
decl.addElement(GL\_FLOAT, 2, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aab44a0a514fea53313de54ef79e549756}{VERTEX\_USAGE\_TEXCOORD});
decl.addElement(GL\_UNSIGNED\_BYTE, 4, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aa4b21ea5dc7270209b96bdcc7555f0ec0}{VERTEX\_USAGE\_COLOR});
decl.addElement(GL\_FLOAT, 4, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aafa3293a2b16c5e0fdca7d9282ee8409b}{VERTEX\_USAGE\_SHADER\_INPUT}, 0U, \textcolor{stringliteral}{"inTangent"});
decl.addElement(GL\_FLOAT, 2, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aafa3293a2b16c5e0fdca7d9282ee8409b}{VERTEX\_USAGE\_SHADER\_INPUT}, 0U, \textcolor{stringliteral}{"inTexcoord2"});
\end{DoxyCode}


Note that the element offsets are automatically computed, but it is possible to provide them manually of course.

These elements are then available in a vertex shader with the following input semantics\+: 
\begin{DoxyCode}
in vec4 inPosition;
...
in vec4 inTangent;
in vec2 inTexcoord2;
\end{DoxyCode}


V\+E\+R\+T\+E\+X\+\_\+\+U\+S\+A\+G\+E\+\_\+\+S\+H\+A\+D\+E\+R\+\_\+\+I\+N\+P\+UT is ignored in fixed function pipeline





Example usage\+: Multiple source buffers in system memory

Given are system memory buffers as vertex data source for drawing\+: 
\begin{DoxyCode}
float4* pVertexPositions;
ubyte4* pVertexColors;
float3* pVertexNormals;
\end{DoxyCode}


It is important that the vertex stride is manually set to 0!! and that the element data pointers are set accordingly\+:


\begin{DoxyCode}
VertexDeclaration decl;
decl.addElement(GL\_FLOAT, 4, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aa50a4029397cce53cd0ebb727e5165a5c}{VERTEX\_USAGE\_POSITION}, pVertexPositions);
decl.addElement(GL\_FLOAT, 3, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aa0339cb865b55fd11e0bb1bd399f408be}{VERTEX\_USAGE\_NORMAL}, pVertexNormals);
decl.addElement(GL\_UNSIGNED\_BYTE, 4, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aa4b21ea5dc7270209b96bdcc7555f0ec0}{VERTEX\_USAGE\_COLOR}, pVertexColors);
decl.setVertexStride(0);
\end{DoxyCode}


Note\+:
\begin{DoxyItemize}
\item vertex stride = 0
\item assign data address in vertex elements and don\textquotesingle{}t change the data location later
\item order of elements is not important in this case
\item mixing interleaved vbo and system memory elements in the same declaration is forbidden 


\end{DoxyItemize}

Example usage\+: Instancing from vbo

\hyperlink{a06186}{Geometry} instancing can be implemented in several ways\+:
\begin{DoxyItemize}
\item compute instance transform procedurally from gl\+\_\+\+Instance\+ID in shader
\item store per instance data in a texture and use vertex texture fetch via gl\+\_\+\+Instance\+ID
\item store per instance data in a vbo and stream these as input to a vertex shader (A\+R\+B\+\_\+instanced\+\_\+arrays).
\end{DoxyItemize}

The first two methods can be implemented without modifying the vertex declaration, so this example focuses on the last method, in which instance data is streamed from a vbo.

Given a mesh with the following vertex elements\+: 
\begin{DoxyCode}
Vertex
\{
  float4 pos
  float3 normal
  float2 texcoord
\}
\end{DoxyCode}


Each instance of this mesh should have a different world transform and a different color. So the per instance data is\+: 
\begin{DoxyCode}
InstanceData
\{
  mat4 modelview
  uint color
\}
\end{DoxyCode}


This per instance data is stored in a separate G\+L\+\_\+\+A\+R\+R\+A\+Y\+\_\+\+B\+U\+F\+F\+ER vbo.

So there are two vbos involved in the draw call\+: geometry\+V\+BO -\/ stores static Vertex data of the mesh instance\+V\+BO -\/ stores Instance\+Data for each instance

The vertex declaration for the instanced draw call is initialized as follows\+:


\begin{DoxyCode}
VertexDeclaration decl;
decl.addElement(GL\_FLOAT, 4, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aa50a4029397cce53cd0ebb727e5165a5c}{VERTEX\_USAGE\_POSITION}, 0U, 0, 0, geometryVBO.id()); \textcolor{comment}{//
       mesh vertex data layout}
decl.addElement(GL\_FLOAT, 3, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aa0339cb865b55fd11e0bb1bd399f408be}{VERTEX\_USAGE\_NORMAL}, 0U, 0, 0, geometryVBO.id());
decl.addElement(GL\_FLOAT, 2, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aab44a0a514fea53313de54ef79e549756}{VERTEX\_USAGE\_TEXCOORD}, 0U, 0, 0, geometryVBO.id());

decl.addElement(GL\_FLOAT, 4, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aafa3293a2b16c5e0fdca7d9282ee8409b}{VERTEX\_USAGE\_SHADER\_INPUT}, 0U, \textcolor{stringliteral}{"inModelView0"}, 1, 
      instanceVBO.id()); \textcolor{comment}{// instance data layout}
decl.addElement(GL\_FLOAT, 4, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aafa3293a2b16c5e0fdca7d9282ee8409b}{VERTEX\_USAGE\_SHADER\_INPUT}, 0U, \textcolor{stringliteral}{"inModelView1"}, 1, 
      instanceVBO.id());
decl.addElement(GL\_FLOAT, 4, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aafa3293a2b16c5e0fdca7d9282ee8409b}{VERTEX\_USAGE\_SHADER\_INPUT}, 0U, \textcolor{stringliteral}{"inModelView2"}, 1, 
      instanceVBO.id());
decl.addElement(GL\_FLOAT, 4, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aafa3293a2b16c5e0fdca7d9282ee8409b}{VERTEX\_USAGE\_SHADER\_INPUT}, 0U, \textcolor{stringliteral}{"inModelView3"}, 1, 
      instanceVBO.id());
decl.addElement(GL\_FLOAT, 4, \hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122aa4b21ea5dc7270209b96bdcc7555f0ec0}{VERTEX\_USAGE\_COLOR}, 0U, 0, 1, instanceVBO.id());
\end{DoxyCode}


The 4x4 modelview matrix has to be split up into float4 elements.

Using this setup, a call to decl.\+activate\+Shader\+Pipeline() is enough to prepare an instanced draw call.

Finally, instancing requires a customized vertex shader that makes use of the per instance data\+: 
\begin{DoxyCode}
..
in vec4 inModelView0;
in vec4 inModelView1;
in vec4 inModelView2;
in vec4 inModelView3;
..

\textcolor{keywordtype}{void} main()
\{
  ..
  vec4 posVS;
  posVS.x = dot(inModelView0, inPosition);
  posVS.y = dot(inModelView1, inPosition);
  ..
  gl\_Position = projection * posVS;
\}
\end{DoxyCode}
 

Definition at line 268 of file Vertex\+Declaration.\+hh.



\subsection{Member Function Documentation}
\mbox{\Hypertarget{a07596_aa6cad16c706ed85850feb45f0d32af24}\label{a07596_aa6cad16c706ed85850feb45f0d32af24}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!activate\+Fixed\+Function@{activate\+Fixed\+Function}}
\index{activate\+Fixed\+Function@{activate\+Fixed\+Function}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{activate\+Fixed\+Function()}{activateFixedFunction()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Vertex\+Declaration\+::activate\+Fixed\+Function (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const}

prepare Open\+GL to use a vertex buffer with this declaration -\/$>$ uses the fixed function pointers (gl\+Vertex\+Pointer, gl\+Color\+Pointer...) 

Definition at line 361 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_ae7147b116ba273b2f0a5ac834773036f}\label{a07596_ae7147b116ba273b2f0a5ac834773036f}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!activate\+Shader\+Pipeline@{activate\+Shader\+Pipeline}}
\index{activate\+Shader\+Pipeline@{activate\+Shader\+Pipeline}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{activate\+Shader\+Pipeline()}{activateShaderPipeline()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Vertex\+Declaration\+::activate\+Shader\+Pipeline (\begin{DoxyParamCaption}\item[{\hyperlink{a08132}{G\+L\+S\+L\+::\+Program} $\ast$}]{\+\_\+prog }\end{DoxyParamCaption}) const}

prepare Open\+GL to use a vertex buffer with this declaration -\/$>$ uses shader attribute pointers ( gl\+Vertex\+Attrib\+Pointer ) 

Definition at line 429 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_a27c0b07fe515bbfb517ebc218a93a543}\label{a07596_a27c0b07fe515bbfb517ebc218a93a543}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!add\+Element@{add\+Element}}
\index{add\+Element@{add\+Element}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{add\+Element()}{addElement()}\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Vertex\+Declaration\+::add\+Element (\begin{DoxyParamCaption}\item[{const \hyperlink{a07592}{Vertex\+Element} $\ast$}]{\+\_\+p\+Element }\end{DoxyParamCaption})}

append one element to declaration 

Definition at line 115 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_a455d94beee218b06de2538c14cea6d37}\label{a07596_a455d94beee218b06de2538c14cea6d37}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!add\+Element@{add\+Element}}
\index{add\+Element@{add\+Element}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{add\+Element()}{addElement()}\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Vertex\+Declaration\+::add\+Element (\begin{DoxyParamCaption}\item[{unsigned int}]{\+\_\+type,  }\item[{unsigned int}]{\+\_\+num\+Elements,  }\item[{\hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122a}{V\+E\+R\+T\+E\+X\+\_\+\+U\+S\+A\+GE}}]{\+\_\+usage,  }\item[{const void $\ast$}]{\+\_\+pointer,  }\item[{const char $\ast$}]{\+\_\+shader\+Input\+Name = {\ttfamily 0},  }\item[{unsigned int}]{\+\_\+divisor = {\ttfamily 0},  }\item[{unsigned int}]{\+\_\+vbo = {\ttfamily 0} }\end{DoxyParamCaption})}

append one element to declarations, direct method 

Definition at line 120 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_a366b3438f3a2b32f268d1ae5142f540a}\label{a07596_a366b3438f3a2b32f268d1ae5142f540a}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!add\+Element@{add\+Element}}
\index{add\+Element@{add\+Element}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{add\+Element()}{addElement()}\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Vertex\+Declaration\+::add\+Element (\begin{DoxyParamCaption}\item[{unsigned int}]{\+\_\+type,  }\item[{unsigned int}]{\+\_\+num\+Elements,  }\item[{\hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122a}{V\+E\+R\+T\+E\+X\+\_\+\+U\+S\+A\+GE}}]{\+\_\+usage,  }\item[{size\+\_\+t}]{\+\_\+byte\+Offset = {\ttfamily 0},  }\item[{const char $\ast$}]{\+\_\+shader\+Input\+Name = {\ttfamily 0},  }\item[{unsigned int}]{\+\_\+divisor = {\ttfamily 0},  }\item[{unsigned int}]{\+\_\+vbo = {\ttfamily 0} }\end{DoxyParamCaption})}

append one element to declarations, direct method 

Definition at line 142 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_af354ef30a7b3174e9ead78f1d8b16c03}\label{a07596_af354ef30a7b3174e9ead78f1d8b16c03}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!add\+Elements@{add\+Elements}}
\index{add\+Elements@{add\+Elements}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{add\+Elements()}{addElements()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Vertex\+Declaration\+::add\+Elements (\begin{DoxyParamCaption}\item[{unsigned int}]{\+\_\+num\+Elements,  }\item[{const \hyperlink{a07592}{Vertex\+Element} $\ast$}]{\+\_\+p\+Elements }\end{DoxyParamCaption})}

append multiple element declarations 

Definition at line 166 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_aafe575c5edc17d9546affb5ecb746d13}\label{a07596_aafe575c5edc17d9546affb5ecb746d13}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!clear@{clear}}
\index{clear@{clear}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{clear()}{clear()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Vertex\+Declaration\+::clear (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}

remove all vertex elements, also clears the user defined stride flag 

Definition at line 570 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_a5e7443b02ee77a1212f7cafe9fe3b26b}\label{a07596_a5e7443b02ee77a1212f7cafe9fe3b26b}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!deactivate\+Fixed\+Function@{deactivate\+Fixed\+Function}}
\index{deactivate\+Fixed\+Function@{deactivate\+Fixed\+Function}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{deactivate\+Fixed\+Function()}{deactivateFixedFunction()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Vertex\+Declaration\+::deactivate\+Fixed\+Function (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const}

disables vertex attributes to prevent any draw related crashes 

Definition at line 407 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_a6eaf217f511b0394d16c6a231c47c0eb}\label{a07596_a6eaf217f511b0394d16c6a231c47c0eb}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!deactivate\+Shader\+Pipeline@{deactivate\+Shader\+Pipeline}}
\index{deactivate\+Shader\+Pipeline@{deactivate\+Shader\+Pipeline}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{deactivate\+Shader\+Pipeline()}{deactivateShaderPipeline()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Vertex\+Declaration\+::deactivate\+Shader\+Pipeline (\begin{DoxyParamCaption}\item[{\hyperlink{a08132}{G\+L\+S\+L\+::\+Program} $\ast$}]{\+\_\+prog }\end{DoxyParamCaption}) const}

disables this vertex declaration to prevent any draw related crashes -\/$>$ calls gl\+Disable\+Vertex\+Attrib\+Array 

Definition at line 486 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_adeaa8811462ca7cd0eab0b7e0bb9e7a4}\label{a07596_adeaa8811462ca7cd0eab0b7e0bb9e7a4}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!find\+Element\+By\+Usage@{find\+Element\+By\+Usage}}
\index{find\+Element\+By\+Usage@{find\+Element\+By\+Usage}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{find\+Element\+By\+Usage()}{findElementByUsage()}}
{\footnotesize\ttfamily const \hyperlink{a07592}{Vertex\+Element} $\ast$ A\+C\+G\+::\+Vertex\+Declaration\+::find\+Element\+By\+Usage (\begin{DoxyParamCaption}\item[{\hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122a}{V\+E\+R\+T\+E\+X\+\_\+\+U\+S\+A\+GE}}]{\+\_\+usage }\end{DoxyParamCaption}) const}

find element ptr by usage, return 0 if not found 

Definition at line 534 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_a1d9c1f43b9727be5e5ce9a54ecbceb46}\label{a07596_a1d9c1f43b9727be5e5ce9a54ecbceb46}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!find\+Element\+Id\+By\+Usage@{find\+Element\+Id\+By\+Usage}}
\index{find\+Element\+Id\+By\+Usage@{find\+Element\+Id\+By\+Usage}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{find\+Element\+Id\+By\+Usage()}{findElementIdByUsage()}}
{\footnotesize\ttfamily int A\+C\+G\+::\+Vertex\+Declaration\+::find\+Element\+Id\+By\+Usage (\begin{DoxyParamCaption}\item[{\hyperlink{a06176_a8e20f3e5c21bdb768c1740315eeb122a}{V\+E\+R\+T\+E\+X\+\_\+\+U\+S\+A\+GE}}]{\+\_\+usage }\end{DoxyParamCaption}) const}

find element id by usage, return -\/1 if not found 

Definition at line 525 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_ac4a9869949acb4e1efb023fdc4e4f4fc}\label{a07596_ac4a9869949acb4e1efb023fdc4e4f4fc}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!get\+Element@{get\+Element}}
\index{get\+Element@{get\+Element}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{get\+Element()}{getElement()}}
{\footnotesize\ttfamily const \hyperlink{a07592}{Vertex\+Element} $\ast$ A\+C\+G\+::\+Vertex\+Declaration\+::get\+Element (\begin{DoxyParamCaption}\item[{unsigned int}]{i }\end{DoxyParamCaption}) const}

get the i\textquotesingle{}th vertex element desc 

Definition at line 519 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_aac43aeaff371027a68cdb603ab37cc81}\label{a07596_aac43aeaff371027a68cdb603ab37cc81}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!get\+Element\+Size@{get\+Element\+Size}}
\index{get\+Element\+Size@{get\+Element\+Size}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{get\+Element\+Size()}{getElementSize()}}
{\footnotesize\ttfamily size\+\_\+t A\+C\+G\+::\+Vertex\+Declaration\+::get\+Element\+Size (\begin{DoxyParamCaption}\item[{const \hyperlink{a07592}{Vertex\+Element} $\ast$}]{\+\_\+p\+Element }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}

get size of one vertex element 

Definition at line 349 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_a37f40ce221c749fdaa185d418322bcc7}\label{a07596_a37f40ce221c749fdaa185d418322bcc7}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!get\+G\+L\+Type\+Size@{get\+G\+L\+Type\+Size}}
\index{get\+G\+L\+Type\+Size@{get\+G\+L\+Type\+Size}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{get\+G\+L\+Type\+Size()}{getGLTypeSize()}}
{\footnotesize\ttfamily size\+\_\+t A\+C\+G\+::\+Vertex\+Declaration\+::get\+G\+L\+Type\+Size (\begin{DoxyParamCaption}\item[{unsigned int}]{\+\_\+type }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}

get size of G\+L\+\_\+\+F\+L\+O\+AT, G\+L\+\_\+\+I\+NT ... 

Definition at line 315 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_a45af8f227d8ec0b36d157d4d7445d660}\label{a07596_a45af8f227d8ec0b36d157d4d7445d660}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!get\+Num\+Elements@{get\+Num\+Elements}}
\index{get\+Num\+Elements@{get\+Num\+Elements}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{get\+Num\+Elements()}{getNumElements()}}
{\footnotesize\ttfamily unsigned int A\+C\+G\+::\+Vertex\+Declaration\+::get\+Num\+Elements (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const}

get num of vertex elements 

Definition at line 309 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_a8366ec697079a9775499c7c4efa42f31}\label{a07596_a8366ec697079a9775499c7c4efa42f31}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!get\+Vertex\+Stride@{get\+Vertex\+Stride}}
\index{get\+Vertex\+Stride@{get\+Vertex\+Stride}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{get\+Vertex\+Stride()}{getVertexStride()}}
{\footnotesize\ttfamily unsigned int A\+C\+G\+::\+Vertex\+Declaration\+::get\+Vertex\+Stride (\begin{DoxyParamCaption}\item[{unsigned int}]{i = {\ttfamily 0} }\end{DoxyParamCaption}) const}

get vertex size (for element i, for multi vbo support) 

Definition at line 545 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_a5f04df6d413858d5601e681ba31348e8}\label{a07596_a5f04df6d413858d5601e681ba31348e8}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!operator"!=@{operator"!=}}
\index{operator"!=@{operator"!=}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{operator"!=()}{operator!=()}}
{\footnotesize\ttfamily bool A\+C\+G\+::\+Vertex\+Declaration\+::operator!= (\begin{DoxyParamCaption}\item[{const \hyperlink{a07596}{Vertex\+Declaration} \&}]{\+\_\+other }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}

comparison operator 

Definition at line 365 of file Vertex\+Declaration.\+hh.

\mbox{\Hypertarget{a07596_a00b8f6d71147a26862d3ada7f452ad00}\label{a07596_a00b8f6d71147a26862d3ada7f452ad00}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!operator==@{operator==}}
\index{operator==@{operator==}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{operator==()}{operator==()}}
{\footnotesize\ttfamily bool A\+C\+G\+::\+Vertex\+Declaration\+::operator== (\begin{DoxyParamCaption}\item[{const \hyperlink{a07596}{Vertex\+Declaration} \&}]{\+\_\+other }\end{DoxyParamCaption}) const}

comparison operator 

Definition at line 640 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_a3c396f988691db74e770514f505179ad}\label{a07596_a3c396f988691db74e770514f505179ad}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!set\+Vertex\+Stride@{set\+Vertex\+Stride}}
\index{set\+Vertex\+Stride@{set\+Vertex\+Stride}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{set\+Vertex\+Stride()}{setVertexStride()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Vertex\+Declaration\+::set\+Vertex\+Stride (\begin{DoxyParamCaption}\item[{unsigned int}]{\+\_\+stride }\end{DoxyParamCaption})}

set vertex stride manually, otherwise it is computed from the vertex elements 

Definition at line 564 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_acda44059ea6cfeabcb1279d14e26569b}\label{a07596_acda44059ea6cfeabcb1279d14e26569b}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!supports\+Instanced\+Arrays@{supports\+Instanced\+Arrays}}
\index{supports\+Instanced\+Arrays@{supports\+Instanced\+Arrays}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{supports\+Instanced\+Arrays()}{supportsInstancedArrays()}}
{\footnotesize\ttfamily bool A\+C\+G\+::\+Vertex\+Declaration\+::supports\+Instanced\+Arrays (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}

Check hw support for streaming instance data from vbo 

Definition at line 655 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_a2c4a54ab204506b1bb53523eb4db30b4}\label{a07596_a2c4a54ab204506b1bb53523eb4db30b4}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!to\+String@{to\+String}}
\index{to\+String@{to\+String}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{to\+String()}{toString()}}
{\footnotesize\ttfamily Q\+String A\+C\+G\+::\+Vertex\+Declaration\+::to\+String (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const}

Returns a string describing the vertex format for debugging purpose. 

Definition at line 580 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_ae21f2744efbe0cda8655e38eb3cc254d}\label{a07596_ae21f2744efbe0cda8655e38eb3cc254d}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!update\+Offsets@{update\+Offsets}}
\index{update\+Offsets@{update\+Offsets}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{update\+Offsets()}{updateOffsets()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Vertex\+Declaration\+::update\+Offsets (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}

automatically computes byte offset for interleaved vertex elements and computes vertex stride 

Definition at line 233 of file Vertex\+Declaration.\+cc.

\mbox{\Hypertarget{a07596_a6055f4e5cfec21ea1fc88a4450e37abc}\label{a07596_a6055f4e5cfec21ea1fc88a4450e37abc}} 
\index{A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}!update\+Shader\+Input\+Name@{update\+Shader\+Input\+Name}}
\index{update\+Shader\+Input\+Name@{update\+Shader\+Input\+Name}!A\+C\+G\+::\+Vertex\+Declaration@{A\+C\+G\+::\+Vertex\+Declaration}}
\subsubsection{\texorpdfstring{update\+Shader\+Input\+Name()}{updateShaderInputName()}}
{\footnotesize\ttfamily void A\+C\+G\+::\+Vertex\+Declaration\+::update\+Shader\+Input\+Name (\begin{DoxyParamCaption}\item[{\hyperlink{a07592}{Vertex\+Element} $\ast$}]{\+\_\+p\+Elem }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}

automatically sets shader input name on passed element, if not provided 

Definition at line 282 of file Vertex\+Declaration.\+cc.



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