Add Phong lighting (WIP)

This commit is contained in:
Jérôme Leclercq
2022-01-11 19:47:29 +01:00
parent 504249e70f
commit b0a3941f4e
40 changed files with 1141 additions and 427 deletions

View File

@@ -20,7 +20,8 @@ namespace Nz
m_projectionMatrix(Matrix4f::Identity()),
m_viewProjMatrix(Matrix4f::Identity()),
m_viewMatrix(Matrix4f::Identity()),
m_targetSize(Vector2f(0.f, 0.f)),
m_targetSize(Vector2f::Zero()),
m_eyePosition(Vector3f::Zero()),
m_dataInvalided(true)
{
PredefinedViewerData viewerUboOffsets = PredefinedViewerData::GetOffsets();
@@ -37,7 +38,7 @@ namespace Nz
PredefinedViewerData viewerDataOffsets = PredefinedViewerData::GetOffsets();
auto& allocation = uploadPool.Allocate(viewerDataOffsets.totalSize);
AccessByOffset<Vector3f&>(allocation.mappedPtr, viewerDataOffsets.eyePositionOffset) = m_viewMatrix.GetTranslation();
AccessByOffset<Vector3f&>(allocation.mappedPtr, viewerDataOffsets.eyePositionOffset) = m_eyePosition;
AccessByOffset<Vector2f&>(allocation.mappedPtr, viewerDataOffsets.invTargetSizeOffset) = 1.f / m_targetSize;
AccessByOffset<Vector2f&>(allocation.mappedPtr, viewerDataOffsets.targetSizeOffset) = m_targetSize;