本文整理汇总了C++中HardwareVertexBufferSharedPtr::getIsInstanceData方法的典型用法代码示例。如果您正苦于以下问题:C++ HardwareVertexBufferSharedPtr::getIsInstanceData方法的具体用法?C++ HardwareVertexBufferSharedPtr::getIsInstanceData怎么用?C++ HardwareVertexBufferSharedPtr::getIsInstanceData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HardwareVertexBufferSharedPtr
的用法示例。
在下文中一共展示了HardwareVertexBufferSharedPtr::getIsInstanceData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setGlobalInstanceVertexBuffer
//---------------------------------------------------------------------
void RenderSystem::setGlobalInstanceVertexBuffer( const HardwareVertexBufferSharedPtr val )
{
if ( !val.isNull() && !val->getIsInstanceData() )
{
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"A none instance data vertex buffer was set to be the global instance vertex buffer.",
"RenderSystem::setGlobalInstanceVertexBuffer");
}
mGlobalInstanceVertexBuffer = val;
}
示例2: ZeroMemory
//-----------------------------------------------------------------------
D3D11_INPUT_ELEMENT_DESC * D3D11VertexDeclaration::getD3DVertexDeclaration(D3D11HLSLProgram* boundVertexProgram, VertexBufferBinding* binding)
{
// Create D3D elements
size_t iNumElements = boundVertexProgram->getNumInputs();
if (mD3delems.find(boundVertexProgram) == mD3delems.end())
{
D3D11_INPUT_ELEMENT_DESC* D3delems = new D3D11_INPUT_ELEMENT_DESC[iNumElements];
ZeroMemory(D3delems, sizeof(D3D11_INPUT_ELEMENT_DESC) * iNumElements);
unsigned int idx;
for (unsigned int idx = 0; idx < iNumElements; ++idx)
{
D3D11_SIGNATURE_PARAMETER_DESC inputDesc = boundVertexProgram->getInputParamDesc(idx);
VertexElementList::const_iterator i, iend;
iend = mElementList.end();
bool found = false;
for (i = mElementList.begin(); i != iend; ++i)
{
LPCSTR semanticName = D3D11Mappings::get(i->getSemantic());
UINT semanticIndex = i->getIndex();
if(
strcmp(semanticName, inputDesc.SemanticName) == 0
&& semanticIndex == inputDesc.SemanticIndex
)
{
found = true;
break;
}
}
if(!found)
{
// find by pos
i = mElementList.begin();
for (int count = 0; count < idx && i != iend; count++, ++i)
{
}
if (i != iend)
{
found = true;
}
}
if(!found)
{
OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, "Unable to set D3D11 vertex declaration" ,
"D3D11VertexDeclaration::getILayoutByShader");
}
D3delems[idx].SemanticName = inputDesc.SemanticName;
D3delems[idx].SemanticIndex = inputDesc.SemanticIndex;
D3delems[idx].Format = D3D11Mappings::get(i->getType());
D3delems[idx].InputSlot = i->getSource();
D3delems[idx].AlignedByteOffset = static_cast<WORD>(i->getOffset());
D3delems[idx].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
D3delems[idx].InstanceDataStepRate = 0;
VertexBufferBinding::VertexBufferBindingMap::const_iterator foundIter;
foundIter = binding->getBindings().find(i->getSource());
if ( foundIter != binding->getBindings().end() )
{
HardwareVertexBufferSharedPtr bufAtSlot = foundIter->second;
if ( bufAtSlot->getIsInstanceData() )
{
D3delems[idx].InputSlotClass = D3D11_INPUT_PER_INSTANCE_DATA;
D3delems[idx].InstanceDataStepRate = bufAtSlot->getInstanceDataStepRate();
}
}
else
{
OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
"Unable to found a bound vertex for a slot that is used in the vertex declaration." ,
"D3D11VertexDeclaration::getD3DVertexDeclaration");
}
}
mD3delems[boundVertexProgram] = D3delems;
}
return mD3delems[boundVertexProgram];
}