本文整理汇总了C++中VertexElement::type方法的典型用法代码示例。如果您正苦于以下问题:C++ VertexElement::type方法的具体用法?C++ VertexElement::type怎么用?C++ VertexElement::type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VertexElement
的用法示例。
在下文中一共展示了VertexElement::type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: push_back
bool VertexDeclaration::push_back(const VertexElement& element)
{
if (has(element.usage())) return false;
_usageMask = _usageMask | vertexAttributeUsageMask(element.usage());
_totalSize += vertexAttributeTypeSize(element.type());
_list.push_back(element);
if (_interleaved)
{
for (auto& i : _list)
i.setStride(static_cast<int>(_totalSize));
}
return true;
}
示例2:
bool
VertexElement::operator != (const VertexElement &src) const
{
if (_usageIndex != src.usageIndex())
return true;
if (_usage != src.usage())
return true;
if (_method != src.method())
return true;
if (_type != src.type())
return true;
if (_offset != src.offset())
return true;
if (_stream != src.stream())
return true;
return false;
}
示例3: LOG
void*
StreamedMesh::internalStreamPtr()
{
if (vertexBufferSize() == 0)
{
LOG ("Error, internal vertex buffer size is 0");
return 0;
}
if (!_vertexBufferCpuMemory)
{
_vertexBufferCpuMemory = (float*)malloc(sizeof(float)*vertexBufferSize());
}
// stash the buffer and put it in an array
std::map <uint32_t, float*> streamMap;
for (auto it = _vertexStreams.begin();
it != _vertexStreams.end();
it++)
{
streamMap.insert (std::make_pair(it->first, it->second->stream()));
}
const std::vector <VertexElement>& declaration = _vertexDeclaration->getDeclaration();
float* vb = (float*)_vertexBufferCpuMemory;
for (uint32_t i = 0; i < vertexCount(); i++)
{
for (uint32_t j = 0; j < declaration.size()-1; j++)
{
VertexElement element = declaration[j];
VertexStream* stream = 0;
if (findStream (stream, element))
{
uint32_t streamId = VertexStream::id(*stream);
auto streamIt = streamMap.find(streamId);
if (streamIt != streamMap.end() &&
streamIt->second)
{
for (uint32_t k = 0; k < stream->stride(); k++)
{
*vb++ = streamIt->second[k];
}
streamIt->second += stream->stride();
}
else
{
uint32_t stride = IVertexDeclaration::elementToSize(element.type());
for (uint32_t k = 0; k < stride; stride++)
{
*vb++ = 0;
}
}
}
else
{
// can't find a stream for this element.
// warn user, and 0 the buffer for the stride size
uint32_t stride = IVertexDeclaration::elementToSize(element.type());
for (uint32_t k = 0; k < stride; stride++)
{
*vb++ = 0;
}
}
}
}
return _vertexBufferCpuMemory;
}