本文整理汇总了C++中Drawable::GetDrawEnable方法的典型用法代码示例。如果您正苦于以下问题:C++ Drawable::GetDrawEnable方法的具体用法?C++ Drawable::GetDrawEnable怎么用?C++ Drawable::GetDrawEnable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drawable
的用法示例。
在下文中一共展示了Drawable::GetDrawEnable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
void operator() (Drawable & drawable)
{
if (!drawable.GetDrawEnable())
return;
assert(drawable.GetVertArray());
const VertexArray & va = *drawable.GetVertArray();
const VertexFormat::Enum vf = va.GetVertexFormat();
const unsigned int vsize = VertexFormat::Get(vf).stride / sizeof(float);
const unsigned int vcount = va.GetNumVertices();
const unsigned int icount = va.GetNumIndices();
// FIXME: text drawables can contain empty vertex arrays,
// they should be culled before getting here
if (vcount == 0)
{
// reset segment as we might miss text drawable vcount change
// happens with Tracks/Cars scroll onfocus tooltip update
// need to investigate this
if (drawable.GetVertexBufferSegment().age)
drawable.SetVertexBufferSegment(Segment());
return;
}
// get dynamic vertex data object (first object in the vector)
const unsigned int obindex = 0;
assert(!ctx.objects[vf].empty());
Object & ob = ctx.objects[vf][obindex];
// gen object buffers
if (ob.vbuffer == 0)
{
glGenBuffers(1, &ob.ibuffer);
glGenBuffers(1, &ob.vbuffer);
if (ctx.use_vao)
{
glGenVertexArrays(1, &ob.varray);
if (ob.varray == 0)
ctx.use_vao = ctx.good_vao = false;
}
ob.vformat = vf;
}
// set segment
Segment sg;
sg.ioffset = ob.icount * sizeof(unsigned int);
sg.icount = icount;
sg.voffset = ob.vcount;
sg.vcount = vcount;
sg.vbuffer = ob.varray ? ob.varray : ob.vbuffer;
sg.vformat = vf;
sg.object = obindex;
sg.age = ctx.age_dynamic;
drawable.SetVertexBufferSegment(sg);
// upload data into staging buffers
std::vector<unsigned int> & index_buffer = ctx.staging_index_buffer[vf];
std::vector<float> & vertex_buffer = ctx.staging_vertex_buffer[vf];
const unsigned int ibn = (ob.icount + icount);
const unsigned int vbn = (ob.vcount + vcount) * vsize;
if (index_buffer.size() < ibn)
{
const unsigned int ibmin = min_dynamic_index_buffer_size / sizeof(unsigned int);
index_buffer.resize(std::max(ibn, ibmin));
}
if (vertex_buffer.size() < vbn)
{
const unsigned int vbmin = min_dynamic_vertex_buffer_size / sizeof(float);
vertex_buffer.resize(std::max(vbn, vbmin));
}
ob.icount = WriteIndices(va, ob.icount, ob.vcount, index_buffer);
ob.vcount = WriteVertices(va, ob.vcount, vsize, vertex_buffer);
}