本文整理汇总了C++中Renderable::getVertices方法的典型用法代码示例。如果您正苦于以下问题:C++ Renderable::getVertices方法的具体用法?C++ Renderable::getVertices怎么用?C++ Renderable::getVertices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Renderable
的用法示例。
在下文中一共展示了Renderable::getVertices方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enqueue
void BatchRenderEngine::enqueue(Renderable r, GLuint * indices)
{
// Check in regard to drawString function - error?
unsigned int vertNum;
unsigned int indNum;
unsigned int i;
const GLuint tid = (GLuint)r.getTid();
float ts = 0.0f;
vertNum = r.getVertices().size();
indNum = (vertNum / 4) * 6; // Assumes all input renderables are sprites - fix
if (vertNum + _currVerts > MAX_VERTS || indNum + _currInds > MAX_INDICES || _currTextures >= MAX_TEXTURES) // we've reached our limit, draw everything and restart
{
endBatch();
flush();
startBatch();
}
// Error possibly here - incorrect textures
if (tid > 0)
{
bool found = false;
for (unsigned int i = 0; i < _currTextures; i++)
{
if (_textures[i] == tid)
{
ts = (float)i;
found = true;
break;
}
}
if (!found)
{
if (_currTextures >= MAX_TEXTURES)
{
endBatch();
flush();
startBatch();
}
ts = _currTextures * 1.0f;
_textures[_currTextures] = tid * 1.0f;
_currTextures++;
}
}
else
ts = -1.0f;
std::vector<Vertex *> verts = r.getVertices();
if (indices == NULL)
{
indices = new GLuint[6];
indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
indices[3] = 2;
indices[4] = 3;
indices[5] = 0;
indNum = 6;
}
// Store all verts and attributes in arrays
for (i = 0; i<vertNum; i++)
{
_vertices[_currVerts + i].pos = *(verts[i]->GetPos());
_vertices[_currVerts + i].texCoord = *(verts[i]->GetTexCoord());
_vertices[_currVerts + i].normal = *(verts[i]->GetNormal());
_vertices[_currVerts + i].color = *(verts[i]->GetColor());
_vertices[_currVerts + i].tid = ts;
}
// Store all indices in an array
for (i = 0; i < indNum; i++)
{
_indices[_currInds + i] = indices[i] + _currVerts;
}
_currVerts += vertNum;
_currInds += indNum;
}