Details
-
Task
-
Resolution: Done
-
Not Evaluated
-
None
-
None
-
None
-
Linux 64bit / Nvidia GTX 970
Description
Basically I tried to extend the deferred rendering example to have a mix of pointlights and spotlights.
So in QML (FinalEffect.qml) I did this:
parameters: [ Parameter { name: "PointLightBlock" value: ShaderData { property ShaderDataArray pointLights: ShaderDataArray { // hard coded lights until we have a way to filter // ShaderData in a scene values: [ sceneEntity.light, light3.light ] } } }, Parameter { name: "SpotLightBlock" value: ShaderData { property ShaderDataArray spotLights: ShaderDataArray { // hard coded lights until we have a way to filter // ShaderData in a scene values: [ cone.light ] } } } ]
And in the fragment shader this:
struct PointLight { vec3 position; vec3 direction; vec4 color; float intensity; }; struct SpotLight { vec3 position; vec3 direction; vec4 color; float intensity; float cutOffAngle; }; const int pointLightCount = 2; const int spotLightCount = 1; uniform PointLightBlock { PointLight pointLights[pointLightCount]; }; uniform SpotLightBlock { SpotLight spotLights[spotLightCount]; };
Unfortunately enabling the second uniform makes the renderer display a black screen
Full code available here: https://github.com/mcallegari/qmlplayground/tree/master/DeferredSpotShadow