// Copyright (C) 2023 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only // RHI version, note the explicit binding (1) #if QSSG_REDUCE_MAX_NUM_LIGHTS #define MAX_NUM_LIGHTS 5 #else #define MAX_NUM_LIGHTS 15 #endif #define MAX_NUM_SHADOWS 8 struct LightSource { vec4 position; vec4 direction; // Specifies the light direction in world coordinates. vec4 diffuse; vec4 specular; float coneAngle; // Specifies the intensity distribution of the light. float innerConeAngle; // Specifies the maximum spread angle of the light. float constantAttenuation; // Specifies the constant light attenuation factor. float linearAttenuation; // Specifies the linear light attenuation factor. float quadraticAttenuation; // Specifies the quadratic light attenuation factor. }; struct ShadowData { mat4 matrices[4]; vec4 dimensionsInverted[4]; // (x, y, z, 0) vec4 csmSplits; vec4 csmActive; float bias; float factor; float isYUp; // 1.0 = true, 0.0 = false float clipNear; // Used for Point light + Spot light float shadowMapFar; // Used for Point light + Spot light int layerIndex; int csmNumSplits; float csmBlendRatio; float pcfFactor; }; layout (std140, binding = 1) uniform cbLights { int uNumLights; LightSource lights[MAX_NUM_LIGHTS]; } ubLights; layout (std140, binding = 2) uniform cbShadows { int uNumShadows; ShadowData shadowData[MAX_NUM_SHADOWS]; } ubShadows;