当前位置: 首页>>代码示例>>C++>>正文


C++ HardwareVertexBufferSharedPtr::isInstanceData方法代码示例

本文整理汇总了C++中HardwareVertexBufferSharedPtr::isInstanceData方法的典型用法代码示例。如果您正苦于以下问题:C++ HardwareVertexBufferSharedPtr::isInstanceData方法的具体用法?C++ HardwareVertexBufferSharedPtr::isInstanceData怎么用?C++ HardwareVertexBufferSharedPtr::isInstanceData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HardwareVertexBufferSharedPtr的用法示例。


在下文中一共展示了HardwareVertexBufferSharedPtr::isInstanceData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setGlobalInstanceVertexBuffer

	//---------------------------------------------------------------------
    void RenderSystem::setGlobalInstanceVertexBuffer( const HardwareVertexBufferSharedPtr &val )
    {
        if ( !val.isNull() && !val->isInstanceData() )
        {
            OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
                        "A none instance data vertex buffer was set to be the global instance vertex buffer.",
                        "RenderSystem::setGlobalInstanceVertexBuffer");
        }
        mGlobalInstanceVertexBuffer = val;
    }
开发者ID:shikui08,项目名称:OgreMain,代码行数:11,代码来源:OgreRenderSystem.cpp

示例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 (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 (unsigned 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->isInstanceData() )
					{
						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];
	}
开发者ID:albmarvil,项目名称:The-Eternal-Sorrow,代码行数:85,代码来源:OgreD3D11VertexDeclaration.cpp


注:本文中的HardwareVertexBufferSharedPtr::isInstanceData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。