void IRenderer::mFunction_GraphicObj_RenderTriangle2DInList(std::vector<IGraphicObject*>* pList) { //prepare to draw , various settings..... ID3D11Buffer* tmp_pVB = NULL; ITextureManager* pTexMgr = GetScene()->GetTextureMgr(); mFunction_SetRasterState(NOISE_FILLMODE_SOLID, NOISE_CULLMODE_NONE); for (UINT i = 0;i < pList->size();i++) { //----------------------1,draw common triangle---------------------- tmp_pVB = pList->at(i)->m_pVB_GPU[NOISE_GRAPHIC_OBJECT_TYPE_TRIANGLE_2D]; g_pImmediateContext->IASetInputLayout(g_pVertexLayout_Simple); g_pImmediateContext->IASetVertexBuffers(0, 1, &tmp_pVB, &c_VBstride_Simple, &c_VBoffset); g_pImmediateContext->IASetIndexBuffer(NULL, DXGI_FORMAT_R32_UINT, 0); g_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); UINT j = 0, vCount = 0; //traverse all region list , to decide use which tech to draw (textured or not) m_pFX_Tech_Solid2D->GetPassByIndex(0)->Apply(0, g_pImmediateContext); vCount = pList->at(i)->GetTriangle2DCount() * 3; if (vCount>0)g_pImmediateContext->Draw(pList->at(i)->GetTriangle2DCount() * 3, 0); //---------------------2,draw rectangles--------------------- tmp_pVB = pList->at(i)->m_pVB_GPU[NOISE_GRAPHIC_OBJECT_TYPE_RECT_2D]; g_pImmediateContext->IASetInputLayout(g_pVertexLayout_Simple); g_pImmediateContext->IASetVertexBuffers(0, 1, &tmp_pVB, &c_VBstride_Simple, &c_VBoffset); g_pImmediateContext->IASetIndexBuffer(NULL, DXGI_FORMAT_R32_UINT, 0); g_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); for (auto tmpRegion : *(pList->at(i)->m_pRectSubsetInfoList)) { //if current Rectangle disable Texture ,then draw in a solid way //thus validate the UID first if (pTexMgr->FindUid(tmpRegion.texName)==FALSE) { //draw with solid texture m_pFX_Tech_Solid2D->GetPassByIndex(0)->Apply(0, g_pImmediateContext); } else { //------Draw 2D Common Texture----- mFunction_GraphicObj_Update_RenderTextured2D(tmpRegion.texName); m_pFX_Tech_Textured2D->GetPassByIndex(0)->Apply(0, g_pImmediateContext); } //draw vCount = tmpRegion.vertexCount; if (vCount>0)g_pImmediateContext->Draw(tmpRegion.vertexCount, tmpRegion.startID); } } //清空渲染列表 pList->clear(); }