ECS/Project/Project/Renderers/VAOStorage/VAOStorage.cpp
//	Get the Available VAO for Geometry.
Get the Available VAO for Geometry.
Get the Available VAO for Geometry .
std::shared_ptr<VAOMetaData> VAOStorage::getVAOforGeometry()
{
	for (auto currentVAO : VAOs)
	{
		if (currentVAO->geometryTypeMetaDatas.size() < 1)
		{
			return currentVAO;
		}
	}
	Construct the new VAO.
	std::shared_ptr<VAOMetaData> newVAO = std::make_shared<VAOMetaData>();
	glCreateVertexArrays(1, &newVAO->vaoID);
	Position - as a vec3
	glEnableVertexArrayAttrib(newVAO->vaoID, 0);
	glVertexArrayAttribFormat(newVAO->vaoID, 0, 4, GL_FLOAT, false, 0);
	glVertexArrayAttribBinding(newVAO->vaoID, 0, 0);
	Normal - as a vec3
	glEnableVertexArrayAttrib(newVAO->vaoID, 1);
	glVertexArrayAttribFormat(newVAO->vaoID, 1, 3, GL_FLOAT, false, 0);
	glVertexArrayAttribBinding(newVAO->vaoID, 1, 1);
	Color - as a vec4
	glEnableVertexArrayAttrib(newVAO->vaoID, 2);
	glVertexArrayAttribFormat(newVAO->vaoID, 2, 4, GL_FLOAT, false, 0);
	glVertexArrayAttribBinding(newVAO->vaoID, 2, 2);
	Vertex Tangent - as a vec3
	glEnableVertexArrayAttrib(newVAO->vaoID, 3);
	glVertexArrayAttribFormat(newVAO->vaoID, 3, 3, GL_FLOAT, false, 0);
	glVertexArrayAttribBinding(newVAO->vaoID, 3, 3);
	Vertex Bitangent - as a vec3
	glEnableVertexArrayAttrib(newVAO->vaoID, 4);
	glVertexArrayAttribFormat(newVAO->vaoID, 4, 3, GL_FLOAT, false, 0);
	glVertexArrayAttribBinding(newVAO->vaoID, 4, 4);
	Vertex Texture Coordinates 1 - as a vec2
	glEnableVertexArrayAttrib(newVAO->vaoID, 5);
	glVertexArrayAttribFormat(newVAO->vaoID, 5, 2, GL_FLOAT, false, 0);
	glVertexArrayAttribBinding(newVAO->vaoID, 5, 5);
	Vertex Texture Coordinates 2- as a vec2
	glEnableVertexArrayAttrib(newVAO->vaoID, 6);
	glVertexArrayAttribFormat(newVAO->vaoID, 6, 2, GL_FLOAT, false, 0);
	glVertexArrayAttribBinding(newVAO->vaoID, 6, 6);
	Add it to the VAOs.
	VAOs.push_back(newVAO);
	glBindVertexArray(0);
	return newVAO;
}
std :: shared_ptr < VAOMetaData > VAOStorage :: getVAOforGeometry ( ) { for ( auto currentVAO : VAOs ) { if ( currentVAO -> geometryTypeMetaDatas . size ( ) < 1 ) { return currentVAO ; } } std :: shared_ptr < VAOMetaData > newVAO = std :: make_shared < VAOMetaData > ( ) ; glCreateVertexArrays ( 1 , & newVAO -> vaoID ) ; glEnableVertexArrayAttrib ( newVAO -> vaoID , 0 ) ; glVertexArrayAttribFormat ( newVAO -> vaoID , 0 , 4 , GL_FLOAT , false , 0 ) ; glVertexArrayAttribBinding ( newVAO -> vaoID , 0 , 0 ) ; glEnableVertexArrayAttrib ( newVAO -> vaoID , 1 ) ; glVertexArrayAttribFormat ( newVAO -> vaoID , 1 , 3 , GL_FLOAT , false , 0 ) ; glVertexArrayAttribBinding ( newVAO -> vaoID , 1 , 1 ) ; glEnableVertexArrayAttrib ( newVAO -> vaoID , 2 ) ; glVertexArrayAttribFormat ( newVAO -> vaoID , 2 , 4 , GL_FLOAT , false , 0 ) ; glVertexArrayAttribBinding ( newVAO -> vaoID , 2 , 2 ) ; glEnableVertexArrayAttrib ( newVAO -> vaoID , 3 ) ; glVertexArrayAttribFormat ( newVAO -> vaoID , 3 , 3 , GL_FLOAT , false , 0 ) ; glVertexArrayAttribBinding ( newVAO -> vaoID , 3 , 3 ) ; glEnableVertexArrayAttrib ( newVAO -> vaoID , 4 ) ; glVertexArrayAttribFormat ( newVAO -> vaoID , 4 , 3 , GL_FLOAT , false , 0 ) ; glVertexArrayAttribBinding ( newVAO -> vaoID , 4 , 4 ) ; glEnableVertexArrayAttrib ( newVAO -> vaoID , 5 ) ; glVertexArrayAttribFormat ( newVAO -> vaoID , 5 , 2 , GL_FLOAT , false , 0 ) ; glVertexArrayAttribBinding ( newVAO -> vaoID , 5 , 5 ) ; glEnableVertexArrayAttrib ( newVAO -> vaoID , 6 ) ; glVertexArrayAttribFormat ( newVAO -> vaoID , 6 , 2 , GL_FLOAT , false , 0 ) ; glVertexArrayAttribBinding ( newVAO -> vaoID , 6 , 6 ) ; VAOs . push_back ( newVAO ) ; glBindVertexArray ( 0 ) ; return newVAO ; }
Get the Available VAO for Geometry.
Get the Available VAO for Geometry .
//	 //	Construct the new VAO. //	Position - as a vec3 //	Normal - as a vec3 //	Color - as a vec4 //	Vertex Tangent - as a vec3 //	Vertex Bitangent - as a vec3 //	Vertex Texture Coordinates 1 - as a vec2 //	Vertex Texture Coordinates 2- as a vec2 //	Add it to the VAOs.