ECS/Project/Project/Renderers/VAOStorage/VAOStorage.cpp
//	Add the Geometry Type to the VAO Storage.
Add the Geometry Type to the VAO Storage.
Add the Geometry Type to the VAO Storage .
void VAOStorage::addGeometryType(std::shared_ptr<GeometryTypeMetaData> newGeometryType)
{
	std::shared_ptr<VAOMetaData> vaoMetaData = getVAOforGeometry();
	newGeometryType->vaoMetaData = vaoMetaData;
	vaoMetaData->geometryTypeMetaDatas[newGeometryType->geometryType] = newGeometryType;
	glCreateBuffers(1, &newGeometryType->EBO);
	glNamedBufferData(newGeometryType->EBO, newGeometryType->rendererGeometryData->indicesArray.size() * sizeof(GLuint), newGeometryType->rendererGeometryData->indicesArray.data(), GL_STATIC_DRAW);
	newGeometryType->offsetEBO = 0;
	glCreateBuffers(1, &newGeometryType->vertexVBO);
	glNamedBufferData(newGeometryType->vertexVBO, newGeometryType->rendererGeometryData->verticesArray.size() * sizeof(Vertex), newGeometryType->rendererGeometryData->verticesArray.data(), GL_STATIC_DRAW);
	newGeometryType->offsetVertexVBO = 0;
	newGeometryType->vertexNormalVBO = 0;
	newGeometryType->offsetVertexNormalVBO = 0;
	newGeometryType->vertexTextureVBO = 0;
	newGeometryType->offsetVertexTextureVBO = 0;
	glVertexArrayVertexBuffer(vaoMetaData->vaoID, 0, newGeometryType->vertexVBO, 0, sizeof(Vertex));
	glVertexArrayVertexBuffer(vaoMetaData->vaoID, 1, newGeometryType->vertexVBO, offsetof(Vertex, normal), sizeof(Vertex));
	glVertexArrayVertexBuffer(vaoMetaData->vaoID, 2, newGeometryType->vertexVBO, offsetof(Vertex, color), sizeof(Vertex));
	glVertexArrayVertexBuffer(vaoMetaData->vaoID, 3, newGeometryType->vertexNormalVBO, 0, sizeof(VertexNormalData));
	glVertexArrayVertexBuffer(vaoMetaData->vaoID, 4, newGeometryType->vertexNormalVBO, offsetof(VertexNormalData, bitangent), sizeof(VertexNormalData));
	glVertexArrayVertexBuffer(vaoMetaData->vaoID, 5, newGeometryType->vertexTextureVBO, 0, sizeof(VertexTextureData));
	glVertexArrayVertexBuffer(vaoMetaData->vaoID, 6, newGeometryType->vertexTextureVBO, offsetof(VertexTextureData, textureCoordinates2), sizeof(VertexTextureData));
}
void VAOStorage :: addGeometryType ( std :: shared_ptr < GeometryTypeMetaData > newGeometryType ) { std :: shared_ptr < VAOMetaData > vaoMetaData = getVAOforGeometry ( ) ; newGeometryType -> vaoMetaData = vaoMetaData ; vaoMetaData -> geometryTypeMetaDatas [ newGeometryType -> geometryType ] = newGeometryType ; glCreateBuffers ( 1 , & newGeometryType -> EBO ) ; glNamedBufferData ( newGeometryType -> EBO , newGeometryType -> rendererGeometryData -> indicesArray . size ( ) * sizeof ( GLuint ) , newGeometryType -> rendererGeometryData -> indicesArray . data ( ) , GL_STATIC_DRAW ) ; newGeometryType -> offsetEBO = 0 ; glCreateBuffers ( 1 , & newGeometryType -> vertexVBO ) ; glNamedBufferData ( newGeometryType -> vertexVBO , newGeometryType -> rendererGeometryData -> verticesArray . size ( ) * sizeof ( Vertex ) , newGeometryType -> rendererGeometryData -> verticesArray . data ( ) , GL_STATIC_DRAW ) ; newGeometryType -> offsetVertexVBO = 0 ; newGeometryType -> vertexNormalVBO = 0 ; newGeometryType -> offsetVertexNormalVBO = 0 ; newGeometryType -> vertexTextureVBO = 0 ; newGeometryType -> offsetVertexTextureVBO = 0 ; glVertexArrayVertexBuffer ( vaoMetaData -> vaoID , 0 , newGeometryType -> vertexVBO , 0 , sizeof ( Vertex ) ) ; glVertexArrayVertexBuffer ( vaoMetaData -> vaoID , 1 , newGeometryType -> vertexVBO , offsetof ( Vertex , normal ) , sizeof ( Vertex ) ) ; glVertexArrayVertexBuffer ( vaoMetaData -> vaoID , 2 , newGeometryType -> vertexVBO , offsetof ( Vertex , color ) , sizeof ( Vertex ) ) ; glVertexArrayVertexBuffer ( vaoMetaData -> vaoID , 3 , newGeometryType -> vertexNormalVBO , 0 , sizeof ( VertexNormalData ) ) ; glVertexArrayVertexBuffer ( vaoMetaData -> vaoID , 4 , newGeometryType -> vertexNormalVBO , offsetof ( VertexNormalData , bitangent ) , sizeof ( VertexNormalData ) ) ; glVertexArrayVertexBuffer ( vaoMetaData -> vaoID , 5 , newGeometryType -> vertexTextureVBO , 0 , sizeof ( VertexTextureData ) ) ; glVertexArrayVertexBuffer ( vaoMetaData -> vaoID , 6 , newGeometryType -> vertexTextureVBO , offsetof ( VertexTextureData , textureCoordinates2 ) , sizeof ( VertexTextureData ) ) ; }
Add the Geometry Type to the VAO Storage.
Add the Geometry Type to the VAO Storage .
//	Associate the VAO Meta Data with the Geometry Type. //	Add the Geometry Type to the VAO. //	Create the Buffers. //	Create the Indices Buffer. //	Create the Vertices Buffer. //	 //	