本文整理汇总了C++中IDirect3DDevice9::SetIndices方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirect3DDevice9::SetIndices方法的具体用法?C++ IDirect3DDevice9::SetIndices怎么用?C++ IDirect3DDevice9::SetIndices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirect3DDevice9
的用法示例。
在下文中一共展示了IDirect3DDevice9::SetIndices方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Process
void PostProcessWater::Process(RenderTarget &destinationTarget, LPDIRECT3DBASETEXTURE9 sourceTexture)
{
// Implement your own solution for the Post-process lab
//return ProcessSolution(destinationTarget, sourceTexture);
elapsedTime += timer.GetElapsedTime();
destinationTarget.ActivateTarget(0);
IDirect3DDevice9 *pDevice = Renderer::theDevicePtr;
Renderer::theDevicePtr->Clear(0,0, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1, 0);
// Set the vertex and index source and declarion
pDevice->SetVertexDeclaration(VertexBufferManager::GetReference().GetPositionTexBuffer().GetVertexDeclaration());
pDevice->SetStreamSource(0, VertexBufferManager::GetReference().GetPositionTexBuffer().GetVertexBuffer(),
0, sizeof(VERTEX_POSTEX));
pDevice->SetIndices(IndexBuffer::GetReference().GetIndices());
effectPtr->SetTexture(textureHandle, sourceTexture);
effectPtr->SetFloat(elapsedTimeHandle, elapsedTime);
// RTT_Ambient, RTT_Diffuse, RTT_Specular, RTT_Emmisive, RTT_Normal
effectPtr->SetTexture(reflectionMapTextureHandle, renderMaterialHandle.GetContent()->GetRTCubeMapHandle().GetContent()->GetHandle());
effectPtr->SetTexture(heightMapTextueHandle, renderMaterialHandle.GetContent()->GetRTHandles()[RTT_Diffuse].GetContent()->GetHandle());
effectPtr->SetTexture(noiseTextureHandle, renderMaterialHandle.GetContent()->GetRTHandles()[RTT_Normal].GetContent()->GetHandle());
effectPtr->SetTexture(foamTextureHandle, renderMaterialHandle.GetContent()->GetRTHandles()[RTT_Ambient].GetContent()->GetHandle());
effectPtr->SetTexture(causticTextureHandle, renderMaterialHandle.GetContent()->GetRTHandles()[RTT_Specular].GetContent()->GetHandle());
effectPtr->SetValue(surfaceColorHandle, &renderMaterialHandle.GetContent()->GetRenderColors()[RTT_Diffuse], sizeof(RenderColor));
effectPtr->SetValue(ambientColorHandle, &renderMaterialHandle.GetContent()->GetRenderColors()[RTT_Ambient], sizeof(RenderColor));
pDevice->SetVertexDeclaration(VertexBufferManager::GetReference().GetPositionTexBuffer().GetVertexDeclaration());
pDevice->SetStreamSource(0, VertexBufferManager::GetReference().GetPositionTexBuffer().GetVertexBuffer(), 0, sizeof(VERTEX_POSTEX));
pDevice->SetIndices(IndexBuffer::GetReference().GetIndices());
// Begin the post-process effect
UINT passes = 0;
effectPtr->Begin(&passes, 0);
// Iterate through the post-process passes
for(UINT pass = 0; pass < passes; ++pass)
{
effectPtr->BeginPass(pass);
Renderer::theDevicePtr->DrawIndexedPrimitive(meshPtr->GetPrimitiveType(), meshPtr->GetStartVertex(), 0, meshPtr->GetVertCount(),
meshPtr->GetStartIndex(), meshPtr->GetPrimitiveCount());
effectPtr->EndPass();
}
effectPtr->End();
destinationTarget.RevertTarget();
timer.Reset();
}
示例2: GetTransform
void NX::Sphere::Render(struct NX::RenderParameter &renderer) {
if (!m_pVertexs) {
return;
}
SetupLightingInfo(renderer);
int nV = (m_iStacks - 1) * (m_iSlices + 1) + 2;
IDirect3DDevice9 *pDevice = renderer.pDXDevice;
m_pEffect->SetMatrix(m_pEffect->GetParameterByName(NULL, "PVMMatrix"), (D3DXMATRIX*)&(renderer.pProjectController->GetWatchMatrix() * GetTransform().GetTransformMatrix()));
m_pEffect->SetTexture(m_pEffect->GetParameterByName(NULL, "BaseColor"),NX::DX9TextureManager::Instance().GetTexture(m_TextureFilePath));
UINT uPasses = 0;
m_pEffect->Begin(&uPasses, 0);
for (int i = 0; i < uPasses; ++i) {
pDevice->SetVertexDeclaration(m_pVertexDesc);
pDevice->SetStreamSource(0, m_pVertexBuffer, 0, sizeof(Vertex));
pDevice->SetIndices(m_pIndexBuffer);
m_pEffect->BeginPass(i);
pDevice->DrawIndexedPrimitive(D3DPT_TRIANGLEFAN, 0, 0, m_iSlices + 2, 0, m_iSlices);
pDevice->DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP, 0, 0, (m_iStacks - 2) * (m_iSlices + 1) * 2, m_iSlices + 2, (m_iStacks - 2) * (m_iSlices + 1) * 2);
pDevice->DrawIndexedPrimitive(D3DPT_TRIANGLEFAN, 0, 0, m_iSlices + 2, (m_iStacks - 2) * (m_iSlices + 1) * 2 + m_iSlices + 2, m_iSlices);
m_pEffect->EndPass();
}
m_pEffect->End();
}
示例3: Enable
//----------------------------------------------------------------------------
void PdrIndexBuffer::Enable (Renderer* renderer)
{
IDirect3DDevice9* device = renderer->mData->mDevice;
HRESULT hr = device->SetIndices(mBuffer);
PX2_UNUSED(hr);
assertion(hr == D3D_OK, "Failed to enable index buffer: %s\n",
DXGetErrorString(hr));
}
示例4: Render
void TexCube::Render()
{
if(NULL == m_pWnd ||
NULL == m_pVB ||
NULL == m_pIB)
{
return;
}
IDirect3DDevice9* pDev = m_pWnd->GetD3DDevice();
pDev->SetStreamSource(0, m_pVB, 0, sizeof(SRNormalTextureVertex));
pDev->SetFVF(SRNormalTextureVertex::FVF);
pDev->SetIndices(m_pIB);
pDev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 24, 0, 12);
}
示例5: Disable
//----------------------------------------------------------------------------
void PdrIndexBuffer::Disable (Renderer* renderer)
{
IDirect3DDevice9* device = renderer->mData->mDevice;
HRESULT hr;
PX2_UNUSED(hr);
#ifdef PX2_PDR_DEBUG
// 检测需要被取消激活的数据,是否匹配。
IDirect3DIndexBuffer9 *activeBuffer = 0;
hr = device->GetIndices(&activeBuffer);
assertion(hr == D3D_OK, "Failed to get indices: %s\n",
DXGetErrorString(hr));
assertion(activeBuffer == mBuffer, "Mismatched index buffers\n");
activeBuffer->Release();
#endif
hr = device->SetIndices(0);
assertion(hr == D3D_OK, "Failed to set indices: %s\n",
DXGetErrorString(hr));
}
示例6: sizeof
fResult f2dGraphics2DImpl::Begin()
{
fResult tRet = f2dGraphicsImpl::Begin();
if(tRet != FCYERR_OK)
return tRet;
if(!(m_pIB && m_pVB))
return FCYERR_INTERNALERR;
m_pParent->SubmitVD(NULL);
setColorBlendType(m_ColorBlendType);
IDirect3DDevice9* pDev = (IDirect3DDevice9*)m_pParent->GetHandle();
pDev->SetFVF(FVF);
pDev->SetStreamSource(0, m_pVB, 0, sizeof(f2dGraphics2DVertex));
pDev->SetIndices(m_pIB);
if(FAILED(pDev->BeginScene()))
{
m_bInRender = false;
return FCYERR_INTERNALERR;
}
else
{
// 准备缓冲区
m_pVB->Lock(0, m_VBMaxCount*sizeof(f2dGraphics2DVertex), (void**)&m_pVBData, D3DLOCK_DISCARD);
m_pIB->Lock(0, m_IBMaxCount*sizeof(fuShort), (void**)&m_pIBData, D3DLOCK_DISCARD);
m_VBUsedCount = 0;
m_IBUsedCount = 0;
m_VBAlloced = 0;
m_IBAlloced = 0;
return FCYERR_OK;
}
}