add D3D11 project

This commit is contained in:
2025-11-19 09:43:09 +01:00
parent 9134d2dc40
commit bff01f5adb
36 changed files with 2779 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#include "Light.h"
#include "Utilities.h"
UINT Light::init(ID3D11Device* pD3DDevice, LightBuffer& lightData)
{
D3D11_BUFFER_DESC desc = {};
desc.ByteWidth = sizeof(LightBuffer);
desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
desc.Usage = D3D11_USAGE_IMMUTABLE; // no light update possible
//desc.Usage = D3D11_USAGE_DYNAMIC; // light update possible
D3D11_SUBRESOURCE_DATA initialData = {};
initialData.pSysMem = &lightData;
HRESULT hr = pD3DDevice->CreateBuffer(&desc, &initialData, &_pLightBuffer);
CheckFailed(hr, 70);
return 0;
}
void Light::update(FLOAT dt)
{
}
void Light::render(ID3D11DeviceContext* pD3DDeviceContext)
{
pD3DDeviceContext->PSSetConstantBuffers(0, 1, &_pLightBuffer);
}
void Light::deInit()
{
safeRelease(_pLightBuffer);
}