feat: add basic forward lighting coverage
This commit is contained in:
@@ -59,6 +59,9 @@ private:
|
||||
Math::Matrix4x4 projection = Math::Matrix4x4::Identity();
|
||||
Math::Matrix4x4 view = Math::Matrix4x4::Identity();
|
||||
Math::Matrix4x4 model = Math::Matrix4x4::Identity();
|
||||
Math::Matrix4x4 normalMatrix = Math::Matrix4x4::Identity();
|
||||
Math::Vector4 mainLightDirectionAndIntensity = Math::Vector4::Zero();
|
||||
Math::Vector4 mainLightColorAndFlags = Math::Vector4::Zero();
|
||||
};
|
||||
|
||||
bool EnsureInitialized(const RenderContext& context);
|
||||
|
||||
@@ -16,9 +16,25 @@ class Scene;
|
||||
|
||||
namespace Rendering {
|
||||
|
||||
struct RenderDirectionalLightData {
|
||||
bool enabled = false;
|
||||
Math::Vector3 direction = Math::Vector3::Back();
|
||||
float intensity = 1.0f;
|
||||
Math::Color color = Math::Color::White();
|
||||
};
|
||||
|
||||
struct RenderLightingData {
|
||||
RenderDirectionalLightData mainDirectionalLight;
|
||||
|
||||
bool HasMainDirectionalLight() const {
|
||||
return mainDirectionalLight.enabled;
|
||||
}
|
||||
};
|
||||
|
||||
struct RenderSceneData {
|
||||
Components::CameraComponent* camera = nullptr;
|
||||
RenderCameraData cameraData;
|
||||
RenderLightingData lighting;
|
||||
std::vector<VisibleRenderItem> visibleItems;
|
||||
|
||||
bool HasCamera() const { return camera != nullptr; }
|
||||
@@ -45,6 +61,9 @@ private:
|
||||
const Components::CameraComponent& camera,
|
||||
uint32_t viewportWidth,
|
||||
uint32_t viewportHeight) const;
|
||||
void ExtractLighting(
|
||||
const Components::Scene& scene,
|
||||
RenderLightingData& lightingData) const;
|
||||
void ExtractVisibleItems(
|
||||
Components::GameObject* gameObject,
|
||||
const Math::Vector3& cameraPosition,
|
||||
|
||||
Reference in New Issue
Block a user