本文整理汇总了C++中FVertexDeclarationElementList::RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C++ FVertexDeclarationElementList::RemoveAt方法的具体用法?C++ FVertexDeclarationElementList::RemoveAt怎么用?C++ FVertexDeclarationElementList::RemoveAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FVertexDeclarationElementList
的用法示例。
在下文中一共展示了FVertexDeclarationElementList::RemoveAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PatchVertexStreamOffsetsToBeUnique
/**
* Patches the declaration so vertex stream offsets are unique. This is required for e.g. GeForce FX cards, which don't support redundant
* offsets in the declaration. We're unable to make that many vertex elements point to the same offset so the function moves redundant
* declarations to higher offsets, pointing to garbage data.
*/
static void PatchVertexStreamOffsetsToBeUnique( FVertexDeclarationElementList& Elements )
{
// check every vertex element
for ( int32 e = 0; e < Elements.Num(); e++ )
{
// check if there's an element that reads from the same offset
for ( int32 i = 0; i < Elements.Num(); i++ )
{
// but only in the same stream and if it's not the same element
if ( ( Elements[ i ].StreamIndex == Elements[ e ].StreamIndex ) && ( Elements[ i ].Offset == Elements[ e ].Offset ) && ( e != i ) )
{
// the id of the highest offset element is stored here (it doesn't need to be the last element in the declarator because the last element may belong to another StreamIndex
uint32 MaxOffsetID = i;
// find the highest offset element
for ( int32 j = 0; j < Elements.Num(); j++ )
{
if ( ( Elements[ j ].StreamIndex == Elements[ e ].StreamIndex ) && ( Elements[ MaxOffsetID ].Offset < Elements[ j ].Offset ) )
{
MaxOffsetID = j;
}
}
// get the size of the highest offset element, it's needed for the redundant element new offset
uint8 PreviousElementSize = GetVertexElementSize( Elements[ MaxOffsetID ].Type );
// prepare a new vertex element
FVertexElement VertElement;
VertElement.Offset = Elements[ MaxOffsetID ].Offset + PreviousElementSize;
VertElement.StreamIndex = Elements[ i ].StreamIndex;
VertElement.Type = Elements[ i ].Type;
VertElement.AttributeIndex = Elements[ i ].AttributeIndex;
VertElement.Stride = Elements[ i ].Stride;
VertElement.bUseInstanceIndex = Elements[i].bUseInstanceIndex;
// remove the old redundant element
Elements.RemoveAt( i );
// add a new element with "correct" offset
Elements.Add( VertElement );
// make sure that when the element has been removed its index is taken by the next element, so we must take care of it too
i = i == 0 ? 0 : i - 1;
}
}
}
}