本文整理汇总了C++中MeshBase::isInMemory方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshBase::isInMemory方法的具体用法?C++ MeshBase::isInMemory怎么用?C++ MeshBase::isInMemory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshBase
的用法示例。
在下文中一共展示了MeshBase::isInMemory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set
void MeshBase::set(const MeshBase& other)
{
if (&other == this)
return;
FW_ASSERT(other.isInMemory());
clear();
if (!isCompatible(other))
{
append(other);
compact();
return;
}
m_stride = other.m_stride;
m_numVertices = other.m_numVertices;
m_attribs = other.m_attribs;
m_vertices = other.m_vertices;
resizeSubmeshes(other.m_submeshes.getSize());
for (int i = 0; i < m_submeshes.getSize(); i++)
{
*m_submeshes[i].indices = *other.m_submeshes[i].indices;
m_submeshes[i].material = other.m_submeshes[i].material;
}
}
示例2: append
void MeshBase::append(const MeshBase& other)
{
FW_ASSERT(&other != this);
FW_ASSERT(isInMemory());
FW_ASSERT(other.isInMemory());
Array<bool> dstAttribUsed(NULL, numAttribs());
for (int i = 0; i < numAttribs(); i++)
dstAttribUsed[i] = false;
Array<Vec2i> copy;
Array<Vec2i> convert;
for (int i = 0; i < other.numAttribs(); i++)
{
const AttribSpec& src = other.attribSpec(i);
for (int j = 0; j < numAttribs(); j++)
{
const AttribSpec& dst = attribSpec(j);
if (src.type != dst.type || dstAttribUsed[j])
continue;
if (src.format != dst.format || src.length != dst.length)
convert.add(Vec2i(i, j));
else
{
for (int k = 0; k < src.bytes; k++)
copy.add(Vec2i(src.offset + k, dst.offset + k));
}
dstAttribUsed[j] = true;
break;
}
}
int oldNumVertices = m_numVertices;
resizeVertices(oldNumVertices + other.m_numVertices);
for (int i = 0; i < other.m_numVertices; i++)
{
if (copy.getSize())
{
const U8* src = &other.m_vertices[i * other.m_stride];
U8* dst = &m_vertices[(i + oldNumVertices) * m_stride];
for (int j = 0; j < copy.getSize(); j++)
dst[copy[j].y] = src[copy[j].x];
}
for (int j = 0; j < convert.getSize(); j++)
setVertexAttrib(i + oldNumVertices, convert[j].y,
other.getVertexAttrib(i, convert[j].x));
}
int oldNumSubmeshes = numSubmeshes();
resizeSubmeshes(oldNumSubmeshes + other.numSubmeshes());
for (int i = 0; i < other.numSubmeshes(); i++)
{
const Submesh& src = other.m_submeshes[i];
Submesh& dst = m_submeshes[i + oldNumSubmeshes];
dst.indices->reset(src.indices->getSize());
for (int j = 0; j < src.indices->getSize(); j++)
dst.indices->set(j, src.indices->get(j) + oldNumVertices);
dst.material = src.material;
}
}