Esempio n. 1
0
	void Technique::ProcessNextPass(IGraphicsDevice *device, RenderState &state)
	{
		if(mPasses.size() > mCurrentPass) {
			Pass *pass = mPasses[mCurrentPass];
			pass->Apply(device, state);
			mCurrentPass++;
		}
	}
Esempio n. 2
0
	void MaterialDemo::Draw(const GameTime& gameTime)
	{
		ID3D11DeviceContext* direct3DDeviceContext = mGame->Direct3DDeviceContext();
		direct3DDeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

		Pass* pass = mBasicMaterial->CurrentTechnique()->Passes().at(0);
		ID3D11InputLayout* inputLayout = mBasicMaterial->InputLayouts().at(pass);
		direct3DDeviceContext->IASetInputLayout(inputLayout);

		UINT stride = mBasicMaterial->VertexSize();
		UINT offset = 0;
		direct3DDeviceContext->IASetVertexBuffers(0, 1, &mVertexBuffer, &stride, &offset);
		direct3DDeviceContext->IASetIndexBuffer(mIndexBuffer, DXGI_FORMAT_R32_UINT, 0);

		XMMATRIX worldMatrix = XMLoadFloat4x4(&mWorldMatrix);
		XMMATRIX wvp = worldMatrix * mCamera->ViewMatrix() * mCamera->ProjectionMatrix();
		mBasicMaterial->WorldViewProjection() << wvp;
		pass->Apply(0, direct3DDeviceContext);

		direct3DDeviceContext->DrawIndexed(mIndexCount, 0, 0);
	}