Beispiel #1
0
void Model::Draw(const Material& material) const{
	if (!m_MeshAssetDataPtr)return;

	if (mForcedMaterial){
		mForcedMaterial->SetShader((bool)mBoneModel != NULL);
		mForcedMaterial->PSSetShaderResources();
	}
	else if (mForcedMaterialUseTexture){
		mForcedMaterialUseTexture->SetShader((bool)mBoneModel != NULL);
		material.VSSetShaderResources();
		material.PSSetShaderResources();
	}
	else{
		material.SetShader((bool)mBoneModel != NULL);
		material.VSSetShaderResources();
		material.PSSetShaderResources();
	}

	IASet();
	SetConstantBuffer();
	if (mBoneModel){
		mBoneModel->SetConstantBuffer();
	}

	auto& buf = m_MeshAssetDataPtr->GetBufferData();
	auto& mesh = buf.GetMesh();
	for (auto& m : mesh){
		Device::mpImmediateContext->DrawIndexed(m.m_IndexNum, m.m_StartIndex, 0);
	}
}
	void Sprite::Draw(ID3D12GraphicsCommandList* commandList){
		SetVertexPos(vertex, pos, base, size, angle);
		UpdateVertex(vertex.data(),vertexResource.get());
		SetConstantBuffer(commandList);
		DX12::SetTexture(commandList,fileName);
		
		UINT SizeTbl[] = { sizeof(DefaultVertex) };
		UINT OffsetTbl[] = { 0 };
		commandList->IASetVertexBuffers(0, 1, &vertexBufferView);
		commandList->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);

		commandList->DrawInstanced(4, 1, 0, 0);
	}
Beispiel #3
0
HRESULT BoneModel::Create(const char* FileName){

	AssetDataBase::Instance(FileName, mBoneAssetDataPtr);
	if (!mBoneAssetDataPtr)return E_FAIL;

	createBone();

	auto& bones = mBoneAssetDataPtr->GetFileData().GetBoneData().mBoneBuffer;

	if (bones.size()){
		mCBBoneMatrix = ConstantBufferArray<cbBoneMatrix>::create(7, bones.size());
		if (!mCBBoneMatrix.mBuffer)
			return E_FAIL;
		DWORD mBoneNum = mBone.size();
		for (DWORD mid = 0; mid < mBoneNum; mid++){
			mCBBoneMatrix.mParam[mid].BoneMatrix[0] = XMFLOAT4(1,0,0,0);
			mCBBoneMatrix.mParam[mid].BoneMatrix[1] = XMFLOAT4(0,1,0,0);
			mCBBoneMatrix.mParam[mid].BoneMatrix[2] = XMFLOAT4(0,0,1,0);
		}
		mCBBoneMatrix.UpdateSubresource();
		SetConstantBuffer();
	}
	return S_OK;
}
Beispiel #4
0
	void CPipeline::SetPixelShaderConstantBuffer(UINT slot,
		const CConstantBuffer<BufferType>* pBuffer) const {
		SetConstantBuffer(S_PIXEL, slot, pBuffer);
	}
Beispiel #5
0
	void CPipeline::SetComputeShaderConstantBuffer(UINT slot,
		const CConstantBuffer<BufferType>* pBuffer) const {
		SetConstantBuffer(S_COMPUTE, slot, pBuffer);
	}
Beispiel #6
0
	void CPipeline::SetGeometryShaderConstantBuffer(UINT slot,
		const CConstantBuffer<BufferType>* pBuffer) const {
		SetConstantBuffer(S_GEOMETRY, slot, pBuffer);
	}
Beispiel #7
0
	void CPipeline::SetDomainShaderConstantBuffer(UINT slot,
		const CConstantBuffer<BufferType>* pBuffer) const {
		SetConstantBuffer(S_DOMAIN, slot, pBuffer);
	}
Beispiel #8
0
	void CPipeline::SetHullShaderConstantBuffer(UINT slot,
		const CConstantBuffer<BufferType>* pBuffer) const {
		SetConstantBuffer(S_HULL, slot, pBuffer);
	}
Beispiel #9
0
	void CPipeline::SetVertexShaderConstantBuffer(UINT slot,
		const CConstantBuffer<BufferType>* pBuffer) const {
		SetConstantBuffer(S_VERTEX, slot, pBuffer);
	}
Beispiel #10
0
// this is the function that creates the shape to render
void FRenderD3D11::InitGraphics()
{
	SetConstantBuffer();
	SetVertexBuffer();
	SetIndexBuffer();
}