Added more models

Fixed issue with material only parts of meshs not being rendered
This commit is contained in:
iDunnoDev
2022-05-14 20:13:55 +01:00
committed by iDunnoDev
parent b856b43209
commit 03329d30ce
35 changed files with 178 additions and 43 deletions

View File

@ -62,10 +62,18 @@ void MeshRenderer::RenderNode(shared_ptr<Node> node, bool renderTransparent)
_cBuffer.specularCoefficient = material->GetSpecularColour();
_cBuffer.shininess = material->GetShininess();
_cBuffer.opacity = opacity;
// Update the constant buffer
// Update the constant buffer
_texture = material->GetTexture();
if (_texture == nullptr)
{
_cBuffer.validTexture = 0;
}
else
{
_cBuffer.validTexture = 1;
}
_deviceContext->VSSetConstantBuffers(0, 1, _constantBuffer.GetAddressOf());
_deviceContext->UpdateSubresource(_constantBuffer.Get(), 0, 0, &_cBuffer, 0, 0);
_texture = material->GetTexture();
_deviceContext->PSSetShaderResources(0, 1, _texture.GetAddressOf());
_deviceContext->PSSetConstantBuffers(0, 1, _constantBuffer.GetAddressOf());
_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);